summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-25 18:14:02 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-25 17:42:33 +0000
commit6fb64b9c7a281c2d148238390fccc08dce962f92 (patch)
treec6a827a02e2a5c116b86be48cec3853422be31c3
parentfd7943bc80f0e96b70d4f851ea4e3f8f7689bead (diff)
downloadsamba-6fb64b9c7a281c2d148238390fccc08dce962f92.tar.gz
samba-6fb64b9c7a281c2d148238390fccc08dce962f92.tar.bz2
samba-6fb64b9c7a281c2d148238390fccc08dce962f92.zip
s4:"samdb_search_count" - introduce a "mem_ctx" parameter
All other "samdb_search_*" calls do have one - why "samdb_search_count" doesn't? Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Mon Oct 25 17:42:33 UTC 2010 on sn-devel-104
-rw-r--r--source4/dsdb/common/util.c9
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c4
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c9
3 files changed, 12 insertions, 10 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 340d721c79..39589e5fd5 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -192,18 +192,17 @@ struct dom_sid *samdb_search_dom_sid(struct ldb_context *sam_ldb,
return the count of the number of records in the sam matching the query
*/
int samdb_search_count(struct ldb_context *sam_ldb,
+ TALLOC_CTX *mem_ctx,
struct ldb_dn *basedn,
- const char *format, ...) _PRINTF_ATTRIBUTE(3,4)
+ const char *format, ...) _PRINTF_ATTRIBUTE(4,5)
{
va_list ap;
const char *attrs[] = { NULL };
int ret;
- TALLOC_CTX *tmp_ctx = talloc_new(sam_ldb);
va_start(ap, format);
- ret = gendb_search_v(sam_ldb, tmp_ctx, basedn, NULL, attrs, format, ap);
+ ret = gendb_search_v(sam_ldb, mem_ctx, basedn, NULL, attrs, format, ap);
va_end(ap);
- talloc_free(tmp_ctx);
return ret;
}
@@ -1870,7 +1869,7 @@ const char *samdb_client_site_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
* is for sure the same as our server site). If more sites do
* exist then we don't know which one to use and set the site
* name to "". */
- cnt = samdb_search_count(ldb, sites_container_dn,
+ cnt = samdb_search_count(ldb, mem_ctx, sites_container_dn,
"(objectClass=site)");
if (cnt == 1) {
site_name = samdb_server_site_name(ldb, mem_ctx);
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 780491faec..26022b7e3c 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -180,7 +180,7 @@ static int samldb_check_sAMAccountName(struct samldb_ctx *ac)
return ldb_operr(ldb);
}
- ret = samdb_search_count(ldb, NULL, "(sAMAccountName=%s)",
+ ret = samdb_search_count(ldb, ac, NULL, "(sAMAccountName=%s)",
ldb_binary_encode_string(ac, name));
if ((ret < 0) || (ret > 1)) {
return ldb_operr(ldb);
@@ -1523,7 +1523,7 @@ static int samldb_prim_group_users_check(struct samldb_ctx *ac)
}
/* Deny delete requests from groups which are primary ones */
- count = samdb_search_count(ldb, NULL,
+ count = samdb_search_count(ldb, ac, NULL,
"(&(primaryGroupID=%u)(objectClass=user))",
rid);
if (count < 0) {
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index ac75b417f9..cef580edec 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -520,12 +520,15 @@ static NTSTATUS dcesrv_samr_info_DomGeneralInformation(struct samr_domain_state
}
/* No users in BUILTIN, and the LOCAL group types are only in builtin, and the global group type is never in BUILTIN */
- info->num_users = samdb_search_count(state->sam_ctx, state->domain_dn,
+ info->num_users = samdb_search_count(state->sam_ctx, mem_ctx,
+ state->domain_dn,
"(objectClass=user)");
- info->num_groups = samdb_search_count(state->sam_ctx, state->domain_dn,
+ info->num_groups = samdb_search_count(state->sam_ctx, mem_ctx,
+ state->domain_dn,
"(&(objectClass=group)(groupType=%u))",
GTYPE_SECURITY_GLOBAL_GROUP);
- info->num_aliases = samdb_search_count(state->sam_ctx, state->domain_dn,
+ info->num_aliases = samdb_search_count(state->sam_ctx, mem_ctx,
+ state->domain_dn,
"(&(objectClass=group)(groupType=%u))",
GTYPE_SECURITY_DOMAIN_LOCAL_GROUP);