diff options
author | Simo Sorce <idra@samba.org> | 2005-09-18 18:49:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:38:16 -0500 |
commit | 16aff2a184f7fab64d718b356056070e305e99e9 (patch) | |
tree | c1c3dd59cb0e9c54c0ce95bf9165d353206ebd8e /source4/lib/ldb/ldb_ildap/ldb_ildap.c | |
parent | 46a8d809376cab59c579c654b0de5105727a9585 (diff) | |
download | samba-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_ildap/ldb_ildap.c')
-rw-r--r-- | source4/lib/ldb/ldb_ildap/ldb_ildap.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index d4239c0f72..be51a65c58 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -82,6 +82,7 @@ static int ildb_rename(struct ldb_module *module, const struct ldb_dn *olddn, co ildb->last_rc = ildap_rename(ildb->ldap, old_dn, newrdn, parentdn, True); if (!NT_STATUS_IS_OK(ildb->last_rc)) { + ldb_set_errstring(module, talloc_strdup(module, ldap_errstr(ildb->ldap, ildb->last_rc))); ret = -1; } @@ -111,6 +112,7 @@ static int ildb_delete(struct ldb_module *module, const struct ldb_dn *dn) ildb->last_rc = ildap_delete(ildb->ldap, del_dn); if (!NT_STATUS_IS_OK(ildb->last_rc)) { + ldb_set_errstring(module, talloc_strdup(module, ldap_errstr(ildb->ldap, ildb->last_rc))); ret = -1; } @@ -316,6 +318,7 @@ static int ildb_add(struct ldb_module *module, const struct ldb_message *msg) ildb->last_rc = ildap_add(ildb->ldap, dn, mods); if (!NT_STATUS_IS_OK(ildb->last_rc)) { + ldb_set_errstring(module, talloc_strdup(module, ldap_errstr(ildb->ldap, ildb->last_rc))); ret = -1; } @@ -354,6 +357,7 @@ static int ildb_modify(struct ldb_module *module, const struct ldb_message *msg) ildb->last_rc = ildap_modify(ildb->ldap, dn, mods); if (!NT_STATUS_IS_OK(ildb->last_rc)) { + ldb_set_errstring(module, talloc_strdup(module, ldap_errstr(ildb->ldap, ildb->last_rc))); ret = -1; } @@ -376,20 +380,6 @@ static int ildb_end_trans(struct ldb_module *module, int status) return status; } -/* - return extended error information -*/ -static const char *ildb_errstring(struct ldb_module *module) -{ - struct ildb_private *ildb = talloc_get_type(module->private_data, - struct ildb_private); - if (ildb == NULL) { - return "ildap not connected"; - } - return ldap_errstr(ildb->ldap, ildb->last_rc); -} - - static const struct ldb_module_ops ildb_ops = { .name = "ldap", .search = ildb_search, @@ -399,8 +389,7 @@ static const struct ldb_module_ops ildb_ops = { .delete_record = ildb_delete, .rename_record = ildb_rename, .start_transaction = ildb_start_trans, - .end_transaction = ildb_end_trans, - .errstring = ildb_errstring + .end_transaction = ildb_end_trans }; |