From: Howard Chu Date: Mon, 8 Aug 2005 12:38:19 +0000 (+0000) Subject: ITS#3922 fix syncrepl ctxcsn leak X-Git-Tag: OPENLDAP_AC_BP~53 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9365649dad8a71b482ba7b86d121f67ed7209006;p=openldap ITS#3922 fix syncrepl ctxcsn leak --- diff --git a/servers/slapd/ldapsync.c b/servers/slapd/ldapsync.c index 4e96b22539..2905903777 100644 --- a/servers/slapd/ldapsync.c +++ b/servers/slapd/ldapsync.c @@ -86,7 +86,8 @@ slap_sync_cookie_free( int slap_parse_sync_cookie( - struct sync_cookie *cookie + struct sync_cookie *cookie, + void *memctx ) { char *csn_ptr; @@ -125,7 +126,7 @@ slap_parse_sync_cookie( break; } if ( valid ) { - ber_str2bv( csn_str, csn_str_len, 1, &cookie->ctxcsn ); + ber_str2bv_x( csn_str, csn_str_len, 1, &cookie->ctxcsn, memctx ); } else { BER_BVZERO( &cookie->ctxcsn ); } diff --git a/servers/slapd/main.c b/servers/slapd/main.c index a6ccd6f150..e0b870df4a 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -361,7 +361,7 @@ int main( int argc, char **argv ) scp = (struct sync_cookie *) ch_calloc( 1, sizeof( struct sync_cookie )); ber_str2bv( optarg, 0, 1, &scp->octet_str ); - slap_parse_sync_cookie( scp ); + slap_parse_sync_cookie( scp, NULL ); LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) { if ( scp->rid == scp_entry->rid ) { diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index b57a5a46be..801db55163 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -2365,7 +2365,7 @@ static int syncprov_parseCtrl ( sr->sr_rhint = rhint; if (!BER_BVISNULL(&cookie)) { ber_dupbv( &sr->sr_state.octet_str, &cookie ); - slap_parse_sync_cookie( &sr->sr_state ); + slap_parse_sync_cookie( &sr->sr_state, op->o_tmpmemctx ); } op->o_controls[slap_cids.sc_LDAPsync] = sr; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 1902de4d4c..24ab45ac70 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -889,7 +889,7 @@ LDAP_SLAPD_F (void) slap_compose_sync_cookie LDAP_P(( LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P(( struct sync_cookie *, int free_cookie )); LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P(( - struct sync_cookie * )); + struct sync_cookie *, void *memctx )); LDAP_SLAPD_F (int) slap_init_sync_cookie_ctxcsn LDAP_P(( struct sync_cookie * )); LDAP_SLAPD_F (struct sync_cookie *) slap_dup_sync_cookie LDAP_P(( diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 087a7cf46f..e944dc5724 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -615,7 +615,7 @@ do_syncrep2( } if ( !BER_BVISNULL( &syncCookie.octet_str ) ) { - slap_parse_sync_cookie( &syncCookie ); + slap_parse_sync_cookie( &syncCookie, NULL ); } } if ( syncrepl_message_to_entry( si, op, msg, @@ -660,7 +660,7 @@ do_syncrep2( } if ( !BER_BVISNULL( &syncCookie.octet_str ) ) { - slap_parse_sync_cookie( &syncCookie ); + slap_parse_sync_cookie( &syncCookie, NULL ); } } if ( ber_peek_tag( ber, &len ) == LDAP_TAG_REFRESHDELETES ) @@ -744,7 +744,7 @@ do_syncrep2( } if ( !BER_BVISNULL( &syncCookie.octet_str ) ) { - slap_parse_sync_cookie( &syncCookie ); + slap_parse_sync_cookie( &syncCookie, NULL ); } } if ( ber_peek_tag( ber, &len ) == @@ -771,7 +771,7 @@ do_syncrep2( } if ( !BER_BVISNULL( &syncCookie.octet_str ) ) { - slap_parse_sync_cookie( &syncCookie ); + slap_parse_sync_cookie( &syncCookie, NULL ); } } if ( ber_peek_tag( ber, &len ) ==