From 4f58efc4d1ba7622b81c0bac50fbb674566f268a Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Tue, 20 May 2003 01:45:12 +0000 Subject: [PATCH] - change in message to modlist conversion --- include/lber.h | 4 ++++ libraries/liblber/io.c | 6 ++++++ servers/slapd/syncrepl.c | 14 ++++++++------ tests/scripts/test017-syncreplication | 3 +++ 4 files changed, 21 insertions(+), 6 deletions(-) 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 & -- 2.39.5