]> git.sur5r.net Git - openldap/commitdiff
Fixed slapd req_pwdexop bug
authorKurt Zeilenga <kurt@openldap.org>
Fri, 7 Oct 2005 18:53:34 +0000 (18:53 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 7 Oct 2005 18:53:34 +0000 (18:53 +0000)
    Fixed slapo-syncprov queued UUIDs bug (ITS#4068)
    Fixed slapo-syncprov memory leak
    Fixed slapd anlist leak
    Removed lint
    Build Environment
        Updated testsuite to test only primary backends by default
        Disable test041-aci

CHANGES
servers/slapd/ad.c
servers/slapd/daemon.c
servers/slapd/ldapsync.c
servers/slapd/overlays/syncprov.c
servers/slapd/passwd.c
servers/slapd/slap.h
servers/slapd/syncrepl.c
tests/Makefile.in

diff --git a/CHANGES b/CHANGES
index ac2aae4f48d96273c4382fdb19a92ec1156a7289..8e3f678941ba1fe6e59a45fb4e84f9a33293a68a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,13 @@
 OpenLDAP 2.3 Change Log
 
 OpenLDAP 2.3.9 Engineering
+       Fixed slapd req_pwdexop bug
+       Fixed slapo-syncprov queued UUIDs bug (ITS#4068)
+       Fixed slapo-syncprov memory leak
+       Fixed slapd anlist leak
+       Removed lint
        Build Environment
+               Updated testsuite to test only primary backends by default
                Disable test041-aci
 
 OpenLDAP 2.3.8 Release
index 676cf8d86f39d2881600b2d4d7907132c5c8cbf2..d351c5c49dcf6743d1543754e51b5f99aaa4eac6 100644 (file)
@@ -988,8 +988,9 @@ anlist2attrs( AttributeName * anlist )
        char **attrs;
        ObjectClass *oc;
 
-       attrs = anlist2charray( anlist, 1 );
-                                                                                
+       if ( anlist == NULL )
+               return NULL;
+
        for ( i = 0; anlist[i].an_name.bv_val; i++ ) {
                if ( ( oc = anlist[i].an_oc ) ) {
                        for ( j = 0; oc->soc_required && oc->soc_required[j]; j++ ) ;
@@ -1002,6 +1003,8 @@ anlist2attrs( AttributeName * anlist )
        if ( i == 0 )
                return NULL;
                                                                                 
+       attrs = anlist2charray( anlist, 1 );
+                                                                                
        n = i;
                                                                                 
        if ( k )
@@ -1026,9 +1029,8 @@ anlist2attrs( AttributeName * anlist )
        i = 0;
        while ( attrs && attrs[i] ) {
                if ( *attrs[i] == '@' ) {
+                       ch_free( attrs[i] );
                        for ( j = i; attrs[j]; j++ ) {
-                               if ( j == i )
-                                       ch_free( attrs[i] );
                                attrs[j] = attrs[j+1];
                        }
                } else {
@@ -1040,9 +1042,8 @@ anlist2attrs( AttributeName * anlist )
                j = i + 1;
                while ( attrs && attrs[j] ) {
                        if ( !strcmp( attrs[i], attrs[j] )) {
+                               ch_free( attrs[j] );
                                for ( k = j; attrs && attrs[k]; k++ ) {
-                                       if ( k == j )
-                                               ch_free( attrs[j] );
                                        attrs[k] = attrs[k+1];
                                }
                        } else {
index a0125a19fc1248ba7f919d56d4112b8515d75805..098bce5242d7d042e2d977dfb8c015b551d36178 100644 (file)
@@ -207,7 +207,7 @@ static struct slap_daemon {
 #define        SLAP_SOCK_IS_MUTE(s)    (!SLAP_SOCK_IS_READ(s))
 
 #define SLAP_SOCK_SET_INIT     \
-       slap_daemon.sd_epolls = ch_malloc(sizeof(struct epoll_event) * dtblsize * 2);   \
+       slap_daemon.sd_epolls = ch_calloc(1, sizeof(struct epoll_event) * dtblsize * 2);        \
        slap_daemon.sd_index = ch_malloc(sizeof(int) * dtblsize);       \
        slap_daemon.sd_epfd = epoll_create( dtblsize ); \
        for (i=0; i<dtblsize; i++) slap_daemon.sd_index[i] = -1
index 9d335860dfbb9c8057d27fc211f02f7bc7a1fd82..72022c24fa1c8612f34887caf5f47804ccf11577 100644 (file)
@@ -55,7 +55,8 @@ slap_compose_sync_cookie(
                                        "csn=%s,rid=%03d", csn->bv_val, rid );
                }
        }
-       ber_str2bv( cookiestr, strlen(cookiestr), 1, cookie );
+       ber_str2bv_x( cookiestr, strlen(cookiestr), 1, cookie, 
+               op ? op->o_tmpmemctx : NULL );
 }
 
 void
index 4316dd042d959d638a6864958ca9977a3b099426..5c0b7cf4efb3d6ef1583cb999d0458ba7c2df312 100644 (file)
@@ -749,6 +749,7 @@ syncprov_sendresp( Operation *op, opcookie *opc, syncops *so, Entry **e, int mod
        a_uuid.a_nvals = &opc->suuid;
        rs.sr_err = syncprov_state_ctrl( op, &rs, &e_uuid,
                mode, ctrls, 0, 1, &cookie );
+       op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
 
        rs.sr_ctrls = ctrls;
        op->o_bd->bd_info = (BackendInfo *)on->on_info;
@@ -910,13 +911,14 @@ syncprov_qresp( opcookie *opc, syncops *so, int mode )
        sr->s_dn.bv_len = opc->sdn.bv_len;
        sr->s_mode = mode;
        sr->s_isreference = opc->sreference;
-       sr->s_ndn.bv_val = lutil_strcopy( sr->s_dn.bv_val, opc->sdn.bv_val );
+       sr->s_ndn.bv_val = lutil_strcopy( sr->s_dn.bv_val,
+                opc->sdn.bv_val ) + 1;
        sr->s_ndn.bv_len = opc->sndn.bv_len;
-       *(sr->s_ndn.bv_val++) = '\0';
-       sr->s_uuid.bv_val = lutil_strcopy( sr->s_ndn.bv_val, opc->sndn.bv_val );
+       sr->s_uuid.bv_val = lutil_strcopy( sr->s_ndn.bv_val,
+                opc->sndn.bv_val ) + 1;
        sr->s_uuid.bv_len = opc->suuid.bv_len;
-       *(sr->s_uuid.bv_val++) = '\0';
-       sr->s_csn.bv_val = lutil_strcopy( sr->s_uuid.bv_val, opc->suuid.bv_val );
+       AC_MEMCPY( sr->s_uuid.bv_val, opc->suuid.bv_val, opc->suuid.bv_len );
+       sr->s_csn.bv_val = sr->s_uuid.bv_val + sr->s_uuid.bv_len + 1;
        sr->s_csn.bv_len = opc->sctxcsn.bv_len;
        strcpy( sr->s_csn.bv_val, opc->sctxcsn.bv_val );
 
@@ -1810,11 +1812,13 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                        rs->sr_err = syncprov_done_ctrl( op, rs, rs->sr_ctrls,
                                0, 1, &cookie, ss->ss_present ?  LDAP_SYNC_REFRESH_PRESENTS :
                                        LDAP_SYNC_REFRESH_DELETES );
+                       op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
                } else {
                /* It's RefreshAndPersist, transition to Persist phase */
                        syncprov_sendinfo( op, rs, ( ss->ss_present && rs->sr_nentries ) ?
                                LDAP_TAG_SYNC_REFRESH_PRESENT : LDAP_TAG_SYNC_REFRESH_DELETE,
                                &cookie, 1, NULL, 0 );
+                       op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
 
                        /* Detach this Op from frontend control */
                        ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
index c8f8ce75b510b2e3350c61250f5857221eacf7b6..4c69a2e6b5f4845ec72990bf3bec472b807573ab 100644 (file)
@@ -68,7 +68,9 @@ int passwd_extop(
                return LDAP_STRONG_AUTH_REQUIRED;
        }
 
+       qpw->rs_old.bv_len = 0;
        qpw->rs_old.bv_val = NULL;
+       qpw->rs_new.bv_len = 0;
        qpw->rs_new.bv_val = NULL;
        qpw->rs_mods = NULL;
        qpw->rs_modtail = NULL;
index 0d4a7fb9835dcdd580c4fc888c40785d266e9d0a..0a628f79be7e7a37de9727fcc62a05889ba0291b 100644 (file)
@@ -1948,8 +1948,7 @@ typedef struct req_extended_s {
 } req_extended_s;
 
 typedef struct req_pwdexop_s {
-       struct berval rs_reqoid;
-       int rs_flags;
+       struct req_extended_s rs_extended;
        struct berval rs_old;
        struct berval rs_new;
        Modifications *rs_mods;
index 2a4220be9a8c1a0b2943b5b40670a542267c2c6d..f812d5d4aaf67a712da7565a34c4b7c704c5324a 100644 (file)
@@ -231,9 +231,8 @@ init_syncrepl(syncinfo_t *si)
                        j = 0;
                        while ( exattrs[j] != NULL ) {
                                if ( !strcmp( exattrs[j], sync_descs[i]->ad_cname.bv_val )) {
+                                       ch_free( exattrs[j] );
                                        for ( k = j; exattrs[k] != NULL; k++ ) {
-                                               if ( k == j )
-                                                       ch_free( exattrs[k] );
                                                exattrs[k] = exattrs[k+1];
                                        }
                                } else {
@@ -250,9 +249,8 @@ init_syncrepl(syncinfo_t *si)
                                        while ( oc->soc_required[k] ) {
                                                if ( !strcmp( exattrs[i],
                                                         oc->soc_required[k]->sat_cname.bv_val )) {
+                                                       ch_free( exattrs[i] );
                                                        for ( l = i; exattrs[l]; l++ ) {
-                                                               if ( l == i )
-                                                                       ch_free( exattrs[i] );
                                                                exattrs[l] = exattrs[l+1];
                                                        }
                                                } else {
index 2726162a01f56314c4ef16f1e143b78ec9bd321c..32d2a5d6ff63c9590c6db64a61f7028ef19a519d 100644 (file)
@@ -21,9 +21,13 @@ BUILD_HDB=@BUILD_HDB@
 BUILD_LDBM=@BUILD_LDBM@
 BUILD_SQL=@BUILD_SQL@
 
+# test primary backends (default)
 test tests:
        @$(MAKE) bdb
        @$(MAKE) hdb
+
+# test all backends
+alltests: tests
        @$(MAKE) ldbm
        @$(MAKE) sql