From d590dea10b3abf93fcc8138189291e8b66bae7d7 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 22 Feb 2006 05:21:43 +0000 Subject: r13615: Make ldb_set_errstring get ldb instead of module as parameter. The module was just used to get to the ldb so it was meningless. Also add LDB_WAIT_ONCE e relative code in ldb_ildap.c (This used to be commit d5b467b7c132b0bd4d23918ba7bf3370b1afcce8) --- source4/dsdb/samdb/ldb_modules/kludge_acl.c | 2 +- source4/dsdb/samdb/ldb_modules/password_hash.c | 20 ++++++++++---------- source4/dsdb/samdb/ldb_modules/proxy.c | 2 +- source4/dsdb/samdb/ldb_modules/samldb.c | 18 ++++++++++++------ 4 files changed, 24 insertions(+), 18 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 83c7d14da4..9ce3217104 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -135,7 +135,7 @@ static int kludge_acl_change(struct ldb_module *module, struct ldb_request *req) case ADMINISTRATOR: return ldb_next_request(module, req); default: - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(req, "kludge_acl_change: " "attempted database modify not permitted. User %s is not SYSTEM or an administrator", user_name(req, module))); diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index 630edf1c7a..e28c85ae37 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -167,7 +167,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r if (req->operation == LDB_REQ_ADD) { if (attribute->num_values > 1) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "sambaPassword_handle: " "attempted set of multiple sambaPassword attributes on %s rejected", ldb_dn_linearize(mem_ctx, dn))); @@ -182,7 +182,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r } else if (((attribute->flags & LDB_FLAG_MOD_MASK) == LDB_FLAG_MOD_ADD) || ((attribute->flags & LDB_FLAG_MOD_MASK) == LDB_FLAG_MOD_REPLACE)) { if (attribute->num_values > 1) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "sambaPassword_handle: " "attempted set of multiple sambaPassword attributes on %s rejected", ldb_dn_linearize(mem_ctx, dn))); @@ -234,7 +234,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r talloc_free(search_request); if (old_res->count != 1) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "(pre) search for %s found %d != 1 objects, for entry we just modified", ldb_dn_linearize(mem_ctx, dn), @@ -280,7 +280,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r talloc_free(search_request); if (res->count != 1) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "search for %s found %d != 1 objects, for entry we just added/modified", ldb_dn_linearize(mem_ctx, dn), @@ -308,7 +308,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r /* Not a 'person', so the rest of this doesn't make * sense. How we got a sambaPassword this far I don't * know... */ - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "attempted set of sambaPassword on non-'person' object %s rejected", ldb_dn_linearize(mem_ctx, dn))); @@ -338,7 +338,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r if (dom_res->count != 1) { /* What happend? The user we are modifying must be odd... */ - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "search for domain %s found %d != 1 objects", dom_sid_string(mem_ctx, domain_sid), @@ -414,7 +414,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r char *samAccountName = talloc_strdup(mem_ctx, ldb_msg_find_string(res->msgs[0], "samAccountName", NULL)); char *saltbody; if (!samAccountName) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "generation of new kerberos keys failed: %s is a computer without a samAccountName", ldb_dn_linearize(mem_ctx, dn))); @@ -443,7 +443,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r } else { const char *samAccountName = ldb_msg_find_string(res->msgs[0], "samAccountName", NULL); if (!samAccountName) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "generation of new kerberos keys failed: %s has no samAccountName", ldb_dn_linearize(mem_ctx, dn))); @@ -455,7 +455,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r if (krb5_ret) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "generation of a saltking principal failed: %s", smb_get_krb5_error_message(smb_krb5_context->krb5_context, @@ -470,7 +470,7 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r krb5_free_principal(smb_krb5_context->krb5_context, salt_principal); if (krb5_ret) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "password_hash_handle: " "generation of new kerberos keys failed: %s", smb_get_krb5_error_message(smb_krb5_context->krb5_context, diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c index 2c66d2c1ec..511f9aeec5 100644 --- a/source4/dsdb/samdb/ldb_modules/proxy.c +++ b/source4/dsdb/samdb/ldb_modules/proxy.c @@ -291,7 +291,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re newreq.controls = req->controls; ret = ldb_request(proxy->upstream, &newreq); if (ret != LDB_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldb_errstring(proxy->upstream))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldb_errstring(proxy->upstream))); return -1; } diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 07f617f4b5..a582127bbe 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -180,7 +180,9 @@ static int samldb_find_next_rid(struct ldb_module *module, TALLOC_CTX *mem_ctx, str = ldb_msg_find_string(res->msgs[0], "nextRid", NULL); if (str == NULL) { - ldb_set_errstring(module, talloc_asprintf(mem_ctx, "attribute nextRid not found in %s\n", ldb_dn_linearize(res, dn))); + ldb_set_errstring(module->ldb, + talloc_asprintf(mem_ctx, "attribute nextRid not found in %s\n", + ldb_dn_linearize(res, dn))); talloc_free(res); return -1; } @@ -337,7 +339,11 @@ int samldb_notice_sid(struct ldb_module *module, "objectSid=%s", ldap_encode_ndr_dom_sid(mem_ctx, sid)); if (ret > 0) { - ldb_set_errstring(module, talloc_asprintf(mem_ctx, "Attempt to add record with SID %s rejected, because this SID is already in the database", dom_sid_string(mem_ctx, sid))); + ldb_set_errstring(module->ldb, + talloc_asprintf(mem_ctx, + "Attempt to add record with SID %s rejected," + " because this SID is already in the database", + dom_sid_string(mem_ctx, sid))); /* We have a duplicate SID, we must reject the add */ talloc_free(dom_msgs); return LDB_ERR_CONSTRAINT_VIOLATION; @@ -605,7 +611,7 @@ static int samldb_fill_user_or_computer_object(struct ldb_module *module, const rdn = ldb_dn_get_rdn(msg2, msg2->dn); if (strcasecmp(rdn->name, "cn") != 0) { - ldb_set_errstring(module, talloc_asprintf(module, "Bad RDN (%s=) for user/computer, should be CN=!\n", rdn->name)); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Bad RDN (%s=) for user/computer, should be CN=!\n", rdn->name)); talloc_free(mem_ctx); return LDB_ERR_CONSTRAINT_VIOLATION; } @@ -681,7 +687,7 @@ static int samldb_fill_foreignSecurityPrincipal_object(struct ldb_module *module rdn = ldb_dn_get_rdn(msg2, msg2->dn); if (strcasecmp(rdn->name, "cn") != 0) { - ldb_set_errstring(module, talloc_asprintf(module, "Bad RDN (%s=) for ForeignSecurityPrincipal, should be CN=!", rdn->name)); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Bad RDN (%s=) for ForeignSecurityPrincipal, should be CN=!", rdn->name)); talloc_free(mem_ctx); return LDB_ERR_CONSTRAINT_VIOLATION; } @@ -692,7 +698,7 @@ static int samldb_fill_foreignSecurityPrincipal_object(struct ldb_module *module sid = dom_sid_parse_talloc(msg2, (const char *)rdn->value.data); if (!sid) { - ldb_set_errstring(module, talloc_asprintf(module, "No valid found SID in ForeignSecurityPrincipal CN!")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "No valid found SID in ForeignSecurityPrincipal CN!")); talloc_free(mem_ctx); return LDB_ERR_CONSTRAINT_VIOLATION; } @@ -718,7 +724,7 @@ static int samldb_fill_foreignSecurityPrincipal_object(struct ldb_module *module ldap_encode_ndr_dom_sid(mem_ctx, dom_sid)); if (ret >= 1) { const char *name = samdb_result_string(dom_msgs[0], "name", NULL); - ldb_set_errstring(module, talloc_asprintf(mem_ctx, "Attempt to add foreign SID record with SID %s rejected, because this domian (%s) is already in the database", dom_sid_string(mem_ctx, sid), name)); + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "Attempt to add foreign SID record with SID %s rejected, because this domian (%s) is already in the database", dom_sid_string(mem_ctx, sid), name)); /* We don't really like the idea of foreign sids that are not foreign */ return LDB_ERR_CONSTRAINT_VIOLATION; } else if (ret == -1) { -- cgit