diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-08-25 07:08:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:45 -0500 |
commit | 0fd98079425cff37c45be824ffa2695458ff12f3 (patch) | |
tree | 6e56cb6f01fcb4242918451a67f63aabeca76693 /source4/dsdb | |
parent | fb36e279e79ae54c1622c316780e20fb9aaf1a85 (diff) | |
download | samba-0fd98079425cff37c45be824ffa2695458ff12f3.tar.gz samba-0fd98079425cff37c45be824ffa2695458ff12f3.tar.bz2 samba-0fd98079425cff37c45be824ffa2695458ff12f3.zip |
r17823: get rid of most of the samdb_base_dn() calls, as they are no longer
needed in searches
(This used to be commit a5ea749f0ac63bf495a55ee8d9d002208ab93572)
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/common/sidmap.c | 13 | ||||
-rw-r--r-- | source4/dsdb/samdb/cracknames.c | 5 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 4 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 8 |
4 files changed, 14 insertions, 16 deletions
diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c index 353d5c14f1..dde01fba72 100644 --- a/source4/dsdb/common/sidmap.c +++ b/source4/dsdb/common/sidmap.c @@ -103,8 +103,7 @@ static NTSTATUS sidmap_primary_domain_sid(struct sidmap_context *sidmap, int ret; struct ldb_message **res = NULL; - ret = gendb_search_dn(sidmap->samctx, mem_ctx, samdb_base_dn(mem_ctx), - &res, attrs); + ret = gendb_search_dn(sidmap->samctx, mem_ctx, NULL, &res, attrs); if (ret != 1) { talloc_free(res); return NT_STATUS_NO_SUCH_DOMAIN; @@ -137,7 +136,7 @@ _PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap, tmp_ctx = talloc_new(sidmap); - ret = gendb_search(sidmap->samctx, tmp_ctx, samdb_base_dn(tmp_ctx), &res, attrs, + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, "objectSid=%s", ldap_encode_ndr_dom_sid(tmp_ctx, sid)); if (ret != 1) { goto allocated_sid; @@ -233,7 +232,7 @@ _PUBLIC_ NTSTATUS sidmap_sid_to_unixgid(struct sidmap_context *sidmap, tmp_ctx = talloc_new(sidmap); - ret = gendb_search(sidmap->samctx, tmp_ctx, samdb_base_dn(tmp_ctx), &res, attrs, + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, "objectSid=%s", ldap_encode_ndr_dom_sid(tmp_ctx, sid)); if (ret != 1) { goto allocated_sid; @@ -347,7 +346,7 @@ _PUBLIC_ NTSTATUS sidmap_uid_to_sid(struct sidmap_context *sidmap, given uid */ - ret = gendb_search(sidmap->samctx, tmp_ctx, samdb_base_dn(tmp_ctx), &res, attrs, + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, "uidNumber=%u", (unsigned int)uid); for (i=0;i<ret;i++) { if (!is_user_account(res[i])) continue; @@ -445,7 +444,7 @@ _PUBLIC_ NTSTATUS sidmap_gid_to_sid(struct sidmap_context *sidmap, given gid */ - ret = gendb_search(sidmap->samctx, tmp_ctx, samdb_base_dn(tmp_ctx), &res, attrs, + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, "gidNumber=%u", (unsigned int)gid); for (i=0;i<ret;i++) { if (!is_group_account(res[i])) continue; @@ -465,7 +464,7 @@ _PUBLIC_ NTSTATUS sidmap_gid_to_sid(struct sidmap_context *sidmap, goto allocate_sid; } - ret = gendb_search(sidmap->samctx, tmp_ctx, samdb_base_dn(tmp_ctx), &res, attrs, + ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, "(|(unixName=%s)(sAMAccountName=%s))", grp->gr_name, grp->gr_name); for (i=0;i<ret;i++) { diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index b755aeef32..e8fd1fa71b 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -69,7 +69,7 @@ static enum drsuapi_DsNameStatus LDB_lookup_spn_alias(krb5_context context, stru return DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR; } - service_dn = ldb_dn_string_compose(tmp_ctx, samdb_base_dn(tmp_ctx), + service_dn = ldb_dn_string_compose(tmp_ctx, NULL, "CN=Directory Service,CN=Windows NT" ",CN=Services,CN=Configuration"); service_dn_str = ldb_dn_linearize(tmp_ctx, service_dn); @@ -578,7 +578,6 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ struct ldb_message **result_res = NULL; const struct ldb_dn *result_basedn; const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration"); - const struct ldb_dn *basedn = samdb_base_dn(mem_ctx); const char * const _domain_attrs_1779[] = { "ncName", "dnsRoot", NULL}; const char * const _result_attrs_null[] = { NULL }; @@ -737,7 +736,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ return WERR_OK; } dom_sid->num_auths--; - ldb_ret = gendb_search(sam_ctx, mem_ctx, basedn, &domain_res, attrs, + ldb_ret = gendb_search(sam_ctx, mem_ctx, NULL, &domain_res, attrs, "(&(objectSid=%s)(objectClass=domain))", ldap_encode_ndr_dom_sid(mem_ctx, dom_sid)); if (ldb_ret != 1) { info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND; diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 98acc2696f..8cf865bd3e 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -301,7 +301,7 @@ int samldb_notice_sid(struct ldb_module *module, filter = talloc_asprintf(mem_ctx, "(objectSid=%s)", ldap_encode_ndr_dom_sid(mem_ctx, sid)); - ret = ldb_search(module->ldb, samdb_base_dn(mem_ctx), LDB_SCOPE_SUBTREE, filter, attrs, &res); + ret = ldb_search(module->ldb, NULL, LDB_SCOPE_SUBTREE, filter, attrs, &res); if (ret == LDB_SUCCESS) { if (res->count > 0) { talloc_free(res); @@ -333,7 +333,7 @@ int samldb_notice_sid(struct ldb_module *module, filter = talloc_asprintf(mem_ctx, "(&(objectSid=%s)(objectclass=domain))", ldap_encode_ndr_dom_sid(mem_ctx, dom_sid)); - ret = ldb_search(module->ldb, samdb_base_dn(mem_ctx), LDB_SCOPE_SUBTREE, filter, attrs, &dom_res); + ret = ldb_search(module->ldb, NULL, LDB_SCOPE_SUBTREE, filter, attrs, &dom_res); if (ret == LDB_SUCCESS) { talloc_steal(mem_ctx, dom_res); if (dom_res->count == 0) { diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index a48e21f52d..4027203b24 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -1024,7 +1024,7 @@ struct security_descriptor *samdb_default_security_descriptor(TALLOC_CTX *mem_ct return sd; } -struct ldb_dn *samdb_base_dn(TALLOC_CTX *mem_ctx) +const struct ldb_dn *samdb_base_dn(TALLOC_CTX *mem_ctx) { TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); int server_role = lp_server_role(); @@ -1217,7 +1217,7 @@ _PUBLIC_ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ct return NT_STATUS_INTERNAL_DB_CORRUPTION; } - count = gendb_search(ctx, mem_ctx, samdb_base_dn(mem_ctx), &res, domain_attrs, + count = gendb_search(ctx, mem_ctx, NULL, &res, domain_attrs, "(objectSid=%s)", ldap_encode_ndr_dom_sid(mem_ctx, domain_sid)); if (count != 1) { @@ -1397,7 +1397,7 @@ _PUBLIC_ NTSTATUS samdb_set_password_sid(struct ldb_context *ctx, TALLOC_CTX *me return NT_STATUS_TRANSACTION_ABORTED; } - user_dn = samdb_search_dn(ctx, mem_ctx, samdb_base_dn(mem_ctx), + user_dn = samdb_search_dn(ctx, mem_ctx, NULL, "(&(objectSid=%s)(objectClass=user))", ldap_encode_ndr_dom_sid(mem_ctx, user_sid)); if (!user_dn) { @@ -1548,7 +1548,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA * cn=For...,cn=Builtin,dc={BASEDN}. -- vl */ - basedn = samdb_search_dn(sam_ctx, mem_ctx, samdb_base_dn(mem_ctx), + basedn = samdb_search_dn(sam_ctx, mem_ctx, NULL, "(&(objectClass=container)(cn=ForeignSecurityPrincipals))"); if (basedn == NULL) { |