From 6020fe58e8f41145540fdbfaa953db870d4cb631 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 25 Jun 2000 20:07:40 +0000 Subject: [PATCH] Modified slapd to be slurpd friendly. Slurpd incorrectly sends a separate attribute for each value of an attribute which caused slapd to complain. Hacked slapd/add.c to merge values. Slurpd uses version 2 and hence cannot set ManageDSAit. Hack slapd/back-ldbm/referral.c such that if update_ndn matches o_ndn, no referrals are returned. Fix replication tests ldapmodify must be made against master as no rebind proc exists final ldapsearch should not chase Fix referral tests Use -C option as needed --- servers/slapd/add.c | 28 +++++++++++++++++++++++++++- servers/slapd/back-ldbm/referral.c | 7 +++++++ tests/data/slapd-repl-slave.conf | 2 +- tests/scripts/test007-replication | 4 ++-- tests/scripts/test009-referral | 8 ++++---- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 347496d1b1..e45ded2ae6 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -285,8 +285,34 @@ static int slap_mods2entry( attr = attr_find( (*e)->e_attrs, mods->sml_desc ); if( attr != NULL ) { +#define SLURPD_FRIENDLY +#ifdef SLURPD_FRIENDLY + ber_len_t i,j; + + for( i=0; attr->a_vals[i]; i++ ) { + /* count them */ + } + for( j=0; mods->sml_bvalues[j]; j++ ) { + /* count them */ + } + j++; /* NULL */ + + attr->a_vals = ch_realloc( attr->a_vals, + sizeof( struct berval * ) * (i+j) ); + + /* should check for duplicates */ + memcpy( &attr->a_vals[i], mods->sml_bvalues, + sizeof( struct berval * ) * j ); + + /* trim the mods array */ + ch_free( mods->sml_bvalues ); + mods->sml_bvalues = NULL; + + continue; +#else *text = "attribute provided more than once"; - return LDAP_OPERATIONS_ERROR; + return LDAP_TYPE_OR_VALUE_EXISTS; +#endif } attr = ch_calloc( 1, sizeof(Attribute) ); diff --git a/servers/slapd/back-ldbm/referral.c b/servers/slapd/back-ldbm/referral.c index 805a03c4d6..38387776ab 100644 --- a/servers/slapd/back-ldbm/referral.c +++ b/servers/slapd/back-ldbm/referral.c @@ -38,6 +38,13 @@ ldbm_back_referrals( return rc; } + if( be->be_update_ndn != NULL && + !strcmp( be->be_update_ndn, op->o_ndn ) ) + { + /* let op take care of updating */ + return rc; + } + /* get entry with reader lock */ e = dn2entry_r( be, ndn, &matched ); if ( e == NULL ) { diff --git a/tests/data/slapd-repl-slave.conf b/tests/data/slapd-repl-slave.conf index bc35f46d78..d821427d2e 100644 --- a/tests/data/slapd-repl-slave.conf +++ b/tests/data/slapd-repl-slave.conf @@ -12,7 +12,7 @@ schemacheck off pidfile ./test-repl/slapd.pid argsfile ./test-repl/slapd.args -referral "ldap://localhost:9009/" +#referral "ldap://localhost:9009/" ####################################################################### # ldbm database definitions diff --git a/tests/scripts/test007-replication b/tests/scripts/test007-replication index 32114d8abb..9e4c275b8a 100755 --- a/tests/scripts/test007-replication +++ b/tests/scripts/test007-replication @@ -81,13 +81,13 @@ fi echo "Waiting 15 seconds for slurpd to send changes..." sleep 15 -echo "Using ldapmodify to modify slave directory..." +echo "Using ldapmodify to modify master directory..." # # Do some modifications # -$LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $SLAVEPORT -w $PASSWD > \ +$LDAPMODIFY -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \ $TESTOUT 2>&1 << EOMODS dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US changetype: modify diff --git a/tests/scripts/test009-referral b/tests/scripts/test009-referral index 5273b5f205..9cc30645e2 100755 --- a/tests/scripts/test009-referral +++ b/tests/scripts/test009-referral @@ -69,7 +69,7 @@ done cat /dev/null > $SEARCHOUT echo "Testing exact searching..." -$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ +$LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ 'sn=jensen' >> $SEARCHOUT 2>&1 if test $RC != 0 ; then echo "ldapsearch failed!" @@ -78,7 +78,7 @@ if test $RC != 0 ; then fi echo "Testing OR searching..." -$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ +$LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ '(|(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1 if test $RC != 0 ; then echo "ldapsearch failed!" @@ -87,7 +87,7 @@ if test $RC != 0 ; then fi echo "Testing AND matching and ends-with searching..." -$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ +$LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1 if test $RC != 0 ; then echo "ldapsearch failed!" @@ -96,7 +96,7 @@ if test $RC != 0 ; then fi echo "Testing NOT searching..." -$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ +$LDAPSEARCH -C -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ '(!(objectclass=person))' >> $SEARCHOUT 2>&1 if test $RC != 0 ; then echo "ldapsearch failed!" -- 2.39.5