]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/compare.c
Moved unbind processing into connection_destroy. unbind handler is not needed.
[openldap] / servers / slapd / compare.c
index 028a4f44d0c3c133b6266bf7153276e864b86d07..f3a8ae9c1358663a0a1033608b94129b3ac7659e 100644 (file)
@@ -34,8 +34,8 @@ do_compare(
        if( op->o_bind_in_progress ) {
                Debug( LDAP_DEBUG_ANY, "do_compare: SASL bind in progress.\n",
                        0, 0, 0 );
-               send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, NULL,
-                   "SASL bind in progress" );
+               send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS,
+                       NULL, "SASL bind in progress", NULL, NULL );
                return LDAP_SASL_BIND_IN_PROGRESS;
        }
 
@@ -59,6 +59,15 @@ do_compare(
                return -1;
        }
 
+       if( dn_normalize_case( ndn ) == NULL ) {
+               Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", ndn, 0, 0 );
+               send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
+                   "invalid DN", NULL, NULL );
+               free( ndn );
+               ava_free( &ava, 0 );
+               return rc;
+       }
+
        if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
                free( ndn );
                ava_free( &ava, 0 );
@@ -71,10 +80,8 @@ do_compare(
        Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
            ndn, ava.ava_type, ava.ava_value.bv_val );
 
-       ndn = dn_normalize_case( ndn );
-
        Statslog( LDAP_DEBUG_STATS, "conn=%d op=%d CMP dn=\"%s\" attr=\"%s\"\n",
-           conn->c_connid, op->o_opid, ndn, ava.ava_type, 0 );
+           op->o_connid, op->o_opid, ndn, ava.ava_type, 0 );
 
        /*
         * We could be serving multiple database backends.  Select the
@@ -85,19 +92,16 @@ do_compare(
                free( ndn );
                ava_free( &ava, 0 );
 
-               send_ldap_result( conn, op, rc = LDAP_PARTIAL_RESULTS, NULL,
-                   default_referral );
+               send_ldap_result( conn, op, rc = LDAP_REFERRAL,
+                       NULL, NULL, default_referral, NULL );
                return 1;
        }
 
-       /* alias suffix if approp */
-       ndn = suffixAlias( ndn, op, be );
-
        if ( be->be_compare ) {
                (*be->be_compare)( be, conn, op, ndn, &ava );
        } else {
-               send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, NULL,
-                   "Function not implemented" );
+               send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+                       NULL, "Function not implemented", NULL, NULL );
        }
 
        free( ndn );