summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-05-01 03:22:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:54 -0500
commita5df01c992372ff286ab0b50c5ad8926add13a06 (patch)
tree2248ad001ec90a60886180e31c3c0896f6d18ad3 /source4/auth
parenta475bfdcca0bc84a3a823a3061bbd53d9bad2842 (diff)
downloadsamba-a5df01c992372ff286ab0b50c5ad8926add13a06.tar.gz
samba-a5df01c992372ff286ab0b50c5ad8926add13a06.tar.bz2
samba-a5df01c992372ff286ab0b50c5ad8926add13a06.zip
r22621: fix the 'sam' auth module
metze (This used to be commit 255acbb1132891e0316a38f1d4721863bb7a7226)
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/auth_sam.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index 6003cfd415..9872031653 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -56,22 +56,7 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
if (domain_name) {
domain_dn = samdb_domain_to_dn(sam_ctx, mem_ctx, domain_name);
-
- /* find the domain's DN */
- ret_domain = gendb_search_dn(sam_ctx, mem_ctx, domain_dn, &msgs_domain_ref, domain_ref_attrs);
- if (ret_domain == -1) {
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
-
- if (ret_domain == 0) {
- DEBUG(3,("sam_search_user: Couldn't find domain [%s] in samdb.\n",
- domain_name));
- return NT_STATUS_NO_SUCH_USER;
- }
-
- if (ret_domain > 1) {
- DEBUG(0,("Found %d records matching domain [%s]\n",
- ret_domain, domain_name));
+ if (!domain_dn) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
}
@@ -95,7 +80,7 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- if (!domain_name) {
+ if (!domain_dn) {
struct dom_sid *domain_sid;
domain_sid = samdb_result_sid_prefix(mem_ctx, msgs[0], "objectSid");
@@ -123,25 +108,25 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- ret_domain = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &msgs_domain_ref, domain_ref_attrs,
- "(nCName=%s)", ldb_dn_alloc_linearized(msgs_tmp, msgs_tmp[0]->dn));
+ domain_dn = msgs_tmp[0]->dn;
+ }
- if (ret_domain == -1) {
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
+ ret_domain = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &msgs_domain_ref, domain_ref_attrs,
+ "(nCName=%s)", ldb_dn_alloc_linearized(msgs_tmp, domain_dn));
+ if (ret_domain == -1) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
- if (ret_domain == 0) {
- DEBUG(3,("check_sam_security: Couldn't find domain [%s] in passdb file.\n",
- ldb_dn_get_linearized(msgs_tmp[0]->dn)));
- return NT_STATUS_NO_SUCH_USER;
- }
+ if (ret_domain == 0) {
+ DEBUG(3,("check_sam_security: Couldn't find domain [%s] in passdb file.\n",
+ ldb_dn_get_linearized(msgs_tmp[0]->dn)));
+ return NT_STATUS_NO_SUCH_USER;
+ }
- if (ret_domain > 1) {
- DEBUG(0,("Found %d records matching domain [%s]\n",
- ret_domain, ldb_dn_get_linearized(msgs_tmp[0]->dn)));
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
-
+ if (ret_domain > 1) {
+ DEBUG(0,("Found %d records matching domain [%s]\n",
+ ret_domain, ldb_dn_get_linearized(msgs_tmp[0]->dn)));
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
*ret_msgs = msgs;