diff options
author | Simo Sorce <idra@samba.org> | 2006-02-22 05:21:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:59 -0500 |
commit | d590dea10b3abf93fcc8138189291e8b66bae7d7 (patch) | |
tree | d859a38ca49d480c36e3a8a3ef2ac28e2b964066 | |
parent | 00fe70e5b917769418f68eaa255d3a06a9a08ce7 (diff) | |
download | samba-d590dea10b3abf93fcc8138189291e8b66bae7d7.tar.gz samba-d590dea10b3abf93fcc8138189291e8b66bae7d7.tar.bz2 samba-d590dea10b3abf93fcc8138189291e8b66bae7d7.zip |
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)
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/kludge_acl.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/password_hash.c | 20 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/proxy.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 18 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 18 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_debug.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 2 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ildap/ldb_ildap.c | 26 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 10 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 18 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 12 | ||||
-rw-r--r-- | source4/lib/ldb/modules/ldb_map.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/modules/objectclass.c | 2 | ||||
-rw-r--r-- | source4/nbt_server/wins/wins_ldb.c | 2 |
15 files changed, 77 insertions, 61 deletions
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) { diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 68722cde96..87705a855a 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -106,12 +106,12 @@ int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, co return LDB_SUCCESS; } -void ldb_set_errstring(struct ldb_module *module, char *err_string) +void ldb_set_errstring(struct ldb_context *ldb, char *err_string) { - if (module->ldb->err_string) { - talloc_free(module->ldb->err_string); + if (ldb->err_string) { + talloc_free(ldb->err_string); } - module->ldb->err_string = talloc_steal(module->ldb, err_string); + ldb->err_string = talloc_steal(ldb, err_string); } void ldb_reset_err_string(struct ldb_context *ldb) @@ -158,7 +158,7 @@ int ldb_transaction_start(struct ldb_context *ldb) if (status != LDB_SUCCESS) { if (ldb->err_string == NULL) { /* no error string was setup by the backend */ - ldb_set_errstring(ldb->modules, + ldb_set_errstring(ldb, talloc_asprintf(ldb, "ldb transaction start error %d", status)); } } @@ -186,7 +186,7 @@ int ldb_transaction_commit(struct ldb_context *ldb) if (status != LDB_SUCCESS) { if (ldb->err_string == NULL) { /* no error string was setup by the backend */ - ldb_set_errstring(ldb->modules, + ldb_set_errstring(ldb, talloc_asprintf(ldb, "ldb transaction commit error %d", status)); } } @@ -212,7 +212,7 @@ int ldb_transaction_cancel(struct ldb_context *ldb) if (status != LDB_SUCCESS) { if (ldb->err_string == NULL) { /* no error string was setup by the backend */ - ldb_set_errstring(ldb->modules, + ldb_set_errstring(ldb, talloc_asprintf(ldb, "ldb transaction cancel error %d", status)); } } @@ -238,7 +238,7 @@ static int ldb_op_finish(struct ldb_context *ldb, int status) } if (ldb->err_string == NULL) { /* no error string was setup by the backend */ - ldb_set_errstring(ldb->modules, + ldb_set_errstring(ldb, talloc_asprintf(ldb, "ldb error %d", status)); } ldb_transaction_cancel(ldb); @@ -330,7 +330,7 @@ int ldb_search(struct ldb_context *ldb, tree = ldb_parse_tree(ldb, expression); if (tree == NULL) { - ldb_set_errstring(ldb->modules, talloc_strdup(ldb, "Unable to parse search expression")); + ldb_set_errstring(ldb, talloc_strdup(ldb, "Unable to parse search expression")); return -1; } diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c index 21b02956b8..c4718c7f52 100644 --- a/source4/lib/ldb/common/ldb_debug.c +++ b/source4/lib/ldb/common/ldb_debug.c @@ -97,7 +97,7 @@ void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level, msg = talloc_vasprintf(ldb, fmt, ap); va_end(ap); if (msg != NULL) { - ldb_set_errstring(ldb->modules, msg); + ldb_set_errstring(ldb, msg); ldb_debug(ldb, level, "%s", msg); } } diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 4a40e34363..8a9e8bea76 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -577,10 +577,12 @@ enum ldb_reply_type { enum ldb_async_wait_type { LDB_WAIT_ALL, + LDB_WAIT_ONCE, LDB_WAIT_NONE }; enum ldb_async_state { + LDB_ASYNC_INIT, LDB_ASYNC_PENDING, LDB_ASYNC_DONE }; diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index db34b58858..24967faeea 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -133,7 +133,7 @@ int ldb_next_end_trans(struct ldb_module *module); int ldb_next_del_trans(struct ldb_module *module); int ldb_next_second_stage_init(struct ldb_module *module); -void ldb_set_errstring(struct ldb_module *module, char *err_string); +void ldb_set_errstring(struct ldb_context *ldb, char *err_string); void ldb_reset_err_string(struct ldb_context *ldb); /* The following definitions come from lib/ldb/common/ldb_debug.c */ diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index 33d3954a73..de32c10ba4 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -230,7 +230,7 @@ static void ildb_async_callback(struct ldap_request *req) } if (msg->r.SearchResultDone.resultcode) { if (msg->r.SearchResultDone.errormessage) { - ldb_set_errstring(ac->module, talloc_strdup(ac->module, msg->r.SearchResultDone.errormessage)); + ldb_set_errstring(ac->module->ldb, talloc_strdup(ac->module, msg->r.SearchResultDone.errormessage)); } } @@ -309,13 +309,13 @@ static int ildb_request_send(struct ldb_module *module, struct ldap_message *msg h = talloc_zero(ildb->ldap, struct ldb_async_handle); if (h == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "Out of Memory")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return LDB_ERR_OPERATIONS_ERROR; } ildb_ac = talloc(h, struct ildb_async_context); if (ildb_ac == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "Out of Memory")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); return LDB_ERR_OPERATIONS_ERROR; } @@ -324,7 +324,7 @@ static int ildb_request_send(struct ldb_module *module, struct ldap_message *msg req = ldap_request_send(ildb->ldap, msg); if (req == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "async send request failed")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "async send request failed")); return LDB_ERR_OPERATIONS_ERROR; } @@ -369,18 +369,18 @@ static int ildb_search_async(struct ldb_module *module, const struct ldb_dn *bas *handle = NULL; if (!callback || !context) { - ldb_set_errstring(module, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; } if (tree == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "Invalid expression parse tree")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Invalid expression parse tree")); return LDB_ERR_OPERATIONS_ERROR; } msg = new_ldap_message(ildb); if (msg == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "Out of Memory")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return LDB_ERR_OPERATIONS_ERROR; } @@ -397,7 +397,7 @@ static int ildb_search_async(struct ldb_module *module, const struct ldb_dn *bas msg->r.SearchRequest.basedn = ldb_dn_linearize(msg, base); } if (msg->r.SearchRequest.basedn == NULL) { - ldb_set_errstring(module, talloc_asprintf(module, "Unable to determine baseDN")); + ldb_set_errstring(module->ldb, talloc_asprintf(module, "Unable to determine baseDN")); talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } @@ -434,7 +434,7 @@ static int ildb_search_sync_callback(struct ldb_context *ldb, void *context, str int n; if (!context) { - ldb_set_errstring(ldb->modules, talloc_asprintf(ldb, "NULL Context in callback")); + ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context in callback")); return LDB_ERR_OPERATIONS_ERROR; } @@ -923,6 +923,14 @@ static int ildb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_ return LDB_ERR_OTHER; } break; + case LDB_WAIT_ONCE: + handle->state = LDB_ASYNC_INIT; + while (handle->status == LDB_SUCCESS && handle->state == LDB_ASYNC_INIT) { + if (event_loop_once(ac->req->conn->event.event_ctx) != 0) { + return LDB_ERR_OTHER; + } + } + break; case LDB_WAIT_ALL: while (handle->status == LDB_SUCCESS && handle->state != LDB_ASYNC_DONE) { if (event_loop_once(ac->req->conn->event.event_ctx) != 0) { diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 7233498eb3..c27ded7767 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -78,7 +78,7 @@ static int lldb_rename(struct ldb_module *module, const struct ldb_dn *olddn, co lldb->last_rc = ldap_rename_s(lldb->ldap, old_dn, newrdn, parentdn, 1, NULL, NULL); if (lldb->last_rc != LDAP_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldap_err2string(lldb->last_rc))); ret = -1; } @@ -108,7 +108,7 @@ static int lldb_delete(struct ldb_module *module, const struct ldb_dn *edn) lldb->last_rc = ldap_delete_s(lldb->ldap, dn); if (lldb->last_rc != LDAP_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldap_err2string(lldb->last_rc))); ret = -1; } @@ -226,7 +226,7 @@ static int lldb_search_bytree(struct ldb_module *module, const struct ldb_dn *ba 0, &ldapres); talloc_free(search_base); if (lldb->last_rc != LDAP_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldap_err2string(lldb->last_rc))); return lldb->last_rc; } @@ -412,7 +412,7 @@ static int lldb_add(struct ldb_module *module, const struct ldb_message *msg) lldb->last_rc = ldap_add_s(lldb->ldap, dn, mods); if (lldb->last_rc != LDAP_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldap_err2string(lldb->last_rc))); ret = -1; } @@ -451,7 +451,7 @@ static int lldb_modify(struct ldb_module *module, const struct ldb_message *msg) lldb->last_rc = ldap_modify_s(lldb->ldap, dn, mods); if (lldb->last_rc != LDAP_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldap_err2string(lldb->last_rc))); ret = -1; } diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index 48d849746f..aedba4e895 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -943,7 +943,7 @@ static int lsqlite3_search_bytree(struct ldb_module * module, const struct ldb_d ret = sqlite3_exec(lsqlite3->sqlite, query, lsqlite3_search_callback, &msgs, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1039,7 +1039,7 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg ret = sqlite3_exec(lsqlite3->sqlite, query, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1094,7 +1094,7 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg ret = sqlite3_exec(lsqlite3->sqlite, insert, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1184,7 +1184,7 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message * ret = sqlite3_exec(lsqlite3->sqlite, mod, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1222,7 +1222,7 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message * ret = sqlite3_exec(lsqlite3->sqlite, mod, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1248,7 +1248,7 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message * ret = sqlite3_exec(lsqlite3->sqlite, mod, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1282,7 +1282,7 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message * ret = sqlite3_exec(lsqlite3->sqlite, mod, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1343,7 +1343,7 @@ static int lsqlite3_delete(struct ldb_module *module, const struct ldb_dn *dn) ret = sqlite3_exec(lsqlite3->sqlite, query, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; @@ -1402,7 +1402,7 @@ static int lsqlite3_rename(struct ldb_module *module, const struct ldb_dn *olddn ret = sqlite3_exec(lsqlite3->sqlite, query, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { if (errmsg) { - ldb_set_errstring(module, talloc_strdup(module, errmsg)); + ldb_set_errstring(module->ldb, talloc_strdup(module, errmsg)); free(errmsg); } ret = LDB_ERR_OTHER; diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 1be11bc64c..8d8c01278d 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -142,7 +142,7 @@ int ltdb_check_special_dn(struct ldb_module *module, const struct ldb_message *m if (ltdb_check_at_attributes_values(&msg->elements[i].values[j]) != 0) { char *err_string = talloc_strdup(module, "Invalid attribute value in an @ATTRIBUTES entry"); if (err_string) { - ldb_set_errstring(module, err_string); + ldb_set_errstring(module->ldb, err_string); } return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } @@ -532,7 +532,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms for (j=0;j<el->num_values;j++) { if (ldb_msg_find_val(el2, &el->values[j])) { err_string = talloc_strdup(module, "Type or value exists"); - if (err_string) ldb_set_errstring(module, err_string); + if (err_string) ldb_set_errstring(module->ldb, err_string); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto failed; } @@ -577,7 +577,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms if (msg_delete_attribute(module, ldb, msg2, msg->elements[i].name) != 0) { err_string = talloc_asprintf(module, "No such attribute: %s", msg->elements[i].name); - if (err_string) ldb_set_errstring(module, err_string); + if (err_string) ldb_set_errstring(module->ldb, err_string); ret = LDB_ERR_NO_SUCH_ATTRIBUTE; goto failed; } @@ -589,7 +589,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms msg->elements[i].name, &msg->elements[i].values[j]) != 0) { err_string = talloc_asprintf(module, "No such attribute: %s", msg->elements[i].name); - if (err_string) ldb_set_errstring(module, err_string); + if (err_string) ldb_set_errstring(module->ldb, err_string); ret = LDB_ERR_NO_SUCH_ATTRIBUTE; goto failed; } @@ -602,7 +602,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms err_string = talloc_asprintf(module, "Invalid ldb_modify flags on %s: 0x%x", msg->elements[i].name, msg->elements[i].flags & LDB_FLAG_MOD_MASK); - if (err_string) ldb_set_errstring(module, err_string); + if (err_string) ldb_set_errstring(module->ldb, err_string); ret = LDB_ERR_PROTOCOL_ERROR; goto failed; } @@ -690,7 +690,7 @@ static int ltdb_rename(struct ldb_module *module, const struct ldb_dn *olddn, co ltdb_delete(module, newdn); } - ldb_set_errstring(module, error_str); + ldb_set_errstring(module->ldb, error_str); talloc_free(msg); diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c index 4c2ef5b239..f313a6e564 100644 --- a/source4/lib/ldb/modules/ldb_map.c +++ b/source4/lib/ldb/modules/ldb_map.c @@ -827,7 +827,7 @@ static int map_search_mp(struct ldb_module *module, struct ldb_request *req) talloc_free(newattrs); if (mpret != LDB_SUCCESS) { - ldb_set_errstring(module, talloc_strdup(module, ldb_errstring(privdat->mapped_ldb))); + ldb_set_errstring(module->ldb, talloc_strdup(module, ldb_errstring(privdat->mapped_ldb))); return mpret; } diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c index 479d943a91..8b4ad598cc 100644 --- a/source4/lib/ldb/modules/objectclass.c +++ b/source4/lib/ldb/modules/objectclass.c @@ -115,7 +115,7 @@ static int objectclass_handle(struct ldb_module *module, struct ldb_request *req res = search_request->op.search.res; talloc_steal(mem_ctx, res); if (res->count != 1) { - ldb_set_errstring(module, + ldb_set_errstring(module->ldb, talloc_asprintf(mem_ctx, "objectClass_handle: " "search for %s found %d != 1 objects, for entry we just added/modified", ldb_dn_linearize(mem_ctx, msg->dn), diff --git a/source4/nbt_server/wins/wins_ldb.c b/source4/nbt_server/wins/wins_ldb.c index 7bf1fa9916..d348c3231f 100644 --- a/source4/nbt_server/wins/wins_ldb.c +++ b/source4/nbt_server/wins/wins_ldb.c @@ -45,7 +45,7 @@ static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req, c if (!h) { error = talloc_strdup(module, "WINS_LDB: INTERNAL ERROR: no winsdb_handle present!"); ldb_debug(module->ldb, LDB_DEBUG_FATAL, "%s", error); - ldb_set_errstring(module, error); + ldb_set_errstring(module->ldb, error); return LDB_ERR_OTHER; } |