]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/compare.c
Add a little SASL framework and remove old X-DIGEST-MD5 hardcode.
[openldap] / servers / slapd / compare.c
index 29a7c8096231a3af61bd4ae902584c6591309169..61380982ffbe29ce0578333f933779b9b280e212 100644 (file)
@@ -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
@@ -90,6 +97,9 @@ do_compare(
                return 1;
        }
 
+       /* deref suffix alias if appropriate */
+       ndn = suffix_alias( be, ndn );
+
        if ( be->be_compare ) {
                (*be->be_compare)( be, conn, op, ndn, &ava );
        } else {