]> git.sur5r.net Git - openldap/commitdiff
ITS#3922 fix syncrepl ctxcsn leak
authorHoward Chu <hyc@openldap.org>
Mon, 8 Aug 2005 12:38:19 +0000 (12:38 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 8 Aug 2005 12:38:19 +0000 (12:38 +0000)
servers/slapd/ldapsync.c
servers/slapd/main.c
servers/slapd/overlays/syncprov.c
servers/slapd/proto-slap.h
servers/slapd/syncrepl.c

index 4e96b22539ca2a95e845f7e10f7f15c265bc1e82..290590377728a7f4032a304f2437cb7fa6285161 100644 (file)
@@ -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 );
        }
index a6ccd6f1509c78ee752eb7bb4d93d531f8aefc67..e0b870df4a7171cbb6e3b03af977b18e4e5f8c6f 100644 (file)
@@ -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 ) {
index b57a5a46bef164665b12cba37c5bd1bf9213aabe..801db5516309b4efb973e24b40e295e5061c2d47 100644 (file)
@@ -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;
index 1902de4d4c229619803f6f7fd4f5069c2dc39906..24ab45ac70577f7a3395c182f0d1c04958222022 100644 (file)
@@ -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((
index 087a7cf46f93716343fc2ab267356a2ce705c3f3..e944dc57242cb68f5b1f5fb55a1684c6afeeb2c1 100644 (file)
@@ -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 ) ==