diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-09-01 23:26:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:36:23 -0500 |
commit | 9b905c9f27f6d7d682085036b27b55d26c1f38ee (patch) | |
tree | 9be17c239260c02b9ae1ab8a7b08e4921fb2a825 /source4/rpc_server/samr | |
parent | 95fcf031b0480ada75ed5ed02826f4acf196be77 (diff) | |
download | samba-9b905c9f27f6d7d682085036b27b55d26c1f38ee.tar.gz samba-9b905c9f27f6d7d682085036b27b55d26c1f38ee.tar.bz2 samba-9b905c9f27f6d7d682085036b27b55d26c1f38ee.zip |
r9930: Use a single samdb_base_dn() function rather than lots of silly
searches all over the place.
This can be extended to cover an NT4 (no ADS) mode in future as well.
Andrew Bartlett
(This used to be commit 0761b22f99a128bd9634a191adc88b0e30982a3a)
Diffstat (limited to 'source4/rpc_server/samr')
-rw-r--r-- | source4/rpc_server/samr/dcesrv_samr.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index aeea3a120c..249fb1c8a4 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -192,7 +192,7 @@ static NTSTATUS samr_LookupDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX ret = gendb_search_dn(c_state->sam_ctx, mem_ctx, samdb_result_dn(mem_ctx, - ref_msgs[0], "ncName", NULL), + ref_msgs[0], "ncName", NULL), &dom_msgs, dom_attrs); } @@ -319,34 +319,27 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX * ret = gendb_search(c_state->sam_ctx, mem_ctx, NULL, &dom_msgs, dom_attrs, - "(&(objectSid=%s)(&(objectclass=domain)(!(objectClass=builtinDomain))))", + "(&(objectSid=%s)(&(objectclass=domain)))", ldap_encode_ndr_dom_sid(mem_ctx, r->in.sid)); - if (ret == -1) { + if (ret != 1) { return NT_STATUS_INTERNAL_DB_CORRUPTION; - } else if (ret == 0) { - ret = gendb_search(c_state->sam_ctx, - mem_ctx, NULL, &dom_msgs, dom_attrs, - "(&(objectSid=%s)(objectClass=builtinDomain))", - ldap_encode_ndr_dom_sid(mem_ctx, r->in.sid)); - if (ret != 1) { - return NT_STATUS_NO_SUCH_DOMAIN; - } - - domain_name = ldb_msg_find_string(dom_msgs[0], "cn", NULL); - if (domain_name == NULL) { - return NT_STATUS_NO_SUCH_DOMAIN; - } } else { ret = gendb_search(c_state->sam_ctx, mem_ctx, NULL, &ref_msgs, ref_attrs, "(&(&(nETBIOSName=*)(objectclass=crossRef))(ncName=%s))", ldb_dn_linearize(mem_ctx, dom_msgs[0]->dn)); - if (ret != 1) { - return NT_STATUS_NO_SUCH_DOMAIN; - } + if (ret == 0) { + domain_name = ldb_msg_find_string(dom_msgs[0], "cn", NULL); + if (domain_name == NULL) { + return NT_STATUS_NO_SUCH_DOMAIN; + } + } else if (ret == 1) { - domain_name = ldb_msg_find_string(ref_msgs[0], "nETBIOSName", NULL); - if (domain_name == NULL) { + domain_name = ldb_msg_find_string(ref_msgs[0], "nETBIOSName", NULL); + if (domain_name == NULL) { + return NT_STATUS_NO_SUCH_DOMAIN; + } + } else { return NT_STATUS_NO_SUCH_DOMAIN; } } @@ -1769,7 +1762,7 @@ static NTSTATUS samr_DeleteGroupMember(struct dcesrv_call_state *dce_call, TALLO samr_QueryGroupMember */ static NTSTATUS samr_QueryGroupMember(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct samr_QueryGroupMember *r) + struct samr_QueryGroupMember *r) { struct dcesrv_handle *h; struct samr_account_state *a_state; @@ -3317,9 +3310,9 @@ static NTSTATUS samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX return NT_STATUS_INVALID_SYSTEM_SERVICE; } - ret = gendb_search(sam_ctx, - mem_ctx, NULL, &msgs, attrs, - "(&(!(objectClass=builtinDomain))(objectclass=domain))"); + /* The domain name in this call is ignored */ + ret = gendb_search_dn(sam_ctx, + mem_ctx, samdb_base_dn(mem_ctx), &msgs, attrs); if (ret <= 0) { return NT_STATUS_NO_SUCH_DOMAIN; } |