You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-04-07 20:04:20
|
Author: cdfrey Date: Tue Apr 7 22:04:11 2009 New Revision: 5556 URL: http://www.opensync.org/changeset/5556 Log: Removed unused code to avoid warnings from gcc 4.3.2 Modified: format-plugins/vformat/src/vcard.c format-plugins/vformat/src/xmlformat-recurrence.c Modified: format-plugins/vformat/src/vcard.c ============================================================================== --- format-plugins/vformat/src/vcard.c Tue Apr 7 20:55:26 2009 (r5555) +++ format-plugins/vformat/src/vcard.c Tue Apr 7 22:04:11 2009 (r5556) @@ -60,12 +60,13 @@ } - +#if 0 static osync_bool vcard_categories_filter(OSyncData *data, const char *config) { //Check what categories are supported here. return FALSE; } +#endif static void destroy_vcard(char *input, unsigned int inpsize, void *user_data) { Modified: format-plugins/vformat/src/xmlformat-recurrence.c ============================================================================== --- format-plugins/vformat/src/xmlformat-recurrence.c Tue Apr 7 20:55:26 2009 (r5555) +++ format-plugins/vformat/src/xmlformat-recurrence.c Tue Apr 7 22:04:11 2009 (r5556) @@ -260,6 +260,7 @@ return frequency_id; } +#if 0 static char *convert_rrule_vcal_freqmod(OSyncXMLField *xmlfield, gchar **rule, int size, int freqstate) { int i; @@ -298,6 +299,7 @@ return g_string_free(fm_buffer, FALSE); } +#endif static char *convert_rrule_vcal_until(const char *until_utc) { |
From: <svn...@op...> - 2009-04-07 18:55:30
|
Author: scriptor Date: Tue Apr 7 20:55:26 2009 New Revision: 5555 URL: http://www.opensync.org/changeset/5555 Log: Further tests. Added: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync (contents, props changed) plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync (contents, props changed) plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync (contents, props changed) plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync (contents, props changed) Added: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync Tue Apr 7 20:55:26 2009 (r5555) @@ -0,0 +1,204 @@ +#!/bin/bash + +set -x + +FILE=$0 +test_name="$1" +PLUGINNAME="ldap-sync" +PLUGINPATH="$2/src" +CFG="$3/src/$PLUGINNAME" +OBJECTTYPE="$4" +XMLFILE="$5" +MODIFIED_FILE="$6" + + + + + + +OSYNCTOOL=$(which osynctool 2>/dev/null) +if test ! -f "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could not be found. Exiting." + exit 1 +fi + +if test ! -x "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could be found, but it is not executable. Exiting." + exit 1 +fi + + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_osynctool_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +source "$SOURCE_DIR/test.conf" +source "$SOURCE_DIR/check_osynctool_common.inc" + + + +echo "PLUGINPATH = \"$PLUGINPATH\"" +echo "CFG = \"$CFG\"" + + +if test -z "$XMLFILE"; then + echo "$FILE:$LINENO: ERROR: \$XMLFILE is empty. Exiting." + exit 1 +fi + +if test ! -f "$XMLFILE"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$XMLFILE"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + +if test -z "$MODIFIED_FILE"; then + echo "$FILE:$LINENO: ERROR: \$MODIFIED_FILE is empty. Exiting." + exit 1 +fi + +if test ! -f "$MODIFIED_FILE"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$MODIFIED_FILE"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + +if test -z "$VALGRIND"; then + echo "$FILE:$LINENO: ERROR: \$VALGRIND is empty. Exiting."; + exit 1; +fi + + + +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" + + + + +# Set up test group +prologue; + + +# Empty LDAP DIT +$SOURCE_DIR/remove_ldifs + + +# Remove entry from directory used by file-sync +remove_file_by_objtype "$OBJECTTYPE" + + +# Add XML file +echo -e "\n\n\nAdd XML file\n\n\n" +add_file "$OBJECTTYPE" "$XMLFILE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: add_file() has failed." + exit 1; +fi + + +# osynctool should synchronize only one particular object type: +echo -e "\n\n\nEnable just $OBJECTTYPE\n\n\n" +enable_only "$OBJECTTYPE" + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after an XML file has been added\n\n\n" +enable_trace_subdir "$test_name" "add" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + exit 1; +fi + +verify_file_add "$XMLFILE" + + +# Modify the XML File +echo -e "\n\n\nModify XML file\n\n\n" +modify_file "$OBJECTTYPE" "$XMLFILE" "$MODIFIED_FILE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: modify_file() has failed." + exit 1; +fi + +echo -e "\n\n\n" +diff "$XMLFILE" "$MODIFIED_FILE" +echo -e "\n\n\n" + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after the XML file has been modified\n\n\n" +enable_trace_subdir "$test_name" "modify" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2)." + exit 1; +fi + + +# Delete the XML File +echo -e "\n\n\nDelete XML file\n\n\n" +delete_file "$OBJECTTYPE" "$XMLFILE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: delete_file() has failed." + exit 1; +fi + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after the XML file has been deleted\n\n\n" +enable_trace_subdir "$test_name" "delete" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (3)." + exit 1; +fi +echo -e "\n\n\n" + + +verify_file_delete "$XMLFILE" + + +# Shut down test group +epilogue + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + + +exit $rv + +#vim:ts=2:sw=2 Added: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync Tue Apr 7 20:55:26 2009 (r5555) @@ -0,0 +1,404 @@ +#!/bin/bash + +set -x + +FILE=$0 +test_name="$1" +PLUGINNAME="ldap-sync" +PLUGINPATH="$2/src" +CFG="$3/src/$PLUGINNAME" +XMLFILE_CONTACT="$4" +XMLFILE_EVENT="$5" +XMLFILE_TODO="$6" +XMLFILE_NOTE="$7" +MODIFIED_FILE_CONTACT="$8" +MODIFIED_FILE_EVENT="$9" +MODIFIED_FILE_TODO="${10}" +MODIFIED_FILE_NOTE="${11}" + + + +OSYNCTOOL=$(which osynctool 2>/dev/null) +if test ! -f "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could not be found. Exiting." + exit 1 +fi + +if test ! -x "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could be found, but it is not executable. Exiting." + exit 1 +fi + + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_osynctool_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +source "$SOURCE_DIR/test.conf" +source "$SOURCE_DIR/check_osynctool_common.inc" + + + + +echo "PLUGINPATH = \"$PLUGINPATH\"" +echo "CFG = \"$CFG\"" + +if test -z "$XMLFILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \$XMLFILE_CONTACT is empty. Exiting." + exit 1 +fi + +if test ! -f "$XMLFILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_CONTACT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$XMLFILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_CONTACT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$XMLFILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \$XMLFILE_EVENT is empty. Exiting." + exit 1 +fi + +if test ! -f "$XMLFILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_EVENT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$XMLFILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_EVENT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$XMLFILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \$XMLFILE_TODO is empty. Exiting." + exit 1 +fi + +if test ! -f "$XMLFILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_TODO\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$XMLFILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_TODO\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$XMLFILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \$XMLFILE_NOTE is empty. Exiting." + exit 1 +fi + +if test ! -f "$XMLFILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_NOTE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$XMLFILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$XMLFILE_NOTE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + + + + + +if test -z "$MODIFIED_FILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \$MODIFIED_FILE_CONTACT is empty. Exiting." + exit 1 +fi + +if test ! -f "$MODIFIED_FILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_CONTACT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$MODIFIED_FILE_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_CONTACT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$MODIFIED_FILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \$MODIFIED_FILE_EVENT is empty. Exiting." + exit 1 +fi + +if test ! -f "$MODIFIED_FILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_EVENT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$MODIFIED_FILE_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_EVENT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$MODIFIED_FILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \$MODIFIED_FILE_TODO is empty. Exiting." + exit 1 +fi + +if test ! -f "$MODIFIED_FILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_TODO\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$MODIFIED_FILE_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_TODO\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$MODIFIED_FILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \$MODIFIED_FILE_NOTE is empty. Exiting." + exit 1 +fi + +if test ! -f "$MODIFIED_FILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_NOTE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$MODIFIED_FILE_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$MODIFIED_FILE_NOTE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$VALGRIND"; then + echo "$FILE:$LINENO: ERROR: \$VALGRIND is empty. Exiting."; + exit 1; +fi + + + + + + +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" + + + + +# Set up test group +prologue; + +# Empty LDAP DIT +$SOURCE_DIR/remove_ldifs + +# Remove entry from directory used by file-sync +remove_files + + +# Add XML files +echo -e "\n\n\nAdd XML files\n\n\n" +add_file "contact" "$XMLFILE_CONTACT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: add_file() has failed." + exit 1; +fi + +add_file "event" "$XMLFILE_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: add_file() has failed." + exit 1; +fi + +add_file "todo" "$XMLFILE_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: add_file() has failed." + exit 1; +fi + +add_file "note" "$XMLFILE_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: add_file() has failed." + exit 1; +fi + + + + + +# Trigger synchronization after ADD +echo -e "\n\n\nSynchronize after 4 XML files have been added\n\n\n" +enable_trace_subdir "$test_name" "add" +valgrind_fast_sync +rv=$? +if test "$rv" -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync has failed after 4 XML files have been added." + exit $rv +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 +echo -e "\n\n\nModify 4 XML files\n\n\n" +modify_file "contact" "$XMLFILE_CONTACT" "$MODIFIED_FILE_CONTACT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: modify_file() has failed." + exit 1; +fi + + +modify_file "event" "$XMLFILE_EVENT" "$MODIFIED_FILE_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: modify_file() has failed." + exit 1; +fi + + +modify_file "todo" "$XMLFILE_TODO" "$MODIFIED_FILE_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: modify_file() has failed." + exit 1; +fi + + +modify_file "note" "$XMLFILE_NOTE" "$MODIFIED_FILE_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: modify_file() has failed." + exit 1; +fi + + + + + + +# Trigger synchronization after MODIFY +echo -e "\n\n\nSynchronize after 4 XML files have been modified\n\n\n" +enable_trace_subdir "$test_name" "modify" +valgrind_fast_sync +rv=$? +if test "$rv" -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync has failed after 4 XML files have been modified." + exit $rv +fi + + + + + + + +# Delete all of the 4 XML Files +echo -e "\n\n\nDelete 4 XML files\n\n\n" +delete_file "contact" "$XMLFILE_CONTACT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: delete_file() has failed." + exit 1; +fi + +delete_file "event" "$XMLFILE_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: delete_file() has failed." + exit 1; +fi + +delete_file "todo" "$XMLFILE_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: delete_file() has failed." + exit 1; +fi + +delete_file "note" "$XMLFILE_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: delete_file() has failed." + exit 1; +fi + + + + + + + + +# Trigger synchronization after DELETE +echo -e "\n\n\nSynchronize after 4 XML files have been deleted\n\n\n" +enable_trace_subdir "$test_name" "delete" +valgrind_fast_sync +rv=$? +if test "$rv" -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync has failed after 4 XML files have been deleted." + exit $rv +fi + + + + + +verify_file_delete "$XMLFILE_CONTACT" +verify_file_delete "$XMLFILE_EVENT" +verify_file_delete "$XMLFILE_TODO" +verify_file_delete "$XMLFILE_NOTE" + + + + + +# Shut down test group +epilogue + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + + +exit $rv Added: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync Tue Apr 7 20:55:26 2009 (r5555) @@ -0,0 +1,397 @@ +#!/bin/bash + +set -x + +FILE=$0 +test_name="$1" +PLUGINNAME="ldap-sync" +PLUGINPATH="$2/src" +CFG="$3/src/$PLUGINNAME" +LDIF_CONTACT="$4" +LDIF_EVENT="$5" +LDIF_TODO="$6" +LDIF_NOTE="$7" +ENTRYMODS_CONTACT="$8" +ENTRYMODS_EVENT="$9" +ENTRYMODS_TODO="${10}" +ENTRYMODS_NOTE="${11}" + + + +OSYNCTOOL=$(which osynctool 2>/dev/null) +if test ! -f "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could not be found. Exiting." + exit 1 +fi + +if test ! -x "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could be found, but it is not executable. Exiting." + exit 1 +fi + + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_osynctool_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +source "$SOURCE_DIR/test.conf" +source "$SOURCE_DIR/check_osynctool_common.inc" + + + +echo "PLUGINPATH = \"$PLUGINPATH\"" +echo "CFG = \"$CFG\"" + + + + +if test -z "$LDIF_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \$LDIF_CONTACT is empty. Exiting." + exit 1 +fi + +if test ! -f "$LDIF_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_CONTACT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$LDIF_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_CONTACT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$LDIF_EVENT"; then + echo "$FILE:$LINENO: ERROR: \$LDIF_EVENT is empty. Exiting." + exit 1 +fi + +if test ! -f "$LDIF_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_EVENT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$LDIF_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_EVENT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$LDIF_TODO"; then + echo "$FILE:$LINENO: ERROR: \$LDIF_TODO is empty. Exiting." + exit 1 +fi + +if test ! -f "$LDIF_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_TODO\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$LDIF_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_TODO\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$LDIF_NOTE"; then + echo "$FILE:$LINENO: ERROR: \$LDIF_NOTE is empty. Exiting." + exit 1 +fi + +if test ! -f "$LDIF_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_NOTE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$LDIF_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF_NOTE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + + + + + +if test -z "$ENTRYMODS_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \$ENTRYMODS_CONTACT is empty. Exiting." + exit 1 +fi + +if test ! -f "$ENTRYMODS_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_CONTACT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$ENTRYMODS_CONTACT"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_CONTACT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + +if test -z "$ENTRYMODS_EVENT"; then + echo "$FILE:$LINENO: ERROR: \$ENTRYMODS_EVENT is empty. Exiting." + exit 1 +fi + +if test ! -f "$ENTRYMODS_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_EVENT\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$ENTRYMODS_EVENT"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_EVENT\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + +if test -z "$ENTRYMODS_TODO"; then + echo "$FILE:$LINENO: ERROR: \$ENTRYMODS_TODO is empty. Exiting." + exit 1 +fi + +if test ! -f "$ENTRYMODS_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_TODO\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$ENTRYMODS_TODO"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_TODO\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$ENTRYMODS_NOTE"; then + echo "$FILE:$LINENO: ERROR: \$ENTRYMODS_NOTE is empty. Exiting." + exit 1 +fi + +if test ! -f "$ENTRYMODS_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_NOTE\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$ENTRYMODS_NOTE"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS_NOTE\" could be found, but it is not readable. Exiting." + exit 1 +fi + + + + +if test -z "$VALGRIND"; then + echo "$FILE:$LINENO: ERROR: \$VALGRIND is empty. Exiting."; + exit 1; +fi + + + + + + +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" + + + + +# Set up test group +prologue; + + +# Empty LDAP DIT +$SOURCE_DIR/remove_ldifs + + +# Remove entry from directory used by file-sync +remove_files + + +# Add 4 LDIFs +echo -e "\n\n\nAdd 4 LDIFs\n\n\n" +run_ldapadd "$LDIF_CONTACT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapadd has failed." + exit 1; +fi + +run_ldapadd "$LDIF_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapadd has failed." + exit 1; +fi + +run_ldapadd "$LDIF_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapadd has failed." + exit 1; +fi + +run_ldapadd "$LDIF_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapadd has failed." + exit 1; +fi + + + + + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after 4 LDIFs have been added\n\n\n" +enable_trace_subdir "$test_name" "add" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + exit 1; +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" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapmodify() has failed." + exit 1; +fi + +run_ldapmodify "$ENTRYMODS_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapmodify() has failed." + exit 1; +fi + +run_ldapmodify "$ENTRYMODS_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapmodify() has failed." + exit 1; +fi + +run_ldapmodify "$ENTRYMODS_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapmodify() has failed." + exit 1; +fi + + + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after all of the 4 LDIFs have been modified\n\n\n" +enable_trace_subdir "$test_name" "modify" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2)." + exit 1; +fi + + +# Delete all of the 4 LDIFs +echo -e "\n\n\nDelete all of the 4 LDIFs\n\n\n" +run_ldapdelete "$LDIF_CONTACT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapdelete has failed." + exit 1; +fi + +run_ldapdelete "$LDIF_EVENT" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapdelete has failed." + exit 1; +fi + +run_ldapdelete "$LDIF_TODO" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapdelete has failed." + exit 1; +fi + +run_ldapdelete "$LDIF_NOTE" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapdelete has failed." + exit 1; +fi + + + + + + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after the LDIFs have been deleted\n\n\n" +enable_trace_subdir "$test_name" "delete" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (3)." + exit 1; +fi +echo -e "\n\n\n" + + + +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 + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + + +exit $rv + +#vim:ts=2:sw=2 Added: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Tue Apr 7 20:55:26 2009 (r5555) @@ -0,0 +1,198 @@ +#!/bin/bash + +set -x + +FILE=$0 +test_name="$1" +PLUGINNAME="ldap-sync" +PLUGINPATH="$2/src" +CFG="$3/src/$PLUGINNAME" +OBJECTTYPE="$4" +LDIF="$5" +ENTRYMODS="$6" + + + +OSYNCTOOL=$(which osynctool 2>/dev/null) +if test ! -f "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could not be found. Exiting." + exit 1 +fi + +if test ! -x "$OSYNCTOOL"; then + echo "$FILE:$LINENO: ERROR: osynctool could be found, but it is not executable. Exiting." + exit 1 +fi + + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_osynctool_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +source "$SOURCE_DIR/test.conf" +source "$SOURCE_DIR/check_osynctool_common.inc" + + + +echo "PLUGINPATH = \"$PLUGINPATH\"" +echo "CFG = \"$CFG\"" + + +if test -z "$LDIF"; then + echo "$FILE:$LINENO: ERROR: \$LDIF is empty. Exiting." + exit 1 +fi + +if test ! -f "$LDIF"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$LDIF"; then + echo "$FILE:$LINENO: ERROR: \"$LDIF\" could be found, but it is not readable. Exiting." + exit 1 +fi + + +if test -z "$ENTRYMODS"; then + echo "$FILE:$LINENO: ERROR: \$ENTRYMODS is empty. Exiting." + exit 1 +fi + +if test ! -f "$ENTRYMODS"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS\" could not be found. Exiting." + exit 1 +fi + +if test ! -r "$ENTRYMODS"; then + echo "$FILE:$LINENO: ERROR: \"$ENTRYMODS\" could be found, but it is not readable. Exiting." + exit 1 +fi + +if test -z "$VALGRIND"; then + echo "$FILE:$LINENO: ERROR: \$VALGRIND is empty. Exiting."; + exit 1; +fi + + + +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" + + + + +# Set up test group +prologue; + + +# Empty LDAP DIT +$SOURCE_DIR/remove_ldifs + + +# Remove entry from directory used by file-sync +remove_file_by_objtype "$OBJECTTYPE" + + +# Add LDIF +echo -e "\n\n\nAdd LDIF\n\n\n" +run_ldapadd "$LDIF" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapadd has failed." + exit 1; +fi + + +# osynctool should synchronize only one particular object type: +echo -e "\n\n\nEnable just $OBJECTTYPE\n\n\n" +enable_only "$OBJECTTYPE" + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after an LDIF has been added\n\n\n" +enable_trace_subdir "$test_name" "add" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + exit 1; +fi + +verify_ldif_add "$LDIF" + +# Modify the LDIF +echo -e "\n\n\nModify LDIF\n\n\n" +run_ldapmodify "$ENTRYMODS" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapmodify() has failed." + exit 1; +fi + + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after the LDIF has been modified\n\n\n" +enable_trace_subdir "$test_name" "modify" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + exit 1; +fi + + +# Delete the LDIF +echo -e "\n\n\nDelete LDIF\n\n\n" +run_ldapdelete "$LDIF" +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: run_ldapdelete has failed." + exit 1; +fi + + +# Trigger synchronization +echo -e "\n\n\nSynchronize after the LDIF has been deleted\n\n\n" +enable_trace_subdir "$test_name" "delete" +valgrind_fast_sync +rv=$? +if test $rv -ne 0; then + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + exit 1; +fi +echo -e "\n\n\n" + + + +verify_ldif_delete "$LDIF" + + + +# Shut down test group +epilogue + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + + +exit $rv + +#vim:ts=2:sw=2 |
From: <svn...@op...> - 2009-04-07 18:54:39
|
Author: scriptor Date: Tue Apr 7 20:54:36 2009 New Revision: 5554 URL: http://www.opensync.org/changeset/5554 Log: One bug less... Modified: plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Tue Apr 7 20:54:28 2009 (r5553) +++ plugins/ldap-sync/tests/opensync.suppr Tue Apr 7 20:54:36 2009 (r5554) @@ -87,34 +87,6 @@ } -{ - <Invalid read 3> - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_message_write_data - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* - obj:* - obj:* - obj:* -} { @@ -145,32 +117,6 @@ } -{ - <Invalid read of size 1> - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_message_write_data - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone -} - { <Invalid read - 4 bytes inside a block of size 28 free'd> @@ -2246,34 +2192,6 @@ obj:* } -{ - <ldap_plugin.c: In osync_report_change() ! > - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_marshal_write_data - fun:osync_marshal_write_buffer - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_report_changes_to_be_added - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* -} { @@ -2294,65 +2212,7 @@ } -{ - <insert a suppression name here> - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_marshal_write_data - fun:osync_marshal_write_buffer - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_report_changes_to_be_added - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* -} - - -{ - <insert a suppression name here> - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_marshal_write_data - fun:osync_marshal_write_buffer - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_report_changes_to_be_added - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* -} { @@ -2480,34 +2340,6 @@ -{ - <uninitializsed value 1 - no clue.> - Memcheck:Cond - fun:xmlDocDumpFormatMemoryEnc - fun:osync_xmlformat_assemble - fun:marshal_xmlformat - fun:osync_objformat_marshal - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_report_changes_to_be_added - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* - obj:* - obj:* -} { @@ -4307,35 +4139,3 @@ } -{ - <insert a suppression name here> - Memcheck:Addr1 - fun:memcpy - fun:g_array_append_vals - fun:g_byte_array_append - fun:osync_marshal_write_data - fun:osync_marshal_write_buffer - fun:osync_message_write_buffer - fun:osync_marshal_data - fun:osync_marshal_change - fun:_osync_client_change_callback - fun:osync_context_report_change - fun:ldap_plugin_report_change - fun:ldap_plugin_report_changes_to_be_added - fun:ldap_plugin_get_changes - fun:osync_objtype_sink_get_changes - fun:_osync_client_handle_get_changes - fun:_osync_client_message_handler - fun:_incoming_dispatch - fun:g_main_context_dispatch - obj:/lib/libglib-2.0.so.0.1800.3 - fun:g_main_loop_run - obj:/lib/libglib-2.0.so.0.1800.3 - fun:start_thread - fun:clone - obj:* -} - - - - |
From: <svn...@op...> - 2009-04-07 18:54:31
|
Author: scriptor Date: Tue Apr 7 20:54:28 2009 New Revision: 5553 URL: http://www.opensync.org/changeset/5553 Log: Still fighting against cmake about how to set a custom timeout: As it seems, it is only the DART_TESTING_TIMEOUT variable that gets noticed by cmake/ctest. And this variable needs to be set in CTestConfig.cmake rather than in tests/CMakeLists.txt. Besides, added some further tests. Modified: plugins/ldap-sync/CTestConfig.cmake plugins/ldap-sync/tests/CMakeLists.txt Modified: plugins/ldap-sync/CTestConfig.cmake ============================================================================== --- plugins/ldap-sync/CTestConfig.cmake Tue Apr 7 20:54:15 2009 (r5552) +++ plugins/ldap-sync/CTestConfig.cmake Tue Apr 7 20:54:28 2009 (r5553) @@ -12,8 +12,14 @@ set(CTEST_DROP_LOCATION "/testing/submit.php?project=ldap-sync") set(CTEST_DROP_SITE_CDASH TRUE) -set (CTEST_TEST_TIMEOUT 300) -set (CMAKE_LONG_TEST_TIMEOUT 300) -set (DART_TESTING_TIMEOUT 300) -set (CTEST_TIME_LIMIT 300) -set (TIMEOUT 300) +IF (RUN_LONG_TESTS) + set (TIMEOUT 3600) +ELSE(RUN_LONG_TESTS) + set (TIMEOUT 300) +ENDIF(RUN_LONG_TESTS) + +set (CTEST_TEST_TIMEOUT ${TIMEOUT}) +set (CMAKE_LONG_TEST_TIMEOUT ${TIMEOUT}) +set (DART_TESTING_TIMEOUT ${TIMEOUT}) +set (CTEST_TIME_LIMIT ${TIMEOUT}) + Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Tue Apr 7 20:54:15 2009 (r5552) +++ plugins/ldap-sync/tests/CMakeLists.txt Tue Apr 7 20:54:28 2009 (r5553) @@ -14,12 +14,15 @@ # Setting a custom timeout does not work, at all, either. Completely buggy. +# # The only variable that seems to be considered by cmake/ctest is # DART_TESTING_TIMEOUT. And even this variable does not get set until # cmake is run for the second time. This is getting on my nerves. - +# +# DART_TESTING_TIMEOUT must be set in CTestConfig.cmake rather than here. +# At least, it seems so... IF (RUN_LONG_TESTS) - SET ( TIMEOUT 1800 CACHE STRING "General timeout value.") + SET ( TIMEOUT 3600 CACHE STRING "General timeout value.") ELSE(RUN_LONG_TESTS) SET ( TIMEOUT 300 CACHE STRING "General timeout value.") ENDIF(RUN_LONG_TESTS) @@ -570,10 +573,8 @@ ADD_TEST( valgrind_osynctool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) - ADD_TEST( valgrind_osynctool_add_note1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) + ADD_TEST( valgrind_osynctool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) - ADD_TEST( valgrind_osynctool_add_note2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.ldif" ) - ADD_TEST( clean_up6 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) @@ -590,7 +591,41 @@ ADD_TEST( valgrind_osynctool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) - + + ADD_TEST( clean_up7 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + + + ADD_TEST( valgrind_osynctool_add_mod_del_contact1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" "${TESTDIR}/contact1.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_contact2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" "${TESTDIR}/contact2.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_event_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" "${TESTDIR}/event1.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_todo_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" "${TESTDIR}/todo1.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_note1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" "${TESTDIR}/note1.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_note2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" "${TESTDIR}/note2.xml_modified" ) + + ADD_TEST( valgrind_osynctool_add_mod_del_all_four_xmlfiles ${TESTDIR}/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_xmlfiles" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${TESTDIR}/contact1.xml" "${TESTDIR}/event1.xml" "${TESTDIR}/todo1.xml" "${TESTDIR}/note1.xml" "${TESTDIR}/contact1.xml_modified" "${TESTDIR}/event1.xml_modified" "${TESTDIR}/todo1.xml_modified" "${TESTDIR}/note1.xml_modified" ) + + + ADD_TEST( clean_up8 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + + + ADD_TEST( valgrind_osynctool_add_mod_del_contact1_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods ) + + ADD_TEST( valgrind_osynctool_add_mod_del_contact2_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods ) + + ADD_TEST( valgrind_osynctool_add_mod_del_event_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods ) + + ADD_TEST( valgrind_osynctool_add_mod_del_todo_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods ) + + ADD_TEST( valgrind_osynctool_add_mod_del_note_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods ) + + ADD_TEST( valgrind_osynctool_add_mod_del_all_four_ldifs_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_ldifs_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods ) + + ENDIF (VALGRIND_EXECUTABLE) ENDIF (LDAPDELETE_EXECUTABLE) ENDIF (LDAPMODIFY_EXECUTABLE) |
From: <svn...@op...> - 2009-04-07 18:54:21
|
Author: scriptor Date: Tue Apr 7 20:54:15 2009 New Revision: 5552 URL: http://www.opensync.org/changeset/5552 Log: Fixed an "Invalid read of size 1" memory error. Modified: plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Tue Apr 7 00:11:18 2009 (r5551) +++ plugins/ldap-sync/src/ldap_plugin.c Tue Apr 7 20:54:15 2009 (r5552) @@ -1443,7 +1443,7 @@ // Add the GList to the glist_container - to_be_reported = g_malloc0(sizeof(glist_container)); + to_be_reported = g_malloc0(sizeof(glist_container) + 1); if (to_be_reported == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: to_be_reported = NULL.", __FILE__, __LINE__); goto error; @@ -1456,7 +1456,8 @@ to_be_reported->magic = "glist_container"; to_be_reported->list = list_to_be_reported; - + char *ptr = (char *)to_be_reported; + ptr[sizeof(glist_container)] = 0; osync_assert(to_be_reported); osync_trace(TRACE_INTERNAL, "%s:%i: sizeof(*to_be_reported) = %u", __FILE__, __LINE__, sizeof(*to_be_reported)); |
From: <svn...@op...> - 2009-04-06 22:11:24
|
Author: henrik Date: Tue Apr 7 00:11:18 2009 New Revision: 5551 URL: http://www.opensync.org/changeset/5551 Log: 1) Currently DisplayName=FirstName+<SPACE>+LastName. Correction so the <SPACE> is only inserted if the both FirstName and LastName are not empty. 2) Only add attributes which have attributeType==ATTRIBUTE_EQUAL. Before we could have two emails with PREF set. Modified: plugins/mozilla-sync/trunk/src/thunderbird-card.cpp plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Modified: plugins/mozilla-sync/trunk/src/thunderbird-card.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/thunderbird-card.cpp Mon Apr 6 22:21:25 2009 (r5550) +++ plugins/mozilla-sync/trunk/src/thunderbird-card.cpp Tue Apr 7 00:11:18 2009 (r5551) @@ -489,6 +489,8 @@ rv=myCard->GetPropertyAsAString("LastName", ln); MOZ_ERROR_CHECK_FALSE(rv, "nsIAbCard::GetPropertyAsAString LastName"); +// TODO: if ( (nFirstName>0) && (nLastName>0) ) + nsString dn; dn.Assign(fn); dn.Append(0x20); @@ -507,10 +509,16 @@ PRUint32 nFirstName=NS_strlen(pruFirstName); PRUint32 nLastName=NS_strlen(pruLastName); PRUnichar *pruDisplayName = (PRUnichar*) NS_Alloc((nFirstName + nLastName + 2) * sizeof(PRUnichar)); - memcpy(pruDisplayName, pruFirstName, nFirstName * sizeof(PRUnichar)); - pruDisplayName[nFirstName] = 0x20; //Space - memcpy(pruDisplayName+nFirstName+1, pruLastName, nLastName * sizeof(PRUnichar)); - pruDisplayName[nFirstName + nLastName + 1] = 0; + PRUint32 nSpace=0; + if (nFirstName>0) { + memcpy(pruDisplayName, pruFirstName, nFirstName * sizeof(PRUnichar)); + if (nLastName>0) { + pruDisplayName[nFirstName] = 0x20; //Space + nSpace=1; + } + } + memcpy(pruDisplayName+nFirstName+nSpace, pruLastName, nLastName * sizeof(PRUnichar)); + pruDisplayName[nFirstName + nLastName + nSpace] = 0; rv=myCard->SetCardValue("DisplayName", pruDisplayName); MOZ_ERROR_CHECK_FALSE(rv, "nsIAbCard::SetCardValue DisplayName"); NS_Free(pruFirstName); @@ -749,10 +757,12 @@ for (pXmlAttributeDef=&(pXmlGroupDef->xmlAttributeDef[0]); pXmlAttributeDef->attributeType; pXmlAttributeDef++) { - rc = xmlTextWriterWriteAttribute(writer, - BAD_CAST pXmlAttributeDef->szAttribute, - BAD_CAST pXmlAttributeDef->szValue); - RC_ERROR_CHECK(buf,"xmlTextWriterWriteAttribute: Error at xmlTextWriterWriteAttribute\n"); + + if (pXmlAttributeDef->attributeType==ATTRIBUTE_EQUAL) + rc = xmlTextWriterWriteAttribute(writer, + BAD_CAST pXmlAttributeDef->szAttribute, + BAD_CAST pXmlAttributeDef->szValue); + RC_ERROR_CHECK(buf,"xmlTextWriterWriteAttribute: Error at xmlTextWriterWriteAttribute\n"); } } Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 Mon Apr 6 22:21:25 2009 (r5550) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 Tue Apr 7 00:11:18 2009 (r5551) @@ -5,7 +5,7 @@ ADR;WORK:;first work address second line;first work street 1;first work cit y;FFFF;11111111;first work country EMAIL;PREF:on...@ex... -EMAIL;PREF:fi...@ex... +EMAIL:fi...@ex... FN:one first N:first;one;;; ORG:first organization;first department @@ -15,4 +15,4 @@ TEL;FAX:111333 TITLE:first title URL:first.example.com -END:VCARD \ No newline at end of file +END:VCARD Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 Mon Apr 6 22:21:25 2009 (r5550) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 Tue Apr 7 00:11:18 2009 (r5551) @@ -6,7 +6,7 @@ ADR;WORK:;second work address second line;second work street 1;secondwork c ity;SSSS;22222222;second work country EMAIL;PREF:tw...@ex... -EMAIL;PREF:se...@ex... +EMAIL:se...@ex... FN:two second N:second;two;;; ORG:second organization;second department Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Mon Apr 6 22:21:25 2009 (r5550) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Tue Apr 7 00:11:18 2009 (r5551) @@ -5,7 +5,7 @@ ADR;WORK:;third work address second line;third work street 3;third work cit y;TTTT;33333333;third work country EMAIL;PREF:th...@ex... -EMAIL;PREF:th...@ex... +EMAIL:th...@ex... FN:three third N:third;three;;; ORG:third organization;third department @@ -15,4 +15,4 @@ TEL;FAX:333333 TITLE:third title URL:third.example.com -END:VCARD \ No newline at end of file +END:VCARD |
From: <svn...@op...> - 2009-04-06 20:21:36
|
Author: scriptor Date: Mon Apr 6 22:21:25 2009 New Revision: 5550 URL: http://www.opensync.org/changeset/5550 Log: Completed support for proxy authorization (authz): If you want to act on behalf of someone else, you authenticate as one person, and state the name of the other person as "authorization identifier" authz. Modified: plugins/ldap-sync/src/ldap-sync plugins/ldap-sync/src/ldap_connect.c plugins/ldap-sync/src/ldap_plugin.c plugins/ldap-sync/src/ldap_plugin.h plugins/ldap-sync/src/ldap_sasl.c Modified: plugins/ldap-sync/src/ldap-sync ============================================================================== --- plugins/ldap-sync/src/ldap-sync Mon Apr 6 22:20:51 2009 (r5549) +++ plugins/ldap-sync/src/ldap-sync Mon Apr 6 22:21:25 2009 (r5550) @@ -15,6 +15,12 @@ </AdvancedOption> <AdvancedOption> + <Name>authzid</Name> + <Type>string</Type> + <Value></Value> + </AdvancedOption> + + <AdvancedOption> <Name>password</Name> <Type>string</Type> <Value>secret</Value> Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Mon Apr 6 22:20:51 2009 (r5549) +++ plugins/ldap-sync/src/ldap_connect.c Mon Apr 6 22:21:25 2009 (r5550) @@ -1350,7 +1350,7 @@ msg = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, rv); - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to search on \"%s\" with filter \"%s\" and scope \"%s\": %s", __FILE__, __LINE__, searchbase, filter, scope_str, msg ? msg : ""); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to search on \"%s\" with authentication mechanism \"%s\", filter \"%s\" and scope \"%s\": %s", __FILE__, __LINE__, searchbase, sinkenv->authmech, filter, scope_str, msg ? msg : ""); if (msg) { g_free(msg); @@ -2242,7 +2242,7 @@ #endif - osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: uid = NULL. Returning NULL. May be, that there is really not a single entry stored on the LDAP server.\n", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: uid = NULL. Returning NULL. May be, that there is really not a single entry stored on the LDAP server. Authentication mechanism = \"%s\", objtype = \"%s\", scope LDAP_SCOPE_ONELEVEL, searchbase = \"%s\", filter=\"%s\".\n", __FILE__, __LINE__, sinkenv->authmech, osync_objtype_sink_get_name(sinkenv->sink), sinkenv->searchbase, filter); if (ldap_get_option(sinkenv->ld, LDAP_OPT_RESULT_CODE, &result_code) != LDAP_OPT_SUCCESS) { Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Mon Apr 6 22:20:51 2009 (r5549) +++ plugins/ldap-sync/src/ldap_plugin.c Mon Apr 6 22:21:25 2009 (r5550) @@ -82,6 +82,11 @@ sinkenv->authcid = NULL; } + if (sinkenv->authzid) { + g_free(sinkenv->authzid); + sinkenv->authzid = NULL; + } + if (sinkenv->authmech) { g_free(sinkenv->authmech); sinkenv->authmech = NULL; @@ -617,6 +622,7 @@ sinkenv->binddn = NULL; sinkenv->bindpwd = NULL; sinkenv->authcid = NULL; + sinkenv->authzid = NULL; sinkenv->searchbase = NULL; sinkenv->searchfilter = NULL; sinkenv->storebase = NULL; @@ -684,6 +690,9 @@ if (!strcmp(name, "authcid")) sinkenv->authcid = g_strdup(val); + if (!strcmp(name, "authzid")) + sinkenv->authzid = g_strdup(val); + if (!strcmp(name, "anonymous")) { #ifdef DEBUG_auth ldap_plugin_printf("%s:%i: Previous setting of anonymous was: %i", __FILE__, __LINE__, sinkenv->anonymous); @@ -1012,6 +1021,12 @@ osync_trace(TRACE_INTERNAL, "sinkenv->authcid = NULL"); + if (sinkenv->authzid) + osync_trace(TRACE_INTERNAL, "sinkenv->authzid = \"%s\"", sinkenv->authzid); + else + osync_trace(TRACE_INTERNAL, "sinkenv->authzid = NULL"); + + if (sinkenv->bindpwd) osync_trace(TRACE_SENSITIVE, "sinkenv->bindpwd = \"%s\"", sinkenv->bindpwd); else Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Mon Apr 6 22:20:51 2009 (r5549) +++ plugins/ldap-sync/src/ldap_plugin.h Mon Apr 6 22:21:25 2009 (r5550) @@ -319,6 +319,9 @@ char *url; ///< URL, resulting from hostname, port and encryption. char *binddn; ///< Bind DN (for simple authentication) char *authcid; ///< authcid (for SASL based authentication) + char *authzid; ///< authzid If the user wants to act on behalf of + ///< someone else. Proxy authorization: Authenticate + ///< as one person, act as a different person. char *bindpwd; ///< Bind password char *searchbase; ///< Base DN for any searches char *searchfilter; ///< Search filter Modified: plugins/ldap-sync/src/ldap_sasl.c ============================================================================== --- plugins/ldap-sync/src/ldap_sasl.c Mon Apr 6 22:20:51 2009 (r5549) +++ plugins/ldap-sync/src/ldap_sasl.c Mon Apr 6 22:21:25 2009 (r5550) @@ -138,11 +138,14 @@ * Has to be freed by ber_free(); likewise the members of this struct. * * @param ld The LDAP connection handle. - * @param mech The SASL mechanism. + * @param mech The SASL authentication mechanism. * @param realm SASL realm - * @param authcid For authentication + * @param authcid The authentication identifier. * @param passwd Password - * @param authzid For authorization + * @param authzid The authorization identifier, if the person who has + * authenticated as authcid wants to act on behalf of + * someone else. Then the authzid must be the identifier + * of this other person. * */ |
From: <svn...@op...> - 2009-04-06 20:20:57
|
Author: scriptor Date: Mon Apr 6 22:20:51 2009 New Revision: 5549 URL: http://www.opensync.org/changeset/5549 Log: Update. Modified: plugins/ldap-sync/ChangeLog Modified: plugins/ldap-sync/ChangeLog ============================================================================== --- plugins/ldap-sync/ChangeLog Mon Apr 6 22:20:43 2009 (r5548) +++ plugins/ldap-sync/ChangeLog Mon Apr 6 22:20:51 2009 (r5549) @@ -31,7 +31,7 @@ session is encrypted... -- SASL/GSSAPI carrying Kerberos V5 works, even though right now there are no special/separate configuration options regarding the - "realm" and the "authzid" (TODO). Prerequisite is, as always with + "realm" (TODO). Prerequisite is, as always with Kerberos V5, that a ticket-granting ticket has been obtained prior to running osynctool (e.g. "kinit -V ldap_user"). -- SASL/EXTERNAL works, as well, provided that the LDAP session @@ -40,6 +40,8 @@ the SSL/TLS certificate of the client and mapping this SSL/TLS DN to an LDAP DN. This LDAP DN is treated as the authentication DN. The mapping can be configured in slapd.conf (authz-regexp). + -- Proxy authorization should work (authenticate as one person, + act as a different person). - Some smaller issues, like hangs, error messages etc. have been resolved. - For the time being the objtype "contact" can be mapped @@ -48,6 +50,10 @@ - The other objtypes are mapped to general object classes, like "ou:" and "document:", while some LDAP attribute names are abused for storing "name" and "value" pairs. +- A test suite has been added. The test suite works only, if run + inside of an environment with a running LDAP server (slapd from + openldap-2.4.x), and if LDAP utilities like ldapsearch, ldapadd, + ldapmodify and ldapdelete, further xsltproc and xmllint are present. 0.22: |
From: <svn...@op...> - 2009-04-06 20:20:48
|
Author: scriptor Date: Mon Apr 6 22:20:43 2009 New Revision: 5548 URL: http://www.opensync.org/changeset/5548 Log: Corrected wrong identifier. Modified: plugins/ldap-sync/tests/contact2.xml Modified: plugins/ldap-sync/tests/contact2.xml ============================================================================== --- plugins/ldap-sync/tests/contact2.xml Mon Apr 6 22:20:27 2009 (r5547) +++ plugins/ldap-sync/tests/contact2.xml Mon Apr 6 22:20:43 2009 (r5548) @@ -112,7 +112,7 @@ <Content>Emperor</Content> </Title> <Uid> - <Content>pas-id-49C62FB900000022</Content> + <Content>pas-id-49C6A95E00000026</Content> </Uid> <Url> <Content>http://www.example.com/</Content> |
From: <svn...@op...> - 2009-04-06 20:20:33
|
Author: scriptor Date: Mon Apr 6 22:20:27 2009 New Revision: 5547 URL: http://www.opensync.org/changeset/5547 Log: Renamed remove_test_ldifs to remove_ldifs. Added remove_trace_dirs. Added: plugins/ldap-sync/tests/remove_ldifs (props changed) - copied unchanged from r5537, plugins/ldap-sync/tests/remove_test_ldifs plugins/ldap-sync/tests/remove_trace_dirs (contents, props changed) Deleted: plugins/ldap-sync/tests/remove_test_ldifs Modified: plugins/ldap-sync/tests/CMakeLists.txt plugins/ldap-sync/tests/clean_up Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Mon Apr 6 22:20:05 2009 (r5546) +++ plugins/ldap-sync/tests/CMakeLists.txt Mon Apr 6 22:20:27 2009 (r5547) @@ -109,6 +109,11 @@ +#################################################### +# Remove all of the directories that contain trace files +ADD_TEST( remove_trace_dirs ${TESTDIR}/remove_trace_dirs ) + + ##################################################### # Check just the stylesheets themselves for validity using external tools: IF (XMLLINT_EXECUTABLE) Modified: plugins/ldap-sync/tests/clean_up ============================================================================== --- plugins/ldap-sync/tests/clean_up Mon Apr 6 22:20:05 2009 (r5546) +++ plugins/ldap-sync/tests/clean_up Mon Apr 6 22:20:27 2009 (r5547) @@ -27,7 +27,7 @@ ###### Clean up LDAP server -$SOURCE_DIR/remove_test_ldifs +$SOURCE_DIR/remove_ldifs ###### Clean up directories in /tmp remove_files Added: plugins/ldap-sync/tests/remove_trace_dirs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/remove_trace_dirs Mon Apr 6 22:20:27 2009 (r5547) @@ -0,0 +1,39 @@ +#!/bin/bash + +set -x + +FILE=$0 + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +source "$SOURCE_DIR/test.conf" + + +if test -z "$TRACE_FILES"; then + echo -e "$FILE:$LINENO: \$TRACE_FILES is empty. Nothing todo." + exit 0; +fi + + +if test ! -d "$TRACE_FILES"; then + echo -e "$FILE:$LINENO: \"$TRACE_FILES\" is not a directory. Nothing todo." + exit 0; +fi + +for d in ${TRACE_FILES}${PATH_SEPARATOR}*; do + if test -d "$d"; then + echo "To be deleted: \"$d\"" + rm -rf "$d" + fi +done + + |
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 |
From: <svn...@op...> - 2009-04-06 20:19:57
|
Author: scriptor Date: Mon Apr 6 22:19:49 2009 New Revision: 5545 URL: http://www.opensync.org/changeset/5545 Log: Not that I recommend the simple authentication mechanism. But it is foreseeable, that many users will choose right this mechanism. Therefore I should present an alternative version of the access rules, which is suitable for both an SASL based mechanism and the simple mechanism. Moreover, I added some remarks about proxy authorization. Modified: plugins/ldap-sync/README.lyx Modified: plugins/ldap-sync/README.lyx ============================================================================== --- plugins/ldap-sync/README.lyx Mon Apr 6 12:30:16 2009 (r5544) +++ plugins/ldap-sync/README.lyx Mon Apr 6 22:19:49 2009 (r5545) @@ -313,6 +313,10 @@ ctest -R remove_test_ldifs \end_layout +\begin_layout LyX-Code +reset; time ctest -R "^add_mod_del_contact1_and_fastsync" +\end_layout + \begin_layout Standard And in case of problems: \end_layout @@ -325,6 +329,10 @@ ctest -R remove_test_ldifs -V \end_layout +\begin_layout LyX-Code +reset; time ctest -R "^add_mod_del_contact1_and_fastsync" -V +\end_layout + \begin_layout Part Configuration \end_layout @@ -597,6 +605,133 @@ (...) \end_layout +\begin_layout Standard +An alternative configuration file in case you want to provide only +\begin_inset Quotes eld +\end_inset + +ldap_user +\begin_inset Quotes erd +\end_inset + + with access, but no other users, even though they may have authenticated + themselves. + Note: The following configuration grants access to the +\begin_inset Quotes eld +\end_inset + +ldap_user +\begin_inset Quotes erd +\end_inset + + only, if he has authenticated himself using an SASL based mechanism. + If he used the simple authentication mechanism, the following access rules + would NOT be sufficient: +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=addressbook,dc=example,dc=com" by dn="cn=ldap_user,dc=ex +ample,dc=com" write by dn="cn=ldap_user,ou=people,dc=example,dc=com" write + +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=calendar,dc=example,dc=com" by dn="cn=ldap_user,dc=examp +le,dc=com" write by dn="cn=ldap_user,ou=people,dc=example,dc=com" write + +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=todo,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write by dn="cn=ldap_user,ou=people,dc=example,dc=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="o=notes,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write by dn="cn=ldap_user,ou=people,dc=example,dc=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.base="cn=Subschema" by * read +\end_layout + +\begin_layout LyX-Code +access to dn.one="ou=people,dc=example,dc=com" by * read +\end_layout + +\begin_layout Standard +A second alternative of the access rights section: Only the +\begin_inset Quotes eld +\end_inset + +ldap_user +\begin_inset Quotes erd +\end_inset + + is granted access to the addressbook etc, but he may be allowed to use + both an SASL based authentication mechanism and the simple one: +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=addressbook,dc=example,dc=com" by dn="cn=ldap_user,dc=ex +ample,dc=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=calendar,dc=example,dc=com" by dn="cn=ldap_user,dc=examp +le,dc=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=todo,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="o=notes,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +access to dn.base="cn=Subschema" by * read +\end_layout + +\begin_layout LyX-Code +access to dn.one="ou=people,dc=example,dc=com" by * read +\end_layout + \begin_layout Subsection Syntax test of the configuration file \end_layout @@ -3339,6 +3474,237 @@ osynctool --discover "sync_ldap_with_evolution" \end_layout +\begin_layout Section +Proxy authorization (authzid) +\end_layout + +\begin_layout Standard +\begin_inset Quotes eld +\end_inset + +Proxy +\begin_inset Quotes erd +\end_inset + + in this context does not have anything to do with a proxy server for http + et al., like squid. + Proxy authorization means, the user authenticates as one particular person, + but acts as a different person. + The user acts on behalf of this other person. +\end_layout + +\begin_layout Standard +In short: +\end_layout + +\begin_layout Itemize +Authentication: answers the question who is basically allowed to do something +\end_layout + +\begin_layout Itemize +Authorization: answers the question to what precisely a particular person + is entitled to do something. + This is about the amount of rights someone has. + How far do his permissions reach. +\end_layout + +\begin_layout Standard +Authorization is the second step. + It does not come to the question about authorization, until someone has + authentiated himself. +\end_layout + +\begin_layout Standard +Say, an LDAP server has the following set of access rules: +\end_layout + +\begin_layout LyX-Code +vim /etc/openldap/slapd.conf +\end_layout + +\begin_layout LyX-Code +(...) +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=addressbook,dc=example,dc=com" by dn="cn=ldap_user,dc=ex +ample,dc=com" write +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=calendar,dc=example,dc=com" by dn="cn=ldap_user,dc=examp +le,dc=com" write +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="ou=todo,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write +\end_layout + +\begin_layout LyX-Code +access to dn.subtree="o=notes,dc=example,dc=com" by dn="cn=ldap_user,dc=example,d +c=com" write +\end_layout + +\begin_layout LyX-Code +(...) +\end_layout + +\begin_layout Standard +With this set of access rules, the user +\begin_inset Quotes eld +\end_inset + +fowly +\begin_inset Quotes erd +\end_inset + + would not be entitled to write to the addressbook. + However, the admin could establish proxy authorization: +\end_layout + +\begin_layout LyX-Code +vim /etc/openldap/slapd.conf +\end_layout + +\begin_layout LyX-Code +(...) +\end_layout + +\begin_layout LyX-Code +authz-policy From +\end_layout + +\begin_layout Standard +This allows the +\begin_inset Quotes eld +\end_inset + +ldap_user +\begin_inset Quotes erd +\end_inset + + to grant permission to +\begin_inset Quotes eld +\end_inset + +fowly +\begin_inset Quotes erd +\end_inset + + to act on behalf of him, the +\begin_inset Quotes eld +\end_inset + +ldap_user +\begin_inset Quotes erd +\end_inset + +: +\end_layout + +\begin_layout LyX-Code +vim authz_from.entrymods +\end_layout + +\begin_layout LyX-Code +dn: cn=ldap_user,ou=people,dc=example,dc=com +\end_layout + +\begin_layout LyX-Code +Replace: authzFrom +\end_layout + +\begin_layout LyX-Code +authzFrom: cn=fowly,dc=example,dc=com +\end_layout + +\begin_layout LyX-Code + +\end_layout + +\begin_layout LyX-Code +ldapmodify -x -D "cn=root,dc=example,dc=com" -w password -f authz_from.entrymods +\end_layout + +\begin_layout Standard +Quick check (mind the plus sign at the end the command: +\end_layout + +\begin_layout LyX-Code +ldapsearch -x -D "cn=ldap_user,ou=people,dc=example,dc=com" -w secret -LLL + -b "cn=ldap_user,ou=people,dc=example,dc=com" + +\end_layout + +\begin_layout LyX-Code +(...) +\end_layout + +\begin_layout LyX-Code +authzFrom: {0}dn:cn=fowly,dc=example,dc=com +\end_layout + +\begin_layout LyX-Code +(...) +\end_layout + +\begin_layout Standard +What are the consequences? +\end_layout + +\begin_layout Standard +The following does not grant write access: +\end_layout + +\begin_layout LyX-Code +ldapadd -U "fowly" -w "hidden" -f contact1.ldif +\end_layout + +\begin_layout Standard +whereas this one does: +\end_layout + +\begin_layout LyX-Code +ldapadd -U "fowly" -w "hidden" -X "dn: cn=ldap_user,ou=people,dc=example,dc=com" + -f contact1.ldif +\end_layout + +\begin_layout Standard +With an LDAP server configured as just shown, the user +\begin_inset Quotes eld +\end_inset + +fowly +\begin_inset Quotes erd +\end_inset + + could run a typical +\begin_inset Quotes eld +\end_inset + +osynctool --configure ... +\begin_inset Quotes erd +\end_inset + + and set the +\begin_inset Quotes eld +\end_inset + +authzid +\begin_inset Quotes erd +\end_inset + + variable to +\begin_inset Quotes eld +\end_inset + +dn=ldap_user,ou=people,dc=example,dc=com +\begin_inset Quotes erd +\end_inset + +. +\end_layout + \begin_layout Part Usage \end_layout |
From: <svn...@op...> - 2009-04-06 12:54:18
|
Author: bellmich Date: Mon Apr 6 14:54:12 2009 New Revision: 1036 URL: http://libsyncml.opensync.org/changeset/1036 Log: - made pendingMaps thread safe - re-enabled 10.000 test items for stress tests - still think that the COMMITTEDCHANGES event is wrong (depends on race condition) Modified: trunk/libsyncml/objects/sml_ds_server.c trunk/libsyncml/objects/sml_ds_server_internals.h trunk/tests/check_data_sync_api.c Modified: trunk/libsyncml/objects/sml_ds_server.c ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.c Mon Apr 6 14:39:58 2009 (r1035) +++ trunk/libsyncml/objects/sml_ds_server.c Mon Apr 6 14:54:12 2009 (r1036) @@ -34,14 +34,17 @@ { smlTrace(TRACE_ENTRY, "%s(%p, %s, %i)", __func__, dsession, VA_STRING(uid), type); + g_mutex_lock(dsession->pendingMapsLock); GList *c = NULL; for (c = dsession->pendingMaps; c; c = c->next) { SmlWriteContext *ctx = c->data; if (!strcmp(uid, ctx->uid) && ctx->type == type) { + g_mutex_unlock(dsession->pendingMapsLock); smlTrace(TRACE_EXIT, "%s: %p", __func__, ctx); return ctx; } } + g_mutex_unlock(dsession->pendingMapsLock); smlTrace(TRACE_EXIT_ERROR, "%s: Not found", __func__); return NULL; @@ -79,7 +82,9 @@ if (((ctx->type != SML_CHANGE_ADD || smlStatusGetClass(ctx->status) != SML_ERRORCLASS_SUCCESS) && !ctx->newuid) || dsession->server->servertype == SML_DS_CLIENT) { ctx->callback(dsession, ctx->status, NULL, ctx->userdata); + g_mutex_lock(dsession->pendingMapsLock); dsession->pendingMaps = g_list_remove(dsession->pendingMaps, ctx); + g_mutex_unlock(dsession->pendingMapsLock); _write_context_free(ctx); smlTrace(TRACE_EXIT, "%s", __func__); @@ -93,9 +98,12 @@ ctx->callback(dsession, ctx->status, ctx->newuid, ctx->userdata); + g_mutex_lock(dsession->pendingMapsLock); dsession->pendingMaps = g_list_remove(dsession->pendingMaps, ctx); + g_mutex_unlock(dsession->pendingMapsLock); _write_context_free(ctx); + /* FIXME: Are you sure about this comment? */ // Now there are no more MapItems ... do some fancy callback. Some applications will love it ;) if (dsession->recvEventCallback && !dsession->pendingMaps) { dsession->recvEventCallback(dsession, SML_DS_EVENT_COMMITEDCHANGES, dsession->recvEventCallbackUserdata); @@ -404,6 +412,8 @@ dsession->location = server->location; smlLocationRef(dsession->location); + + dsession->pendingMapsLock = g_mutex_new(); smlTrace(TRACE_EXIT, "%s: %p", __func__, dsession); return dsession; @@ -456,12 +466,18 @@ if (dsession->syncCommand) smlCommandUnref(dsession->syncCommand); + if (!g_mutex_trylock(dsession->pendingMapsLock)) { + smlTrace(TRACE_ERROR, + "%s: somebody still uses this object", __func__); + g_mutex_lock(dsession->pendingMapsLock); + } while (dsession->pendingMaps) { SmlWriteContext *ctx = dsession->pendingMaps->data; _write_context_free(ctx); dsession->pendingMaps = g_list_delete_link(dsession->pendingMaps, dsession->pendingMaps); } - + g_mutex_unlock(dsession->pendingMapsLock); + g_mutex_free(dsession->pendingMapsLock); while (dsession->mapItems) { SmlMapItem *item = dsession->mapItems->data; @@ -1073,7 +1089,9 @@ ctx->type = type; ctx->session = dsession; + g_mutex_lock(dsession->pendingMapsLock); dsession->pendingMaps = g_list_append(dsession->pendingMaps, ctx); + g_mutex_unlock(dsession->pendingMapsLock); if (!smlSessionSendCommand(dsession->session, cmd, dsession->syncCommand, _change_reply, ctx, error)) goto error_free_ctx; Modified: trunk/libsyncml/objects/sml_ds_server_internals.h ============================================================================== --- trunk/libsyncml/objects/sml_ds_server_internals.h Mon Apr 6 14:39:58 2009 (r1035) +++ trunk/libsyncml/objects/sml_ds_server_internals.h Mon Apr 6 14:54:12 2009 (r1036) @@ -85,6 +85,7 @@ SmlCommand *syncCommand; GList *pendingMaps; + GMutex *pendingMapsLock; GList *mapItems; //SmlCommand *mapCommand; Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Mon Apr 6 14:39:58 2009 (r1035) +++ trunk/tests/check_data_sync_api.c Mon Apr 6 14:54:12 2009 (r1036) @@ -511,7 +511,7 @@ goto error; /* configure test data */ - int max_items = 1000; + int max_items = 10000; int i; for(i = 0; i < max_items; i++) { client_items = g_list_append(client_items, (char *) "client data"); |
From: <svn...@op...> - 2009-04-06 12:40:06
|
Author: bellmich Date: Mon Apr 6 14:39:58 2009 New Revision: 1035 URL: http://libsyncml.opensync.org/changeset/1035 Log: reduced test items for ds_api test and hope that it still causes some segfaults Modified: trunk/tests/check_data_sync_api.c Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Mon Apr 6 14:00:12 2009 (r1034) +++ trunk/tests/check_data_sync_api.c Mon Apr 6 14:39:58 2009 (r1035) @@ -511,7 +511,7 @@ goto error; /* configure test data */ - int max_items = 10000; + int max_items = 1000; int i; for(i = 0; i < max_items; i++) { client_items = g_list_append(client_items, (char *) "client data"); |
From: <svn...@op...> - 2009-04-06 12:00:24
|
Author: bellmich Date: Mon Apr 6 14:00:12 2009 New Revision: 1034 URL: http://libsyncml.opensync.org/changeset/1034 Log: fixed some libsoup 2.2 issues which were introduced by the gcc profiling fixes Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Apr 6 13:38:13 2009 (r1033) +++ trunk/tests/check_libsoup.c Mon Apr 6 14:00:12 2009 (r1034) @@ -71,6 +71,8 @@ SoupServerContext *context, SoupMessage *msg, gpointer data) +{ + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, context, msg, data); #else static void server_callback( SoupServer *server, @@ -79,9 +81,10 @@ GHashTable *query, SoupClientContext *client, gpointer data) -#endif { + /* additional stuff is only traced to avoid warnings from gcc profiling */ smlTrace(TRACE_ENTRY, "%s(%p, %p, %s, %p, %p, %p)", __func__, server, msg, path, query, client, data); +#endif smlAssert(msg); #ifdef HAVE_LIBSOUP22 const char *content = msg->request.body; @@ -115,14 +118,17 @@ #ifdef HAVE_LIBSOUP22 static void client_callback(SoupMessage *msg, gpointer userdata) +{ + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, msg, userdata); #else static void client_callback( SoupSession *session, SoupMessage *msg, gpointer userdata) -#endif { + /* session is only traced to avoid warnings from gcc profiling */ smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, session, msg, userdata); +#endif g_atomic_int_inc(&client_messages); smlTrace(TRACE_EXIT, "%s", __func__); } |
From: <svn...@op...> - 2009-04-06 11:38:33
|
Author: bellmich Date: Mon Apr 6 13:38:13 2009 New Revision: 1033 URL: http://libsyncml.opensync.org/changeset/1033 Log: fixed libsoup 2.2 issue which was introduced by gcc profiling fixes Modified: trunk/libsyncml/transports/http_client.c Modified: trunk/libsyncml/transports/http_client.c ============================================================================== --- trunk/libsyncml/transports/http_client.c Mon Apr 6 13:33:08 2009 (r1032) +++ trunk/libsyncml/transports/http_client.c Mon Apr 6 13:38:13 2009 (r1033) @@ -38,11 +38,14 @@ #ifdef HAVE_LIBSOUP22 static void smlTransportHttpClientCallback(SoupMessage *msg, gpointer userdata) +{ + smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, msg, userdata); #else static void smlTransportHttpClientCallback(SoupSession *session, SoupMessage *msg, gpointer userdata) -#endif { + /* session is only traced to avoid warnings from gcc profiling */ smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, session, msg, userdata); +#endif SmlTransportHttpClientEnv *env = userdata; SmlError *error = NULL; |
From: <svn...@op...> - 2009-04-06 11:33:21
|
Author: bellmich Date: Mon Apr 6 13:33:08 2009 New Revision: 1032 URL: http://libsyncml.opensync.org/changeset/1032 Log: fixed coverage building after understanding "ctest -T test -T coverage -R ." Modified: trunk/tests/coverage.sh.cmake Modified: trunk/tests/coverage.sh.cmake ============================================================================== --- trunk/tests/coverage.sh.cmake Fri Apr 3 21:39:52 2009 (r1031) +++ trunk/tests/coverage.sh.cmake Mon Apr 6 13:33:08 2009 (r1032) @@ -13,8 +13,8 @@ fi echo $TITLE -if ! [ -d coverage/html ]; then - mkdir -p coverage/html +if ! [ -d ${CMAKE_BINARY_DIR}/coverage/html ]; then + mkdir -p ${CMAKE_BINARY_DIR}/coverage/html fi ## compile tests @@ -26,31 +26,32 @@ ## create gcda files RESULT=`find ${CMAKE_CURRENT_BINARY_DIR} -name "*.gcda" -print | wc -l` if [ "$RESULT" == "0" ]; then - ctest -R "^error$" + ctest -R . fi ## analyze statistics lcov \ --test-name "$TITLE" \ --base-directory ${CMAKE_SOURCE_DIR} \ - --directory ${CMAKE_CURRENT_BINARY_DIR} \ + --directory ${CMAKE_BINARY_DIR} \ --quiet \ --capture \ - --output-file coverage/$TITLE.info -genhtml --legend -t "$TITLE" -o coverage/html/$TITLE coverage/$TITLE.info &> /dev/null + --output-file ${CMAKE_BINARY_DIR}/coverage/$TITLE.info +genhtml --legend -t "$TITLE" -o ${CMAKE_BINARY_DIR}/coverage/html/$TITLE ${CMAKE_BINARY_DIR}/coverage/$TITLE.info &> /dev/null -cd coverage/html/ -ln -sf $TITLE LATEST -cd ../../ +cd ${CMAKE_BINARY_DIR}/coverage/html/ +if [ -e LATEST ]; then rm -f LATEST; fi +ln -s $TITLE LATEST +cd ${CMAKE_BINARY_DIR} ## cleanup gcda files -lcov \ - --test-name "$TITLE" \ - --base-directory ${CMAKE_SOURCE_DIR} \ - --directory ${CMAKE_BINARY_DIR} \ - --quiet \ - --zerocounters \ - --output-file coverage/$TITLE.info +#lcov \ +# --test-name "$TITLE" \ +# --base-directory ${CMAKE_SOURCE_DIR} \ +# --directory ${CMAKE_BINARY_DIR} \ +# --quiet \ +# --zerocounters \ +# --output-file coverage/$TITLE.info echo -n "Code Coverage is: " grep " %</td>" coverage/html/$TITLE/index.html | sed -e "s/^[^>]*>//g" -e "s/<[^>]*>//g" |
From: <svn...@op...> - 2009-04-06 09:01:30
|
Author: bricks Date: Mon Apr 6 11:01:23 2009 New Revision: 5543 URL: http://www.opensync.org/changeset/5543 Log: Committed a modifed version of Henriks patch for glib and iconv with win32 refs #1097 Modified: branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Modified: branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Sun Apr 5 19:55:52 2009 (r5542) +++ branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Mon Apr 6 11:01:23 2009 (r5543) @@ -13,7 +13,7 @@ # Copyright (c) 2007 Daniel Gollub <dg...@su...> # Copyright (c) 2007 Alban Browaeys <pr...@ya...> # Copyright (c) 2008 Michael Bell <mic...@we...> -# Copyright (c) 2008 Bjoern Ricks <bjo...@go...> +# Copyright (c) 2008-2009 Bjoern Ricks <bjo...@go...> # # Redistribution and use is allowed according to the terms of the New # BSD license. @@ -206,6 +206,23 @@ ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) +IF ( WIN32 ) + # include libiconv for win32 + IF ( NOT LIBICONV_FOUND ) + FIND_PATH(LIBICONV_INCLUDE_DIR iconv.h PATH_SUFFIXES glib-2.0) + + FIND_LIBRARY(LIBICONV_LIBRARY NAMES iconv) + + IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + SET (LIBICONV_FOUND TRUE) + ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + ENDIF ( NOT LIBICONV_FOUND ) + IF (LIBICONV_FOUND) + SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) + SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) + ENDIF (LIBICONV_FOUND) +ENDIF ( WIN32 ) + IF ( GLIB2_FOUND ) # Check if system has a newer version of glib # which supports g_regex_match_simple |
From: <svn...@op...> - 2009-04-05 17:55:57
|
Author: bricks Date: Sun Apr 5 19:55:52 2009 New Revision: 5542 URL: http://www.opensync.org/changeset/5542 Log: started to implement OSyncDBConnection Added: branches/osyncdb2/opensync/db2/opensync_db_connection.c branches/osyncdb2/opensync/db2/opensync_db_internals.h Modified: branches/osyncdb2/opensync/db2/opensync_db.c branches/osyncdb2/opensync/db2/opensync_db_connection_private.h branches/osyncdb2/opensync/db2/opensync_db_private.h Modified: branches/osyncdb2/opensync/db2/opensync_db.c ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db.c Sun Apr 5 19:12:15 2009 (r5541) +++ branches/osyncdb2/opensync/db2/opensync_db.c Sun Apr 5 19:55:52 2009 (r5542) @@ -19,6 +19,7 @@ */ #include "opensync_db.h" +#include "opensync_db_internals.h" #include "opensync_db_private.h" OSyncDB *osync_db_new(OSyncError **error) { @@ -124,5 +125,26 @@ OSyncDBConnection* osync_db_connect(OSyncDB *db, const char *dbname, const char *username, const *password, OSyncError **error) { osync_assert(db); - return db->connect(db, dbname, username, password, osync_db_get_userdata(db), error); + OSyncDBConnection *retval = NULL; + retval = db->connect(db, dbname, username, password, osync_db_get_userdata(db), error); + + if ( retval ) { + osync_list_add(osync_db_get_connections(db), retval); + osync_db_connection_ref(retval); + } + + return retval; +} + +OSyncList *osync_db_get_connections(OSyncDB *db) { + osync_assert(db); + return db->connections; +} + +void osync_db_remove_connection(OSyncDB *db, OSyncDBConnection *dbcon) { + osync_assert(db); + osync_assert(dbcon); + + osync_list_remove(osync_db_get_connections(db), dbcon); + osync_db_connection_unref(dbcon); } Added: branches/osyncdb2/opensync/db2/opensync_db_connection.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/osyncdb2/opensync/db2/opensync_db_connection.c Sun Apr 5 19:55:52 2009 (r5542) @@ -0,0 +1,103 @@ +/* + * libopensync - A synchronization framework + * Copyright (C) 2009 Bjoern Ricks <bjo...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "opensync_db_connection.h" +#include "opensync_db_connection_private.h" + + + +OSyncDBConnection *osync_db_connection_new(OSyncDB *db, OSyncError *error) { + OSyncDBConnection *dbcon = NULL; + + osync_assert(db); + + osync_trace(TRACE_ENTRY, "%s(%p)", __func__, error); + + dbcon = osync_try_malloc0(sizeof(OSyncDBConnection), error); + if (!dbcon) { + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return NULL; + } + osync_db_connection_set_db(dbcon, db); + dbcon->ref_count = 1; + + osync_trace(TRACE_EXIT, "%s: %p", __func__, dbdbcon); + return dbcon; +} + +OSyncDB *osync_db_connection_ref(OSyncDBConnection *dbcon) { + osync_assert(dbcon); + + g_atomic_int_inc(&(dbcon->ref_count)); + + return dbcon; +} + +void osync_db_connection_unref(OSyncDBConnection *dbcon) { + osync_assert(dbcon); + + if (g_atomic_int_dec_and_test(&(dbcon->ref_count))) { + osync_db_unref(dbcon->db); + osync_free(db); + } +} + +void osync_db_connection_set_db(OSyncDBConnection *con, OSyncDB *db) { + osync_assert(con); + osync_assert(db); + + if ( con->db ) { + osync_db_unref(con->db); + } + con->db = db; + osync_db_ref(db); +} + +void *osync_db_connection_get_data(OSyncDBConnection *dbcon) { + return dbcon->data; +} + +OSyncList *osync_db_connection_query(OSyncDBConnection *dbcon, const char *query, OSyncError **error) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, dbcon, query, error); + + osync_assert(dbcon); + + OSyncList *list = NULL; + list = dbcon->query(dbcon, query, osync_db_connection_get_data(dbcon), error); + + osync_trace(TRACE_EXIT, "%s", __func__); + return list; +} + +void osync_db_connection_disconnect(OSyncDBConnection *dbcon, OSyncError **error) { + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, dbcon, error); + + osync_assert(dbcon); + dbcon->disconnect(dbcon, osync_db_connection_get_data(dbcon), error); + + OSyncDB *db = osync_db_connection_get_db(dbcon); + osync_db_remove_connection(db, dbcon); + + osync_trace(TRACE_EXIT, "%s", __func__); +} + +OSyncDB *osync_db_connection_get_db(OSyncDBConnection *dbcon) { + return dbcon->db; +} Modified: branches/osyncdb2/opensync/db2/opensync_db_connection_private.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_connection_private.h Sun Apr 5 19:12:15 2009 (r5541) +++ branches/osyncdb2/opensync/db2/opensync_db_connection_private.h Sun Apr 5 19:55:52 2009 (r5542) @@ -27,6 +27,11 @@ OSyncDBConnectionDisconnectFn disconnect; /*TODO to be continued */ void *data; + int ref_count; } OSyncDBConnection; +void osync_db_connection_set_db(OSyncDBConnection *con, OSyncDB *db); + +void *osync_db_connection_get_data(OSyncDBConnection *dbcon); + #endif /* _OPENSYNC_DB_CONNECTION_PRIVATE_H_ */ Added: branches/osyncdb2/opensync/db2/opensync_db_internals.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/osyncdb2/opensync/db2/opensync_db_internals.h Sun Apr 5 19:55:52 2009 (r5542) @@ -0,0 +1,26 @@ +/* + * libopensync - A synchronization framework + * Copyright (C) 2009 Bjoern Ricks <bjo...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _OPENSYNC_DB_INTERNALS_H_ +#define _OPENSYNC_DB_INTERNALS_H_ + +void osync_db_remove_connection(OSyncDB *db, OSyncDBConnection *dbcon); + +#endif /* _OPENSYNC_DB_INTERNALS_H_ */ Modified: branches/osyncdb2/opensync/db2/opensync_db_private.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_private.h Sun Apr 5 19:12:15 2009 (r5541) +++ branches/osyncdb2/opensync/db2/opensync_db_private.h Sun Apr 5 19:55:52 2009 (r5542) @@ -31,6 +31,10 @@ int ref_count; } OSyncDB; -void osync_db_set_data(OSyncDB *db, void *userdata); +void osync_db_set_userdata(OSyncDB *db, void *userdata); + +void *osync_db_get_userdata(OSyncDB *db); + +OSyncList *osync_db_get_connections(OSyncDB *db); #endif /* _OPENSYNC_DB_PRIVATE_H_ */ |
From: <svn...@op...> - 2009-04-05 17:12:25
|
Author: bricks Date: Sun Apr 5 19:12:15 2009 New Revision: 5541 URL: http://www.opensync.org/changeset/5541 Log: specified more functions for new db interface also started to implement first functions Added: branches/osyncdb2/opensync/db2/opensync_db.c branches/osyncdb2/opensync/db2/opensync_db_env.c Modified: branches/osyncdb2/opensync/db2/opensync_db.h branches/osyncdb2/opensync/db2/opensync_db_connection.h branches/osyncdb2/opensync/db2/opensync_db_connection_private.h branches/osyncdb2/opensync/db2/opensync_db_env.h branches/osyncdb2/opensync/db2/opensync_db_env_private.h branches/osyncdb2/opensync/db2/opensync_db_private.h branches/osyncdb2/opensync/module/opensync_module.c Added: branches/osyncdb2/opensync/db2/opensync_db.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/osyncdb2/opensync/db2/opensync_db.c Sun Apr 5 19:12:15 2009 (r5541) @@ -0,0 +1,128 @@ +/* + * libopensync - A synchronization framework + * Copyright (C) 2009 Bjoern Ricks <bjo...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "opensync_db.h" +#include "opensync_db_private.h" + +OSyncDB *osync_db_new(OSyncError **error) { + OSyncDB *db = NULL; + osync_trace(TRACE_ENTRY, "%s(%p)", __func__, error); + + env = osync_try_malloc0(sizeof(OSyncDB), error); + if (!env) { + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return NULL; + } + + db->ref_count = 1; + osync_trace(TRACE_EXIT, "%s: %p", __func__, db); + return db; +} + +OSyncDB *osync_db_ref(OSyncDB *db) { + osync_assert(db); + + g_atomic_int_inc(&(db->ref_count)); + + return db; +} + +void osync_db_unref(OSyncDB *db) { + osync_assert(db); + + if (g_atomic_int_dec_and_test(&(db->ref_count))) { + if (db->name) { + osync_free(db->name); + } + osync_free(db); + } +} + +void osync_db_free_list(OSyncList *queryresult) { + OSyncList *row; + osync_trace(TRACE_ENTRY, "%s(%p)", __func__, queryresult); + + for (row = queryresult; row; row = row->next) { + osync_list_foreach((OSyncList *) row->data, (GFunc) osync_free, NULL); + osync_list_free((OSyncList *) row->data); + } + + osync_list_free(list); + + osync_trace(TRACE_EXIT, "%s", __func__); +} + +void osync_db_set_name(OSyncDB *db, const char *name) { + osync_assert(db); + if (db->name) { + osync_free(db->name); + } + db->name = osync_strdup(name); +} + +const char *osync_db_get_name(OSyncDB *db) { + osync_assert(db); + return db->name; +} + +void osync_db_set_initialize_func(OSyncDB *db, OSyncDBInitializeFn init_func) { + osync_assert(db); + db->initialize = init_func; +} + +void osync_db_set_finalize_func(OSyncDB *db, OSyncDBFinalizeFn fin_func) { + osync_assert(db); + db->finalize = fin_func; +} + +void osync_db_set_connect_func(OSyncDB *db, OSyncDBConnectFn connect_func) { + osync_assert(db); + db->connect = connect_func; +} + +void osync_db_set_userdata(OSyncDB *db, void *userdata) { + osync_assert(db); + db->userdata = userdata; +} + +void *osync_db_get_userdata(OSyncDB *db) { + osync_assert(db); + return db->userdata; +} + +void osync_db_initialize(OSyncDB *db, OSyncError **error) { + osync_assert(db); + if ( db->initialize ) { + void *userdata = db->initialize(db, error); + osync_db_set_userdata(db, userdata); + } +} + +void osync_db_finalize(OSyncDB *db) { + osync_assert(db); + if ( db->finialize ) { + db->finalize(db, osync_db_get_userdata(db)); + } +} + +OSyncDBConnection* osync_db_connect(OSyncDB *db, const char *dbname, const char *username, const *password, OSyncError **error) { + osync_assert(db); + return db->connect(db, dbname, username, password, osync_db_get_userdata(db), error); +} Modified: branches/osyncdb2/opensync/db2/opensync_db.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -33,10 +33,22 @@ OSYNC_EXPORT void osync_db_unref(OSyncDB *db); -OSYNC_EXPORT void osync_db_set_initialize(OSyncDB *db, OSyncDBInitializeFn); +OSYNC_EXPORT void osync_db_free_list(OSyncList *query_result); -OSYNC_EXPORT void osync_db_set_finalize(OSyncDB *db, OSyncDBFinalizeFn); +OSYNC_EXPORT const char *osync_db_get_name(OSyncDB *db); -OSYNC_EXPORT void osync_db_set_connect(OSyncDB *db, OSyncDBConnectFn); +OSYNC_EXPORT void osync_db_set_name(OSyncDB *db); + +OSYNC_EXPORT void osync_db_set_initialize_func(OSyncDB *db, OSyncDBInitializeFn init_func); + +OSYNC_EXPORT void osync_db_set_finalize_func(OSyncDB *db, OSyncDBFinalizeFn fin_func); + +OSYNC_EXPORT void osync_db_set_connect_func(OSyncDB *db, OSyncDBConnectFn connect_func); + +OSYNC_EXPORT void osync_db_initialize(OSyncDB *db); + +OSYNC_EXPORT void osync_db_finalize(OSyncDB *db); + +OSYNC_EXPOT OSyncDBConnection* osync_db_connect(OSyncDB *db, const char *dbname, const char *username, const *password, OSyncError **error); #endif /* _OPENSYNC_DB_H_ */ Modified: branches/osyncdb2/opensync/db2/opensync_db_connection.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_connection.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db_connection.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -23,13 +23,7 @@ typedef void (* OSyncDBConnectionDisconnectFn) (OSyncDBConnection *dbcon, void *data, OSyncError **error); -typedef void * (* OSyncDBConnectionQueryFn) (OSyncDBConnection *dbcon, const char *query, void *data, OSyncError **error); /*TODO return value type ???*/ - -typedef struct OSyncDBConnectionFunctions { - OSyncDBConnectionQueryFn query; - OSyncDBConnectionDisconnectFn disconnect; - /*TODO to be continued */ -} OSyncDBConnectionFunctions; +typedef OSyncList * (* OSyncDBConnectionQueryFn) (OSyncDBConnection *dbcon, const char *query, void *data, OSyncError **error); OSYNC_EXPORT OSyncDBConnection *osync_db_connection_new(OSyncDB *db, OSyncError *error); @@ -37,6 +31,14 @@ OSYNC_EXPORT void osync_db_connection_unref(OSyncDBConnection *dbcon); -OSYNC_EXPORT void osync_db_connection_set_functions(OSyncDBConnection *dbcon, OSyncDBConnectionFunctions functions. void *data); +OSYNC_EXPORT OSyncList *osync_db_connection_query(OSyncDBConnection *dbcon, const char *query, OSyncError **error); + +OSYNC_EXPORT void osync_db_connection_disconnect(OSyncDBConnection *dbcon, OSyncError **error); + +OSYNC_EXPORT void osync_db_connection_set_disconnect_func(OSyncDBConnection *dbcon, OSyncDBConnectionDisconnectFn disconnect_func); + +OSYNC_EXPORT void osync_db_connection_set_query_func(OSyncDBConnection *dbcon, OSyncDBConnectionQueryFn query_func); + +OSYNC_EXPORT void osync_db_connection_set_userdata(OSyncDBConnection *dbcon, void *userdata); #endif /* _OPENSYNC_DB_CONNECTION_H_ */ Modified: branches/osyncdb2/opensync/db2/opensync_db_connection_private.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_connection_private.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db_connection_private.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -23,7 +23,9 @@ typedef struct OSyncDBConnection { OSyncDB *db; - OSyncDBConnectionFunctions functions; + OSyncDBConnectionQueryFn query; + OSyncDBConnectionDisconnectFn disconnect; + /*TODO to be continued */ void *data; } OSyncDBConnection; Added: branches/osyncdb2/opensync/db2/opensync_db_env.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/osyncdb2/opensync/db2/opensync_db_env.c Sun Apr 5 19:12:15 2009 (r5541) @@ -0,0 +1,202 @@ +/* + * libopensync - A synchronization framework + * Copyright (C) 2009 Bjoern Ricks <bjo...@gm...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "opensync_db_env.h" +#include "opensync_db_env_private.h" + +OSyncDBEnv *osync_db_env_new(OSyncError **error) +{ + OSyncDBEnv *env = NULL; + osync_trace(TRACE_ENTRY, "%s(%p)", __func__, error); + + env = osync_try_malloc0(sizeof(OSyncDBEnv), error); + if (!env) { + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return NULL; + } + + env->ref_count = 1; + osync_trace(TRACE_EXIT, "%s: %p", __func__, env); + return env; +} + +void osync_db_env_unref(OSyncDBEnv *env) { + + osync_trace(TRACE_ENTRY, "%s(%p)", __func__, env); + osync_assert(env); + + if (g_atomic_int_dec_and_test(&(env->ref_count))) { + /* Free the plugins */ + while (env->plugins) { + osync_db_unref(env->plugins->data); + env->dbs = osync_list_remove(env->dbs, env->dbs->data); + } + + /* Unload all modules */ + while (env->modules) { + osync_module_unload(env->modules->data); + osync_module_unref(env->modules->data); + env->modules = osync_list_remove(env->modules, env->modules->data); + } + osync_free(env); + } + + osync_trace(TRACE_EXIT, "%s", __func__); +} + +OSyncDBEnv *osync_db_env_ref(OSyncDBEnv *env) { + osync_assert(env); + + g_atomic_int_inc(&(env->ref_count)); + + return env; +} + +osync_bool osync_db_env_load(OSyncDBEnv *env, const char *path, OSyncError **error) { + osync_bool must_exist = TRUE; + GDir *dir = NULL; + GError *gerror = NULL; + char *filename = NULL; + const gchar *de = NULL; + + osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, __NULLSTR(path), error); + + if (!path) { + path = OPENSYNC_DBPLUGINDIR; + must_exist = FALSE; + } + + //Load all available shared libraries + if (!g_file_test(path, G_FILE_TEST_IS_DIR)) { + if (must_exist) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Path is not loadable"); + goto error; + } else { + osync_trace(TRACE_EXIT, "%s: Directory %s does not exist (non-fatal)", __func__, path); + return TRUE; + } + } + + dir = g_dir_open(path, 0, &gerror); + if (!dir) { + osync_error_set(error, OSYNC_ERROR_IO_ERROR, "Unable to open directory %s: %s", path, gerror->message); + g_error_free(gerror); + goto error; + } + + while ((de = g_dir_read_name(dir))) { + filename = osync_strdup_printf ("%s%c%s", path, G_DIR_SEPARATOR, de); + + if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR) || !g_pattern_match_simple("*."G_MODULE_SUFFIX, filename)) { + osync_free(filename); + continue; + } + + if (!osync_db_env_load_module(env, filename, error)) { + osync_trace(TRACE_ERROR, "Unable to load module: %s", osync_error_print(error)); + } + + osync_free(filename); + } + + g_dir_close(dir); + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; + +error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; +} + +osync_bool osync_db_env_load_module(OSyncDBEnv *env, const char *filename, OSyncError **error) { + OSyncModule *module = NULL; + + osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, env, filename, error); + osync_assert(env); + osync_assert(filename); + + module = osync_module_new(error); + if (!module) + goto error; + + if (!osync_module_load(module, filename, error)) { + osync_trace(TRACE_INTERNAL, "Unable to load module %s: %s", filename, osync_error_print(error)); + osync_module_unref(module); + } else { + if (!osync_module_check(module, error)) { + if (osync_error_is_set(error)) { + osync_trace(TRACE_INTERNAL, "Module check error for %s: %s", filename, osync_error_print(error)); + } + osync_module_unload(module); + osync_module_unref(module); + osync_trace(TRACE_EXIT, "%s: Unable to load module", __func__); + return FALSE; + } + + if (!osync_module_get_db_info(module, env, error)) { + if (osync_error_is_set(error)) + goto error_free_module; + + osync_module_unload(module); + osync_module_unref(module); + osync_trace(TRACE_EXIT, "%s: No get_db_info function", __func__); + return FALSE; + } + env->modules = osync_list_append(env->modules, module); + } + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; + +error_free_module: + osync_module_unload(module); + osync_module_unref(module); +error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; +} + +void osync_db_env_register_db(OSyncPluginEnv *env, OSyncDB *db) { + osync_assert(env); + osync_assert(db); + + if ( db->connect ) { + env->dbs = osync_list_append(env->dbs, dbs); + osync_db_ref(db); + } + else { + /* TODO raise error! */ + } +} + +OSyncDB *osync_db_env_find_db(OSyncDBEnv *env, const char *name) { + OSyncList *db = NULL; + for (db = env->dbs; db; db = db->next) { + OSyncDB *osyncdb = (OSyncDB*)db->data; + if (g_ascii_strcasecmp(osync_db_get_name(osyncdb), name) == 0) + return osyncdb; + } + return NULL; +} + +OSyncList *osync_db_env_get_dbs(OSyncDBEnv *env) { + return osync_list_copy(env->dbs); +} Modified: branches/osyncdb2/opensync/db2/opensync_db_env.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_env.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db_env.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -33,4 +33,6 @@ OSYNC_EXPORT OSyncList *osync_db_env_get_dbs(OSyncDBEnv *env); +OSYNC_EXPORT void osync_db_env_register_db(OSyncPluginEnv *env, OSyncDB *db) + #endif /* _OPENSYNC_DB_ENV_H_ */ Modified: branches/osyncdb2/opensync/db2/opensync_db_env_private.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_env_private.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db_env_private.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -22,7 +22,9 @@ #define _OSYNC_DB_ENV_PRIVATE_H_ typedef struct OSyncDBEnv { - + OSyncList *dbs; + OSyncList *modules; + int ref_count; } OSyncDBEnv; #endif /* _OSYNC_DB_ENV_PRIVATE_H_ */ Modified: branches/osyncdb2/opensync/db2/opensync_db_private.h ============================================================================== --- branches/osyncdb2/opensync/db2/opensync_db_private.h Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/db2/opensync_db_private.h Sun Apr 5 19:12:15 2009 (r5541) @@ -13,7 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, wri te to the Free Software + * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ @@ -23,10 +23,14 @@ typedef struct OSyncDB { char *name; - GList connections; + void *userdata; + OSyncList connections; OSyncDBInitializeFn initialize; OSyncDBConnectFn connect; OSyncDBFinalizeFn finalize; + int ref_count; } OSyncDB; +void osync_db_set_data(OSyncDB *db, void *userdata); + #endif /* _OPENSYNC_DB_PRIVATE_H_ */ Modified: branches/osyncdb2/opensync/module/opensync_module.c ============================================================================== --- branches/osyncdb2/opensync/module/opensync_module.c Sun Apr 5 16:14:48 2009 (r5540) +++ branches/osyncdb2/opensync/module/opensync_module.c Sun Apr 5 19:12:15 2009 (r5541) @@ -26,6 +26,7 @@ typedef osync_bool (* fkt_b_plugenv_error)(OSyncPluginEnv *env, OSyncError **error); typedef osync_bool (* fkt_b_fmtenv_error)(OSyncFormatEnv *env, OSyncError **error); +typedef osync_bool (* fkt_b_dbenv_error)(OSyncDBEnv *env, OSyncError **error); OSyncModule *osync_module_new(OSyncError **error) { @@ -91,6 +92,28 @@ return function; } +osync_bool osync_module_get_db_info(OSyncModule *module, OSyncDBEnv *env, OSyncError **error) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, module, env, error); + + /* Load the get_db_info symbol */ + fct_info = (fkt_b_dbenv_error) osync_module_get_function(module, "get_db_info", error); + if (!fct_info) { + osync_trace(TRACE_EXIT_ERROR, "%s: Not get_db_info function", __func__); + return FALSE; + } + + /* Call the get_info function */ + if (!fct_info(env, error)) + goto error; + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; + + error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; +} + osync_bool osync_module_get_sync_info(OSyncModule *module, OSyncPluginEnv *env, OSyncError **error) { fkt_b_plugenv_error fct_info = NULL; |
From: <svn...@op...> - 2009-04-05 14:14:59
|
Author: scriptor Date: Sun Apr 5 16:14:48 2009 New Revision: 5540 URL: http://www.opensync.org/changeset/5540 Log: The trace files are now stored in a new way: Each test gets its own subdirectory. And so does each call to osynctool within a test. Otherwise one would face several hundreds of trace files in one directory. This makes debugging of certain failures almost impossible. Example: /tmp/trace |
From: <svn...@op...> - 2009-04-05 14:14:33
|
Author: scriptor Date: Sun Apr 5 16:14:22 2009 New Revision: 5539 URL: http://www.opensync.org/changeset/5539 Log: Adding PATH_SEPARATOR for the new handling of trace files in the test suite: Each test will have its own subdirectory. And even each call to osyncplugin/osynctool will have its own sub-subdirectory. Otherwise debugging is almost impossible when there are hundreds of trace files in one directory. Still struggling with setting a timeout with ctest: cmake and ctest are rather buggy if it comes to setting a timeout. New insight: When you first run cmake there does not seem to be any way to avoid the 1500 seconds timeout defined in DART_TESTING_TIMEOUT (well, -D..., possibly does). But running cmake for a second time does seem to consider the settings in CMakeLists.txt. So we must run cmake twice to set DART_TESTING_TIMEOUT as we want. Modified: plugins/ldap-sync/CTestConfig.cmake plugins/ldap-sync/tests/test.conf Modified: plugins/ldap-sync/CTestConfig.cmake ============================================================================== --- plugins/ldap-sync/CTestConfig.cmake Sun Apr 5 16:14:05 2009 (r5538) +++ plugins/ldap-sync/CTestConfig.cmake Sun Apr 5 16:14:22 2009 (r5539) @@ -11,3 +11,9 @@ set(CTEST_DROP_SITE "opensync.org") set(CTEST_DROP_LOCATION "/testing/submit.php?project=ldap-sync") set(CTEST_DROP_SITE_CDASH TRUE) + +set (CTEST_TEST_TIMEOUT 300) +set (CMAKE_LONG_TEST_TIMEOUT 300) +set (DART_TESTING_TIMEOUT 300) +set (CTEST_TIME_LIMIT 300) +set (TIMEOUT 300) Modified: plugins/ldap-sync/tests/test.conf ============================================================================== --- plugins/ldap-sync/tests/test.conf Sun Apr 5 16:14:05 2009 (r5538) +++ plugins/ldap-sync/tests/test.conf Sun Apr 5 16:14:22 2009 (r5539) @@ -43,11 +43,13 @@ # If the variable is empty, tracing is disabled. TRACE_FILES="/tmp/trace" #TRACE_FILES="" +PATH_SEPARATOR="/" + ########## Set a more realistic timeout in seconds for each test: # Default would be 1500 s (= 25 minutes!) -export TIMEOUT=1500 +export TIMEOUT=300 export CTEST_TEST_TIMEOUT=${TIMEOUT} export DART_TESTING_TIMEOUT=${TIMEOUT} export CMAKE_LONG_TEST_TIMEOUT=${TIMEOUT} |
From: <svn...@op...> - 2009-04-05 14:14:18
|
Author: scriptor Date: Sun Apr 5 16:14:05 2009 New Revision: 5538 URL: http://www.opensync.org/changeset/5538 Log: Removed workaround for missing symbol get_sync_info() when called by osyncplugin. This workaround does not seem to be absolutely necessary any more, although osyncplugin still has that bug that it loads the format plugin in the same way as the sync plugin. Modified: plugins/ldap-sync/src/ldap_format.c Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sat Apr 4 23:51:02 2009 (r5537) +++ plugins/ldap-sync/src/ldap_format.c Sun Apr 5 16:14:05 2009 (r5538) @@ -6439,30 +6439,5 @@ #endif -/** - * @brief This function exists just because of bugs in osyncplugin: - * osyncplugin loads format plugins in the same way as - * sync plugins, thus erroneously assuming that there - * must be a get_sync_info() function. Which is wrong, - * of course: get_conversion_info() is it, rather. - * So this function is nothing else but a workaround with - * no further purpose. - * - * @param env The environment for the whole plugin. - * @param error The libopensync error pointer. - * - * @returns Always TRUE. - * - */ -osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error) -{ - osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, env, error); - - - ldap_plugin_printf("%s:%i: \n\n\nget_sync_info() in the LDAP format plugin (!) has been called. This function exists just because of bugs in osyncplugin.", __FILE__, __LINE__); - - osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; -} /* @} */ |
From: <svn...@op...> - 2009-04-04 21:51:06
|
Author: scriptor Date: Sat Apr 4 23:51:02 2009 New Revision: 5537 URL: http://www.opensync.org/changeset/5537 Log: Workaround for a bug in osyncplugin: osyncplugin loads format plugins in the same way as sync plugins. Thus it expects a "get_sync_info" function. Which is wrong for format plugins. In order to prevent corresponding exit errors, I have added a function "get_sync_info" to the format plugin without any functionality, just to pretend that there is such a symbol. This silences the exit errors about a missing "get_sync_info" function. Modified: plugins/ldap-sync/src/ldap_format.c Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sat Apr 4 23:50:08 2009 (r5536) +++ plugins/ldap-sync/src/ldap_format.c Sat Apr 4 23:51:02 2009 (r5537) @@ -6439,6 +6439,30 @@ #endif +/** + * @brief This function exists just because of bugs in osyncplugin: + * osyncplugin loads format plugins in the same way as + * sync plugins, thus erroneously assuming that there + * must be a get_sync_info() function. Which is wrong, + * of course: get_conversion_info() is it, rather. + * So this function is nothing else but a workaround with + * no further purpose. + * + * @param env The environment for the whole plugin. + * @param error The libopensync error pointer. + * + * @returns Always TRUE. + * + */ +osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, env, error); + ldap_plugin_printf("%s:%i: \n\n\nget_sync_info() in the LDAP format plugin (!) has been called. This function exists just because of bugs in osyncplugin.", __FILE__, __LINE__); + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; +} + /* @} */ |
From: <svn...@op...> - 2009-04-04 21:50:12
|
Author: scriptor Date: Sat Apr 4 23:50:08 2009 New Revision: 5536 URL: http://www.opensync.org/changeset/5536 Log: Update of suppressions. Modified: plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Sat Apr 4 23:49:57 2009 (r5535) +++ plugins/ldap-sync/tests/opensync.suppr Sat Apr 4 23:50:08 2009 (r5536) @@ -4307,4 +4307,35 @@ } +{ + <insert a suppression name here> + Memcheck:Addr1 + fun:memcpy + fun:g_array_append_vals + fun:g_byte_array_append + fun:osync_marshal_write_data + fun:osync_marshal_write_buffer + fun:osync_message_write_buffer + fun:osync_marshal_data + fun:osync_marshal_change + fun:_osync_client_change_callback + fun:osync_context_report_change + fun:ldap_plugin_report_change + fun:ldap_plugin_report_changes_to_be_added + fun:ldap_plugin_get_changes + fun:osync_objtype_sink_get_changes + fun:_osync_client_handle_get_changes + fun:_osync_client_message_handler + fun:_incoming_dispatch + fun:g_main_context_dispatch + obj:/lib/libglib-2.0.so.0.1800.3 + fun:g_main_loop_run + obj:/lib/libglib-2.0.so.0.1800.3 + fun:start_thread + fun:clone + obj:* +} + + + |