char *samdb_ntds_msdcs_dns_name(struct ldb_context *samdb,
				TALLOC_CTX *mem_ctx,
				const struct GUID *ntds_guid)
{
	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
	const char *guid_str;
	struct ldb_dn *forest_dn;
	const char *dnsforest;
	char *ret;

	guid_str = GUID_string(tmp_ctx, ntds_guid);
	if (guid_str == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	forest_dn = ldb_get_root_basedn(samdb);
	if (forest_dn == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	dnsforest = samdb_dn_to_dns_domain(tmp_ctx, forest_dn);
	if (dnsforest == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	ret = talloc_asprintf(mem_ctx, "%s._msdcs.%s", guid_str, dnsforest);
	talloc_free(tmp_ctx);
	return ret;
}
char *samdb_ntds_msdcs_dns_name(struct ldb_context *samdb,
				TALLOC_CTX *mem_ctx,
				const struct GUID *ntds_guid)
{
	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
	const char *guid_str;
	struct ldb_dn *forest_dn;
	const char *dnsforest;
	char *ret;

	guid_str = GUID_string(tmp_ctx, ntds_guid);
	if (guid_str == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	forest_dn = ldb_get_root_basedn(samdb);
	if (forest_dn == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	dnsforest = samdb_dn_to_dns_domain(tmp_ctx, forest_dn);
	if (dnsforest == NULL) {
		talloc_free(tmp_ctx);
		return NULL;
	}
	ret = talloc_asprintf(mem_ctx, "%s._msdcs.%s", guid_str, dnsforest);
	talloc_free(tmp_ctx);
	return ret;
}