diff --git a/openldap2-client.changes b/openldap2-client.changes index 2c6900a..736f8ad 100644 --- a/openldap2-client.changes +++ b/openldap2-client.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Nov 5 12:01:57 CET 2008 - rhafer@suse.de + +- Fixed database shutdown sequence (bnc#441774, ITS#5745) + +------------------------------------------------------------------- +Tue Nov 4 14:10:24 CET 2008 - rhafer@suse.de + +- Handle ldbm databases in updates from 2.3 release (bnc#440589) + ------------------------------------------------------------------- Thu Oct 23 12:59:08 CEST 2008 - rhafer@suse.de diff --git a/openldap2-client.spec b/openldap2-client.spec index 77334dc..d8b6e8e 100644 --- a/openldap2-client.spec +++ b/openldap2-client.spec @@ -27,7 +27,7 @@ BuildRequires: -pwdutils BuildRequires: -db-devel -pwdutils libdb-4_5-devel %endif Version: 2.4.12 -Release: 2 +Release: 3 Url: http://www.openldap.org License: BSD 3-Clause %if "%{name}" == "openldap2" @@ -65,6 +65,8 @@ Patch14: slapo-collect-include.dif Patch15: libldap_ctrl_lderrno.dif Patch16: slapd-privdb-config-its5736.dif Patch17: slapo-chain-dangling-its5742.dif +Patch18: slapd-db-close-error-its5745.dif +Patch19: slapo-syncprov-skip-its5709.dif Patch100: openldap-2.3.37.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -171,6 +173,8 @@ Authors: %patch15 %patch16 %patch17 +%patch18 +%patch19 cp %{SOURCE5} . cd ../openldap-2.3.37 %patch100 @@ -427,19 +431,30 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then MSG="" db_num=0 dir_num=0 + restart="" + /etc/init.d/ldap status 2&>1 > /dev/null + if [ "$?" = "0" ]; then + /etc/init.d/ldap stop + restart="1" + fi for i in $BACKENDS; do db_num=$((db_num+1)); - if [ "x$i" = "xbdb" ]; then + if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then db_dir=${DIRECTORIES[$dir_num]}; - if [ -f $db_dir/id2entry.bdb ] ; then + if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then rm $db_dir/__db* ; mkdir $db_dir/db_bak ; echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ; /usr/sbin/openldap-2.3-slapcat -T c \ -f $SCHEMA_BACKUP/slapd.conf.update \ - -n $db_num -l $db_dir/ldapbak.ldif.$db_num ; - mv $db_dir/*.bdb $db_dir/db_bak/ ; - mv $db_dir/log.* $db_dir/db_bak/ ; + -n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE; + if [ "x$i" = "xldbm" ] ; then + mv $db_dir/*.dbb $db_dir/db_bak/ ; + else + mv $db_dir/*.bdb $db_dir/db_bak/ ; + mv $db_dir/log.* $db_dir/db_bak/ ; + fi + mv $db_dir/alock $db_dir/db_bak/ ; rm -f $db_dir/__db* ; fi dir_num=$((dir_num+1)); @@ -447,13 +462,23 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then done db_num=0 dir_num=0 + sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF for i in $BACKENDS; do db_num=$((db_num+1)); - if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] ; then + if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then db_dir=${DIRECTORIES[$dir_num]}; if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then - if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 1000000 ]; then - echo "Restoring $i database in $db_dir" ; + if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then + if [ "x$i" = "xldbm" ] ; then + echo "Converting $i database to bdb in $db_dir" ; + # Create default DB_CONFIG for better performance + echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG + echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG + echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG + echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG + else + echo "Restoring $i database in $db_dir" ; + fi slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ; if [ $? -ne 0 ]; then MSG="$MSG\nFailed to restore database in $db_dir"; @@ -474,6 +499,9 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then echo -e "$MSG"; else rm -f /etc/openldap/UPDATE_NEEDED ; + if [ $restart ]; then + /etc/init.d/ldap start + fi fi fi @@ -509,6 +537,10 @@ fi %endif %changelog +* Wed Nov 05 2008 rhafer@suse.de +- Fixed database shutdown sequence (bnc#441774, ITS#5745) +* Tue Nov 04 2008 rhafer@suse.de +- Handle ldbm databases in updates from 2.3 release (bnc#440589) * Thu Oct 23 2008 rhafer@suse.de - the helper function to create various LDAP controls returned wrong error codes under certain circumstances @@ -518,7 +550,7 @@ fi of databases (translucent, chain, ...) (bnc#438094, ITS#5736) * Mon Oct 13 2008 rhafer@suse.de - Added missing #include to slapo-collect -* Mon Oct 13 2008 rhafer@suse.de +* Sun Oct 12 2008 rhafer@suse.de - Update to 2.4.12. Most important changes: * Fixed libldap ldap_utf8_strchar arguments (ITS#5720) * Fixed libldap TLS_CRLFILE (ITS#5677) @@ -688,7 +720,7 @@ fi ITS#5484, ITS#5451) * Fri Apr 25 2008 rhafer@suse.de - Adjust ownership of DB_CONFIG to ldap:ldap (bnc#376204) -* Fri Apr 11 2008 matz@suse.de +* Thu Apr 10 2008 matz@suse.de - Compile with glibc 2.8. * Thu Apr 10 2008 ro@suse.de - added baselibs.conf file to build xxbit packages @@ -845,7 +877,7 @@ fi * Fixed libldap referral chasing loop (ITS#4955) * Fixed libldap response code handling on rebind (ITS#4924) * Fixed libldap SASL_MAX_BUFF_SIZE (ITS#4935) -* Thu Jun 14 2007 dmueller@suse.de +* Wed Jun 13 2007 dmueller@suse.de - remove binutils prereq * Mon May 21 2007 dmueller@suse.de - reduce duplicated buildrequires against db42 and db45 @@ -1136,7 +1168,7 @@ fi - libldap-result.dif: ldapsearch was hanging in select() when retrieving results from eDirectory through a StartTLS protected connection (Bugzilla #44942) -* Tue Aug 10 2004 dobey@suse.de +* Mon Aug 09 2004 dobey@suse.de - added ntlm support * Tue Aug 03 2004 rhafer@suse.de - updated to 2.2.16 @@ -1211,7 +1243,7 @@ fi - small fixes for the YaST user schema * Tue Nov 11 2003 rhafer@suse.de - enabled SLP-support -* Sat Oct 18 2003 kukuk@suse.de +* Fri Oct 17 2003 kukuk@suse.de - Remove unused des from neededforbuild * Tue Sep 02 2003 mt@suse.de - Bugzilla #29859: fixed typo in sysconfig metadata, @@ -1253,7 +1285,7 @@ fi - remove unpacked files from BuildRoot * Fri May 09 2003 rhafer@suse.de - updated to version 2.1.19 -* Wed Apr 16 2003 ro@suse.de +* Tue Apr 15 2003 ro@suse.de - fixed requires for devel-package ... * Tue Apr 15 2003 ro@suse.de - fixed neededforbuild @@ -1263,7 +1295,7 @@ fi - added /etc/openldap to filelist * Mon Feb 03 2003 rhafer@suse.de - switch default backend to ldbm -* Mon Feb 03 2003 ro@suse.de +* Sun Feb 02 2003 ro@suse.de - fixed requires for devel package (cyrus-sasl2-devel) * Fri Jan 31 2003 rhafer@suse.de - liblber.dif: Fixes two bugs in liblber by which remote attackers diff --git a/openldap2.changes b/openldap2.changes index 2c6900a..736f8ad 100644 --- a/openldap2.changes +++ b/openldap2.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Nov 5 12:01:57 CET 2008 - rhafer@suse.de + +- Fixed database shutdown sequence (bnc#441774, ITS#5745) + +------------------------------------------------------------------- +Tue Nov 4 14:10:24 CET 2008 - rhafer@suse.de + +- Handle ldbm databases in updates from 2.3 release (bnc#440589) + ------------------------------------------------------------------- Thu Oct 23 12:59:08 CEST 2008 - rhafer@suse.de diff --git a/openldap2.spec b/openldap2.spec index 5d6982b..3cb0eb8 100644 --- a/openldap2.spec +++ b/openldap2.spec @@ -27,7 +27,7 @@ BuildRequires: -pwdutils BuildRequires: -db-devel -pwdutils libdb-4_5-devel %endif Version: 2.4.12 -Release: 2 +Release: 3 Url: http://www.openldap.org License: BSD 3-Clause; openldap 2.8 %if "%{name}" == "openldap2" @@ -65,6 +65,8 @@ Patch14: slapo-collect-include.dif Patch15: libldap_ctrl_lderrno.dif Patch16: slapd-privdb-config-its5736.dif Patch17: slapo-chain-dangling-its5742.dif +Patch18: slapd-db-close-error-its5745.dif +Patch19: slapo-syncprov-skip-its5709.dif Patch100: openldap-2.3.37.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -174,6 +176,8 @@ Authors: %patch15 %patch16 %patch17 +%patch18 +%patch19 cp %{SOURCE5} . cd ../openldap-2.3.37 %patch100 @@ -430,19 +434,30 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then MSG="" db_num=0 dir_num=0 + restart="" + /etc/init.d/ldap status 2&>1 > /dev/null + if [ "$?" = "0" ]; then + /etc/init.d/ldap stop + restart="1" + fi for i in $BACKENDS; do db_num=$((db_num+1)); - if [ "x$i" = "xbdb" ]; then + if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then db_dir=${DIRECTORIES[$dir_num]}; - if [ -f $db_dir/id2entry.bdb ] ; then + if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then rm $db_dir/__db* ; mkdir $db_dir/db_bak ; echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ; /usr/sbin/openldap-2.3-slapcat -T c \ -f $SCHEMA_BACKUP/slapd.conf.update \ - -n $db_num -l $db_dir/ldapbak.ldif.$db_num ; - mv $db_dir/*.bdb $db_dir/db_bak/ ; - mv $db_dir/log.* $db_dir/db_bak/ ; + -n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE; + if [ "x$i" = "xldbm" ] ; then + mv $db_dir/*.dbb $db_dir/db_bak/ ; + else + mv $db_dir/*.bdb $db_dir/db_bak/ ; + mv $db_dir/log.* $db_dir/db_bak/ ; + fi + mv $db_dir/alock $db_dir/db_bak/ ; rm -f $db_dir/__db* ; fi dir_num=$((dir_num+1)); @@ -450,13 +465,23 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then done db_num=0 dir_num=0 + sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF for i in $BACKENDS; do db_num=$((db_num+1)); - if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] ; then + if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then db_dir=${DIRECTORIES[$dir_num]}; if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then - if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 1000000 ]; then - echo "Restoring $i database in $db_dir" ; + if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then + if [ "x$i" = "xldbm" ] ; then + echo "Converting $i database to bdb in $db_dir" ; + # Create default DB_CONFIG for better performance + echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG + echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG + echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG + echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG + else + echo "Restoring $i database in $db_dir" ; + fi slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ; if [ $? -ne 0 ]; then MSG="$MSG\nFailed to restore database in $db_dir"; @@ -477,6 +502,9 @@ if [ -f /etc/openldap/UPDATE_NEEDED ] ; then echo -e "$MSG"; else rm -f /etc/openldap/UPDATE_NEEDED ; + if [ $restart ]; then + /etc/init.d/ldap start + fi fi fi @@ -512,6 +540,10 @@ fi %endif %changelog +* Wed Nov 05 2008 rhafer@suse.de +- Fixed database shutdown sequence (bnc#441774, ITS#5745) +* Tue Nov 04 2008 rhafer@suse.de +- Handle ldbm databases in updates from 2.3 release (bnc#440589) * Thu Oct 23 2008 rhafer@suse.de - the helper function to create various LDAP controls returned wrong error codes under certain circumstances @@ -521,7 +553,7 @@ fi of databases (translucent, chain, ...) (bnc#438094, ITS#5736) * Mon Oct 13 2008 rhafer@suse.de - Added missing #include to slapo-collect -* Mon Oct 13 2008 rhafer@suse.de +* Sun Oct 12 2008 rhafer@suse.de - Update to 2.4.12. Most important changes: * Fixed libldap ldap_utf8_strchar arguments (ITS#5720) * Fixed libldap TLS_CRLFILE (ITS#5677) @@ -691,7 +723,7 @@ fi ITS#5484, ITS#5451) * Fri Apr 25 2008 rhafer@suse.de - Adjust ownership of DB_CONFIG to ldap:ldap (bnc#376204) -* Fri Apr 11 2008 matz@suse.de +* Thu Apr 10 2008 matz@suse.de - Compile with glibc 2.8. * Thu Apr 10 2008 ro@suse.de - added baselibs.conf file to build xxbit packages @@ -848,7 +880,7 @@ fi * Fixed libldap referral chasing loop (ITS#4955) * Fixed libldap response code handling on rebind (ITS#4924) * Fixed libldap SASL_MAX_BUFF_SIZE (ITS#4935) -* Thu Jun 14 2007 dmueller@suse.de +* Wed Jun 13 2007 dmueller@suse.de - remove binutils prereq * Mon May 21 2007 dmueller@suse.de - reduce duplicated buildrequires against db42 and db45 @@ -1139,7 +1171,7 @@ fi - libldap-result.dif: ldapsearch was hanging in select() when retrieving results from eDirectory through a StartTLS protected connection (Bugzilla #44942) -* Tue Aug 10 2004 dobey@suse.de +* Mon Aug 09 2004 dobey@suse.de - added ntlm support * Tue Aug 03 2004 rhafer@suse.de - updated to 2.2.16 @@ -1214,7 +1246,7 @@ fi - small fixes for the YaST user schema * Tue Nov 11 2003 rhafer@suse.de - enabled SLP-support -* Sat Oct 18 2003 kukuk@suse.de +* Fri Oct 17 2003 kukuk@suse.de - Remove unused des from neededforbuild * Tue Sep 02 2003 mt@suse.de - Bugzilla #29859: fixed typo in sysconfig metadata, @@ -1256,7 +1288,7 @@ fi - remove unpacked files from BuildRoot * Fri May 09 2003 rhafer@suse.de - updated to version 2.1.19 -* Wed Apr 16 2003 ro@suse.de +* Tue Apr 15 2003 ro@suse.de - fixed requires for devel-package ... * Tue Apr 15 2003 ro@suse.de - fixed neededforbuild @@ -1266,7 +1298,7 @@ fi - added /etc/openldap to filelist * Mon Feb 03 2003 rhafer@suse.de - switch default backend to ldbm -* Mon Feb 03 2003 ro@suse.de +* Sun Feb 02 2003 ro@suse.de - fixed requires for devel package (cyrus-sasl2-devel) * Fri Jan 31 2003 rhafer@suse.de - liblber.dif: Fixes two bugs in liblber by which remote attackers diff --git a/slapd-db-close-error-its5745.dif b/slapd-db-close-error-its5745.dif new file mode 100644 index 0000000..e2c4428 --- /dev/null +++ b/slapd-db-close-error-its5745.dif @@ -0,0 +1,238 @@ +Index: servers/slapd/back-bdb/init.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/back-bdb/init.c,v +retrieving revision 1.298 +retrieving revision 1.299 +diff -u -r1.298 -r1.299 +--- servers/slapd/back-bdb/init.c 2 Nov 2008 22:06:11 -0000 1.298 ++++ servers/slapd/back-bdb/init.c 3 Nov 2008 12:00:00 -0000 1.299 +@@ -584,6 +584,17 @@ + ber_bvarray_free( bdb->bi_db_config ); + bdb->bi_db_config = NULL; + ++ if( bdb->bi_dbenv ) { ++ /* Free cache locker if we enabled locking. ++ * TXNs must all be closed before DBs... ++ */ ++ if ( !( slapMode & SLAP_TOOL_QUICK ) && bdb->bi_cache.c_txn ) { ++ TXN_ABORT( bdb->bi_cache.c_txn ); ++ bdb->bi_cache.c_txn = NULL; ++ } ++ bdb_reader_flush( bdb->bi_dbenv ); ++ } ++ + while( bdb->bi_databases && bdb->bi_ndatabases-- ) { + db = bdb->bi_databases[bdb->bi_ndatabases]; + rc = db->bdi_db->close( db->bdi_db, 0 ); +@@ -614,13 +625,6 @@ + + /* close db environment */ + if( bdb->bi_dbenv ) { +- /* Free cache locker if we enabled locking */ +- if ( !( slapMode & SLAP_TOOL_QUICK ) && bdb->bi_cache.c_txn ) { +- TXN_ABORT( bdb->bi_cache.c_txn ); +- bdb->bi_cache.c_txn = NULL; +- } +- bdb_reader_flush( bdb->bi_dbenv ); +- + /* force a checkpoint, but not if we were ReadOnly, + * and not in Quick mode since there are no transactions there. + */ +Index: servers/slapd/backend.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/backend.c,v +retrieving revision 1.403 +retrieving revision 1.404 +diff -u -r1.403 -r1.404 +--- servers/slapd/backend.c 2 Nov 2008 06:58:50 -0000 1.403 ++++ servers/slapd/backend.c 3 Nov 2008 12:23:05 -0000 1.404 +@@ -349,11 +349,13 @@ + } + + if ( be->bd_info->bi_db_close ) { +- be->bd_info->bi_db_close( be, NULL ); ++ rc = be->bd_info->bi_db_close( be, NULL ); ++ if ( rc ) return rc; + } + + if( be->bd_info->bi_close ) { +- be->bd_info->bi_close( be->bd_info ); ++ rc = be->bd_info->bi_close( be->bd_info ); ++ if ( rc ) return rc; + } + + return 0; +Index: servers/slapd/slapacl.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapacl.c,v +retrieving revision 1.31 +retrieving revision 1.32 +diff -u -r1.31 -r1.32 +--- servers/slapd/slapacl.c 7 Jan 2008 23:20:09 -0000 1.31 ++++ servers/slapd/slapacl.c 3 Nov 2008 12:23:05 -0000 1.32 +@@ -399,7 +399,8 @@ + } + } + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + + return rc; + } +Index: servers/slapd/slapadd.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapadd.c,v +retrieving revision 1.54 +retrieving revision 1.55 +diff -u -r1.54 -r1.55 +--- servers/slapd/slapadd.c 22 Mar 2008 15:01:23 -0000 1.54 ++++ servers/slapd/slapadd.c 3 Nov 2008 12:23:05 -0000 1.55 +@@ -447,7 +447,8 @@ + } + } + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + + return rc; + } +Index: servers/slapd/slapauth.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapauth.c,v +retrieving revision 1.13 +retrieving revision 1.14 +diff -u -r1.13 -r1.14 +--- servers/slapd/slapauth.c 7 Jan 2008 23:20:09 -0000 1.13 ++++ servers/slapd/slapauth.c 3 Nov 2008 12:23:05 -0000 1.14 +@@ -166,7 +166,8 @@ + if ( !BER_BVISNULL( &authzID ) ) { + op->o_tmpfree( authzID.bv_val, op->o_tmpmemctx ); + } +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + + return rc; + } +Index: servers/slapd/slapcat.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapcat.c,v +retrieving revision 1.12 +retrieving revision 1.13 +diff -u -r1.12 -r1.13 +--- servers/slapd/slapcat.c 11 Apr 2008 10:20:01 -0000 1.12 ++++ servers/slapd/slapcat.c 3 Nov 2008 12:23:05 -0000 1.13 +@@ -134,6 +134,7 @@ + + be->be_entry_close( be ); + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + return rc; + } +Index: servers/slapd/slapcommon.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapcommon.c,v +retrieving revision 1.88 +retrieving revision 1.89 +diff -u -r1.88 -r1.89 +--- servers/slapd/slapcommon.c 7 Jan 2008 23:20:09 -0000 1.88 ++++ servers/slapd/slapcommon.c 3 Nov 2008 12:23:05 -0000 1.89 +@@ -740,13 +740,16 @@ + } + } + +-void slap_tool_destroy( void ) ++int slap_tool_destroy( void ) + { ++ int rc = 0; + if ( !dryrun ) { + if ( need_shutdown ) { +- slap_shutdown( be ); ++ if ( slap_shutdown( be )) ++ rc = EXIT_FAILURE; + } +- slap_destroy(); ++ if ( slap_destroy()) ++ rc = EXIT_FAILURE; + } + #ifdef SLAPD_MODULES + if ( slapMode == SLAP_SERVER_MODE ) { +@@ -772,4 +775,5 @@ + if ( ldiffp && ldiffp != &dummy ) { + ldif_close( ldiffp ); + } ++ return rc; + } +Index: servers/slapd/slapcommon.h +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapcommon.h,v +retrieving revision 1.19 +retrieving revision 1.20 +diff -u -r1.19 -r1.20 +--- servers/slapd/slapcommon.h 7 Jan 2008 23:20:09 -0000 1.19 ++++ servers/slapd/slapcommon.h 3 Nov 2008 12:23:05 -0000 1.20 +@@ -101,6 +101,6 @@ + int tool, + int argc, char **argv )); + +-void slap_tool_destroy LDAP_P((void)); ++int slap_tool_destroy LDAP_P((void)); + + #endif /* SLAPCOMMON_H_ */ +Index: servers/slapd/slapdn.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapdn.c,v +retrieving revision 1.10 +retrieving revision 1.11 +diff -u -r1.10 -r1.11 +--- servers/slapd/slapdn.c 7 Jan 2008 23:20:09 -0000 1.10 ++++ servers/slapd/slapdn.c 3 Nov 2008 12:23:05 -0000 1.11 +@@ -99,7 +99,8 @@ + } + } + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + + return rc; + } +Index: servers/slapd/slapindex.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slapindex.c,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -r1.7 -r1.8 +--- servers/slapd/slapindex.c 7 Jan 2008 23:20:09 -0000 1.7 ++++ servers/slapd/slapindex.c 3 Nov 2008 12:23:05 -0000 1.8 +@@ -99,6 +99,7 @@ + + (void) be->be_entry_close( be ); + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + return( rc ); + } +Index: servers/slapd/slaptest.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slaptest.c,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -r1.11 -r1.12 +--- servers/slapd/slaptest.c 7 Jan 2008 23:20:09 -0000 1.11 ++++ servers/slapd/slaptest.c 3 Nov 2008 12:23:05 -0000 1.12 +@@ -108,7 +108,8 @@ + fprintf( stderr, "config file testing succeeded\n"); + } + +- slap_tool_destroy(); ++ if ( slap_tool_destroy()) ++ rc = EXIT_FAILURE; + + return rc; + } diff --git a/slapo-syncprov-skip-its5709.dif b/slapo-syncprov-skip-its5709.dif new file mode 100644 index 0000000..826639a --- /dev/null +++ b/slapo-syncprov-skip-its5709.dif @@ -0,0 +1,296 @@ +Index: servers/slapd/proto-slap.h +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/proto-slap.h,v +retrieving revision 1.762 +retrieving revision 1.763 +diff -u -r1.762 -r1.763 +--- servers/slapd/proto-slap.h 1 Nov 2008 14:16:49 -0000 1.762 ++++ servers/slapd/proto-slap.h 2 Nov 2008 21:16:20 -0000 1.763 +@@ -804,7 +804,7 @@ + LDAP_SLAPD_V( const struct berval ) slap_ldapsync_bv; + LDAP_SLAPD_V( const struct berval ) slap_ldapsync_cn_bv; + LDAP_SLAPD_F (void) slap_get_commit_csn LDAP_P(( +- Operation *, struct berval *maxcsn )); ++ Operation *, struct berval *maxcsn, int *foundit )); + LDAP_SLAPD_F (void) slap_rewind_commit_csn LDAP_P(( Operation * )); + LDAP_SLAPD_F (void) slap_graduate_commit_csn LDAP_P(( Operation * )); + LDAP_SLAPD_F (Entry *) slap_create_context_csn_entry LDAP_P(( Backend *, struct berval *)); +Index: servers/slapd/overlays/syncprov.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/overlays/syncprov.c,v +retrieving revision 1.249 +retrieving revision 1.250 +diff -u -r1.249 -r1.250 +--- servers/slapd/overlays/syncprov.c 28 Oct 2008 19:33:46 -0000 1.249 ++++ servers/slapd/overlays/syncprov.c 2 Nov 2008 14:26:25 -0000 1.250 +@@ -1604,12 +1604,12 @@ + { + struct berval maxcsn = BER_BVNULL; + char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; +- int do_check = 0, have_psearches; ++ int do_check = 0, have_psearches, foundit; + + /* Update our context CSN */ + cbuf[0] = '\0'; + ldap_pvt_thread_rdwr_wlock( &si->si_csn_rwlock ); +- slap_get_commit_csn( op, &maxcsn ); ++ slap_get_commit_csn( op, &maxcsn, &foundit ); + if ( BER_BVISNULL( &maxcsn ) && SLAP_GLUE_SUBORDINATE( op->o_bd )) { + /* syncrepl queues the CSN values in the db where + * it is configured , not where the changes are made. +@@ -1618,7 +1618,7 @@ + */ + BackendDB *be = op->o_bd; + op->o_bd = select_backend( &be->be_nsuffix[0], 1); +- slap_get_commit_csn( op, &maxcsn ); ++ slap_get_commit_csn( op, &maxcsn, &foundit ); + op->o_bd = be; + } + if ( !BER_BVISNULL( &maxcsn ) ) { +@@ -1641,7 +1641,7 @@ + sizeof(int)); + si->si_sids[i] = sid; + } +- } else { ++ } else if ( !foundit ) { + /* internal ops that aren't meant to be replicated */ + ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock ); + return SLAP_CB_CONTINUE; +@@ -1678,8 +1678,11 @@ + ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock ); + } + +- opc->sctxcsn.bv_len = maxcsn.bv_len; +- opc->sctxcsn.bv_val = cbuf; ++ /* only update consumer ctx if this is the greatest csn */ ++ if ( bvmatch( &maxcsn, &op->o_csn )) { ++ opc->sctxcsn.bv_len = maxcsn.bv_len; ++ opc->sctxcsn.bv_val = cbuf; ++ } + + /* Handle any persistent searches */ + ldap_pvt_thread_mutex_lock( &si->si_ops_mutex ); +Index: servers/slapd/ctxcsn.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/ctxcsn.c,v +retrieving revision 1.47 +retrieving revision 1.50 +diff -u -r1.47 -r1.50 +--- servers/slapd/ctxcsn.c 10 Feb 2008 01:18:22 -0000 1.47 ++++ servers/slapd/ctxcsn.c 2 Nov 2008 21:16:20 -0000 1.50 +@@ -33,71 +33,72 @@ + void + slap_get_commit_csn( + Operation *op, +- struct berval *maxcsn ++ struct berval *maxcsn, ++ int *foundit + ) + { + struct slap_csn_entry *csne, *committed_csne = NULL; ++ BackendDB *be = op->o_bd->bd_self; + + if ( maxcsn ) { + BER_BVZERO( maxcsn ); + } ++ if ( foundit ) { ++ *foundit = 0; ++ } + +- ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex ); + +- LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { ++ LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { + if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { + csne->ce_state = SLAP_CSN_COMMIT; ++ if ( foundit ) *foundit = 1; + break; + } + } + +- LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { ++ LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { + if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne; + if ( csne->ce_state == SLAP_CSN_PENDING ) break; + } + + if ( committed_csne && maxcsn ) *maxcsn = committed_csne->ce_csn; +- ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex ); + } + + void + slap_rewind_commit_csn( Operation *op ) + { + struct slap_csn_entry *csne; ++ BackendDB *be = op->o_bd->bd_self; + +- ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex ); + +- LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { ++ LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { + if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { + csne->ce_state = SLAP_CSN_PENDING; + break; + } + } + +- ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex ); + } + + void + slap_graduate_commit_csn( Operation *op ) + { + struct slap_csn_entry *csne; ++ BackendDB *be; + + if ( op == NULL ) return; + if ( op->o_bd == NULL ) return; ++ be = op->o_bd->bd_self; + +-#if 0 +- /* it is NULL when we get here from the frontendDB; +- * alternate fix: initialize frontendDB like all other backends */ +- assert( op->o_bd->be_pcl_mutexp != NULL ); +-#endif +- +- if ( op->o_bd->be_pcl_mutexp == NULL ) return; +- +- ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex ); + +- LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { ++ LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) { + if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { +- LDAP_TAILQ_REMOVE( op->o_bd->be_pending_csn_list, ++ LDAP_TAILQ_REMOVE( be->be_pending_csn_list, + csne, ce_csn_link ); + Debug( LDAP_DEBUG_SYNC, "slap_graduate_commit_csn: removing %p %s\n", + csne->ce_csn.bv_val, csne->ce_csn.bv_val, 0 ); +@@ -110,7 +111,7 @@ + } + } + +- ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex ); + + return; + } +@@ -161,22 +162,23 @@ + struct berval *csn ) + { + struct slap_csn_entry *pending; ++ BackendDB *be = op->o_bd->bd_self; + + pending = (struct slap_csn_entry *) ch_calloc( 1, + sizeof( struct slap_csn_entry )); + + Debug( LDAP_DEBUG_SYNC, "slap_queue_csn: queing %p %s\n", csn->bv_val, csn->bv_val, 0 ); + +- ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex ); + + ber_dupbv( &pending->ce_csn, csn ); + ber_bvreplace_x( &op->o_csn, &pending->ce_csn, op->o_tmpmemctx ); + pending->ce_connid = op->o_connid; + pending->ce_opid = op->o_opid; + pending->ce_state = SLAP_CSN_PENDING; +- LDAP_TAILQ_INSERT_TAIL( op->o_bd->be_pending_csn_list, ++ LDAP_TAILQ_INSERT_TAIL( be->be_pending_csn_list, + pending, ce_csn_link ); +- ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex ); + } + + int +Index: servers/slapd/frontend.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/frontend.c,v +retrieving revision 1.26 +retrieving revision 1.27 +diff -u -r1.26 -r1.27 +--- servers/slapd/frontend.c 19 Sep 2008 18:37:11 -0000 1.26 ++++ servers/slapd/frontend.c 2 Nov 2008 06:58:50 -0000 1.27 +@@ -108,11 +108,7 @@ + frontendDB->be_def_limit.lms_s_pr_hide = 0; /* don't hide number of entries left */ + frontendDB->be_def_limit.lms_s_pr_total = 0; /* number of total entries returned by pagedResults equal to hard limit */ + +-#if 0 +- /* FIXME: do we need this? */ +- frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex; +- ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp ); +-#endif ++ ldap_pvt_thread_mutex_init( &frontendDB->be_pcl_mutex ); + + /* suffix */ + frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) ); +Index: servers/slapd/slap.h +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/slap.h,v +retrieving revision 1.860 +retrieving revision 1.861 +diff -u -r1.860 -r1.861 +--- servers/slapd/slap.h 1 Nov 2008 14:16:49 -0000 1.860 ++++ servers/slapd/slap.h 2 Nov 2008 06:58:50 -0000 1.861 +@@ -1895,7 +1895,6 @@ + BerVarray be_update_refs; /* where to refer modifying clients to */ + struct be_pcl *be_pending_csn_list; + ldap_pvt_thread_mutex_t be_pcl_mutex; +- ldap_pvt_thread_mutex_t *be_pcl_mutexp; + struct syncinfo_s *be_syncinfo; /* For syncrepl */ + + void *be_pb; /* Netscape plugin */ +Index: servers/slapd/overlays/pcache.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/overlays/pcache.c,v +retrieving revision 1.157 +retrieving revision 1.158 +diff -u -r1.157 -r1.158 +--- servers/slapd/overlays/pcache.c 24 Oct 2008 16:57:38 -0000 1.157 ++++ servers/slapd/overlays/pcache.c 2 Nov 2008 06:58:50 -0000 1.158 +@@ -3145,7 +3145,7 @@ + cm->db = *be; + SLAP_DBFLAGS(&cm->db) |= SLAP_DBFLAG_NO_SCHEMA_CHECK; + cm->db.be_private = NULL; +- cm->db.be_pcl_mutexp = &cm->db.be_pcl_mutex; ++ cm->db.bd_self = &cm->db; + cm->qm = qm; + cm->numattrsets = 0; + cm->num_entries_limit = 5; +Index: servers/slapd/overlays/translucent.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/overlays/translucent.c,v +retrieving revision 1.56 +retrieving revision 1.57 +diff -u -r1.56 -r1.57 +--- servers/slapd/overlays/translucent.c 17 Oct 2008 15:40:49 -0000 1.56 ++++ servers/slapd/overlays/translucent.c 2 Nov 2008 06:58:50 -0000 1.57 +@@ -1268,7 +1268,6 @@ + on->on_bi.bi_private = ov; + ov->db = *be; + ov->db.be_private = NULL; +- ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex; + ov->defer_db_open = 1; + + if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) { +Index: servers/slapd/backend.c +=================================================================== +RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/backend.c,v +retrieving revision 1.402 +retrieving revision 1.403 +diff -u -r1.402 -r1.403 +--- servers/slapd/backend.c 1 Nov 2008 14:16:49 -0000 1.402 ++++ servers/slapd/backend.c 2 Nov 2008 06:58:50 -0000 1.403 +@@ -594,8 +594,7 @@ + be->be_requires = frontendDB->be_requires; + be->be_ssf_set = frontendDB->be_ssf_set; + +- be->be_pcl_mutexp = &be->be_pcl_mutex; +- ldap_pvt_thread_mutex_init( be->be_pcl_mutexp ); ++ ldap_pvt_thread_mutex_init( &be->be_pcl_mutex ); + + /* assign a default depth limit for alias deref */ + be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;