]> git.sur5r.net Git - openldap/commitdiff
tolerate more error conditions
authorPierangelo Masarati <ando@openldap.org>
Fri, 4 Nov 2005 15:51:19 +0000 (15:51 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 4 Nov 2005 15:51:19 +0000 (15:51 +0000)
tests/progs/slapd-addel.c
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c

index 163910bb93ab6807e23951c4113dbbb8169d75bc..95b4185b9063f74ca3b9f187b872756acaa56692 100644 (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 ) {
index a2f275d9f8705a5cf73c7872df500761c327e5b2..ad5ad6f3b1edcfe91b023ecb1f0a597a4ae98e4c 100644 (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 ) {
-                               do_retry--;
-                               goto retry;
+                       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;
+                               }
+                               /* fall thru */
+
+                       default:
+                               goto done;
                        }
-                       if ( rc != LDAP_NO_SUCH_OBJECT ) break;
-                       continue;
                }
                
                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:
index 4378fe29edf2902c85762d098ef0ae9a8911b4c6..67f6462cbce903483825c62f564b06fbfef60eee 100644 (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: