ITS#3118: initial fix: (objectClasses=2.5.6.0) works

need to add special handler to allow (objectClasses=top) to work
This commit is contained in:
Kurt Zeilenga 2004-04-28 05:12:53 +00:00
parent 917fd9bfc0
commit 81d31dc721
3 changed files with 43 additions and 23 deletions

View 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;

View 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;

View File

@ -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