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_delete.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_delete.c')
-rw-r--r-- | ldap/servers/slapd/back-ldbm/ldbm_delete.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c index 97873003..82241146 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c @@ -45,6 +45,12 @@ #include "back-ldbm.h" +#define DEL_SET_ERROR(rc, error, count) \ +{ \ + (rc) = (error); \ + (count) = RETRY_TIMES; /* otherwise, the transaction may not be aborted */ \ +} + int ldbm_back_delete( Slapi_PBlock *pb ) { @@ -445,7 +451,8 @@ ldbm_back_delete( 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; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } if (cache_add_tentative( &inst->inst_cache, tombstone, NULL) == 0) { @@ -467,7 +474,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) LDBM_OS_ERR_IS_DISKFULL(retval)) { disk_full = 1; } - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -486,7 +494,7 @@ ldbm_back_delete( Slapi_PBlock *pb ) } if (retval != 0) { LDAPDebug( LDAP_DEBUG_TRACE, "index_del_entry failed\n", 0, 0, 0 ); - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } if(create_tombstone_entry) @@ -512,7 +520,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_VALUE_TOMBSTONE, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } retval = index_addordel_string(be, SLAPI_ATTR_UNIQUEID, @@ -531,7 +540,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_UNIQUEID, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } retval = index_addordel_string(be, SLAPI_ATTR_NSCP_ENTRYDN, @@ -550,7 +560,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_NSCP_ENTRYDN, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } /* add a new usn to the entryusn index */ @@ -573,7 +584,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_ENTRYUSN, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -596,7 +608,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_ENTRYUSN, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -616,7 +629,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -645,7 +659,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_VALUE_TOMBSTONE, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } retval = index_addordel_string(be, SLAPI_ATTR_UNIQUEID, @@ -664,7 +679,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_UNIQUEID, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } @@ -687,7 +703,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_NSCP_ENTRYDN, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -712,7 +729,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) SLAPI_ATTR_ENTRYUSN, retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -732,7 +750,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) retval, (msg = dblayer_strerror( retval )) ? msg : "" ); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -751,7 +770,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) LDAPDebug( LDAP_DEBUG_TRACE, "delete 3 BAD, 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; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } @@ -771,7 +791,8 @@ ldbm_back_delete( Slapi_PBlock *pb ) } if (retval != 0 ) { if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; - ldap_result_code= LDAP_OPERATIONS_ERROR; + DEL_SET_ERROR(ldap_result_code, + LDAP_OPERATIONS_ERROR, retry_count); goto error_return; } } |