From: <svn...@op...> - 2009-04-06 20:20:26
|
Author: scriptor Date: Mon Apr 6 22:20:05 2009 New Revision: 5546 URL: http://www.opensync.org/changeset/5546 Log: The osynctool based tests make now some first basic checks whether the intended modification like ADD, MODIFY and DELETE has really taken place on the side of the peer (which is currently only the file-sync plugin). Added "local" to the rv variables in check_osynctool_common.inc. Modified: plugins/ldap-sync/tests/check_add_modify_delete_and_sync plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync plugins/ldap-sync/tests/check_osynctool_common.inc Modified: plugins/ldap-sync/tests/check_add_modify_delete_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_add_modify_delete_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -201,8 +201,6 @@ - - echo "Command: $LDAPMODIFY $AUTH -f $ENTRYMODS" $LDAPMODIFY $AUTH -f $ENTRYMODS Modified: plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -278,6 +278,8 @@ $VALGRIND $OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect $SYNCMETHOD --syncdone --disconnect --finalize delete_rv=$? + + echo echo echo Modified: plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -441,7 +441,6 @@ - if test -d "$TMPDIR"; then rm -rf "$TMPDIR" fi Modified: plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync Mon Apr 6 22:20:05 2009 (r5546) @@ -79,7 +79,7 @@ prologue; # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync remove_file_by_objtype "$OBJECTTYPE" @@ -99,6 +99,10 @@ slow_sync "$OBJECTTYPE" rv=$? + +verify_file_add "$XMLFILE" + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync Mon Apr 6 22:20:05 2009 (r5546) @@ -87,7 +87,7 @@ prologue; # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync remove_file_by_objtype "$OBJECTTYPE" @@ -107,6 +107,10 @@ valgrind_slow_sync "$OBJECTTYPE" rv=$? + +verify_file_add "$XMLFILE" + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync Mon Apr 6 22:20:05 2009 (r5546) @@ -78,7 +78,7 @@ prologue; # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync remove_file_by_objtype "$OBJECTTYPE" @@ -98,6 +98,10 @@ slow_sync "$OBJECTTYPE" rv=$? + +verify_ldif_add "$LDIF" + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync Mon Apr 6 22:20:05 2009 (r5546) @@ -87,7 +87,7 @@ prologue; # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync remove_file_by_objtype "$OBJECTTYPE" @@ -107,6 +107,10 @@ valgrind_slow_sync "$OBJECTTYPE" rv=$? + +verify_ldif_add "$LDIF" + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -101,7 +101,7 @@ # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync @@ -133,6 +133,8 @@ exit 1; fi +verify_file_add "$XMLFILE" + # Modify the XML File echo -e "\n\n\nModify XML file\n\n\n" @@ -181,6 +183,8 @@ echo -e "\n\n\n" +verify_file_delete "$XMLFILE" + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -215,7 +215,7 @@ prologue; # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync remove_files @@ -266,6 +266,10 @@ fi +verify_file_add "$XMLFILE_CONTACT" +verify_file_add "$XMLFILE_EVENT" +verify_file_add "$XMLFILE_TODO" +verify_file_add "$XMLFILE_NOTE" # Modify all of the 4 XML files @@ -371,6 +375,15 @@ + + +verify_file_delete "$XMLFILE_CONTACT" +verify_file_delete "$XMLFILE_EVENT" +verify_file_delete "$XMLFILE_TODO" +verify_file_delete "$XMLFILE_NOTE" + + + # Shut down test group Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -218,7 +218,7 @@ # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync @@ -271,6 +271,12 @@ fi +verify_ldif_add "$LDIF_CONTACT" +verify_ldif_add "$LDIF_EVENT" +verify_ldif_add "$LDIF_TODO" +verify_ldif_add "$LDIF_NOTE" + + # Modify all of the 4 LDIFs echo -e "\n\n\nModify 4 LDIFs\n\n\n" run_ldapmodify "$ENTRYMODS_CONTACT" @@ -364,6 +370,13 @@ +verify_ldif_delete "$LDIF_CONTACT" +verify_ldif_delete "$LDIF_EVENT" +verify_ldif_delete "$LDIF_TODO" +verify_ldif_delete "$LDIF_NOTE" + + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Mon Apr 6 22:20:05 2009 (r5546) @@ -98,7 +98,7 @@ # Empty LDAP DIT -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs # Remove entry from directory used by file-sync @@ -130,6 +130,7 @@ exit 1; fi +verify_ldif_add "$LDIF" # Modify the LDIF echo -e "\n\n\nModify LDIF\n\n\n" @@ -165,7 +166,7 @@ # Trigger synchronization echo -e "\n\n\nSynchronize after the LDIF has been deleted\n\n\n" -enable_trace_subdir "$test_name" "fast_sync" +enable_trace_subdir "$test_name" "delete" fast_sync rv=$? if test $rv -ne 0; then @@ -176,6 +177,10 @@ +verify_ldif_delete "$LDIF" + + + # Shut down test group epilogue Modified: plugins/ldap-sync/tests/check_osynctool_common.inc ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_common.inc Mon Apr 6 22:19:49 2009 (r5545) +++ plugins/ldap-sync/tests/check_osynctool_common.inc Mon Apr 6 22:20:05 2009 (r5546) @@ -27,15 +27,17 @@ if test ! -d "$osync_trace_dir"; then mkdir -p "$osync_trace_dir" else - rm -f "${osync_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${osync_trace_dir}${PATH_SEPARATOR}Thread* fi if test ! -d "$syncml_trace_dir"; then mkdir -p "$syncml_trace_dir" else - rm -f "${syncml_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${syncml_trace_dir}${PATH_SEPARATOR}Thread* fi + a=$(ls -alR $osync_trace_dir) + echo -e "$a" echo -e "\n\n\n${FUNCNAME}(): Enabling trace files (OSYNC_TRACE and SYNCML_TRACE) for \"${test_name}\":\n$osync_trace_dir\n$syncml_trace_dir\n\n\n" @@ -78,7 +80,7 @@ if test ! -d "$osync_trace_dir"; then mkdir -p "$osync_trace_dir" else - rm -f "${osync_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${osync_trace_dir}${PATH_SEPARATOR}Thread* fi @@ -87,7 +89,7 @@ if test ! -d "${new_osync_trace_dir}"; then mkdir -p "${new_osync_trace_dir}" else - rm -f "${new_osync_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${new_osync_trace_dir}${PATH_SEPARATOR}Thread* fi @@ -98,7 +100,7 @@ if test ! -d "$syncml_trace_dir"; then mkdir -p "$syncml_trace_dir" else - rm -f "${syncml_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${syncml_trace_dir}${PATH_SEPARATOR}Thread* fi @@ -106,11 +108,14 @@ if test ! -d "${new_syncml_trace_dir}"; then mkdir -p "${new_syncml_trace_dir}" else - rm -f "${new_syncml_trace_dir}${PATH_SEPARATOR}Thread*" + rm -f ${new_syncml_trace_dir}${PATH_SEPARATOR}Thread* fi + a=$(ls -alR ${osync_trace_dir}) + echo -e "$a" + echo -e "\n\n\n${FUNCNAME}(): Enabling trace files (OSYNC_TRACE and SYNCML_TRACE) for \"${test_name}\":\n${new_osync_trace_dir}\n${new_syncml_trace_dir}\n\n\n" @@ -122,6 +127,308 @@ +verify_ldif_add() +{ + ldif="$1" + if test -z "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: \$ldif is empty. Exiting." + exit 1 + fi + + if test ! -f "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: $ldif could not be found. Exiting." + fi + + if test ! -r "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: $ldif could be found, but was not readable. Exiting." + fi + + + DN_FULL=$(head -n 1 $ldif) + if test -z "$DN_FULL"; then + echo "${FUNCNAME}(): ERROR: \$DN_FULL is empty. Exiting." + exit 1; + fi + + DN=${DN_FULL#dn: } + if test -z "$DN"; then + echo "${FUNCNAME}(): ERROR: \$DN is empty. Exiting." + exit 1; + fi + + DN2=${DN/@/_} + if test -z "$DN2"; then + echo "${FUNCNAME}(): ERROR: \$DN2 is empty. Exiting." + exit 1; + fi + + to_be_found="" + + if test "$DN" == "$CONTACT1_DN" -o "$DN2" == "$CONTACT1_DN"; then + to_be_found="$CONTACT1_FILE" + elif test "$DN" == "$CONTACT2_DN" -o "$DN2" == "$CONTACT2_DN"; then + to_be_found="$CONTACT2_FILE" + elif test "$DN" == "$EVENT1_DN" -o "$DN2" == "$EVENT1_DN"; then + to_be_found="$EVENT1_FILE" + elif test "$DN" == "$TODO1_DN" -o "$DN2" == "$TODO1_DN"; then + to_be_found="$TODO1_FILE" + elif test "$DN" == "$NOTE1_DN" -o "$DN2" == "$NOTE1_DN"; then + to_be_found="$NOTE1_FILE" + elif test "$DN" == "$NOTE2_DN" -o "$DN2" == "$NOTE2_DN"; then + to_be_found="$NOTE2_FILE" + fi + + if test -z "$to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \$to_be_found could not be set. Exiting." + exit 1 + fi + + if test ! -f "$to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \"$to_be_found\" could not be found. Synchronizing after the addition must have failed. Exiting." + exit 1; + else + echo -e "\n\n\nOK. Synchronizing has worked as expected.\n\n\n" + return 0; + fi + +} + + + + +verify_ldif_delete() +{ + ldif="$1" + if test -z "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: \$ldif is empty. Exiting." + exit 1 + fi + + if test ! -f "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: $ldif could not be found. Exiting." + fi + + if test ! -r "$ldif"; then + echo -e "${FUNCNAME}(): ERROR: $ldif could be found, but was not readable. Exiting." + fi + + + DN_FULL=$(head -n 1 $ldif) + if test -z "$DN_FULL"; then + echo "${FUNCNAME}(): ERROR: \$DN_FULL is empty. Exiting." + exit 1; + fi + + DN=${DN_FULL#dn: } + if test -z "$DN"; then + echo "${FUNCNAME}(): ERROR: \$DN is empty. Exiting." + exit 1; + fi + + DN2=${DN/@/_} + if test -z "$DN2"; then + echo "${FUNCNAME}(): ERROR: \$DN2 is empty. Exiting." + exit 1; + fi + + to_be_found="" + + if test "$DN" == "$CONTACT1_DN" -o "$DN2" == "$CONTACT1_DN"; then + to_be_found="$CONTACT1_FILE" + elif test "$DN" == "$CONTACT2_DN" -o "$DN2" == "$CONTACT2_DN"; then + to_be_found="$CONTACT2_FILE" + elif test "$DN" == "$EVENT1_DN" -o "$DN2" == "$EVENT1_DN"; then + to_be_found="$EVENT1_FILE" + elif test "$DN" == "$TODO1_DN" -o "$DN2" == "$TODO1_DN"; then + to_be_found="$TODO1_FILE" + elif test "$DN" == "$NOTE1_DN" -o "$DN2" == "$NOTE1_DN"; then + to_be_found="$NOTE1_FILE" + elif test "$DN" == "$NOTE2_DN" -o "$DN2" == "$NOTE2_DN"; then + to_be_found="$NOTE2_FILE" + fi + + if test -z "$to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \$to_be_found could not be set. Exiting." + exit 1 + fi + + if test -f "$to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \"$to_be_found\" is still existing. Synchronizing after the deletion must have failed. Exiting." + exit 1; + else + echo -e "\n\n\nOK. Synchronizing has worked as expected.\n\n\n" + return 0; + fi + +} + + + + + + + + + + + + + +verify_file_add() +{ + xmlfile="$1" + if test -z "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: \$xmlfile is empty. Exiting." + exit 1 + fi + + if test ! -f "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: $xmlfile could not be found. Exiting." + fi + + if test ! -r "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: $xmlfile could be found, but was not readable. Exiting." + fi + + + short_name=$(basename $xmlfile) + if test -z "$short_name"; then + echo -e "${FUNCNAME}(): ERROR: \$short_name is empty. basename() must have failed." + exit 1 + fi + + dn_to_be_found="" + dn_to_be_found2="" + if test "$short_name" == "contact1.xml"; then + dn_to_be_found="$CONTACT1_DN" + elif test "$short_name" == "contact2.xml"; then + dn_to_be_found="$CONTACT2_DN" + elif test "$short_name" == "event1.xml"; then + dn_to_be_found="$EVENT1_DN" + elif test "$short_name" == "todo1.xml"; then + dn_to_be_found="$TODO1_DN" + elif test "$short_name" == "note1.xml"; then + dn_to_be_found="$NOTE1_DN" + elif test "$short_name" == "note2.xml"; then + dn_to_be_found="$NOTE2_DN" + fi + + if test -z "$dn_to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \$dn_to_be_found could not be set. Exiting." + exit 1 + fi + + dn_to_be_found2="${dn_to_be_found/@/_}" + + LDAPSEARCH=$(which ldapsearch 2>/dev/null) + + if test ! -f "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could be found, but is not executable. Exiting." + exit 1 + fi + + + echo "AUTH = \"$AUTH\"" + + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found" + output=`$cmd` + local rv=$? + if test $rv -ne 0; then + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" + output=`$cmd` + rv=$? + if test $rv -ne 0; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could not find \"$dn_to_be_found\" nor \"$dn_to_be_found2\". Synchronizing after the addition must have failed. Exiting." + exit 1 + fi + else + echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" + fi +} + + + + + +verify_file_delete() +{ + xmlfile="$1" + if test -z "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: \$xmlfile is empty. Exiting." + exit 1 + fi + + if test ! -f "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: $xmlfile could not be found. Exiting." + fi + + if test ! -r "$xmlfile"; then + echo -e "${FUNCNAME}(): ERROR: $xmlfile could be found, but was not readable. Exiting." + fi + + + short_name=$(basename $xmlfile) + if test -z "$short_name"; then + echo -e "${FUNCNAME}(): ERROR: \$short_name is empty. basename() must have failed." + exit 1 + fi + + dn_to_be_found="" + dn_to_be_found2="" + if test "$short_name" == "contact1.xml"; then + dn_to_be_found="$CONTACT1_DN" + elif test "$short_name" == "contact2.xml"; then + dn_to_be_found="CONTACT2_DN" + elif test "$short_name" == "event1.xml"; then + dn_to_be_found="$EVENT1_DN" + elif test "$short_name" == "todo1.xml"; then + dn_to_be_found="$TODO1_DN" + elif test "$short_name" == "note1.xml"; then + dn_to_be_found="NOTE1_DN" + elif test "$short_name" == "note2.xml"; then + dn_to_be_found="NOTE2_DN" + fi + + if test -z "$dn_to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \$dn_to_be_found could not be set. Exiting." + exit 1 + fi + + dn_to_be_found2="${dn_to_be_found/@/_}" + + LDAPSEARCH=$(which ldapsearch 2>/dev/null) + + if test ! -f "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could be found, but is not executable. Exiting." + exit 1 + fi + + + echo "AUTH = \"$AUTH\"" + + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" + output=`$cmd` + local rv=$? + if test $rv -eq 0; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch found \"$dn_to_be_found2\". Synchronizing after the deletion must have failed. Exiting." + exit 1 + else + echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" + fi +} + + + @@ -154,7 +461,7 @@ $OSYNCTOOL --listplugins | grep -q "$plugin" - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldap-sync was not included in pluginlist. Exiting." exit 1 @@ -183,7 +490,7 @@ $OSYNCTOOL --listformats | grep -q "ldap-evolutionperson" - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldap-evolutionperson was not included in formatlist. Exiting." exit 1 @@ -241,7 +548,7 @@ $OSYNCTOOL --listformats | grep -q "xmlformat-contact$" - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: xmlformat-contact was not included in formatlist. Exiting." exit 1 @@ -338,7 +645,7 @@ $OSYNCTOOL --configdir "$TMPDIR" --configure "$group" "$memberid" < "$SOURCE_DIR/$member_config_file" - rv=$? + local rv=$? export EDITOR="$oldeditor" @@ -392,7 +699,7 @@ configure_plugin "$group" "1" "file-sync.conf" - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: configure plugin \"$group\" \"1\" has failed. Exiting." @@ -574,7 +881,7 @@ echo "Command: $LDAPADD $AUTH -a -f $ldif" $LDAPADD $AUTH -a -f $ldif - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldapadd has failed. Exiting." exit $rv; @@ -633,7 +940,7 @@ echo "Command: $LDAPMODIFY $AUTH -f $entrymods" $LDAPMODIFY $AUTH -f $entrymods - rv=$? + local rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldapmodify has failed. Exiting." exit $rv; @@ -706,7 +1013,7 @@ echo "Command: $LDAPDELETE $AUTH -r $DN" $LDAPDELETE $AUTH -r $DN - rv=$? + local rv=$? if test $rv -ne 0; then $LDAPDELETE $AUTH -r ${DN/@/_} rv=$? @@ -861,7 +1168,15 @@ if test "$objtype" == "contact"; then - cp -f "$xmlfile" $CONTACT1_FILE + tmp=$(basename "$xmlfile") + if test "$tmp" == "contact1.xml"; then + cp -f "$xmlfile" $CONTACT1_FILE + elif test "$tmp" == "contact2.xml"; then + cp -f "$xmlfile" $CONTACT2_FILE + else + echo "$FUNCNAME(): ERROR: Cannot find out whether to take CONTACT1_FILE or CONTACT2_FILE. Exiting." + exit 1; + fi elif test "$objtype" == "event"; then cp -f "$xmlfile" $EVENT1_FILE |