]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/search.c
ITS#1716 is_entry_subentr/ies/y/
[openldap] / servers / slapd / search.c
index c3a6acc34d127809fe07deaf85632e8eca55f4d2..6ba03faf3a19d9f507edf35e2271c493a0acf1c9 100644 (file)
@@ -37,7 +37,7 @@ do_search(
        struct berval nbase = { 0, NULL };
        struct berval   fstr = { 0, NULL };
        Filter          *filter = NULL;
-       AttributeName   *an;
+       AttributeName   *an = NULL;
        ber_len_t       siz, off, i;
        Backend         *be;
        int                     rc;
@@ -136,7 +136,7 @@ do_search(
 #endif
 
        /* filter - returns a "normalized" version */
-       rc = get_filter( conn, op->o_ber, &filter, &fstr, &text );
+       rc = get_filter( conn, op->o_ber, &filter, &text );
        if( rc != LDAP_SUCCESS ) {
                if( rc == SLAPD_DISCONNECT ) {
                        send_ldap_disconnect( conn, op,
@@ -146,13 +146,18 @@ do_search(
                                NULL, text, NULL, NULL );
                }
                goto return_results;
+
+       } else {
+               filter2bv( filter, &fstr );
        }
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
-               "do_search: conn %d     filter: %s\n", conn->c_connid, fstr.bv_val ));
+               "do_search: conn %d     filter: %s\n", conn->c_connid,
+               fstr.bv_len ? fstr.bv_val : "empty" ));
 #else
-       Debug( LDAP_DEBUG_ARGS, "    filter: %s\n", fstr.bv_val, 0, 0 );
+       Debug( LDAP_DEBUG_ARGS, "    filter: %s\n",
+               fstr.bv_len ? fstr.bv_val : "empty", 0, 0 );
 #endif
 
        /* attributes */
@@ -327,7 +332,7 @@ return_results:;
 
        if( fstr.bv_val != NULL) free( fstr.bv_val );
        if( filter != NULL) filter_free( filter );
-       free(an);
+       if( an != NULL ) free( an );
 
        return rc;
 }