summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-17 13:19:53 +1000
committerAndrew Tridgell <tridge@samba.org>2010-08-17 21:21:50 +1000
commitdf14f645b3c56ca7652463d53731437158d5c4bb (patch)
tree5fb6cc21254b5ac7de530b3a3c49a0fdd1c2d78b
parentf6e0b151a32a2fa450ded3af2fd87d9767cd4540 (diff)
downloadsamba-df14f645b3c56ca7652463d53731437158d5c4bb.tar.gz
samba-df14f645b3c56ca7652463d53731437158d5c4bb.tar.bz2
samba-df14f645b3c56ca7652463d53731437158d5c4bb.zip
s4-dsdb: cope with cracknames of form dnsdomain\account
this is used by w2k8r2 when doing a RODC dcpromo Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source4/dsdb/samdb/cracknames.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index 99d25c4e9c..63fe34552d 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -453,6 +453,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
case DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT: {
char *p;
char *domain;
+ struct ldb_dn *dn_domain;
const char *account = NULL;
domain = talloc_strdup(mem_ctx, name);
@@ -470,9 +471,14 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
account = &p[1];
}
+ /* it could be in DNS domain form */
+ dn_domain = samdb_dns_domain_to_dn(sam_ctx, mem_ctx, domain);
+ W_ERROR_HAVE_NO_MEMORY(dn_domain);
+
domain_filter = talloc_asprintf(mem_ctx,
- "(&(&(nETBIOSName=%s)(objectclass=crossRef))(ncName=*))",
- ldb_binary_encode_string(mem_ctx, domain));
+ "(&(&(|(nETBIOSName=%s)(nCName=%s))(objectclass=crossRef))(ncName=*))",
+ ldb_binary_encode_string(mem_ctx, domain),
+ ldb_dn_get_linearized(dn_domain));
W_ERROR_HAVE_NO_MEMORY(domain_filter);
if (account) {
result_filter = talloc_asprintf(mem_ctx, "(sAMAccountName=%s)",