summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_ldap/ldb_ldap.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-09-18 18:49:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:16 -0500
commit16aff2a184f7fab64d718b356056070e305e99e9 (patch)
treec1c3dd59cb0e9c54c0ce95bf9165d353206ebd8e /source4/lib/ldb/ldb_ldap/ldb_ldap.c
parent46a8d809376cab59c579c654b0de5105727a9585 (diff)
downloadsamba-16aff2a184f7fab64d718b356056070e305e99e9.tar.gz
samba-16aff2a184f7fab64d718b356056070e305e99e9.tar.bz2
samba-16aff2a184f7fab64d718b356056070e305e99e9.zip
r10305: start implementing better error handling
changed the prioivate modules API error string are now not spread over all modules but are kept in a single place. This allows a better control of memory and error reporting. (This used to be commit 3fc676ac1d6f59d08bedbbd9377986154cf84ce4)
Diffstat (limited to 'source4/lib/ldb/ldb_ldap/ldb_ldap.c')
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 39f56dba0e..2035913f2a 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -78,6 +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)));
ret = -1;
}
@@ -107,6 +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)));
ret = -1;
}
@@ -200,6 +202,7 @@ static int lldb_search(struct ldb_module *module, const struct ldb_dn *base,
0, &ldapres);
talloc_free(search_base);
if (lldb->last_rc != LDAP_SUCCESS) {
+ ldb_set_errstring(module, talloc_strdup(module, ldap_err2string(lldb->last_rc)));
return -1;
}
@@ -404,6 +407,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)));
ret = -1;
}
@@ -442,6 +446,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)));
ret = -1;
}
@@ -464,16 +469,6 @@ static int lldb_end_trans(struct ldb_module *module, int status)
return status;
}
-/*
- return extended error information
-*/
-static const char *lldb_errstring(struct ldb_module *module)
-{
- struct lldb_private *lldb = module->private_data;
- return ldap_err2string(lldb->last_rc);
-}
-
-
static const struct ldb_module_ops lldb_ops = {
.name = "ldap",
.search = lldb_search,
@@ -483,8 +478,7 @@ static const struct ldb_module_ops lldb_ops = {
.delete_record = lldb_delete,
.rename_record = lldb_rename,
.start_transaction = lldb_start_trans,
- .end_transaction = lldb_end_trans,
- .errstring = lldb_errstring
+ .end_transaction = lldb_end_trans
};