]> git.sur5r.net Git - openldap/commitdiff
ITS#3118: initial fix: (objectClasses=2.5.6.0) works
authorKurt Zeilenga <kurt@openldap.org>
Wed, 28 Apr 2004 05:12:53 +0000 (05:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 28 Apr 2004 05:12:53 +0000 (05:12 +0000)
  need to add special handler to allow (objectClasses=top) to work

servers/slapd/oc.c
servers/slapd/schema_init.c
tests/scripts/test000-rootdse

index d67ea5ecd090c984fe5abe8dad59f1d479b046b0..52aa6e2e690ddb2275092fa60ee7632f8cd4794f 100644 (file)
@@ -501,13 +501,14 @@ oc_schema_info( Entry *e )
                        return -1;
                }
 
-#if 0
-               Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s\n",
-              (long) val.bv_len, val.bv_val, 0 );
-#endif
                nval.bv_val = oc->soc_oid;
                nval.bv_len = strlen(oc->soc_oid);
 
+#if 0
+               Debug( LDAP_DEBUG_TRACE, "Merging oc [%ld] %s (%s)\n",
+              (long) val.bv_len, val.bv_val, nval.bv_val );
+#endif
+
                if( attr_merge_one( e, ad_objectClasses, &val, &nval ) )
                {
                        return -1;
index 87e7786aafa6a23f233109febeb04e74f65efebd..4f501a0f715949e2163b3c26fd3255c2f27bbd72 100644 (file)
@@ -2790,19 +2790,24 @@ firstComponentNormalize(
        void *ctx )
 {
        int rc;
-       struct berval oid;
-       ber_len_t len = 0;
+       struct berval comp;
+       ber_len_t len;
 
-       if( val->bv_len == 0 ) return LDAP_INVALID_SYNTAX;
+       if( SLAP_MR_IS_VALUE_OF_ASSERTION_SYNTAX( usage )) {
+               ber_dupbv_x( normalized, val, ctx );
+               return LDAP_SUCCESS;
+       }
 
-       if( val->bv_val[0] == '(' /*')'*/ ||
-               val->bv_val[0] == '{' /*'}'*/ )
+       if( val->bv_len < 3 ) return LDAP_INVALID_SYNTAX;
+
+       if( val->bv_val[0] != '(' /*')'*/ &&
+               val->bv_val[0] != '{' /*'}'*/ )
        {
-               len = 1;
+               return LDAP_INVALID_SYNTAX;
        }
 
        /* trim leading white space */
-       for( ;
+       for( len=1;
                len < val->bv_len && ASCII_SPACE(val->bv_val[len]);
                len++ )
        {
@@ -2810,26 +2815,26 @@ firstComponentNormalize(
        }
 
        /* grab next word */
-       oid.bv_val = &val->bv_val[len];
+       comp.bv_val = &val->bv_val[len];
        len = val->bv_len - len;
-       for( oid.bv_len=0;
-               !ASCII_SPACE(oid.bv_val[oid.bv_len]) && oid.bv_len < len;
-               oid.bv_len++ )
+       for( comp.bv_len=0;
+               !ASCII_SPACE(comp.bv_val[comp.bv_len]) && comp.bv_len < len;
+               comp.bv_len++ )
        {
                /* empty */
        }
 
        if( mr == slap_schema.si_mr_objectIdentifierFirstComponentMatch ) {
-               rc = numericoidValidate( NULL, &oid );
+               rc = numericoidValidate( NULL, &comp );
        } else if( mr == slap_schema.si_mr_integerFirstComponentMatch ) {
-               rc = integerValidate( NULL, &oid );
+               rc = integerValidate( NULL, &comp );
        } else {
                rc = LDAP_INVALID_SYNTAX;
        }
        
 
        if( rc == LDAP_SUCCESS ) {
-               ber_dupbv_x( normalized, &oid, ctx );
+               ber_dupbv_x( normalized, &comp, ctx );
        }
 
        return rc;
index 0db0731d66ee81bf8315d9d6917f9c31733dc2c5..90935a360462c63001a23659cb8c2c6033e2139b 100755 (executable)
@@ -30,7 +30,8 @@ KILLPIDS="$PID"
 
 echo "Using ldapsearch to retrieve the root DSE..."
 for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -b "" -s base -h $LOCALHOST -p $PORT1 '+extensibleObject' > $SEARCHOUT 2>&1
+       $LDAPSEARCH -b "" -s base -h $LOCALHOST -p $PORT1 \
+               '+extensibleObject' > $SEARCHOUT 2>&1
        RC=$?
        if test $RC = 0 ; then
                break
@@ -39,9 +40,18 @@ for i in 0 1 2 3 4 5; do
        sleep 5
 done
 
+if test $RC = 0 ; then
+       echo "Using ldapsearch to retrieve the cn=Subschema..."
+       $LDAPSEARCH -b "cn=Subschema" -s base -h $LOCALHOST -p $PORT1 \
+                '(objectClasses=2.5.6.0)' cn objectClass >> $SEARCHOUT  2>&1
+       RC=$?
+
+fi
+
 if test $RC = 0 -a $MONITORDB = yes ; then
        echo "Using ldapsearch to retrieve the cn=Monitor..."
-       $LDAPSEARCH -b "cn=Monitor" -s base -h $LOCALHOST -p $PORT1 '+extensibleObject' >> $SEARCHOUT 2>&1
+       $LDAPSEARCH -b "cn=Monitor" -s base -h $LOCALHOST -p $PORT1 \
+               '+extensibleObject' >> $SEARCHOUT 2>&1
        RC=$?
 fi
 
@@ -49,13 +59,17 @@ test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
 cat $SEARCHOUT
 
+
 if test $RC != 0 ; then
        echo ">>>>> Test failed"
 else
-       if grep "TLS:" $SEARCHOUT; then
-               RC=-1
+       RC=`grep '^dn:' $SEARCHOUT | wc -l`
+       if test $RC != 3 ; then
+               echo ">>>>> Test failed: expected 3 entries, got" $RC
+               RC=1
        else
-           echo ">>>>> Test succeeded"
+               echo ">>>>> Test succeeded"
+               RC=0
        fi
 fi