tolerate more error conditions

This commit is contained in:
Pierangelo Masarati 2005-11-04 15:51:19 +00:00
parent d08257407d
commit 203525a64b
3 changed files with 36 additions and 6 deletions

View file

@ -329,6 +329,12 @@ retry:;
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_add" );
switch ( rc ) {
case LDAP_ALREADY_EXISTS:
/* NOTE: this likely means
* the delete failed
* during the previous round... */
break;
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry > 0 ) {
@ -353,6 +359,12 @@ retry:;
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_delete" );
switch ( rc ) {
case LDAP_NO_SUCH_OBJECT:
/* NOTE: this likely means
* the add failed
* during the previous round... */
break;
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry > 0 ) {

View file

@ -220,12 +220,24 @@ retry:;
rc = ldap_modify_s( ld, entry, mods );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_modify" );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
switch ( rc ) {
case LDAP_TYPE_OR_VALUE_EXISTS:
/* NOTE: this likely means
* the second modify failed
* during the previous round... */
break;
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry > 0 ) {
do_retry--;
goto retry;
}
if ( rc != LDAP_NO_SUCH_OBJECT ) break;
continue;
/* fall thru */
default:
goto done;
}
}
mod.mod_op = LDAP_MOD_DELETE;
@ -233,7 +245,10 @@ retry:;
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_modify" );
switch ( rc ) {
case LDAP_NO_SUCH_OBJECT:
case LDAP_NO_SUCH_ATTRIBUTE:
/* NOTE: this likely means
* the first modify failed
* during the previous round... */
break;
case LDAP_BUSY:

View file

@ -235,6 +235,9 @@ retry:;
ldap_perror( ld, "ldap_modrdn" );
switch ( rc ) {
case LDAP_NO_SUCH_OBJECT:
/* NOTE: this likely means
* the first modrdn failed
* during the previous round... */
break;
case LDAP_BUSY: