diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-02-10 17:19:43 -0800 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-02-10 17:19:43 -0800 |
commit | 508af98564fd93bf0eed9093c6b551e806ebee81 (patch) | |
tree | f9361422c8fd0eaa6903c80543f21c76a23988a3 /ldap/servers/slapd/back-ldbm/ldbm_modify.c | |
parent | f81e7eac08e2af16fa6b8d245525c4a5ac5eb6f7 (diff) | |
download | ds-508af98564fd93bf0eed9093c6b551e806ebee81.tar.gz ds-508af98564fd93bf0eed9093c6b551e806ebee81.tar.xz ds-508af98564fd93bf0eed9093c6b551e806ebee81.zip |
563365 - Error handling problems in the backend functions
https://bugzilla.redhat.com/show_bug.cgi?id=563365
1) Error handling in ldbm_back_{add,delete,modify,modrdn} functions was
incomplete. When any error occurs after the transaction begins, the
changes made after that should be aborted. There were some cases the
abort was not called.
2) If modrdn failed in ldbm_back_modrdn, new DN in the DN cache was not
removed.
3) config_set_instancedir in libglobs.c was missing the function type.
Diffstat (limited to 'ldap/servers/slapd/back-ldbm/ldbm_modify.c')
-rw-r--r-- | ldap/servers/slapd/back-ldbm/ldbm_modify.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c index 9a0bea07..3cda1d80 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c @@ -50,6 +50,12 @@ extern char *hassubordinates; static void remove_illegal_mods(LDAPMod **mods); static int mods_have_effect (Slapi_Entry *entry, Slapi_Mods *smods); +#define MOD_SET_ERROR(rc, error, count) \ +{ \ + (rc) = (error); \ + (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \ +} + /* Modify context structure constructor, sans allocation */ void modify_init(modify_context *mc,struct backentry *old_entry) { @@ -406,7 +412,7 @@ ldbm_back_modify( Slapi_PBlock *pb ) LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } ec_in_cache = 1; @@ -420,7 +426,7 @@ ldbm_back_modify( Slapi_PBlock *pb ) LDAPDebug( LDAP_DEBUG_ANY, "index_add_mods failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } /* @@ -440,7 +446,8 @@ ldbm_back_modify( Slapi_PBlock *pb ) "vlv_update_index failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + MOD_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } @@ -456,7 +463,7 @@ ldbm_back_modify( Slapi_PBlock *pb ) } if (cache_replace( &inst->inst_cache, e, ec ) != 0 ) { - ldap_result_code= LDAP_OPERATIONS_ERROR; + MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } @@ -516,9 +523,9 @@ error_return: disk_full = 1; } - if (disk_full) + if (disk_full) { rc= return_on_disk_full(li); - else if (ldap_result_code != LDAP_SUCCESS) { + } else if (ldap_result_code != LDAP_SUCCESS) { if (retry_count > 0) { /* It is safer not to abort when the transaction is not started. */ dblayer_txn_abort(li,&txn); /* abort crashes in case disk full */ |