summaryrefslogtreecommitdiffstats
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-08-19 17:30:28 +1000
committerAndrew Tridgell <tridge@samba.org>2011-08-25 07:39:37 +1000
commit68ff9ecd010c938da0a7d347a00cfef80a9999a0 (patch)
tree8c162404937909ff47b942974ad2da7e6e0f9412 /source4/dsdb/samdb
parent4744c12d2cfdaf47ac5884951ad86b9451f7075e (diff)
downloadsamba-68ff9ecd010c938da0a7d347a00cfef80a9999a0.tar.gz
samba-68ff9ecd010c938da0a7d347a00cfef80a9999a0.tar.xz
samba-68ff9ecd010c938da0a7d347a00cfef80a9999a0.zip
s4-dsdb: cleanup use of NULL vs base DN in samldb
NULL should be used when doing all partition searches. The default basedn should be used when wanting just the domain NC Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 6ca3fe84c69..b1f6b720dcd 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -187,7 +187,7 @@ static int samldb_check_sAMAccountName(struct samldb_ctx *ac)
}
ret = dsdb_module_search(ac->module, ac, &res,
- NULL, LDB_SCOPE_SUBTREE, noattrs,
+ ldb_get_default_basedn(ldb), LDB_SCOPE_SUBTREE, noattrs,
DSDB_FLAG_NEXT_MODULE,
ac->req,
"(sAMAccountName=%s)",
@@ -260,7 +260,8 @@ static bool samldb_krbtgtnumber_available(struct samldb_ctx *ac,
const char *no_attrs[] = { NULL };
int ret;
- ret = dsdb_module_search(ac->module, tmp_ctx, &res, NULL,
+ ret = dsdb_module_search(ac->module, tmp_ctx, &res,
+ ldb_get_default_basedn(ldb_module_get_ctx(ac->module)),
LDB_SCOPE_SUBTREE, no_attrs,
DSDB_FLAG_NEXT_MODULE,
ac->req,
@@ -1075,7 +1076,9 @@ static int samldb_prim_group_tester(struct samldb_ctx *ac, uint32_t rid)
return ldb_operr(ldb);
}
- ret = dsdb_module_search(ac->module, ac, &res, NULL, LDB_SCOPE_SUBTREE,
+ ret = dsdb_module_search(ac->module, ac, &res,
+ ldb_get_default_basedn(ldb),
+ LDB_SCOPE_SUBTREE,
noattrs, DSDB_FLAG_NEXT_MODULE,
ac->req,
"(objectSid=%s)",
@@ -1181,7 +1184,9 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
return LDB_SUCCESS;
}
- ret = dsdb_module_search(ac->module, ac, &group_res, NULL, LDB_SCOPE_SUBTREE,
+ ret = dsdb_module_search(ac->module, ac, &group_res,
+ ldb_get_default_basedn(ldb),
+ LDB_SCOPE_SUBTREE,
noattrs, DSDB_FLAG_NEXT_MODULE,
ac->req,
"(objectSid=%s)",
@@ -1199,7 +1204,9 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
return ldb_operr(ldb);
}
- ret = dsdb_module_search(ac->module, ac, &group_res, NULL, LDB_SCOPE_SUBTREE,
+ ret = dsdb_module_search(ac->module, ac, &group_res,
+ ldb_get_default_basedn(ldb),
+ LDB_SCOPE_SUBTREE,
noattrs, DSDB_FLAG_NEXT_MODULE,
ac->req,
"(objectSid=%s)",
@@ -1561,7 +1568,9 @@ static int samldb_sam_accountname_check(struct samldb_ctx *ac)
/* Make sure that a "sAMAccountName" is only used once */
- ret = dsdb_module_search(ac->module, ac, &res, NULL, LDB_SCOPE_SUBTREE, no_attrs,
+ ret = dsdb_module_search(ac->module, ac, &res,
+ ldb_get_default_basedn(ldb),
+ LDB_SCOPE_SUBTREE, no_attrs,
DSDB_FLAG_NEXT_MODULE, ac->req,
"(sAMAccountName=%s)", enc_str);
if (ret != LDB_SUCCESS) {
@@ -2211,7 +2220,9 @@ static int samldb_prim_group_users_check(struct samldb_ctx *ac)
}
/* Deny delete requests from groups which are primary ones */
- ret = dsdb_module_search(ac->module, ac, &res, NULL, LDB_SCOPE_SUBTREE, noattrs,
+ ret = dsdb_module_search(ac->module, ac, &res,
+ ldb_get_default_basedn(ldb),
+ LDB_SCOPE_SUBTREE, noattrs,
DSDB_FLAG_NEXT_MODULE,
ac->req,
"(&(primaryGroupID=%u)(objectClass=user))", rid);