]> git.sur5r.net Git - openldap/commitdiff
fix various result returning bugs, mostly related to candidate selction that results...
authorPierangelo Masarati <ando@openldap.org>
Mon, 1 Oct 2001 16:16:51 +0000 (16:16 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 1 Oct 2001 16:16:51 +0000 (16:16 +0000)
servers/slapd/back-meta/add.c
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/candidates.c
servers/slapd/back-meta/delete.c
servers/slapd/back-meta/modify.c
servers/slapd/back-meta/modrdn.c
servers/slapd/back-meta/search.c

index 5e46ad2c2bca98ba00904b668b16421d68f17ec5..f344c793f5b561d4ec70056c0b4d744d0d30e42e 100644 (file)
@@ -129,12 +129,12 @@ meta_back_add(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
                
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 6d2188359e344581cf0396d329e54a4e0bce0d41..cc9fc94b88cc007fbf41ab322ad73fe82236f266 100644 (file)
@@ -127,6 +127,8 @@ meta_back_bind(
                                "meta_back_bind: no target for dn %s.\n%s%s",
                                dn, "", "");
 #endif /* !NEW_LOGGING */
+               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, 
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
@@ -198,7 +200,7 @@ meta_back_bind(
                 * deal with bind failure ...
                 */
                err = ldap_back_map_result( err );
-               send_ldap_result( conn, op, err, NULL, "", NULL, NULL );
+               send_ldap_result( conn, op, err, NULL, NULL, NULL, NULL );
                return -1;
        }
 
@@ -355,12 +357,14 @@ meta_back_dobind( struct metaconn *lc, Operation *op )
 int
 meta_back_op_result( struct metaconn *lc, Operation *op )
 {
-       int i, err = LDAP_SUCCESS;
-       char *msg = NULL;
-       char *match = NULL;
+       int i, rerr = LDAP_SUCCESS;
        struct metasingleconn **lsc;
 
        for ( i = 0, lsc = lc->conns; lsc[ 0 ] != NULL; ++i, ++lsc ) {
+               int err = LDAP_SUCCESS;
+               char *msg = NULL;
+               char *match = NULL;
+
                ldap_get_option( lsc[ 0 ]->ld, LDAP_OPT_ERROR_NUMBER, &err );
                if ( err != LDAP_SUCCESS ) {
                        /*
@@ -375,39 +379,39 @@ meta_back_op_result( struct metaconn *lc, Operation *op )
                                        LDAP_OPT_MATCHED_DN, &match );
                        err = ldap_back_map_result( err );
 
-                       /*
-                        * FIXME: need to rewrite "match" (need rwinfo)
-                        */
-                       send_ldap_result( lc->conn, op, err, match, msg,
-                                       NULL, NULL );
-                       
+                       rerr = err;
+               }
+
+               /*
+                * FIXME: need to rewrite "match" (need rwinfo)
+                */
+               send_ldap_result( lc->conn, op, err, match, msg, NULL, NULL );
+               
 #ifdef NEW_LOGGING
-                       LDAP_LOG(( "backend", LDAP_DEBUG_NOTICE,
-                                       "meta_back_op_result: target"
-                                       " <%d> sending msg \"%s\""
-                                       " (matched \"%s\")\n",
-                                       i, ( msg ? msg : "" ),
-                                       ( match ? match : "" ) ));
+               LDAP_LOG(( "backend", LDAP_DEBUG_NOTICE,
+                               "meta_back_op_result: target"
+                               " <%d> sending msg \"%s\""
+                               " (matched \"%s\")\n",
+                               i, ( msg ? msg : "" ),
+                               ( match ? match : "" ) ));
 #else /* !NEW_LOGGING */
-                       Debug(LDAP_DEBUG_ANY,
-                                       "==> meta_back_op_result: target"
-                                       " <%d> sending msg \"%s\""
-                                       " (matched \"%s\")\n", 
-                                       i, ( msg ? msg : "" ),
-                                       ( match ? match : "" ) );
+               Debug(LDAP_DEBUG_ANY,
+                               "==> meta_back_op_result: target"
+                               " <%d> sending msg \"%s\""
+                               " (matched \"%s\")\n", 
+                               i, ( msg ? msg : "" ),
+                               ( match ? match : "" ) );
 #endif /* !NEW_LOGGING */
 
-                       /* better test the pointers before freeing? */
-                       if ( match ) {
-                               free( match );
-                       }
-                       if ( msg ) {
-                               free( msg );
-                       }
-                       return -1;
+               /* better test the pointers before freeing? */
+               if ( match ) {
+                       free( match );
+               }
+               if ( msg ) {
+                       free( msg );
                }
        }
 
-       return ( err == LDAP_SUCCESS ) ? 0 : -1;
+       return ( rerr == LDAP_SUCCESS ) ? 0 : -1;
 }
 
index fe08ceda9903d092a753ee121e1d40389b7a114d..ee2bf0171fa611474acb771c3e59b3a8ffc71cb1 100644 (file)
@@ -119,7 +119,7 @@ meta_back_is_candidate(
                        return META_NOT_CANDIDATE;
                }
 
-               if ( strcmp( &nsuffix[ len - ndnlen] , ndn ) == 0 ) {
+               if ( strcmp( &nsuffix[ len - ndnlen ] , ndn ) == 0 ) {
                        /*
                         * Got it!
                         */
index 4c22ac89e2b73aeeabf9658f51473872e0fe3486..6f47e91fbbfac6e5319165ab839ca5aacb1c2245 100644 (file)
@@ -117,12 +117,12 @@ meta_back_delete(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
        
index a2530a4c08930227de35c1bd8e0ecb78f297aa48..dd3ea4c3b2ee31bbc7146b820232ee78129a741a 100644 (file)
@@ -120,12 +120,12 @@ meta_back_modify(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 16b6e7691b76de73eb69173f4c1e81ec6c65fe93..3528a52072b00c4b525ea8cf967896bc17740594 100644 (file)
@@ -119,8 +119,7 @@ meta_back_modrdn(
                         * FIXME: is this the correct return code?
                         */
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
-                                       NULL, NULL );
+                                       NULL, NULL, NULL, NULL );
                        return -1;
                }
 
@@ -151,14 +150,12 @@ meta_back_modrdn(
 
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
-                                       NULL, NULL );
+                                       NULL, NULL, NULL, NULL );
                        return -1;
 
                case REWRITE_REGEXEC_ERR:
                        send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                                       NULL, "Operations error",
-                                       NULL, NULL );
+                                       NULL, NULL, NULL, NULL );
                        return -1;
                }
        }
