From 4a66c6c68a8b774bd49e3df5b7848c653e9e4d18 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Aug 10 2011 23:33:49 +0000 Subject: Merge branch 'master' into RHEL-6 --- diff --git a/VERSION.sh b/VERSION.sh index d56e037..fc465c6 100644 --- a/VERSION.sh +++ b/VERSION.sh @@ -10,7 +10,7 @@ vendor="389 Project" # PACKAGE_VERSION is constructed from these VERSION_MAJOR=1 VERSION_MINOR=2 -VERSION_MAINT=9.5 +VERSION_MAINT=9.6 # if this is a PRERELEASE, set VERSION_PREREL # otherwise, comment it out # be sure to include the dot prefix in the prerel diff --git a/config.h.in b/config.h.in index 888611a..111c557 100644 --- a/config.h.in +++ b/config.h.in @@ -57,6 +57,12 @@ /* enable the presence plugin */ #undef ENABLE_PRESENCE +/* have 64-bit atomic bool compare and swap function provided by gcc */ +#undef HAVE_64BIT_ATOMIC_CAS_FUNC + +/* have 64-bit atomic operation functions provided by gcc */ +#undef HAVE_64BIT_ATOMIC_OP_FUNCS + /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H @@ -67,9 +73,6 @@ don't. */ #undef HAVE_DECL_STRERROR_R -/* do not have 64-bit atomic compare and swap functions provided by gcc */ -#undef HAVE_DECL___SYNC_ADD_AND_FETCH - /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H diff --git a/configure b/configure index 44bbd25..e05fc81 100755 --- a/configure +++ b/configure @@ -22144,8 +22144,8 @@ _ACEOF ;; esac - { $as_echo "$as_me:$LINENO: checking for GCC provided 64-bit atomic functions ..." >&5 -$as_echo_n "checking for GCC provided 64-bit atomic functions ...... " >&6; } + { $as_echo "$as_me:$LINENO: checking for GCC provided 64-bit atomic bool cas function ..." >&5 +$as_echo_n "checking for GCC provided 64-bit atomic bool cas function ...... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22182,13 +22182,17 @@ $as_echo "$ac_try_echo") >&5 test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then - have_gcc_64bit_cas=1; { $as_echo "$as_me:$LINENO: result: yes" >&5 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_64BIT_ATOMIC_CAS_FUNC 1 +_ACEOF +{ $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - have_gcc_64bit_cas=; { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl___sync_add_and_fetch" >&5 @@ -22198,19 +22202,61 @@ if test "x$ac_cv_have_decl___sync_add_and_fetch" = x""yes; then rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext - if test -n "$have_gcc_64bit_cas" ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DECL___SYNC_ADD_AND_FETCH 1 + { $as_echo "$as_me:$LINENO: checking for GCC provided 64-bit atomic ops functions ..." >&5 +$as_echo_n "checking for GCC provided 64-bit atomic ops functions ...... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - else +int +main () +{ +long long ptrval = 0, val = 0; (void)__sync_add_and_fetch_8(&ptrval, val); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then cat >>confdefs.h <<\_ACEOF -#define HAVE_DECL___SYNC_ADD_AND_FETCH 0 +#define HAVE_64BIT_ATOMIC_OP_FUNCS 1 _ACEOF +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - fi + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext # some programs use the native thread library directly THREADLIB=-lpthread THREADLIB=$THREADLIB diff --git a/configure.ac b/configure.ac index ac4dc82..6d8e277 100644 --- a/configure.ac +++ b/configure.ac @@ -407,17 +407,16 @@ case $host in AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter]) ;; esac - dnl no headers to test for __sync_bool_compare_and_swap_8 - AC_MSG_CHECKING([for GCC provided 64-bit atomic functions ...]) + AC_MSG_CHECKING([for GCC provided 64-bit atomic bool cas function ...]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[long long ptrval = 0, val = 0, newval = 1; (void)__sync_bool_compare_and_swap_8(&ptrval, val, newval);]])], - [have_gcc_64bit_cas=1; AC_MSG_RESULT([yes])], - [have_gcc_64bit_cas=; AC_MSG_RESULT([no])]) - if test -n "$have_gcc_64bit_cas" ; then - AC_DEFINE([HAVE_DECL___SYNC_ADD_AND_FETCH], [1], [have 64-bit atomic compare and swap functions provided by gcc]) - else - AC_DEFINE([HAVE_DECL___SYNC_ADD_AND_FETCH], [0], [do not have 64-bit atomic compare and swap functions provided by gcc]) - fi + [AC_DEFINE([HAVE_64BIT_ATOMIC_CAS_FUNC], [1], [have 64-bit atomic bool compare and swap function provided by gcc])AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + AC_MSG_CHECKING([for GCC provided 64-bit atomic ops functions ...]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[long long ptrval = 0, val = 0; (void)__sync_add_and_fetch_8(&ptrval, val);]])], + [AC_DEFINE([HAVE_64BIT_ATOMIC_OP_FUNCS], [1], [have 64-bit atomic operation functions provided by gcc])AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) # some programs use the native thread library directly THREADLIB=-lpthread AC_SUBST([THREADLIB], [$THREADLIB]) diff --git a/ldap/admin/src/scripts/template-dn2rdn.in b/ldap/admin/src/scripts/template-dn2rdn.in index a9402fd..8e85db6 100755 --- a/ldap/admin/src/scripts/template-dn2rdn.in +++ b/ldap/admin/src/scripts/template-dn2rdn.in @@ -19,12 +19,5 @@ SHLIB_PATH=$LD_LIBRARY_PATH export SHLIB_PATH cd {{SERVERBIN-DIR}} -if [ $# -eq 0 ] -then - bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S` - ./ns-slapd upgradedb -D {{CONFIG-DIR}} -r -a "$bak_dir" -else - echo "Usage: dn2rdn" - exit 1 -fi - +bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S` +./ns-slapd upgradedb -D {{CONFIG-DIR}} -r -a "$bak_dir" "$@" diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c index f76e749..9205393 100644 --- a/ldap/servers/plugins/replication/windows_connection.c +++ b/ldap/servers/plugins/replication/windows_connection.c @@ -659,7 +659,7 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter, &conn->timeout, 0 /* sizelimit */, &res); if ((LDAP_SUCCESS != ldap_rc) && !IS_DISCONNECT_ERROR(ldap_rc)) { - slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, + slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "Could not retrieve entry from Windows using search " "base [%s] scope [%d] filter [%s]: error %d:%s\n", searchbase_copy, scope, filter_copy, ldap_rc, diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c index f85699d..3bba77d 100644 --- a/ldap/servers/plugins/replication/windows_inc_protocol.c +++ b/ldap/servers/plugins/replication/windows_inc_protocol.c @@ -473,6 +473,9 @@ windows_inc_run(Private_Repl_Protocol *prp) dev_debug("windows_inc_run(STATE_WAIT_CHANGES): EVENT_TRIGGERING_CRITERIA_MET received -> STATE_READY_TO_ACQUIRE\n"); next_state = STATE_READY_TO_ACQUIRE; wait_change_timer_set = 0; + /* We want to run dirsync to catch values generated by AD after + * it process operations that we send to it (such as GUID values). */ + run_dirsync = PR_TRUE; } else if ((e1 = event_occurred(prp, EVENT_WINDOW_OPENED)) || event_occurred(prp, EVENT_BACKOFF_EXPIRED)) diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c index 51b26fd..71e59ed 100644 --- a/ldap/servers/plugins/replication/windows_protocol_util.c +++ b/ldap/servers/plugins/replication/windows_protocol_util.c @@ -770,9 +770,13 @@ static int send_password_modify(Slapi_DN *sdn, char *password, Private_Repl_Protocol *prp) { ConnResult pw_return = 0; - int is_nt4 = windows_private_get_isnt4(prp->agmt); - if (is_nt4) + if (!sdn || !slapi_sdn_get_dn(sdn) || !password) + { + return CONN_OPERATION_FAILED; + } + + if (windows_private_get_isnt4(prp->agmt)) { /* NT4 just wants a plaintext password */ Slapi_Mods smods = {0}; @@ -1555,10 +1559,17 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op case SLAPI_OPERATION_DELETE: if (delete_remote_entry_allowed(local_entry)) { - return_value = windows_conn_send_delete(prp->conn, slapi_sdn_get_dn(remote_dn), NULL, NULL /* returned controls */); + if (missing_entry) { slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, - "%s: windows_replay_update: deleted remote entry, dn=\"%s\", result=%d\n", - agmt_get_long_name(prp->agmt), slapi_sdn_get_dn(remote_dn), return_value); + "%s: windows_replay_update: remote entry doesn't exist. " + "Skipping operation, dn=\"%s\"\n", agmt_get_long_name(prp->agmt), + slapi_sdn_get_dn(remote_dn)); + } else { + return_value = windows_conn_send_delete(prp->conn, slapi_sdn_get_dn(remote_dn), NULL, NULL /* returned controls */); + slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, + "%s: windows_replay_update: deleted remote entry, dn=\"%s\", result=%d\n", + agmt_get_long_name(prp->agmt), slapi_sdn_get_dn(remote_dn), return_value); + } } else { slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, @@ -1628,7 +1639,8 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op * it is assumed that is_user is set for user entries and that only user entries need * accountcontrol values */ - if ((return_value == CONN_OPERATION_SUCCESS) && remote_dn && (password || missing_entry) && is_user) { + if ((op->operation_type != SLAPI_OPERATION_DELETE) && (return_value == CONN_OPERATION_SUCCESS) + && remote_dn && (password || missing_entry) && is_user) { return_value = send_accountcontrol_modify(remote_dn, prp, missing_entry); } } else { diff --git a/ldap/servers/plugins/replication/windows_tot_protocol.c b/ldap/servers/plugins/replication/windows_tot_protocol.c index 24d1675..6c54004 100644 --- a/ldap/servers/plugins/replication/windows_tot_protocol.c +++ b/ldap/servers/plugins/replication/windows_tot_protocol.c @@ -241,6 +241,14 @@ windows_tot_run(Private_Repl_Protocol *prp) agmt_set_consumer_ruv(prp->agmt, starting_ruv ); } + /* Do another dirsync to ensure we get GUIDs for newly added entries. */ + if ((one_way == ONE_WAY_SYNC_DISABLED) || (one_way == ONE_WAY_SYNC_FROM_AD)) { + windows_dirsync_inc_run(prp); + } + + /* Save the dirsync cookie. */ + windows_private_save_dirsync_cookie(prp->agmt); + /* call end total update callback */ winsync_plugin_call_end_update_cb(prp->agmt, windows_private_get_directory_subtree(prp->agmt), diff --git a/ldap/servers/slapd/back-ldbm/dbversion.c b/ldap/servers/slapd/back-ldbm/dbversion.c index 5c5cdeb..4c47c3d 100644 --- a/ldap/servers/slapd/back-ldbm/dbversion.c +++ b/ldap/servers/slapd/back-ldbm/dbversion.c @@ -122,7 +122,9 @@ dbversion_write(struct ldbminfo *li, const char *directory, len = strlen(buf); ptr = buf + len; } - len = strlen( buf ); + /* end in a newline */ + PL_strncpyz(ptr, "\n", sizeof(buf) - len); + len = strlen(buf); if ( slapi_write_buffer( prfd, buf, len ) != len ) { LDAPDebug( LDAP_DEBUG_ANY, "Could not write to file \"%s\"\n", filename, 0, 0 ); diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index 87048c9..4427a43 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -2652,12 +2652,20 @@ int ldbm_back_upgradedb(Slapi_PBlock *pb) inst = (ldbm_instance *)object_get_data(inst_obj); if (!(up_flags & SLAPI_UPGRADEDB_FORCE)) { /* upgrade idl to new */ + int need_upgrade = 0; li->li_flags |= LI_FORCE_MOD_CONFIG; /* set new idl */ ldbm_config_internal_set(li, CONFIG_IDL_SWITCH, "new"); /* First check the dbversion */ rval = check_db_inst_version(inst); - if (!(DBVERSION_NEED_IDL_OLD2NEW & rval)) + need_upgrade = (DBVERSION_NEED_IDL_OLD2NEW & rval); + if (!need_upgrade && (up_flags & SLAPI_UPGRADEDB_DN2RDN)) { + need_upgrade = (rval & DBVERSION_NEED_DN2RDN); + } + if (!need_upgrade) { + need_upgrade = (rval & (DBVERSION_UPGRADE_3_4|DBVERSION_UPGRADE_4_4)); + } + if (!need_upgrade) { slapi_log_error(SLAPI_LOG_FATAL, "upgrade DB", "Index version is up-to-date\n"); diff --git a/ldap/servers/slapd/slapi_counter.c b/ldap/servers/slapd/slapi_counter.c index c3f1f44..4d2c5cf 100644 --- a/ldap/servers/slapd/slapi_counter.c +++ b/ldap/servers/slapd/slapi_counter.c @@ -54,19 +54,11 @@ PRUint64 _sparcv9_AtomicSub(PRUint64 *address, PRUint64 val); #endif #ifdef ATOMIC_64BIT_OPERATIONS -#if defined LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH) +#if defined(LINUX) && !HAVE_64BIT_ATOMIC_OP_FUNCS /* On systems that don't have the 64-bit GCC atomic builtins, we need to * implement our own atomic functions using inline assembly code. */ PRUint64 __sync_add_and_fetch_8(PRUint64 *ptr, PRUint64 addval); PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval); -#endif - -#if defined LINUX && !HAVE_DECL___SYNC_ADD_AND_FETCH -/* Systems that have the atomic builtins defined, but don't have - * implementations for 64-bit values will automatically try to - * call the __sync_*_8 versions we provide. If the atomic builtins - * are not defined at all, we define them here to use our local - * functions. */ #define __sync_add_and_fetch __sync_add_and_fetch_8 #define __sync_sub_and_fetch __sync_sub_and_fetch_8 #endif @@ -294,7 +286,7 @@ PRUint64 slapi_counter_set_value(Slapi_Counter *counter, PRUint64 newvalue) #ifdef LINUX /* Use our own inline assembly for an atomic set if * the builtins aren't available. */ -#if defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH +#if !HAVE_64BIT_ATOMIC_CAS_FUNC /* * %0 = counter->value * %1 = newvalue @@ -370,7 +362,7 @@ PRUint64 slapi_counter_get_value(Slapi_Counter *counter) #ifdef LINUX /* Use our own inline assembly for an atomic get if * the builtins aren't available. */ -#if defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH +#if !HAVE_64BIT_ATOMIC_CAS_FUNC /* * %0 = counter->value * %1 = value @@ -432,7 +424,7 @@ PRUint64 slapi_counter_get_value(Slapi_Counter *counter) } #ifdef ATOMIC_64BIT_OPERATIONS -#if defined LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH) +#if defined(LINUX) && !HAVE_64BIT_ATOMIC_OP_FUNCS /* On systems that don't have the 64-bit GCC atomic builtins, we need to * implement our own atomic add and subtract functions using inline * assembly code. */ @@ -523,5 +515,5 @@ PRUint64 __sync_sub_and_fetch_8(PRUint64 *ptr, PRUint64 subval) return retval; } -#endif /* LINUX && (defined CPU_x86 || !HAVE_DECL___SYNC_ADD_AND_FETCH) */ +#endif /* LINUX && !HAVE_64BIT_ATOMIC_OP_FUNCS */ #endif /* ATOMIC_64BIT_OPERATIONS */