]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/compare.c
Never let ldif_parse_line() return a NULL value with success.
[openldap] / servers / slapd / compare.c
index b62d69dc4ad9410bfcb9271f1a460d1f65017576..81e3e9f54e206783b54226bbe957f3b67fe4b4fa 100644 (file)
@@ -36,6 +36,7 @@ do_compare(
 )
 {
        Entry *entry = NULL;
+       Entry *fentry = NULL;
        struct berval dn = { 0, NULL };
        struct berval pdn = { 0, NULL };
        struct berval ndn = { 0, NULL };
@@ -169,7 +170,9 @@ do_compare(
                        goto cleanup;
                }
 
-       } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
+               fentry = entry;
+
+       } else if ( bvmatch( &ndn, &global_schemandn ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ARGS, 
                        "do_compare: dn (%s) attr(%s) value (%s)\n",
@@ -198,11 +201,12 @@ do_compare(
                        rc = 0;
                        goto cleanup;
                }
+               fentry = entry;
        }
 
        if( entry ) {
                rc = compare_entry( conn, op, entry, &ava );
-               entry_free( entry );
+               if( fentry) entry_free( fentry );
 
                send_ldap_result( conn, op, rc, NULL, text, NULL, NULL );