From: Jong Hyuk Choi Date: Tue, 20 May 2003 01:45:12 +0000 (+0000) Subject: - change in message to modlist conversion X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~105 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4f58efc4d1ba7622b81c0bac50fbb674566f268a;p=openldap - change in message to modlist conversion --- diff --git a/include/lber.h b/include/lber.h index 87b01d07b1..20095179a6 100644 --- a/include/lber.h +++ b/include/lber.h @@ -476,6 +476,10 @@ ber_flatten2 LDAP_P(( struct berval *bv, int alloc )); +LBER_F( int ) +ber_remaining LDAP_P(( + BerElement *ber )); + /* * LBER ber accessor functions */ diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 65ff26cf1f..2f60e27ca8 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -717,3 +717,9 @@ ber_rewind ( BerElement * ber ) ber->ber_end = ber->ber_ptr; ber->ber_ptr = ber->ber_buf; } + +int +ber_remaining( BerElement * ber ) +{ + return ber_pvt_ber_remaining( ber ); +} diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 923d4ecb72..b12ecd2cb6 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -500,7 +500,7 @@ do_syncrepl( entry_free( entry ); for ( ml = modlist; ml != NULL; ml = mlnext ) { mlnext = ml->sml_next; - free( ml ); + ber_memfree( ml ); } break; @@ -699,6 +699,8 @@ syncrepl_message_to_entry( LDAPControl** rctrls = NULL; BerElement* ctrl_ber; + ber_tag_t tag; + *modlist = NULL; if ( ldap_msgtype( msg ) != LDAP_RES_SEARCH_ENTRY ) { @@ -732,10 +734,10 @@ syncrepl_message_to_entry( e->e_attrs = NULL; - for ( rc = ldap_get_attribute_ber( ld, msg, ber, &tmp.sml_type, &tmp.sml_bvalues); - rc == LDAP_SUCCESS; - rc = ldap_get_attribute_ber( ld, msg, ber, &tmp.sml_type, &tmp.sml_bvalues)) - { + while ( ber_remaining( ber ) ) { + tag = ber_scanf( ber, "{mW}", &tmp.sml_type, &tmp.sml_values ); + + if ( tag == LBER_ERROR ) break; if ( tmp.sml_type.bv_val == NULL ) break; mod = (Modifications *) ch_malloc( sizeof( Modifications )); @@ -862,7 +864,7 @@ done: return e; } -int +int syncuuid_cmp( const void* v_uuid1, const void* v_uuid2 ) { const struct berval *uuid1 = v_uuid1; diff --git a/tests/scripts/test017-syncreplication b/tests/scripts/test017-syncreplication index ae4fec3a44..fe55521333 100755 --- a/tests/scripts/test017-syncreplication +++ b/tests/scripts/test017-syncreplication @@ -39,6 +39,9 @@ if test $WAIT != 0 ; then read foo fi +echo "Waiting 5 seconds to wait for master to start..." +sleep 5 + echo "Starting slave slapd on TCP/IP port $SLAVEPORT..." . $CONFFILTER $BACKEND $MONITORDB < $SRSLAVECONF > $REPLCONF $SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &