From c859cdab519ea82a6f51d9ede6496ab3d3e47b77 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 11 May 2006 19:04:26 +0000 Subject: [PATCH] From HEAD + Fixed slapd-bdb pre/post-read unavailable issue (ITS#4538) + Fixed slapo-refinit delete prohibit issue (ITS#4442) + Fixed slapo-syncprov/syncrepl sessionlog issue (ITS#4534) + Fixed test020-proxycache disabled debug issue (ITS#4491) --- CHANGES | 9 ++++++-- servers/slapd/overlays/refint.c | 34 ++++++++++++++++++------------- servers/slapd/overlays/syncprov.c | 21 ++++++++++++++----- servers/slapd/syncrepl.c | 20 ++++++++++++------ tests/scripts/test020-proxycache | 9 ++++++++ 5 files changed, 66 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 88aded6d38..c6a35be935 100644 --- a/CHANGES +++ b/CHANGES @@ -14,8 +14,9 @@ OpenLDAP 2.3.22 Engineering Fixed slapd runqueue use of freed memory (ITS#4517) Fixed slapd slap_send_ldap_result bug (ITS#4499) Fixed slapd thread pool init issue (ITS#4513) - Fixed slapd-bdb pre/post-read freeing (ITS#4532) Added slapd syncrepl mandatory searchbase check + Fixed slapd-bdb pre/post-read freeing (ITS#4532) + Fixed slapd-bdb pre/post-read unavailable issue (ITS#4538) Fixed slapadd cn=config issue (ITS#4194) Fixed slapd-ldap proxyAuthz of bound identity/override (ITS#4497) Fixed slapd-ldap/meta protocol version propagation (ITS#4488) @@ -24,10 +25,14 @@ OpenLDAP 2.3.22 Engineering Fixed slapo-accesslog log purging issue (ITS#4505) Added slapo-accesslog reqOld feature Fixed slapo-auditlog missing return codes - Fixed slapo-ppolicy BER tags (ITS#4528) + Fixed slapo-ppolicy BER tags issue (ITS#4528) + Fixed slapo-refinit delete prohibit issue (ITS#4442) Fixed slapo-syncprov MODs cause DELs (ITS#4423) + Fixed slapo-syncprov/syncrepl sessionlog issue (ITS#4534) Fixed slapo-translucent modifications (ITS#4527) Fixed slurpd potential overflow issue + Build Environment + Fixed test020-proxycache disabled debug issue (ITS#4491) OpenLDAP 2.3.21 Release Fixed libldap referral chasing issue (ITS#4448) diff --git a/servers/slapd/overlays/refint.c b/servers/slapd/overlays/refint.c index 66d597fd36..fc197234e1 100644 --- a/servers/slapd/overlays/refint.c +++ b/servers/slapd/overlays/refint.c @@ -468,8 +468,8 @@ refint_response( for(ip = id->attrs, ac = 0; ip; ip = ip->next, ac++); if(!ac) { - rs->sr_err = LDAP_OTHER; - rs->sr_text = "refint_response called without any attributes"; + Debug( LDAP_DEBUG_TRACE, + "refint_response called without any attributes\n", 0, 0, 0 ); return SLAP_CB_CONTINUE; } @@ -483,13 +483,15 @@ refint_response( if(nop.o_bd) { if (!nop.o_bd->be_search || !nop.o_bd->be_modify) { - rs->sr_err = LDAP_UNWILLING_TO_PERFORM; - rs->sr_text = "backend missing search and/or modify"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: backend missing search and/or modify\n", + 0, 0, 0 ); return SLAP_CB_CONTINUE; } } else { - rs->sr_err = LDAP_OTHER; - rs->sr_text = "no known backend? this shouldn't be happening!"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: no backend for our baseDN %s??\n", + id->dn.bv_val, 0, 0 ); return SLAP_CB_CONTINUE; } @@ -580,15 +582,17 @@ refint_response( dd.nnewdn.bv_val = NULL; if(rc != LDAP_SUCCESS) { - rs->sr_err = nrs.sr_err; - rs->sr_text = "refint_response search failed"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: search failed: %d\n", + rc, 0, 0 ); goto done; } /* safety? paranoid just in case */ if(!cb.sc_private) { - rs->sr_err = LDAP_OTHER; - rs->sr_text = "whoa! refint_response callback wiped out sc_private?!"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: callback wiped out sc_private?!\n", + 0, 0, 0 ); goto done; } @@ -625,8 +629,9 @@ refint_response( nop.o_req_ndn = dp->dn; nop.o_bd = select_backend(&dp->dn, 0, 1); if(!nop.o_bd) { - rs->sr_err = LDAP_OTHER; - rs->sr_text = "this should never happen either!"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: no backend for DN %s!\n", + dp->dn.bv_val, 0, 0 ); goto done; } nrs.sr_type = REP_RESULT; @@ -637,8 +642,9 @@ refint_response( nop.o_ndn = nop.o_bd->be_rootndn; if(rs->sr_err != LDAP_SUCCESS) goto done; if((rc = nop.o_bd->be_modify(&nop, &nrs)) != LDAP_SUCCESS) { - rs->sr_err = nrs.sr_err; - rs->sr_text = "dependent modify failed"; + Debug( LDAP_DEBUG_TRACE, + "refint_response: dependent modify failed: %d\n", + nrs.sr_err, 0, 0 ); goto done; } } diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index b4c42c3f52..b6f77b832a 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1320,12 +1320,14 @@ playlog_cb( Operation *op, SlapReply *rs ) /* enter with sl->sl_mutex locked, release before returning */ static void syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl, - struct berval *oldcsn, struct berval *ctxcsn ) + sync_control *srs, struct berval *ctxcsn ) { slap_overinst *on = (slap_overinst *)op->o_bd->bd_info; slog_entry *se; int i, j, ndel, num, nmods, mmods; + char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; BerVarray uuids; + struct berval delcsn; if ( !sl->sl_num ) { ldap_pvt_thread_mutex_unlock( &sl->sl_mutex ); @@ -1338,19 +1340,23 @@ syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl, uuids = op->o_tmpalloc( (num+1) * sizeof( struct berval ) + num * UUID_LEN, op->o_tmpmemctx ); - uuids[0].bv_val = (char *)(uuids + num + 1); + delcsn.bv_len = 0; + delcsn.bv_val = cbuf; + /* Make a copy of the relevant UUIDs. Put the Deletes up front * and everything else at the end. Do this first so we can * unlock the list mutex. */ for ( se=sl->sl_head; se; se=se->se_next ) { - if ( ber_bvcmp( &se->se_csn, oldcsn ) <= 0 ) continue; + if ( ber_bvcmp( &se->se_csn, &srs->sr_state.ctxcsn ) <= 0 ) continue; if ( ber_bvcmp( &se->se_csn, ctxcsn ) > 0 ) break; if ( se->se_tag == LDAP_REQ_DELETE ) { j = i; i++; + AC_MEMCPY( cbuf, se->se_csn.bv_val, se->se_csn.bv_len ); + delcsn.bv_len = se->se_csn.bv_len; } else { nmods++; j = num - nmods; @@ -1442,9 +1448,14 @@ syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl, fop.o_bd->bd_info = (BackendInfo *)on; } if ( ndel ) { + struct berval cookie; + + slap_compose_sync_cookie( op, &cookie, &delcsn, srs->sr_state.rid ); uuids[ndel].bv_val = NULL; - syncprov_sendinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL, 0, uuids, 1 ); + syncprov_sendinfo( op, rs, LDAP_TAG_SYNC_ID_SET, &cookie, 0, uuids, 1 ); + op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx ); } + op->o_tmpfree( uuids, op->o_tmpmemctx ); } static int @@ -1963,7 +1974,7 @@ syncprov_op_search( Operation *op, SlapReply *rs ) if ( ber_bvcmp( &srs->sr_state.ctxcsn, &sl->sl_mincsn ) >= 0 ) { do_present = 0; /* mutex is unlocked in playlog */ - syncprov_playlog( op, rs, sl, &srs->sr_state.ctxcsn, &ctxcsn ); + syncprov_playlog( op, rs, sl, srs, &ctxcsn ); } else { ldap_pvt_thread_mutex_unlock( &sl->sl_mutex ); } diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 68dcf4e0e4..b3e2f73a80 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -91,7 +91,7 @@ typedef struct syncinfo_s { static int syncuuid_cmp( const void *, const void * ); static void avl_ber_bvfree( void * ); -static void syncrepl_del_nonpresent( Operation *, syncinfo_t *, BerVarray ); +static void syncrepl_del_nonpresent( Operation *, syncinfo_t *, BerVarray, struct berval * ); static int syncrepl_message_to_op( syncinfo_t *, Operation *, LDAPMessage * ); static int syncrepl_message_to_entry( @@ -813,7 +813,7 @@ do_syncrep2( if ( refreshDeletes == 0 && match < 0 && err == LDAP_SUCCESS ) { - syncrepl_del_nonpresent( op, si, NULL ); + syncrepl_del_nonpresent( op, si, NULL, NULL ); } else { avl_free( si->si_presentlist, avl_ber_bvfree ); si->si_presentlist = NULL; @@ -905,7 +905,8 @@ do_syncrep2( ber_scanf( ber, "[W]", &syncUUIDs ); ber_scanf( ber, /*"{"*/ "}" ); if ( refreshDeletes ) { - syncrepl_del_nonpresent( op, si, syncUUIDs ); + syncrepl_del_nonpresent( op, si, syncUUIDs, + &syncCookie.ctxcsn ); ber_bvarray_free_x( syncUUIDs, op->o_tmpmemctx ); } else { for ( i = 0; !BER_BVISNULL( &syncUUIDs[i] ); i++ ) { @@ -948,7 +949,7 @@ do_syncrep2( if ( si->si_refreshPresent == 1 ) { if ( match < 0 ) { - syncrepl_del_nonpresent( op, si, NULL ); + syncrepl_del_nonpresent( op, si, NULL, NULL ); } } @@ -1993,7 +1994,8 @@ static void syncrepl_del_nonpresent( Operation *op, syncinfo_t *si, - BerVarray uuids ) + BerVarray uuids, + struct berval *cookiecsn ) { Backend* be = op->o_bd; slap_callback cb = { NULL }; @@ -2005,6 +2007,7 @@ syncrepl_del_nonpresent( AttributeName an[2]; struct berval pdn = BER_BVNULL; + struct berval csn; op->o_req_dn = si->si_base; op->o_req_ndn = si->si_base; @@ -2071,7 +2074,12 @@ syncrepl_del_nonpresent( if ( !LDAP_LIST_EMPTY( &si->si_nonpresentlist ) ) { - slap_queue_csn( op, &si->si_syncCookie.ctxcsn ); + if ( cookiecsn && !BER_BVISNULL( cookiecsn )) + csn = *cookiecsn; + else + csn = si->si_syncCookie.ctxcsn; + + slap_queue_csn( op, &csn ); np_list = LDAP_LIST_FIRST( &si->si_nonpresentlist ); while ( np_list != NULL ) { diff --git a/tests/scripts/test020-proxycache b/tests/scripts/test020-proxycache index 35c250e45a..f68cb68e04 100755 --- a/tests/scripts/test020-proxycache +++ b/tests/scripts/test020-proxycache @@ -123,6 +123,15 @@ if test $RC != 0 ; then exit $RC fi +# ITS#4491, if debug messages are unavailable, we can't verify the tests. +grep "query template" $LOG2 > /dev/null +RC=$? +if test $RC != 0 ; then + echo "Debug messages unavailable, test aborted..." + test $KILLSERVERS != no && kill -HUP $KILLPIDS && wait + exit 0 +fi + echo "Query 2: filter:(|(cn=*Jon*)(sn=Jon*)) attrs:cn sn title uid" echo "# Query 2: filter:(|(cn=*Jon*)(sn=Jon*)) attrs:cn sn title uid" >> $SLAVEOUT $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \ -- 2.39.5