@@ -184,12 +181,12 @@ meta_back_modrdn(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, NULL, NULL, NULL );
                return -1;
        }
 
index 220152405718f6ba6a41cdd2125dcc82456f900e..92c0b8fa54e91eabfdf8fe9252caa6e38100db31 100644 (file)
@@ -141,6 +141,8 @@ meta_back_search(
         */
        msgid = ch_calloc( sizeof( int ), li->ntargets );
        if ( msgid == NULL ) {
+               send_search_result( conn, op, LDAP_OPERATIONS_ERROR,
+                               NULL, NULL, NULL, NULL, 0 );
                return -1;
        }
        
@@ -315,11 +317,13 @@ meta_back_search(
                
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
-                                       NULL, NULL );
-                       /* continue to the next case */
+                                       NULL, NULL, NULL, NULL );
+                       rc = -1;
+                       goto finish;
 
                case REWRITE_REGEXEC_ERR:
+                       send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+                                       NULL, NULL, NULL, NULL );
                        rc = -1;
                        goto finish;
                }
@@ -515,11 +519,13 @@ meta_back_search(
                        
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
-                                       NULL, NULL );
-                       /* continue to the next case */
+                                       NULL, NULL, NULL, NULL );
+                       rc = -1;
+                       goto finish;
                        
                case REWRITE_REGEXEC_ERR:
+                       send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+                                       NULL, NULL, NULL, NULL );
                        rc = -1;
                        goto finish;
                }