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...> - 2010-02-28 17:40:58
|
Author: scriptor Date: Sun Feb 28 18:40:50 2010 New Revision: 6044 URL: http://www.opensync.org/changeset/6044 Log: More suppression files created on occasion of leak tracking. Modified: plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Sun Feb 28 18:39:36 2010 (r6043) +++ plugins/ldap-sync/tests/opensync.suppr Sun Feb 28 18:40:50 2010 (r6044) @@ -2509,7 +2509,7 @@ { - <osync_trace_leak6> + <osync_trace_leak1> Memcheck:Leak fun:malloc fun:g_malloc @@ -2521,7 +2521,7 @@ { - <osync_trace_leak7> + <osync_trace_leak2> Memcheck:Leak fun:malloc fun:g_malloc @@ -2534,7 +2534,7 @@ { - <osync_trace_leak8> + <osync_trace_leak3> Memcheck:Leak fun:memalign fun:posix_memalign @@ -2555,6 +2555,175 @@ +# ==31985== 1,984 bytes in 4 blocks are possibly lost in loss record 829 of 904 +# ==31985== at 0x4A04360: memalign (vg_replace_malloc.c:532) +# ==31985== by 0x4A043B9: posix_memalign (vg_replace_malloc.c:660) +# ==31985== by 0x38EA655D51: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA656DF1: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA65C49A: g_string_sized_new (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x4C5A4A6: osync_trace (opensync_trace.c:178) +# ==31985== by 0x58DA5CF: ldap_format_copy_ldap_entry (ldap_format.c:766) +# ==31985== by 0x58DAE09: ldap_format_copy_ldap_entry (ldap_format.c:934) +# ==31985== by 0x58E7A94: ldap_format_copy_format1 (ldap_format.c:6870) +# ==31985== by 0x58E7F37: ldap_format_marshal_glist_container (ldap_format.c:7005) +# ==31985== by 0x4C71EF3: osync_objformat_marshal (opensync_objformat.c:269) +# ==31985== by 0x4C84914: osync_marshal_data (opensync_serializer.c:78) +# ==31985== by 0x4C84DE2: osync_marshal_change (opensync_serializer.c:200) +# ==31985== by 0x4C49057: _osync_client_change_callback (opensync_client.c:378) +# ==31985== by 0x4C8B090: osync_context_report_change (opensync_context.c:165) +# ==31985== by 0x9047560: ldap_plugin_report_change (ldap_plugin.c:1626) +# ==31985== by 0x9047DFE: ldap_plugin_report_changes_to_be_added (ldap_plugin.c:1880) +# ==31985== by 0x904956A: ldap_plugin_get_changes (ldap_plugin.c:2496) +# ==31985== by 0x4C97A36: osync_objtype_sink_get_changes (opensync_objtype_sink.c:286) +# ==31985== by 0x4C4B5C3: _osync_client_handle_get_changes (opensync_client.c:1270) +# ==31985== by 0x4C4C1CB: _osync_client_message_handler (opensync_client.c:1569) +# ==31985== by 0x4C81A8D: _incoming_dispatch (opensync_queue.c:391) +# ==31985== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==31985== +# +{ + <osync_trace_leak4> + Memcheck:Leak + fun:memalign + fun:posix_memalign + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_slice_alloc + fun:g_string_sized_new + fun:osync_trace + fun:ldap_format_copy_ldap_entry + fun:ldap_format_copy_ldap_entry + fun:ldap_format_copy_format1 + fun:ldap_format_marshal_glist_container + 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 +} + + + +# ==31985== 1,984 bytes in 4 blocks are possibly lost in loss record 830 of 904 +# ==31985== at 0x4A04360: memalign (vg_replace_malloc.c:532) +# ==31985== by 0x4A043B9: posix_memalign (vg_replace_malloc.c:660) +# ==31985== by 0x38EA655D51: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA656DF1: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA65C49A: g_string_sized_new (in /lib64/libglib-2.0.so.0.220 +# 0.2) +# ==31985== by 0x4C5A4A6: osync_trace (opensync_trace.c:178) +# ==31985== by 0x58DA5CF: ldap_format_copy_ldap_entry (ldap_format.c:766) +# ==31985== by 0x58DAE09: ldap_format_copy_ldap_entry (ldap_format.c:934) +# ==31985== by 0x58E7A94: ldap_format_copy_format1 (ldap_format.c:6870) +# ==31985== by 0x4C71A46: osync_objformat_copy (opensync_objformat.c:176) +# ==31985== by 0x4C57D7D: osync_data_clone (opensync_data.c:179) +# ==31985== by 0x4C709F5: osync_format_env_detect_objformat_full (opensync_form +# at_env.c:1128) +# ==31985== by 0x4C5B350: _osync_engine_receive_change (opensync_engine.c:226) +# ==31985== by 0x4C4ED58: _osync_client_proxy_message_handler (opensync_client_ +# proxy.c:841) +# ==31985== by 0x4C81A8D: _incoming_dispatch (opensync_queue.c:391) +# ==31985== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==31985== +# +{ + <osync_trace_leak5> + Memcheck:Leak + fun:memalign + fun:posix_memalign + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_slice_alloc + fun:g_string_sized_new + fun:osync_trace + fun:ldap_format_copy_ldap_entry + fun:ldap_format_copy_ldap_entry + fun:ldap_format_copy_format1 + fun:osync_objformat_copy + fun:osync_data_clone + fun:osync_format_env_detect_objformat_full + fun:_osync_engine_receive_change + fun:_osync_client_proxy_message_handler + fun:_incoming_dispatch + fun:g_main_context_dispatch + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_main_loop_run + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:start_thread +} + + + +# ==31985== 1,984 bytes in 4 blocks are possibly lost in loss record 831 of 904 +# ==31985== at 0x4A04360: memalign (vg_replace_malloc.c:532) +# ==31985== by 0x4A043B9: posix_memalign (vg_replace_malloc.c:660) +# ==31985== by 0x38EA655D51: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA656DF1: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA65C49A: g_string_sized_new (in /lib64/libglib-2.0.so.0.220 +# 0.2) +# ==31985== by 0x4C5A4A6: osync_trace (opensync_trace.c:178) +# ==31985== by 0x58DA5CF: ldap_format_copy_ldap_entry (ldap_format.c:766) +# ==31985== by 0x58DB172: ldap_format_create_ldap_entries_list_from_ldapmods (l +# dap_format.c:1034) +# ==31985== by 0x58E3581: ldap_format_convert_xmlinternal2ldap (ldap_format.c:4 +# 905) +# ==31985== by 0x58E3D85: ldap_format_post_stylesheet (ldap_format.c:5128) +# ==31985== by 0x58E5968: ldap_format_do_conv_xmlformat_to_ldap (ldap_format.c: +# 5908) +# ==31985== by 0x58E5E47: ldap_format_conv_xmlformat_contact_to_ldap_evolution_ +# person (ldap_format.c:6036) +# ==31985== by 0x4C6BE0B: osync_converter_invoke (opensync_converter.c:196) +# ==31985== by 0x4C70E18: osync_format_env_convert (opensync_format_env.c:1213) +# ==31985== by 0x4C6EE7E: osync_format_env_find_path_fn (opensync_format_env.c:638) +# ==31985== by 0x4C713A5: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +# ==31985== by 0x4C651DF: osync_entry_engine_convert (opensync_mapping_entry_engine.c:244) +# ==31985== by 0x4C69E48: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:196) +# ==31985== by 0x4C6947D: osync_obj_engine_prepare_write (opensync_obj_engine.c:1469) +# ==31985== by 0x4C68B27: osync_obj_engine_command (opensync_obj_engine.c:1217) +# ==31985== by 0x4C60A3F: osync_engine_event (opensync_engine.c:2045) +# ==31985== by 0x4C5E2CD: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==31985== by 0x4C5F49E: _osync_engine_generate_event (opensync_engine.c:1536) +# ==31985== by 0x4C5F5A5: _osync_engine_event_callback (opensync_engine.c:1570) +# ==31985== by 0x4C68E5B: osync_obj_engine_event (opensync_obj_engine.c:1315) +# ==31985== by 0x4C68B0F: osync_obj_engine_command (opensync_obj_engine.c:1212) +# ==31985== by 0x4C60358: osync_engine_command (opensync_engine.c:1884) +# ==31985== by 0x4C5BA30: _command_dispatch (opensync_engine.c:383) +# ==31985== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==31985== +# +{ + <osync_trace_leak6> + Memcheck:Leak + fun:memalign + fun:posix_memalign + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_slice_alloc + fun:g_string_sized_new + fun:osync_trace + fun:ldap_format_copy_ldap_entry + fun:ldap_format_create_ldap_entries_list_from_ldapmods + fun:ldap_format_convert_xmlinternal2ldap + fun:ldap_format_post_stylesheet + fun:ldap_format_do_conv_xmlformat_to_ldap +} + + + + + + { <leak 38> @@ -11163,7 +11332,7 @@ { - <osync_trace_leak5> + <osync_trace_leak7> Memcheck:Leak fun:malloc fun:g_malloc |
From: <svn...@op...> - 2010-02-28 17:39:45
|
Author: scriptor Date: Sun Feb 28 18:39:36 2010 New Revision: 6043 URL: http://www.opensync.org/changeset/6043 Log: Comments, minor changes. Modified: plugins/ldap-sync/CMakeLists.txt plugins/ldap-sync/src/CMakeLists.txt plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/CMakeLists.txt Sun Feb 28 18:39:19 2010 (r6042) +++ plugins/ldap-sync/CMakeLists.txt Sun Feb 28 18:39:36 2010 (r6043) @@ -450,7 +450,7 @@ ########################################################################## ## Packaging -SET(CPACK_SOURCE_IGNORE_FILES "/Testing/;tags;/obsolete/;build;build_debug;svn_;/CVS/;/\\.svn/;\\.swp$;.*~;") +SET(CPACK_SOURCE_IGNORE_FILES "/Testing/;tags;/obsolete/;build;build_debug;build_windows;svn_;/CVS/;/[.]svn/;[.]swp$;.*~;") OPENSYNC_PACKAGE( ${PROJECT_NAME} ${VERSION} ) # vim:tw=0:nowrap Modified: plugins/ldap-sync/src/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/src/CMakeLists.txt Sun Feb 28 18:39:19 2010 (r6042) +++ plugins/ldap-sync/src/CMakeLists.txt Sun Feb 28 18:39:36 2010 (r6043) @@ -30,13 +30,13 @@ ENDIF ( NOT _LDAP_INCLUDE_DIRS ) IF ( NOT _LDAP_LIBRARY_DIRS ) - MESSAGE( FATAL ERROR " _LDAP_LIBRARY_DIRS could not be determined. The build process of the ldap-sync plugin must know where to find the ldap libraries.") + MESSAGE( FATAL_ERROR " _LDAP_LIBRARY_DIRS could not be determined. The build process of the ldap-sync plugin must know where to find the ldap libraries.") ELSE ( NOT _LDAP_LIBRARY_DIRS ) MESSAGE( STATUS "_LDAP_LIBRARY_DIRS = \"${_LDAP_LIBRARY_DIRS}\"" ) ENDIF ( NOT _LDAP_LIBRARY_DIRS ) IF ( NOT _LDAP_LIBRARIES ) - MESSAGE( FATAL ERROR " _LDAP_LIBRARIES could not be determined. The build process of the ldap-sync plugin requires the ldap library.") + MESSAGE( FATAL_ERROR " _LDAP_LIBRARIES could not be determined. The build process of the ldap-sync plugin requires the ldap library.") ELSE ( NOT _LDAP_LIBRARIES ) MESSAGE( STATUS "_LDAP_LIBRARIES = \"${_LDAP_LIBRARIES}\"" ) ENDIF ( NOT _LDAP_LIBRARIES ) Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sun Feb 28 18:39:19 2010 (r6042) +++ plugins/ldap-sync/src/ldap_format.c Sun Feb 28 18:39:36 2010 (r6043) @@ -2874,7 +2874,9 @@ osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat = %p", __FILE__, __LINE__, (void *)xmlformat); osync_trace(TRACE_INTERNAL, "%s:%i: This needs to be freed eventually. But by whom? And where and when exactly?", __FILE__, __LINE__); - + // To answer this question: One possibility is the call of + // osync_xmlformat_unref() in ldap_format_osync_xml_format2ldap_entries() + #ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: ---------- </osync_xmlformat_parse()> -----------", __FILE__, __LINE__); Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Sun Feb 28 18:39:19 2010 (r6042) +++ plugins/ldap-sync/src/ldap_plugin.c Sun Feb 28 18:39:36 2010 (r6043) @@ -838,13 +838,16 @@ continue; } + if (name[0] == 0) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: name[0] = 0. Skipping this entry.\n", __FILE__, __LINE__); + continue; + } if (val == NULL) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: val = NULL. Skipping this entry.\n", __FILE__, __LINE__); continue; } - if (!strcmp(name, "binddn")) sinkenv->binddn = g_strdup(val); @@ -4635,12 +4638,17 @@ /** * @brief This function finishes the whole ldap-sync plugin. * - * @param userdata ??????? + * @param userdata The plugin specific environment is here passed as + * void-pointer. plugin_env has been allocated in + * ldap_plugin_initialize(). * * @returns Nothing */ void ldap_plugin_finalize(void *userdata) { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): userdata = %p", __FILE__, __LINE__, __func__, userdata); + + plugin_environment *plugin_env = (plugin_environment *)userdata; if (plugin_env == NULL) { |
From: <svn...@op...> - 2010-02-28 17:39:28
|
Author: scriptor Date: Sun Feb 28 18:39:19 2010 New Revision: 6042 URL: http://www.opensync.org/changeset/6042 Log: Fixed validation error with the CalendarScale element. Modified: plugins/ldap-sync/src/xslt/ldap_event2xmlformat_event.xsl Modified: plugins/ldap-sync/src/xslt/ldap_event2xmlformat_event.xsl ============================================================================== --- plugins/ldap-sync/src/xslt/ldap_event2xmlformat_event.xsl Sun Feb 28 18:39:09 2010 (r6041) +++ plugins/ldap-sync/src/xslt/ldap_event2xmlformat_event.xsl Sun Feb 28 18:39:19 2010 (r6042) @@ -253,7 +253,9 @@ </xsl:for-each> </xsl:for-each> - <xsl:value-of select="subentry/CalendarScale" /> + <xsl:element name="Content"> + <xsl:value-of select="subentry/CalendarScale" /> + </xsl:element> </xsl:element> </xsl:if> |
From: <svn...@op...> - 2010-02-28 17:39:18
|
Author: scriptor Date: Sun Feb 28 18:39:09 2010 New Revision: 6041 URL: http://www.opensync.org/changeset/6041 Log: Small bug fixes and minor changes with the test scripts. Modified: plugins/ldap-sync/tests/check_common.inc plugins/ldap-sync/tests/clean_up Modified: plugins/ldap-sync/tests/check_common.inc ============================================================================== --- plugins/ldap-sync/tests/check_common.inc Sun Feb 28 18:38:49 2010 (r6040) +++ plugins/ldap-sync/tests/check_common.inc Sun Feb 28 18:39:09 2010 (r6041) @@ -57,7 +57,7 @@ # a=$(ls -alR $osync_trace_dir) # echo -e "$a" - echo -e "\n${FUNCNAME}(): Enabling trace files (OSYNC_TRACE and SYNCML_TRACE) for \"${test_name}\":\n$osync_trace_dir\n$syncml_trace_dir\n" + echo -e "\n\n${FUNCNAME}(): Enabling trace files (OSYNC_TRACE and SYNCML_TRACE) for \"${test_name}\":\n$osync_trace_dir\n$syncml_trace_dir\n\n" export OSYNC_TRACE="$osync_trace_dir" export SYNCML_TRACE="$syncml_trace_dir" @@ -366,6 +366,8 @@ exit 1; fi + echo -e "\n${FUNCNAME}(): VALGRIND = \"$VALGRIND\"\n" + export DART_TESTING_TIMEOUT="600" else @@ -1014,7 +1016,8 @@ templ=$(eval "$SOURCE_DIR/${member_config_file}.templ") echo "${templ}" > "$BUILD_DIR/$member_config_file" else - echo "${FUNCNAME}(): INFO: $SOURCE_DIR/${member_config_file}.templ could NOT be found." + echo "${FUNCNAME}(): INFO: $SOURCE_DIR/${member_config_file}.templ could NOT be found. Exiting." + exit 1; fi @@ -1027,9 +1030,13 @@ fi fi + if test -z "$config_file"; then + echo "${FUNCNAME}(): ERROR: \$config_file is empty. Exiting."; + exit 1; + fi if test ! -e "$config_file"; then - echo "${FUNCNAME}(): ERROR: $config_file does not exist. Exiting."; + echo "${FUNCNAME}(): ERROR: \$config_file = \"$config_file\" does not exist. Exiting."; exit 1; fi Modified: plugins/ldap-sync/tests/clean_up ============================================================================== --- plugins/ldap-sync/tests/clean_up Sun Feb 28 18:38:49 2010 (r6040) +++ plugins/ldap-sync/tests/clean_up Sun Feb 28 18:39:09 2010 (r6041) @@ -7,7 +7,6 @@ # set -x FILE=$0 -PLUGINNAME="ldap-sync" SOURCE_DIR=`dirname $FILE` if test ! -d "$SOURCE_DIR"; then echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." |
From: <svn...@op...> - 2010-02-24 10:34:13
|
Author: bellmich Date: Wed Feb 24 11:34:03 2010 New Revision: 1361 URL: http://libsyncml.opensync.org/changeset/1361 Log: added change log entry for ticket #257 Modified: trunk/ChangeLog Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue Feb 23 15:19:41 2010 (r1360) +++ trunk/ChangeLog Wed Feb 24 11:34:03 2010 (r1361) @@ -8,6 +8,9 @@ * a fix for some hangs on 64 bit machines because of mixed data types (r1285) * added a forgotten change type in syncml-ds-tool (r1326) + * Andris Pavenis <and...@ik...> fixed a wrong error handling + in the code which handles the passphrase callback during the + authentication (ticket #257, patch r1358). 2009-06-04 Michael Bell <mic...@we...> * Released 0.5.4 |
From: <svn...@op...> - 2010-02-23 14:19:51
|
Author: bellmich Date: Tue Feb 23 15:19:41 2010 New Revision: 1360 URL: http://libsyncml.opensync.org/changeset/1360 Log: added support for handling of status code 419 Modified: trunk/libsyncml/sml_error.c trunk/libsyncml/sml_error.h trunk/tools/syncml-ds-tool.c Modified: trunk/libsyncml/sml_error.c ============================================================================== --- trunk/libsyncml/sml_error.c Mon Feb 22 16:09:54 2010 (r1359) +++ trunk/libsyncml/sml_error.c Tue Feb 23 15:19:41 2010 (r1360) @@ -130,6 +130,12 @@ case SML_ERROR_ALREADY_EXISTS: return "Already exists. The requested Put or Add command failed " \ "because the target already exists."; + case SML_ERROR_CONFLICT_SERVER_WINS: + return "Conflict resolved with server data. The response indicates that the " \ + "client request created a conflict; which was resolved by the server " \ + "command winning. The normal information in the Status " \ + "SHOULD be sufficient for the client to \"undo\" the resolution, if it " \ + "is desired."; case SML_ERROR_SIZE_MISMATCH: return "Size mismatch. The chunked object was received, but the size of " \ "the received object did not match the size declared within the first " \ Modified: trunk/libsyncml/sml_error.h ============================================================================== --- trunk/libsyncml/sml_error.h Mon Feb 22 16:09:54 2010 (r1359) +++ trunk/libsyncml/sml_error.h Tue Feb 23 15:19:41 2010 (r1360) @@ -95,6 +95,7 @@ SML_ERROR_AUTH_REQUIRED = 407, // Authentication required, Missing Credentials SML_ERROR_RETRY_LATER = 417, // Retry later SML_ERROR_ALREADY_EXISTS = 418, // Put or Add failed because item already exists + SML_ERROR_CONFLICT_SERVER_WINS = 419, // Put or Add creates a conflict. Server data wins. SML_ERROR_SIZE_MISMATCH = 424, // Size mismatch /* Standard errors */ Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Mon Feb 22 16:09:54 2010 (r1359) +++ trunk/tools/syncml-ds-tool.c Tue Feb 23 15:19:41 2010 (r1360) @@ -1308,11 +1308,19 @@ /* map the item if necessary */ if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_ADD) { - const char *map = g_key_file_get_string(datastore->index, "reverse_map", safeUID, error); - if (!map) + /* sometimes an item is not mappeni + * (e.g. client:ADD => server:DELETE because of error 419) + */ + const char *map = NULL; + if (g_key_file_has_group(datastore->index, "reverse_map")) + map = g_key_file_get_string(datastore->index, "reverse_map", safeUID, error); + if (!map && *error) goto error; - smlSafeCFree(&safeUID); - safeUID = g_strdup(map); + if (map) + { + smlSafeCFree(&safeUID); + safeUID = g_strdup(map); + } printf("\tMap item to %s.\n", safeUID); } @@ -1648,8 +1656,14 @@ { smlTrace(TRACE_ENTRY, "%s(%p, %p, %d, %p, %p)", __func__, session, item, code, userdata, error); - /* If there is an error then the whole operation must be aborted. */ - if (sml_error_get_class(code) != SML_ERRORCLASS_SUCCESS) + /* If there is an error then the whole operation must be aborted. + * 418 => The item is already present. So no problem. + * 419 => There was a conflict but the server data wins. + * Usually this means that the item should be removed. + */ + if (sml_error_get_class(code) != SML_ERRORCLASS_SUCCESS && + code != SML_ERROR_ALREADY_EXISTS && + code != SML_ERROR_CONFLICT_SERVER_WINS) { g_set_error(error, TOOL_ERROR, code, smlErrorTypeGetMessage(code)); goto error; @@ -1672,17 +1686,38 @@ if (!digest && *error) goto error; - if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_DELETE) + if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_DELETE && + ! (code == SML_ERROR_CONFLICT_SERVER_WINS && + sml_data_sync_change_item_get_action(item) == SML_CHANGE_ADD + ) + ) + { + /* No delete and no 419 of an add. */ g_key_file_set_string(datastore->index, "committed_index", key, digest); + } + /* NOTICE: glib changed the return type of g_key_file_remove_key */ g_key_file_remove_key(datastore->index, "change_index", key, error); if (*error) goto error; +// /* 419 => conflict and server wins +// * => item must be locally removed. +// */ +// if (code == SML_ERROR_CONFLICT_SERVER_WINS && +// sml_data_sync_change_item_get_action(item) == SML_CHANGE_ADD) +// { +// char *safeUID = getSafeFilename(key); +// char *absoluteUID = g_strdup_printf("%s/%s", datastore->directory, safeUID); +// g_unlink(absoluteUID); +// smlSafeCFree(&absoluteUID); +// smlSafeCFree(&safeUID); +// } + smlTrace(TRACE_EXIT, "%s - TRUE", __func__); return TRUE; error: - smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, (*error)->message); + smlTrace(TRACE_EXIT_ERROR, "%s - %d => %s", __func__, (*error)->code, (*error)->message); return FALSE; } |
From: <svn...@op...> - 2010-02-23 12:58:53
|
Author: bellmich Date: Tue Feb 23 13:40:17 2010 New Revision: 224 URL: http://libwbxml.opensync.org/changeset/224 Log: - The content type of a SyncML data object is now correctly detected even within a CDATA section. - If a vFormat object is embedded into a SyncML message then the line break must be a CRLF. This is a violation of the XML specification but this is a known bug of the SyncML specification. All LFs inside a vFormat object are replaced by a CRLF. - Added a comment about the Nokia ConML support. Modified: wbxml2/trunk/ChangeLog wbxml2/trunk/src/wbxml_tree.c wbxml2/trunk/src/wbxml_tree_clb_xml.c Modified: wbxml2/trunk/ChangeLog ============================================================================== --- wbxml2/trunk/ChangeLog Thu Jun 11 10:12:09 2009 (r223) +++ wbxml2/trunk/ChangeLog Tue Feb 23 13:40:17 2010 (r224) @@ -1,4 +1,10 @@ + * Added Nokia ConML support (ticket #35). + There is no public documentation available from Nokia. The + transformation tables were created from sniffed WBXML documents. + The patch was supplied by Anton D. Kachalov. + 2009-05-12 Michael Bell <mic...@we...> + * Released 0.10.7 * Fixed a Debian MIPS port build issue (ticket #34) If the operating system environment has a built-in getopt implementation then the cmake environment disables the internal @@ -8,6 +14,7 @@ POSIX header files (e.g. optopt). 2009-04-24 Michael Bell <mic...@we...> + * Released 0.10.6 * Extended (updated) tables for Microsoft AirSync (The patch was supplied by Ossi Jormakka from Ixonos Plc.) * Expat splits <html> into three separate text nodes. Modified: wbxml2/trunk/src/wbxml_tree.c ============================================================================== --- wbxml2/trunk/src/wbxml_tree.c Thu Jun 11 10:12:09 2009 (r223) +++ wbxml2/trunk/src/wbxml_tree.c Tue Feb 23 13:40:17 2010 (r224) @@ -793,6 +793,10 @@ if (node == NULL) return WBXML_SYNCML_DATA_TYPE_NORMAL; + /* If we are in a CDATA node then we must look into the parent node. */ + if (node->type == WBXML_TREE_CDATA_NODE) + node = node->parent; + /* Are we in a <Data> ? */ if ((node->type == WBXML_TREE_ELEMENT_NODE) && (node->name != NULL) && Modified: wbxml2/trunk/src/wbxml_tree_clb_xml.c ============================================================================== --- wbxml2/trunk/src/wbxml_tree_clb_xml.c Thu Jun 11 10:12:09 2009 (r223) +++ wbxml2/trunk/src/wbxml_tree_clb_xml.c Tue Feb 23 13:40:17 2010 (r224) @@ -405,11 +405,31 @@ #if defined ( WBXML_SUPPORT_SYNCML ) /* Specific treatment for SyncML */ switch (wbxml_tree_node_get_syncml_data_type(tree_ctx->current)) { - case WBXML_SYNCML_DATA_TYPE_CLEAR: case WBXML_SYNCML_DATA_TYPE_DIRECTORY_VCARD: case WBXML_SYNCML_DATA_TYPE_VCALENDAR: case WBXML_SYNCML_DATA_TYPE_VCARD: case WBXML_SYNCML_DATA_TYPE_VOBJECT: + /* SyncML has some real design bugs + * because the authors of the specification did not understand XML. + * + * There must be a hack to preserve the CRLFs of vFormat objects. + * The only chance to do this is the detection of the vFormat itself + * and the conversion of every LF to a CRLF. + * + * The line breaks are always in a single text node. + * So a CR is appended to get a CRLF at the end. + */ + + if (len == 1 && ch[0] == '\n') /* line break - LF */ + { + ch = "\r\n"; + len = 2; + } + + /* Do not break here. + * The CDATA handling is required for vFormat objects too. + */ + case WBXML_SYNCML_DATA_TYPE_CLEAR: /* * Add a missing CDATA section node * @@ -472,7 +492,7 @@ * </Data> * ... * - * In this example, the spaces beetwen "]]>" and "</Data>" mustn't be added + * In this example, the spaces beetwen "]]>" and "</Data>" must not be added * to a CDATA section. */ if ((tree_ctx->current != NULL) && |
From: <svn...@op...> - 2010-02-23 12:51:07
|
Author: bellmich Date: Tue Feb 23 13:50:38 2010 New Revision: 226 URL: http://libwbxml.opensync.org/changeset/226 Log: removed all OMA DM files which are copyright protected by the OMA ticket #36 Deleted: wbxmlTestSuite/trunk/ddf/dm_devdetail-v1_2.ddf wbxmlTestSuite/trunk/ddf/dm_devinfo-v1_2.ddf wbxmlTestSuite/trunk/ddf/dm_dmacc-v1_2.ddf wbxmlTestSuite/trunk/ddf/ds_mo-v1_0.ddf wbxmlTestSuite/trunk/ddf/mo_oma_imps-V1_3.ddf |
From: <svn...@op...> - 2010-02-23 12:50:34
|
Author: bellmich Date: Tue Feb 23 13:50:20 2010 New Revision: 225 URL: http://libwbxml.opensync.org/changeset/225 Log: removed all OMA DM files which are copyright protected by the OMA Modified: wbxml2/trunk/CMakeLists.txt wbxml2/trunk/ChangeLog Modified: wbxml2/trunk/CMakeLists.txt ============================================================================== --- wbxml2/trunk/CMakeLists.txt Tue Feb 23 13:40:17 2010 (r224) +++ wbxml2/trunk/CMakeLists.txt Tue Feb 23 13:50:20 2010 (r225) @@ -250,7 +250,7 @@ CONFIGURE_FILE( "tests/launchTests.sh" "${CMAKE_CURRENT_BINARY_DIR}/launchTests.sh") CONFIGURE_FILE( "tests/normalize_xml.pl" "${CMAKE_CURRENT_BINARY_DIR}/normalize_xml.pl" @ONLY) SET( airsync_tests 3 ) -SET( ddf_tests 7 ) +SET( ddf_tests 2 ) # 2009-Jan-19 bellmich # All DRMREL 1.0 tests are switched off. # The background is the extremely bad specification. Modified: wbxml2/trunk/ChangeLog ============================================================================== --- wbxml2/trunk/ChangeLog Tue Feb 23 13:40:17 2010 (r224) +++ wbxml2/trunk/ChangeLog Tue Feb 23 13:50:20 2010 (r225) @@ -1,3 +1,8 @@ + * Removed OMA DM tests because the OMA did not grant a permission + for the inclusion (ticket #36). + * Added a fix for the broken vFormat handling in the SyncML + specification. All LFs are replaced by CRLFs in every vFormat + object inside a SyncML message. * Added Nokia ConML support (ticket #35). There is no public documentation available from Nokia. The transformation tables were created from sniffed WBXML documents. |
From: <svn...@op...> - 2010-02-22 15:10:05
|
Author: bellmich Date: Mon Feb 22 16:09:54 2010 New Revision: 1359 URL: http://libsyncml.opensync.org/changeset/1359 Log: - fixed some wrong trace statements - added a sanity check Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Mon Feb 22 14:31:36 2010 (r1358) +++ trunk/tools/syncml-ds-tool.c Mon Feb 22 16:09:54 2010 (r1359) @@ -969,7 +969,9 @@ goto error; /* migrate all entries from committed_index to last_index */ - char **keys = g_key_file_get_keys(datastore->index, "committed_index", NULL, NULL); + char **keys = NULL; + if (g_key_file_has_group(datastore->index, "committed_index")) + keys = g_key_file_get_keys(datastore->index, "committed_index", NULL, NULL); int pos = 0; while (keys != NULL && keys[pos] != NULL) { @@ -1001,7 +1003,7 @@ smlSafeCFree(&absolute); } } - smlTrace(TRACE_EXIT, "%s"); + smlTrace(TRACE_EXIT, "%s", __func__); return; error: smlTrace(TRACE_EXIT_ERROR, "%s - %s", error->message); @@ -1203,7 +1205,7 @@ g_message("ERROR: %s\n", error->message); writeSyncStatus(FALSE); // g_error_free(error); - smlTrace(TRACE_EXIT_ERROR, "%s - failed."); + smlTrace(TRACE_EXIT_ERROR, "%s - failed.", __func__); exit(2); break; case SML_DATA_SYNC_SESSION_EVENT_CONNECT: |
From: <svn...@op...> - 2010-02-22 14:08:31
|
Author: bellmich Date: Mon Feb 22 14:31:36 2010 New Revision: 1358 URL: http://libsyncml.opensync.org/changeset/1358 Log: fixed ticket #257 The solution based on the original patch from Andris Pavenis. Modified: trunk/libsyncml/objects/sml_auth.c Modified: trunk/libsyncml/objects/sml_auth.c ============================================================================== --- trunk/libsyncml/objects/sml_auth.c Mon Feb 22 14:03:00 2010 (r1357) +++ trunk/libsyncml/objects/sml_auth.c Mon Feb 22 14:31:36 2010 (r1358) @@ -110,9 +110,21 @@ { auth->state = SML_AUTH_ACCEPTED; } else { - g_set_error(&error, SML_ERROR, SML_ERROR_AUTH_REJECTED, - "Auth rejected for username %s", - sml_location_get_name(smlSessionGetSource(session))); + + if (error) { + smlTrace(TRACE_ERROR, "%s: %s", __func__, error->message); + GError *cb_error = error; + error = NULL; + g_set_error(&error, SML_ERROR, SML_ERROR_AUTH_REJECTED, + "Auth rejected for username %s. %s", + sml_location_get_name(smlSessionGetSource(session)), + cb_error->message); + g_error_free(cb_error); + } else { + g_set_error(&error, SML_ERROR, SML_ERROR_AUTH_REJECTED, + "Auth rejected for username %s. %s", + sml_location_get_name(smlSessionGetSource(session))); + } smlSessionDispatchEvent(session, SML_SESSION_EVENT_ERROR, NULL, NULL, NULL, error); g_error_free(error); error = NULL; |
From: <svn...@op...> - 2010-02-22 13:18:40
|
Author: bellmich Date: Mon Feb 22 14:03:00 2010 New Revision: 1357 URL: http://libsyncml.opensync.org/changeset/1357 Log: - disable features in the help message which are not supported - fixed returns and exit traces of scanArguments - usage exits with 0 if the usage message was explicitly requested - g_key_file_get_keys returns NULL if there is no key. This must be checked because NULL[0] is a segmentation fault. - g_key_file_get_string can only be called on an existing section. The section must be checked previously with g_key_file_has_group. Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Mon Dec 7 15:06:07 2009 (r1356) +++ trunk/tools/syncml-ds-tool.c Mon Feb 22 14:03:00 2010 (r1357) @@ -271,7 +271,7 @@ /* *********** USAGE ****************** */ /* ************************************ */ -static void usage (char *name) +static void usage (char *name, gboolean isError) { fprintf(stderr, "Usage: %s\n\n", name); @@ -304,12 +304,15 @@ fprintf(stderr, "\t--ssl-cert <file>\n\n"); fprintf(stderr, "\t<port>\tmust be a port for the http server.\n\n"); +#ifdef ENABLE_OBEX fprintf(stderr, "\tOBEX client configuration:\n"); fprintf(stderr, "\t==========================\n\n"); fprintf(stderr, "\t-s <device>\tConnect to the serial device.\n"); fprintf(stderr, "\t-u\t\tList all available USB interfaces.\n"); fprintf(stderr, "\t-u <id>\t\tConnect to the given usb interface number.\n"); +#ifdef ENABLE_BLUETOOTH fprintf(stderr, "\t-b <addr> <channel>\tConnect to the given bluetooth device.\n"); +#endif fprintf(stderr, "\t--ip <addr> <port>\tConnect to this TCP/IP address.\n"); fprintf(stderr, "\t--irda\t\tConnect using IrDA.\n"); fprintf(stderr, "\t--irda-service <service>\tUse the given IrDA service (default: OBEX).\n\n"); @@ -317,6 +320,7 @@ fprintf(stderr, "\tOBEX server configuration:\n"); fprintf(stderr, "\t==========================\n\n"); fprintf(stderr, "\t--port <port>\tListen to this TCP/IP port.\n\n"); +#endif fprintf(stderr, "\tGeneral SyncML options:\n"); fprintf(stderr, "\t=======================\n\n"); @@ -351,7 +355,10 @@ fprintf(stderr, "\t--fake-software-version <SwV>\tset the software version of the faked device.\n"); fprintf(stderr, "\n"); - exit (1); + if (isError) + exit (1); + else + exit(0); } /* ************************************ */ @@ -459,7 +466,7 @@ { smlTrace(TRACE_ENTRY, "%s", __func__); if (argc == 1) - usage (argv[0]); + usage (argv[0], TRUE); maxMsgSize = g_strdup("65535"); maxObjSize = g_strdup("3000000"); @@ -493,7 +500,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); sml_data_sync_data_store_set_content_type(datastore->object, argv[i]); if (!strstr(argv[i], "/")) @@ -506,7 +513,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); sml_data_sync_data_store_set_local_uri(datastore->object, argv[i]); @@ -569,10 +576,12 @@ if (!argv[i]) { #ifdef ENABLE_OBEX list_interfaces(); - return 0; + smlTrace(TRACE_EXIT, "%s - OBEX list returned", __func__); + return FALSE; #else printf("OBEX not available in this build\n"); - return 1; + smlTrace(TRACE_EXIT_ERROR, "%s - OBEX list requested but not available", __func__); + return FALSE; #endif } if (!sml_data_sync_set_option( @@ -591,7 +600,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_BLUETOOTH_ADDRESS, @@ -600,7 +609,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_BLUETOOTH_CHANNEL, @@ -608,7 +617,8 @@ goto error; #else printf("Bluetooth is not available in this build\n"); - return 1; + smlTrace(TRACE_EXIT, "%s - Bluetooth requested but not available", __func__); + return FALSE; #endif } else if (!strcmp (arg, "--irda")) { if (!sml_data_sync_set_option( @@ -626,7 +636,7 @@ goto error; i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_IRDA_SERVICE, @@ -642,7 +652,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_URL, @@ -660,7 +670,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_BLUETOOTH_CHANNEL, @@ -668,7 +678,8 @@ goto error; #else printf("Bluetooth is not available in this build\n"); - return 1; + smlTrace(TRACE_EXIT, "%s - Bluetooth requested but not available", __func__); + return FALSE; #endif } else if (!strcmp (arg, "--ip")) { if (!sml_data_sync_set_option( @@ -680,7 +691,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_URL, @@ -689,7 +700,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_PORT, @@ -705,7 +716,7 @@ i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_PORT, @@ -714,7 +725,7 @@ } else if (!strcmp (arg, "--identifier")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_IDENTIFIER, @@ -724,7 +735,7 @@ } else if (!strcmp (arg, "--target")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_TARGET, @@ -734,7 +745,7 @@ } else if (!strcmp (arg, "--username")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_AUTH_USERNAME, @@ -743,7 +754,7 @@ } else if (!strcmp (arg, "--password")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_AUTH_PASSWORD, @@ -752,7 +763,7 @@ } else if (!strcmp (arg, "--maxMsgSize")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); maxMsgSize = argv[i]; if (!sml_data_sync_set_option( dsObject, @@ -762,7 +773,7 @@ } else if (!strcmp (arg, "--maxObjSize")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); maxObjSize = argv[i]; if (!sml_data_sync_set_option( dsObject, @@ -797,7 +808,8 @@ i++; if (!argv[i]) { fprintf(stdout, "Version: %s ($Revision$)\n", VERSION); - return 0; + smlTrace(TRACE_EXIT, "%s - Only the version was requested.", __func__); + return FALSE; } if (!sml_data_sync_set_option( @@ -807,7 +819,7 @@ goto error; syncmlVersion = g_strdup(argv[i]); } else if (!strcmp (arg, "--help")) { - usage (argv[0]); + usage (argv[0], FALSE); } else if (!strcmp (arg, "--wbxml")) { if (!sml_data_sync_set_option( dsObject, @@ -821,13 +833,13 @@ } else if (!strcmp (arg, "--remoteWinsConflicts")) { localWinsConflicts = FALSE; if (sessionType == SML_SESSION_TYPE_CLIENT) - usage(argv[0]); + usage(argv[0], TRUE); } else if (!strcmp(arg, "--read-only")) { readOnly = TRUE; } else if (!strcmp (arg, "--http-client")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_URL, @@ -836,7 +848,7 @@ } else if (!strcmp (arg, "--ssl-ca-certs")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_SSL_CA_FILE, @@ -845,7 +857,7 @@ } else if (!strcmp (arg, "--http-server")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_PORT, @@ -854,7 +866,7 @@ } else if (!strcmp (arg, "--ssl-key")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_SSL_KEY, @@ -863,7 +875,7 @@ } else if (!strcmp (arg, "--ssl-cert")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_TRANSPORT_CONFIG_SSL_SERVER_CERT, @@ -872,7 +884,7 @@ } else if (!strcmp (arg, "--fake-manufacturer")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_FAKE_DEVICE, @@ -886,7 +898,7 @@ } else if (!strcmp (arg, "--fake-model")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_FAKE_DEVICE, @@ -900,7 +912,7 @@ } else if (!strcmp (arg, "--fake-software-version")) { i++; if (!argv[i]) - usage (argv[0]); + usage (argv[0], TRUE); if (!sml_data_sync_set_option( dsObject, SML_DATA_SYNC_CONFIG_FAKE_DEVICE, @@ -915,7 +927,7 @@ break; } else { g_warning("Unknown parameter: %s", arg); - usage (argv[0]); + usage (argv[0], TRUE); } } @@ -933,7 +945,7 @@ error: smlTrace(TRACE_EXIT_ERROR, - "Failed to start the client: %s\n", + "%s - Failed to start the client: %s\n", (*error)->message); return FALSE; } @@ -944,6 +956,7 @@ static void writeSyncStatus(gboolean success) { + smlTrace(TRACE_ENTRY, "%s (%s)", __func__, success ? "TRUE" : "FALSE"); GError *error = NULL; SmlDsToolLocationType *datastore = NULL; GList *o = datastores; @@ -958,7 +971,7 @@ /* migrate all entries from committed_index to last_index */ char **keys = g_key_file_get_keys(datastore->index, "committed_index", NULL, NULL); int pos = 0; - while (keys[pos] != NULL) + while (keys != NULL && keys[pos] != NULL) { char *digest = g_key_file_get_string(datastore->index, "committed_index", keys[pos], &error); if (!digest && error) @@ -988,8 +1001,10 @@ smlSafeCFree(&absolute); } } + smlTrace(TRACE_EXIT, "%s"); return; error: + smlTrace(TRACE_EXIT_ERROR, "%s - %s", error->message); g_error("%s", error->message); } @@ -1049,7 +1064,9 @@ if (!digest) goto error; #endif - char *original = g_key_file_get_string(datastore->index, "last_index", filename, NULL); + char *original = NULL; + if (g_key_file_has_group(datastore->index, "last_index")) + original = g_key_file_get_string(datastore->index, "last_index", filename, NULL); /* fix indexes */ SmlChangeType changeType = SML_CHANGE_UNKNOWN; @@ -1125,9 +1142,12 @@ */ gsize count = 0; - char **keys = g_key_file_get_keys(datastore->index, "last_index", &count, error); - if (*error) - goto error; + char **keys = NULL; + if (g_key_file_has_group(datastore->index, "last_index")) { + keys = g_key_file_get_keys(datastore->index, "last_index", &count, error); + if (*error) + goto error; + } gsize i = 0; for (; !datastore->slow && i < count; i++) { @@ -1183,6 +1203,7 @@ g_message("ERROR: %s\n", error->message); writeSyncStatus(FALSE); // g_error_free(error); + smlTrace(TRACE_EXIT_ERROR, "%s - failed."); exit(2); break; case SML_DATA_SYNC_SESSION_EVENT_CONNECT: @@ -1312,7 +1333,8 @@ char *index_digest = NULL; char *item_digest = NULL; char *file_digest = NULL; - index_digest = g_key_file_get_string(datastore->index, "last_index", safeUID, NULL); + if (g_key_file_has_group(datastore->index, "last_index")) + index_digest = g_key_file_get_string(datastore->index, "last_index", safeUID, NULL); const char *data = sml_data_sync_change_item_get_data(item); if (data) { @@ -1884,6 +1906,7 @@ } /* close the object */ g_object_unref(dsObject); + g_message("syncml-ds-tool succeeded."); return 0; error: @@ -1891,5 +1914,6 @@ fprintf(stderr, "ERROR: %s\n", error->message); g_error_free(error); } + g_message("syncml-ds-tool failed."); return 1; } |
From: <svn...@op...> - 2010-02-19 18:03:12
|
Author: scriptor Date: Fri Feb 19 19:02:59 2010 New Revision: 6039 URL: http://www.opensync.org/changeset/6039 Log: - Small bug fixes with the test scripts - Two additional todo files - opensync.suppr updated Added: plugins/ldap-sync/tests/vtodos/kdepim-todo2.ics plugins/ldap-sync/tests/vtodos/kdepim-todo2.vcs Modified: plugins/ldap-sync/misc/ldap_format_convert.c plugins/ldap-sync/tests/check_common.inc plugins/ldap-sync/tests/check_do_convert_from_to.c plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/misc/ldap_format_convert.c ============================================================================== --- plugins/ldap-sync/misc/ldap_format_convert.c Fri Feb 19 19:02:10 2010 (r6038) +++ plugins/ldap-sync/misc/ldap_format_convert.c Fri Feb 19 19:02:59 2010 (r6039) @@ -940,7 +940,6 @@ OSyncError *error = NULL; OSyncFormatEnv *format_env = NULL; OSyncObjFormat *sourceformat = NULL; - OSyncFormatConverterPath *converter_path = NULL; conv_detection detection_type = TARGET_AUTO; char *program = NULL; char *format_config = NULL; @@ -1255,9 +1254,6 @@ if (data) osync_data_unref(data); - if (converter_path) - osync_converter_path_unref(converter_path); - if (sourceformat_name) { if (!strncmp(sourceformat_name, "xmlformat-", 10)) { @@ -1285,9 +1281,6 @@ if (data) osync_data_unref(data); - if (converter_path) - osync_converter_path_unref(converter_path); - if (sourceformat_name) { if (!strncmp(sourceformat_name, "xmlformat-", 10)) { if (sourceformat) Modified: plugins/ldap-sync/tests/check_common.inc ============================================================================== --- plugins/ldap-sync/tests/check_common.inc Fri Feb 19 19:02:10 2010 (r6038) +++ plugins/ldap-sync/tests/check_common.inc Fri Feb 19 19:02:59 2010 (r6039) @@ -661,31 +661,35 @@ exit 1 fi + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + echo "AUTH = \"$AUTH\"" + fi - echo "AUTH = \"$AUTH\"" - - cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found" + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found 2>&1" + echo "$cmd" output=`$cmd` rv=$? if test $rv -ne 0; then - cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2 2>&1" + echo "$cmd" output=`$cmd` rv=$? if test $rv -ne 0; then - cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found3" + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found3 2>&1" + echo "$cmd" 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 else - echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" + echo -e "\n\n\nOK. Synchronizing after the addition was successful (3).\n\n\n" fi else - echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" + echo -e "\n\n\nOK. Synchronizing after the addition was successful (2).\n\n\n" fi else - echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" + echo -e "\n\n\nOK. Synchronizing after the addition was successful (1).\n\n\n" fi } @@ -740,17 +744,19 @@ exit 1 fi + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + echo "AUTH = \"$AUTH\"" + fi - echo "AUTH = \"$AUTH\"" - - cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2 2>&1" + echo "$cmd" output=`$cmd` 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" + echo -e "\n\n\nOK. Synchronizing after the deletion was successful.\n\n\n" fi } @@ -1794,10 +1800,11 @@ exit 1 fi + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + echo "AUTH = \"$AUTH\"" + fi - echo "AUTH = \"$AUTH\"" - - cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found" + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found 2>&1" output=`$cmd` rv=$? if test $rv -ne 0; then @@ -1928,6 +1935,7 @@ # Workaround for failing tests: + clear_dn "documentIdentifier=event1.xml,ou=calendar,dc=example,dc=com" clear_dn "documentIdentifier=todo1.xml,ou=todo,dc=example,dc=com" clear_dn "documentIdentifier=vnote1-same.vnt-new,o=notes,dc=example,dc=com" clear_dn "documentIdentifier=vnote1-same.vnt-new-new,o=notes,dc=example,dc=com" @@ -2164,12 +2172,16 @@ base=$(basename $xmlfile) if test "$base" == "contact1.xml"; then - diff "$CONTACT1_FILE" "$newfile" + cmd="diff \"$CONTACT1_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd echo -e "\n\n" rm -f "$CONTACT1_FILE" cp -f "$newfile" $CONTACT1_FILE elif test "$base" == "contact2.xml"; then - diff "$CONTACT2_FILE" "$newfile" + cmd="diff \"$CONTACT2_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd echo -e "\n\n" rm -f "$CONTACT2_FILE" cp -f "$newfile" $CONTACT2_FILE @@ -2178,13 +2190,17 @@ fi elif test "$objtype" == "event"; then - diff "$EVENT1_FILE" "$newfile" + cmd="diff \"$EVENT1_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd echo -e "\n\n" rm -f "$EVENT1_FILE" cp -f "$newfile" $EVENT1_FILE elif test "$objtype" == "todo"; then - diff "$TODO1_FILE" "$newfile" + cmd="diff \"$TODO1_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd echo -e "\n\n" rm -f "$TODO1_FILE" cp -f "$newfile" $TODO1_FILE @@ -2193,12 +2209,16 @@ base=$(basename ${xmlfile}) if test "$base" == "note1.xml"; then - diff "$NOTE1_FILE" "$newfile" + cmd="diff \"$NOTE1_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd rm -f "$NOTE1_FILE" cp -f "$newfile" $NOTE1_FILE elif test "$base" == "note2.xml"; then - diff "$NOTE2_FILE" "$newfile" + cmd="diff \"$NOTE2_FILE\" \"$newfile\"" + echo -e "$cmd\n" + eval $cmd rm -f "$NOTE2_FILE" cp -f "$newfile" $NOTE2_FILE else Modified: plugins/ldap-sync/tests/check_do_convert_from_to.c ============================================================================== --- plugins/ldap-sync/tests/check_do_convert_from_to.c Fri Feb 19 19:02:10 2010 (r6038) +++ plugins/ldap-sync/tests/check_do_convert_from_to.c Fri Feb 19 19:02:59 2010 (r6039) @@ -940,7 +940,6 @@ OSyncError *error = NULL; OSyncFormatEnv *format_env = NULL; OSyncObjFormat *sourceformat = NULL; - OSyncFormatConverterPath *converter_path = NULL; conv_detection detection_type = TARGET_AUTO; char *program = NULL; char *format_config = NULL; @@ -1255,9 +1254,6 @@ if (data) osync_data_unref(data); - if (converter_path) - osync_converter_path_unref(converter_path); - if (sourceformat_name) { if (!strncmp(sourceformat_name, "xmlformat-", 10)) { @@ -1285,9 +1281,6 @@ if (data) osync_data_unref(data); - if (converter_path) - osync_converter_path_unref(converter_path); - if (sourceformat_name) { if (!strncmp(sourceformat_name, "xmlformat-", 10)) { if (sourceformat) 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 Fri Feb 19 19:02:10 2010 (r6038) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync Fri Feb 19 19:02:59 2010 (r6039) @@ -339,7 +339,7 @@ enable_trace_subdir "$test_name" "modify" if test "$WITH_VALGRIND" = "yes" -o "$WITH_VALGRIND" = "YES" -o "$WITH_VALGRIND" = "on" -o "$WITH_VALGRIND" = "ON"; then - fast_sync + valgrind_fast_sync rv=$? else fast_sync Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Fri Feb 19 19:02:10 2010 (r6038) +++ plugins/ldap-sync/tests/opensync.suppr Fri Feb 19 19:02:59 2010 (r6039) @@ -956,6 +956,25 @@ } + +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:xmlNewMutex + fun:xmlInitMemory + fun:xmlInitParser + fun:xmlSAXParseFileWithData + fun:osync_xml_open_file + fun:osync_group_load + fun:osync_group_env_load_groups + fun:main +} + + + + + { <leak 9> Memcheck:Leak @@ -1171,6 +1190,26 @@ { + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:xmlNewCharEncodingHandler + fun:xmlInitCharEncodingHandlers + fun:xmlInitParser + fun:xmlSAXParseFileWithData + fun:osync_xml_open_file + fun:osync_group_load + fun:osync_group_env_load_groups + fun:main +} + + + + + + + +{ <leak 19> Memcheck:Leak fun:malloc @@ -2120,6 +2159,128 @@ } +# ==1132== 672 bytes in 14 blocks are indirectly lost in loss record 715 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9AA08: osync_xmlfield_new_xmlfield (opensync_xmlfield.c:53) +# ==1132== by 0x4C9AC80: osync_xmlfield_parse (opensync_xmlfield.c:119) +# ==1132== by 0x4C9ACF2: osync_xmlfield_parse (opensync_xmlfield.c:128) +# ==1132== by 0x4C9CB47: osync_xmlformat_parse (opensync_xmlformat.c:104) +# ==1132== by 0x56D41AF: ??? +# ==1132== by 0x4C6BD33: osync_converter_invoke (opensync_converter.c:196) +# ==1132== by 0x4C70D40: osync_format_env_convert (opensync_format_env.c:1213) +# ==1132== by 0x4C6EDA6: osync_format_env_find_path_fn (opensync_format_env.c:638) +# ==1132== by 0x4C712CD: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +# ==1132== by 0x4C65107: osync_entry_engine_convert (opensync_mapping_entry_engine.c:244) +# ==1132== by 0x4C69D70: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:196) +# ==1132== by 0x4C693A5: osync_obj_engine_prepare_write (opensync_obj_engine.c:1469) +# ==1132== by 0x4C68A4F: osync_obj_engine_command (opensync_obj_engine.c:1217) +# ==1132== by 0x4C60967: osync_engine_event (opensync_engine.c:2045) +# ==1132== by 0x4C5E1F5: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==1132== by 0x4C5F3C6: _osync_engine_generate_event (opensync_engine.c:1536) +# ==1132== by 0x4C5F4CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==1132== by 0x4C68D83: osync_obj_engine_event (opensync_obj_engine.c:1315) +# ==1132== by 0x4C68A37: osync_obj_engine_command (opensync_obj_engine.c:1212) +# ==1132== by 0x4C60280: osync_engine_command (opensync_engine.c:1884) +# ==1132== by 0x4C5B958: _command_dispatch (opensync_engine.c:383) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_xmlfield + fun:osync_xmlfield_parse + fun:osync_xmlfield_parse + fun:osync_xmlformat_parse + obj:* + fun:osync_converter_invoke +} + + +# ==1132== 672 bytes in 14 blocks are indirectly lost in loss record 717 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9AA08: osync_xmlfield_new_xmlfield (opensync_xmlfield.c:53) +# ==1132== by 0x4C9AC80: osync_xmlfield_parse (opensync_xmlfield.c:119) +# ==1132== by 0x4C9ACF2: osync_xmlfield_parse (opensync_xmlfield.c:128) +# ==1132== by 0x4C9CB47: osync_xmlformat_parse (opensync_xmlformat.c:104) +# ==1132== by 0x4C9DB1B: osync_xmlformat_copy (opensync_xmlformat.c:422) +# ==1132== by 0x65F37E4: copy_xmlformat (xmlformat.c:65) +# ==1132== by 0x4C7196E: osync_objformat_copy (opensync_objformat.c:176) +# ==1132== by 0x4C57D7D: osync_data_clone (opensync_data.c:179) +# ==1132== by 0x4C62F98: osync_mapping_engine_multiply (opensync_mapping_engine.c:336) +# ==1132== by 0x4C68A05: osync_obj_engine_command (opensync_obj_engine.c:1208) +# ==1132== by 0x4C60280: osync_engine_command (opensync_engine.c:1884) +# ==1132== by 0x4C5B958: _command_dispatch (opensync_engine.c:383) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_xmlfield + fun:osync_xmlfield_parse + fun:osync_xmlfield_parse + fun:osync_xmlformat_parse + fun:osync_xmlformat_copy + fun:copy_xmlformat + fun:osync_objformat_copy + fun:osync_data_clone + fun:osync_mapping_engine_multiply + fun:osync_obj_engine_command + fun:osync_engine_command +} + + +# ==1132== 2,520 (1,776 direct, 744 indirect) bytes in 37 blocks are definitely lost in loss record 782 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9AA08: osync_xmlfield_new_xmlfield (opensync_xmlfield.c:53) +# ==1132== by 0x4C9AC80: osync_xmlfield_parse (opensync_xmlfield.c:119) +# ==1132== by 0x4C9ACF2: osync_xmlfield_parse (opensync_xmlfield.c:128) +# ==1132== by 0x4C9CB47: osync_xmlformat_parse (opensync_xmlformat.c:104) +# ==1132== by 0x56D41AF: ??? +# ==1132== by 0x4C6BD33: osync_converter_invoke (opensync_converter.c:196) +# ==1132== by 0x4C70D40: osync_format_env_convert (opensync_format_env.c:1213) +# ==1132== by 0x4C5B4FC: _osync_engine_receive_change (opensync_engine.c:271) +# ==1132== by 0x4C4ED58: _osync_client_proxy_message_handler (opensync_client_proxy.c:841) +# ==1132== by 0x4C819B5: _incoming_dispatch (opensync_queue.c:391) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_xmlfield + fun:osync_xmlfield_parse + fun:osync_xmlfield_parse + fun:osync_xmlformat_parse + obj:* + fun:osync_converter_invoke +} + + + + { <insert_a_suppression_name_here> @@ -2146,6 +2307,81 @@ +# ==1132== 48 bytes in 1 blocks are definitely lost in loss record 376 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9A97C: osync_xmlfield_new_node (opensync_xmlfield.c:36) +# ==1132== by 0x4C9CB0A: osync_xmlformat_parse (opensync_xmlformat.c:101) +# ==1132== by 0x56D41AF: ??? +# ==1132== by 0x4C6BD33: osync_converter_invoke (opensync_converter.c:196) +# ==1132== by 0x4C70D40: osync_format_env_convert (opensync_format_env.c:1213) +# ==1132== by 0x4C6EDA6: osync_format_env_find_path_fn (opensync_format_env.c:638) +# ==1132== by 0x4C712CD: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +# ==1132== by 0x4C65107: osync_entry_engine_convert (opensync_mapping_entry_engine.c:244) +# ==1132== by 0x4C69D70: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:196) +# ==1132== by 0x4C693A5: osync_obj_engine_prepare_write (opensync_obj_engine.c:1469) +# ==1132== by 0x4C68A4F: osync_obj_engine_command (opensync_obj_engine.c:1217) +# ==1132== by 0x4C60967: osync_engine_event (opensync_engine.c:2045) +# ==1132== by 0x4C5E1F5: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==1132== by 0x4C5F3C6: _osync_engine_generate_event (opensync_engine.c:1536) +# ==1132== by 0x4C5F4CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==1132== by 0x4C68D83: osync_obj_engine_event (opensync_obj_engine.c:1315) +# ==1132== by 0x4C68A37: osync_obj_engine_command (opensync_obj_engine.c:1212) +# ==1132== by 0x4C60280: osync_engine_command (opensync_engine.c:1884) +# ==1132== by 0x4C5B958: _command_dispatch (opensync_engine.c:383) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_node + fun:osync_xmlformat_parse + obj:* + fun:osync_converter_invoke +} + + +# ==1132== 48 bytes in 1 blocks are definitely lost in loss record 377 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9A97C: osync_xmlfield_new_node (opensync_xmlfield.c:36) +# ==1132== by 0x4C9CB0A: osync_xmlformat_parse (opensync_xmlformat.c:101) +# ==1132== by 0x56D41AF: ??? +# ==1132== by 0x4C6BD33: osync_converter_invoke (opensync_converter.c:196) +# ==1132== by 0x4C70D40: osync_format_env_convert (opensync_format_env.c:1213) +# ==1132== by 0x4C5B4FC: _osync_engine_receive_change (opensync_engine.c:271) +# ==1132== by 0x4C4ED58: _osync_client_proxy_message_handler (opensync_client_proxy.c:841) +# ==1132== by 0x4C819B5: _incoming_dispatch (opensync_queue.c:391) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_node + fun:osync_xmlformat_parse + obj:* + fun:osync_converter_invoke +} + + + + + + { <leak 34> @@ -9594,6 +9830,65 @@ } +# ==1132== 104 bytes in 1 blocks are still reachable in loss record 553 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x38F4EA2F1A: xmlNewRMutex (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4EF30E4: ??? (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4EF32DE: xmlDictCreate (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E3404C: xmlInitParserCtxt (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E3424B: xmlNewParserCtxt (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E3791D: xmlCreateURLParserCtxt (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E4DF9D: xmlSAXParseFileWithData (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x4C56950: osync_xml_open_file (opensync_xml.c:495) +# ==1132== by 0x4C760CE: osync_group_load (opensync_group.c:661) +# ==1132== by 0x4C77F23: osync_group_env_load_groups (opensync_group_env.c:351) +# ==1132== by 0x408490: main (osynctool.c:1548) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:xmlNewRMutex + obj:/usr/lib64/libxml2.so.2.7.6 + fun:xmlDictCreate + fun:xmlInitParserCtxt + fun:xmlNewParserCtxt + fun:xmlCreateURLParserCtxt + fun:xmlSAXParseFileWithData + fun:osync_xml_open_file + fun:osync_group_load + fun:osync_group_env_load_groups + fun:main +} + + +# ==1132== 400 bytes in 1 blocks are still reachable in loss record 694 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x38F4E3044F: xmlInitCharEncodingHandlers (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E38107: xmlInitParser (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x38F4E4DF95: xmlSAXParseFileWithData (in /usr/lib64/libxml2.so.2.7.6) +# ==1132== by 0x4C56950: osync_xml_open_file (opensync_xml.c:495) +# ==1132== by 0x4C760CE: osync_group_load (opensync_group.c:661) +# ==1132== by 0x4C77F23: osync_group_env_load_groups (opensync_group_env.c:351) +# ==1132== by 0x408490: main (osynctool.c:1548) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:xmlInitCharEncodingHandlers + fun:xmlInitParser + fun:xmlSAXParseFileWithData + fun:osync_xml_open_file + fun:osync_group_load + fun:osync_group_env_load_groups +} + + + + { <insert_a_suppression_name_here> Memcheck:Leak @@ -15134,3 +15429,215 @@ # fun:osync_converter_invoke #} + + +# ==1132== 96 (48 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 532 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9A97C: osync_xmlfield_new_node (opensync_xmlfield.c:36) +# ==1132== by 0x4C9CB0A: osync_xmlformat_parse (opensync_xmlformat.c:101) +# ==1132== by 0x4C9DB1B: osync_xmlformat_copy (opensync_xmlformat.c:422) +# ==1132== by 0x65F37E4: copy_xmlformat (xmlformat.c:65) +# ==1132== by 0x4C7196E: osync_objformat_copy (opensync_objformat.c:176) +# ==1132== by 0x4C57D7D: osync_data_clone (opensync_data.c:179) +# ==1132== by 0x4C62F98: osync_mapping_engine_multiply (opensync_mapping_engine.c:336) +# ==1132== by 0x4C68A05: osync_obj_engine_command (opensync_obj_engine.c:1208) +# ==1132== by 0x4C60280: osync_engine_command (opensync_engine.c:1884) +# ==1132== by 0x4C5B958: _command_dispatch (opensync_engine.c:383) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_node + fun:osync_xmlformat_parse + fun:osync_xmlformat_copy + fun:copy_xmlformat + fun:osync_objformat_copy + fun:osync_data_clone + fun:osync_mapping_engine_multiply + fun:osync_obj_engine_command + fun:osync_engine_command + fun:_command_dispatch + fun:g_main_context_dispatch + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_main_loop_run + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:start_thread +} + + +# ==1132== 624 bytes in 13 blocks are definitely lost in loss record 714 of 827 +# ==1132== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==1132== by 0x4C5450E: osync_try_malloc0 (opensync_memory.c:32) +# ==1132== by 0x4C9A97C: osync_xmlfield_new_node (opensync_xmlfield.c:36) +# ==1132== by 0x4C9CB0A: osync_xmlformat_parse (opensync_xmlformat.c:101) +# ==1132== by 0x4C9DB1B: osync_xmlformat_copy (opensync_xmlformat.c:422) +# ==1132== by 0x65F37E4: copy_xmlformat (xmlformat.c:65) +# ==1132== by 0x4C7196E: osync_objformat_copy (opensync_objformat.c:176) +# ==1132== by 0x4C57D7D: osync_data_clone (opensync_data.c:179) +# ==1132== by 0x4C6ED16: osync_format_env_find_path_fn (opensync_format_env.c:630) +# ==1132== by 0x4C712CD: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +# ==1132== by 0x4C65107: osync_entry_engine_convert (opensync_mapping_entry_engine.c:244) +# ==1132== by 0x4C69D70: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:196) +# ==1132== by 0x4C693A5: osync_obj_engine_prepare_write (opensync_obj_engine.c:1469) +# ==1132== by 0x4C68A4F: osync_obj_engine_command (opensync_obj_engine.c:1217) +# ==1132== by 0x4C60967: osync_engine_event (opensync_engine.c:2045) +# ==1132== by 0x4C5E1F5: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==1132== by 0x4C5F3C6: _osync_engine_generate_event (opensync_engine.c:1536) +# ==1132== by 0x4C5F4CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==1132== by 0x4C68D83: osync_obj_engine_event (opensync_obj_engine.c:1315) +# ==1132== by 0x4C68A37: osync_obj_engine_command (opensync_obj_engine.c:1212) +# ==1132== by 0x4C60280: osync_engine_command (opensync_engine.c:1884) +# ==1132== by 0x4C5B958: _command_dispatch (opensync_engine.c:383) +# ==1132== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==1132== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +# ==1132== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:osync_try_malloc0 + fun:osync_xmlfield_new_node + fun:osync_xmlformat_parse + fun:osync_xmlformat_copy + fun:copy_xmlformat + fun:osync_objformat_copy + fun:osync_data_clone + fun:osync_format_env_find_path_fn + fun:osync_format_env_find_path_formats_with_detectors + fun:osync_entry_engine_convert + fun:osync_sink_engine_convert_to_dest + fun:osync_obj_engine_prepare_write + fun:osync_obj_engine_command + fun:osync_engine_event +} + + + + +# ==25472== 176 bytes in 1 blocks are indirectly lost in loss record 797 of 1,010 +# ==25472== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +# ==25472== by 0x38F4E52834: xmlNewDoc (in /usr/lib64/libxml2.so.2.7.6) +# ==25472== by 0x38F4EF6538: xmlSAX2StartDocument (in /usr/lib64/libxml2.so.2.7.6) +# ==25472== by 0x38F4E4D245: xmlParseDocument (in /usr/lib64/libxml2.so.2.7.6) +# ==25472== by 0x38F4E4D404: ??? (in /usr/lib64/libxml2.so.2.7.6) +# ==25472== by 0x4C9DA9B: osync_xmlformat_parse (opensync_xmlformat.c:89) +# ==25472== by 0x4C9EB2F: osync_xmlformat_copy (opensync_xmlformat.c:422) +# ==25472== by 0x65F47E4: copy_xmlformat (xmlformat.c:65) +# ==25472== by 0x4C72A02: osync_objformat_copy (opensync_objformat.c:176) +# ==25472== by 0x4C58D7D: osync_data_clone (opensync_data.c:179) +# ==25472== by 0x4C6FDAA: osync_format_env_find_path_fn (opensync_format_env.c:630) +# ==25472== by 0x4C72361: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +# ==25472== by 0x4C66107: osync_entry_engine_convert (opensync_mapping_entry_engine.c:244) +# ==25472== by 0x4C6AE00: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:201) +# ==25472== by 0x4C6A424: osync_obj_engine_prepare_write (opensync_obj_engine.c:1478) +# ==25472== by 0x4C69ACE: osync_obj_engine_command (opensync_obj_engine.c:1226) +# ==25472== by 0x4C61967: osync_engine_event (opensync_engine.c:2045) +# ==25472== by 0x4C5F1F5: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==25472== by 0x4C603C6: _osync_engine_generate_event (opensync_engine.c:1536) +# ==25472== by 0x4C604CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==25472== by 0x4C69E02: osync_obj_engine_event (opensync_obj_engine.c:1324) +# ==25472== by 0x4C69AB6: osync_obj_engine_command (opensync_obj_engine.c:1221) +# ==25472== by 0x4C61280: osync_engine_command (opensync_engine.c:1884) +# ==25472== by 0x4C5C958: _command_dispatch (opensync_engine.c:383) +# ==25472== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==25472== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==25472== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:malloc + fun:xmlNewDoc + fun:xmlSAX2StartDocument + fun:xmlParseDocument + obj:/usr/lib64/libxml2.so.2.7.6 + fun:osync_xmlformat_parse + fun:osync_xmlformat_copy + fun:copy_xmlformat + fun:osync_objformat_copy + fun:osync_data_clone + fun:osync_format_env_find_path_fn + fun:osync_format_env_find_path_formats_with_detectors + fun:osync_entry_engine_convert + fun:osync_sink_engine_convert_to_dest + fun:osync_obj_engine_prepare_write + fun:osync_obj_engine_command + fun:osync_engine_event +} + + + + +# ==6161== 1,488 bytes in 3 blocks are possibly lost in loss record 575 of 668 +# ==6161== at 0x4A04360: memalign (vg_replace_malloc.c:532) +# ==6161== by 0x4A043B9: posix_memalign (vg_replace_malloc.c:660) +# ==6161== by 0x38EA655D51: ??? (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x38EA656DF1: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x38EA6370DD: g_list_prepend (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x38EA64AA40: g_queue_push_head (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x38EA615033: g_async_queue_push_unlocked (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x38EA61510F: g_async_queue_push (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== by 0x4C85523: osync_queue_send_message_with_timeout (opensync_queue.c:1446) +# ==6161== by 0x4C52C70: osync_client_proxy_committed_all (opensync_client_proxy.c:1857) +# ==6161== by 0x4C6B1F6: osync_sink_engine_write (opensync_sink_engine.c:273) +# ==6161== by 0x4C6A559: osync_obj_engine_write (opensync_obj_engine.c:1510) +# ==6161== by 0x4C69B76: osync_obj_engine_command (opensync_obj_engine.c:1245) +# ==6161== by 0x4C619CD: osync_engine_event (opensync_engine.c:2054) +# ==6161== by 0x4C62F2B: osync_engine_continue (opensync_engine.c:2548) +# ==6161== by 0x404EF8: multiply_summary (osynctool.c:344) +# ==6161== by 0x4C5F3CF: _osync_engine_generate_prepared_write_event (opensync_engine.c:1237) +# ==6161== by 0x4C603D4: _osync_engine_generate_event (opensync_engine.c:1539) +# ==6161== by 0x4C604CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==6161== by 0x4C69E02: osync_obj_engine_event (opensync_obj_engine.c:1324) +# ==6161== by 0x4C69AE6: osync_obj_engine_command (opensync_obj_engine.c:1228) +# ==6161== by 0x4C61967: osync_engine_event (opensync_engine.c:2045) +# ==6161== by 0x4C5F1F5: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +# ==6161== by 0x4C603C6: _osync_engine_generate_event (opensync_engine.c:1536) +# ==6161== by 0x4C604CD: _osync_engine_event_callback (opensync_engine.c:1570) +# ==6161== by 0x4C69E02: osync_obj_engine_event (opensync_obj_engine.c:1324) +# ==6161== by 0x4C69AB6: osync_obj_engine_command (opensync_obj_engine.c:1221) +# ==6161== by 0x4C61280: osync_engine_command (opensync_engine.c:1884) +# ==6161== by 0x4C5C958: _command_dispatch (opensync_engine.c:383) +# ==6161== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +# ==6161== +# +{ + <insert_a_suppression_name_here> + Memcheck:Leak + fun:memalign + fun:posix_memalign + obj:/lib64/libglib-2.0.so.0.2200.2 + fun:g_slice_alloc + fun:g_list_prepend + fun:g_queue_push_head + fun:g_async_queue_push_unlocked + fun:g_async_queue_push + fun:osync_queue_send_message_with_timeout + fun:osync_client_proxy_committed_all + fun:osync_sink_engine_write + fun:osync_obj_engine_write + fun:osync_obj_engine_command + fun:osync_engine_event + fun:osync_engine_continue + fun:multiply_summary + fun:_osync_engine_generate_prepared_write_event + fun:_osync_engine_generate_event + fun:_osync_engine_event_callback + fun:osync_obj_engine_event + fun:osync_obj_engine_command + fun:osync_engine_event +} + Added: plugins/ldap-sync/tests/vtodos/kdepim-todo2.ics ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vtodos/kdepim-todo2.ics Fri Feb 19 19:02:59 2010 (r6039) @@ -0,0 +1,24 @@ +BEGIN:VCALENDAR +PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN +VERSION:2.0 +BEGIN:VTODO +DTSTAMP:20100217T180932Z +ATTENDEE;CN="Gaius Iulius Caesar";RSVP=TRUE;PARTSTAT=NEEDS-ACTION; + ROLE=REQ-PARTICIPANT:mailto:ca...@ex... +CREATED:20100217T180558Z +UID:libkcal-1259583221.152 +SEQUENCE:1 +LAST-MODIFIED:20100217T180826Z +DESCRIPTION:Here one could describe what to do. +SUMMARY:A new todo from Kontact-4.3.2 +LOCATION:Here. +PRIORITY:5 +DUE;VALUE=DATE:20100224 +PERCENT-COMPLETE:0 +BEGIN:VALARM +DESCRIPTION: +ACTION:DISPLAY +TRIGGER;VALUE=DURATION;RELATED=END:-PT15M +END:VALARM +END:VTODO +END:VCALENDAR Added: plugins/ldap-sync/tests/vtodos/kdepim-todo2.vcs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vtodos/kdepim-todo2.vcs Fri Feb 19 19:02:59 2010 (r6039) @@ -0,0 +1,19 @@ +BEGIN:VCALENDAR +PRODID:-//K Desktop Environment//NONSGML libkcal 4.3//EN +VERSION:1.0 +BEGIN:VTODO +DUE:20100224T000000 +DCREATED:20100217T180558Z +UID:libkcal-1259583221.152 +SEQUENCE:1 +LAST-MODIFIED:20100217T180826Z +ATTENDEE;RSVP=TRUE;STATUS=NEEDS ACTION:MAILTO:Gaius Iulius Caesar <ca...@ex...> +DESCRIPTION:Here one could describe what to do. +SUMMARY:A new todo from Kontact-4.3.2 +LOCATION:Here. +STATUS:NEEDS_ACTION +PRIORITY:5 +DALARM:20100224T000000Z;;1;beep! +END:VTODO +END:VCALENDAR + |
From: <svn...@op...> - 2010-02-19 18:02:28
|
Author: scriptor Date: Fri Feb 19 19:02:10 2010 New Revision: 6038 URL: http://www.opensync.org/changeset/6038 Log: - Add missing osync_trace() call. - Removed a few leaks. - Cosmetic changes. Modified: plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Thu Feb 11 01:53:31 2010 (r6037) +++ plugins/ldap-sync/src/ldap_format.c Fri Feb 19 19:02:10 2010 (r6038) @@ -1361,7 +1361,6 @@ osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); - return FALSE; } @@ -1958,8 +1957,8 @@ * user_data_carrier struct which stores references to memory * that has been allocated, but not freed, yet. * - * @param user_data Pointer to a user_data_carrier struct, that has - * allocated by ldap_format_finalize_converter(). + * @param user_data Pointer to a user_data_carrier struct, that has been + * allocated by ldap_format_initialize_converter(). * @param error The libopensync error pointer. * * @returns TRUE on success, FALSE otherwise. @@ -1986,10 +1985,12 @@ } + // http://xmlsoft.org/XSLT/html/libxslt-xslt.html#xsltCleanupGlobals // http://localhost/usr_share_doc/libxslt-devel-1.1.26/html/libxslt-xslt.html#xsltCleanupGlobals xsltCleanupGlobals(); + // http://xmlsoft.org/html/libxml-parser.html#xmlCleanupParser // http://localhost/usr_share_doc/libxml2-devel-2.7.6/html/libxml-parser.html#xmlCleanupParser /* * "This function name is somewhat misleading. It does not clean up @@ -2157,6 +2158,7 @@ xmlSchemaPtr xsd = NULL; xmlSchemaParserCtxtPtr xsd_file = NULL; + osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p)", __func__, (void *)input, inpsize, (void *)xmlcard, (void *)stylesheet_file, (void *)error); @@ -2912,6 +2914,7 @@ * the problem, that libxml2 may or may not free some cur->node * pointers: * + * http://xmlsoft.org/html/libxml-tree.html#xmlAddChild * Quoting from http://localhost/usr_share_doc/libxml2-devel-2.7.6/html/libxml-tree.html * * Function: xmlAddChild @@ -3597,9 +3600,6 @@ osync_bool ldap_format_do_convert_ldap2xmlinternal_create_head(const char *objtype, const char *ldap_format_name, xmlDoc **doc, xmlNode **root_node, OSyncError **error) { - - - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, (void *)objtype, (void *)ldap_format_name, (void *)doc, (void *)error); @@ -5443,9 +5443,9 @@ pre_output = NULL; } - // if (xmlformat) { - // osync_xmlformat_unref(xmlformat); - // } + if (xmlformat) { + osync_xmlformat_unref(xmlformat); + } osync_trace(TRACE_EXIT, "%s(): *ldap_entries = %p", __func__, (void *) *ldap_entries); @@ -5463,9 +5463,9 @@ pre_output = NULL; } - // if (xmlformat) { - // osync_xmlformat_unref(xmlformat); - // } + if (xmlformat) { + osync_xmlformat_unref(xmlformat); + } if (!osync_error_is_set(error)) Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Thu Feb 11 01:53:31 2010 (r6037) +++ plugins/ldap-sync/src/ldap_plugin.c Fri Feb 19 19:02:10 2010 (r6038) @@ -653,6 +653,17 @@ return TRUE; error: + // Clean up + if (path_field) { + g_free(path_field); + path_field = NULL; + } + + if (timestamp) { + g_free(timestamp); + timestamp = NULL; + } + if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -1756,34 +1767,27 @@ OSyncHashTable *hashtable = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, (void *)ctx, (void *)info, (void *)sinkenv, (void *)error); - - if (ctx == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ctx = NULL.", __FILE__, __LINE__); goto error; } - if (sinkenv == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL.", __FILE__, __LINE__); goto error; } - if (info == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: info = NULL.", __FILE__, __LINE__); goto error; } - if (!sinkenv->sink) { osync_trace(TRACE_INTERNAL, "%s:%i: INFO: No sink available. Apparently, this objtype has been disabled by configuration. Returning.\n", __FILE__, __LINE__); - osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; + goto out; } @@ -1797,7 +1801,6 @@ OSyncChange *change = osync_change_new(error); if (!change) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: change = NULL.\n", __FILE__, __LINE__); - osync_list_free(uids); goto error; } @@ -1809,6 +1812,7 @@ formatenv = osync_plugin_info_get_format_env(info); if (formatenv == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: formatenv = NULL. Returning.\n", __FILE__, __LINE__); + osync_change_unref(change); goto error; } @@ -1823,6 +1827,7 @@ OSyncObjFormat *format = sinkenv->objformat; if (format == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format = NULL.\n", __FILE__, __LINE__); + osync_change_unref(change); goto error; } @@ -1836,6 +1841,7 @@ if (!osync_error_is_set(error)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: odata = NULL.\n", __FILE__, __LINE__); } + osync_change_unref(change); goto error; } @@ -1857,12 +1863,21 @@ // end of OSYNC_CHANGE_TYPE_DELETED - osync_list_free(uids); - + if (uids) { + osync_list_free(uids); + uids = NULL; + } + +out: osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; error: + if (uids) { + osync_list_free(uids); + uids = NULL; + } + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; } @@ -1985,9 +2000,9 @@ { ldap_entry *ldapdata = NULL; unsigned int i = 0; - // unsigned int j = 0; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %d, %p, %p)", __func__, (void *)ctx, (void *)sinkenv, slow_sync_requested, (void *)ldaplist_modified, (void *)error); if (ctx == NULL) { @@ -2000,17 +2015,14 @@ goto error; } - if (ldaplist_modified == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldaplist_modified = NULL.", __FILE__, __LINE__); goto error; } - if (!sinkenv->sink) { osync_trace(TRACE_INTERNAL, "%s:%i: INFO: No sink available. Apparently, this objtype has been disabled by configuration. Returning.\n", __FILE__, __LINE__); - osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; + goto out; } @@ -2046,7 +2058,7 @@ } // for (i = 0; i < g_list_length(ldaplist_modified) ; i++) - +out: osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -2060,6 +2072,9 @@ } + + + /** * @brief Tells the opensync library which LDAP entries have been deleted * on the LDAP server. Currently not used. @@ -2177,8 +2192,6 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %d, %p, %p)", __func__, (void *)ctx, (void *)sinkenv, slow_sync_requested, (void *)unmodified_uids, (void *)error); - - if (ctx == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ctx = NULL.", __FILE__, __LINE__); goto error; @@ -2189,30 +2202,24 @@ goto error; } - if (unmodified_uids == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: unmodified_uids = NULL.", __FILE__, __LINE__); goto error; } - if (!sinkenv->sink) { osync_trace(TRACE_INTERNAL, "%s:%i: INFO: No sink available. Apparently, this objtype has been disabled by configuration. Returning.\n", __FILE__, __LINE__); - osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; + goto out; } + + // Get Hashtable hashtable = osync_objtype_sink_get_hashtable(sinkenv->sink); osync_assert(hashtable); - if (unmodified_uids == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: unmodified_uids = NULL.\n", __FILE__, __LINE__); - goto error; - } - - + // Walk through the list for (list = g_list_first(unmodified_uids); list; list = g_list_next(list)) { OSyncChange *change = osync_change_new(error); @@ -2232,9 +2239,10 @@ osync_hashtable_update_change(hashtable, change); osync_change_unref(change); - } + } // for (list = g_list_first(unmodified_uids); +out: osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -2463,35 +2471,27 @@ goto error; } - if (info == NULL) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: info = NULL. Returning.\n", __FILE__, __LINE__); goto error; } - if (ctx == NULL) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ctx = NULL. Returning.\n", __FILE__, __LINE__); goto error; } - if (sink == NULL) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sink = NULL. Returning.\n", __FILE__, __LINE__); goto error; } - - - - osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Is this sink (%s) enabled? %d", __FILE__, __LINE__, __func__, osync_objtype_sink_get_name(sink), osync_objtype_sink_is_enabled(sink)); + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Is this sink (%s) enabled (1)? %d", __FILE__, __LINE__, __func__, osync_objtype_sink_get_name(sink), osync_objtype_sink_is_enabled(sink)); if (!osync_objtype_sink_is_enabled(sink)) { osync_trace(TRACE_INTERNAL, "%s:%i: Objtype \"%s\" has been disabled. So nothing to do. Early return.", __FILE__, __LINE__, osync_objtype_sink_get_name(sink)); - osync_context_report_success(ctx); // ldap_plugin_get_changes() - osync_trace(TRACE_EXIT, "%s", __func__); - return; + goto out; } @@ -2502,7 +2502,6 @@ goto error; } - if (sinkenv == NULL) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL. Returning.\n", __FILE__, __LINE__); goto error; @@ -2519,17 +2518,13 @@ osync_trace(TRACE_INTERNAL, "sink = %p", (void *)sink); osync_trace(TRACE_INTERNAL, "sinkenv->sink = %p", (void *)(sinkenv->sink)); if (sinkenv->sink) { - osync_trace(TRACE_INTERNAL, "%s: Is this sink (%s) enabled? %d", __func__, osync_objtype_sink_get_name(sinkenv->sink), osync_objtype_sink_is_enabled(sinkenv->sink)); + osync_trace(TRACE_INTERNAL, "%s: Is this sink (%s) enabled (2)? %d", __func__, osync_objtype_sink_get_name(sinkenv->sink), osync_objtype_sink_is_enabled(sinkenv->sink)); } - - // Check read permission if (!(sinkenv->ldap_read)) { - osync_trace(TRACE_INTERNAL, "Reading entries from LDAP has been disabled by configuration"); - osync_context_report_success(ctx); // ldap_plugin_get_changes() - osync_trace(TRACE_EXIT, "%s", __func__); - return; + osync_trace(TRACE_INTERNAL, "Reading entries from LDAP has been disabled by configuration. So nothing to do here. Early return."); + goto out; // Nothing to do here. } @@ -2554,9 +2549,6 @@ - - - // Report all the changes that are to be added: if (ldaplist_added) { if (!ldap_plugin_report_changes_to_be_added(ctx, sinkenv, slow_sync_requested, ldaplist_added, &error)) { @@ -2568,9 +2560,9 @@ * Maybe in the destroy function ldap_format_destroy_format1() * But even this seems to be to early. */ - } + // Report all the changes that are to be modified: if (ldaplist_modified) { if (!ldap_plugin_report_changes_to_be_modified(ctx, sinkenv, slow_sync_requested, ldaplist_modified, &error)) { @@ -2584,6 +2576,7 @@ */ } + /** * Report all the changes that are to be removed from the hashtable. * Quoting from http://www.opensync.org/doxygen/group__OSyncHashtableAPI.html @@ -2592,19 +2585,17 @@ * not reported as osync_hashtable_update_change(), independent of the * changetype." */ + + // xxx jl: TODO ??????????? + // I don't report here anything??? + + + + // Report everything that does NOT need to be modified: if (unmodified_uids) { if (!ldap_plugin_report_changes_to_be_kept_being_unmodified(ctx, sinkenv, slow_sync_requested, unmodified_uids, &error)) { goto error; - } - - - for (list = g_list_first(unmodified_uids); list; list = g_list_next(list)) - { - if (list->data) { - g_free(list->data); - } - } - g_list_free(unmodified_uids); + } } @@ -2617,9 +2608,25 @@ //When you are done looping and if you are using hashtables //check for deleted entries ... via hashtable + // xxx jl: TODO ????? deleted_uids is not even passed on... ????? // This seems to be for entries that have already been deleted // on the peer, only. - ldap_plugin_process_deleted_entries(ctx, info, sinkenv, &error); + if (!ldap_plugin_process_deleted_entries(ctx, info, sinkenv, &error)) { + goto error; + } + + + // Clean up: + if (unmodified_uids) { + for (list = g_list_first(unmodified_uids); list; list = g_list_next(list)) + { + if (list->data) { + g_free(list->data); + } + } + g_list_free(unmodified_uids); + unmodified_uids = NULL; + } if (deleted_uids) { @@ -2633,7 +2640,7 @@ } - +out: //Now we need to answer the call osync_context_report_success(ctx); // ldap_plugin_get_changes() osync_trace(TRACE_EXIT, "%s", __func__); @@ -2653,6 +2660,18 @@ } + if (unmodified_uids) { + for (list = g_list_first(unmodified_uids); list; list = g_list_next(list)) + { + if (list->data) { + g_free(list->data); + } + } + g_list_free(unmodified_uids); + unmodified_uids = NULL; + } + + if (deleted_uids) { for (list = g_list_first(deleted_uids); list; list = g_list_next(list)) { @@ -4869,7 +4888,7 @@ if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason"); - osync_trace(TRACE_INTERNAL, "%s(): return -2;", __func__); + osync_trace(TRACE_INTERNAL, "%s(): return -1;", __func__); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return -1; } |
From: <svn...@op...> - 2010-02-11 02:02:51
|
Author: paule Date: Thu Feb 11 01:52:36 2010 New Revision: 6036 URL: http://www.opensync.org/changeset/6036 Log: opie-sync: support new synchronisation protocol in upcoming Opie 1.2.5 version; detect and handle base64 encoded QCop messages Modified: plugins/opie-sync/src/opie_qcop.c plugins/opie-sync/src/opie_qcop.h plugins/opie-sync/src/opie_sync.c plugins/opie-sync/src/opie_sync.h plugins/opie-sync/src/opie_xml.c plugins/opie-sync/src/opie_xml.h Modified: plugins/opie-sync/src/opie_qcop.c ============================================================================== --- plugins/opie-sync/src/opie_qcop.c Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_qcop.c Thu Feb 11 01:52:36 2010 (r6036) @@ -1,7 +1,8 @@ /* MultiSync Opie Plugin - Synchronize Opie/Zaurus Devices Copyright (C) 2003 Tom Foottit <to...@fo...> - Eike M. Lang <ma...@el...> + Eike M. Lang <ma...@el...> + Copyright (C) 2009 Paul Eggleton <blu...@bl...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -45,6 +46,9 @@ #include <errno.h> #include <unistd.h> +#include <opensync/opensync.h> +#include <opensync/opensync-common.h> + #include "opie_qcop.h" #define OPIEQCOP_BUFLEN (1024) /* maximum response size */ @@ -282,7 +286,17 @@ if(!expect(qconn, "230", "530", "Failed to log into server - please check username / password")) return qconn; - + + /* Check if the other end is using old Sharp argument style */ + send_allof(qconn, "CALL QPE/System sendVersionInfo()\n"); + if (!expect(qconn, "200", NULL, "Failed to obtain versionInfo")) + return NULL; + char *pc = get_line(qconn); + if(strstr(pc, ") AAA")) + qconn->compatmode = TRUE; + else + qconn->compatmode = FALSE; + /* connected OK */ qconn->result = TRUE; } @@ -326,63 +340,278 @@ /* - * + * Send a QCop message */ -char* qcop_get_root(qcop_conn* qconn) +gboolean qcop_send(qcop_conn* qconn, const char *message, gchar **args) +{ + gchar *output; + if(args) { + /* FIXME: the Opie code uses this send method no matter what mode + is in use. Not sure about Qtopia. */ + + /* Replace special characters with their entity equivalents */ + int argc = g_strv_length(args); + gchar **args2 = g_new(gchar*, argc+1); + int i; + for(i=0; args[i] != NULL; i++) { + gchar *item = args[i]; + int count = 1; + int j; + for(j=0; item[j]; j++) { + if(strchr("\n\r& ", item[j])) + count+=6; + else + count++; + } + + gchar *item2 = (gchar *)g_malloc0(count); + gchar *ptr = item2; + for(j=0; item[j]; j++) { + if(item[j] == '\n') + ptr = g_stpcpy(ptr, "&0x0a;"); + else if(item[j] == '\r') + ptr = g_stpcpy(ptr, "&0x0d;"); + else if(item[j] == '&') + ptr = g_stpcpy(ptr, "&"); + else if(item[j] == ' ') + ptr = g_stpcpy(ptr, "&0x20;"); + else { + *ptr = item[j]; + ptr++; + } + } + args2[i] = item2; + } + args2[argc] = NULL; + gchar *argstr = g_strjoinv(" ", args2); + if(argc > 0) + g_strfreev(args2); + + output = g_strdup_printf("CALL %s %s\n", message, argstr); + g_free(argstr); + } + else + output = g_strdup_printf("CALL %s\n", message); + gboolean result = send_allof(qconn, output); + g_free(output); + return result; +} + +int decode_int_arg(guchar *data) +{ + return (data[0] >> 24) + (data[1] >> 16) + (data[2] >> 8) + data[3]; +} + +gchar *decode_string_arg(gchar *data, gsize *len) { + char *startc; + gsize outlen = 0; + GError *err = NULL; gchar* temp = NULL; - char* start; - gchar* pc; - - send_allof(qconn, "CALL QPE/System sendHandshakeInfo()\n"); - - if (!expect(qconn, "200", NULL, "Failed to obtain HandshakeInfo")) + + /* first four bytes are the string length */ + *len = decode_int_arg(data); + startc = data + 4; + temp = g_convert(startc, *len, "UTF8", "UTF16BE", NULL, &outlen, &err); + if (err != NULL) { + fprintf(stderr, "UTF16 convert error: %s\n", err->message); + g_error_free(err); + if(temp) { + /* Don't accept partial conversions */ + g_free(temp); + temp = NULL; + } + } + return temp; +} + +/* + * Wait for a QCop response message + */ +gchar **qcop_wait_for(qcop_conn* qconn, const char *message) +{ + if (!expect(qconn, "200", NULL, "Failed to retrieve expected result")) return NULL; - pc = get_line(qconn); - if(!strstr(pc, "handshakeInfo(QString,bool)")) - { + gchar *pc = get_line(qconn); + if(!strstr(pc, message)) { qconn->resultmsg = g_strdup_printf("Unrecognised response: %s", pc); g_free(pc); return NULL; } - - if ((start=strstr(strstr(pc,"/")+1,"/"))) /* We need the second slash */ - { - /* caller responsible for free()ing temp */ - temp = g_strndup(start,strstr(start," ")-start); /* from slash to blank is our path */ + + gchar **response = NULL; + if( qconn->compatmode ) { + gchar **parts = g_strsplit(pc, " ", 0); + gchar *msg = parts[2]; + char *ptr = strchr(msg, '('); + char *ptr2 = strchr(msg, ')'); + if(ptr && ptr2) { + *ptr2 = 0; + ptr++; + gchar **argtypes = g_strsplit(ptr, ",", 0); + *ptr2 = ')'; + + int argc = g_strv_length(argtypes); + response = g_new (gchar*, argc+4); + int i; + for(i=0; i<3; i++) + response[i] = g_strdup(parts[i]); + + gsize declen = 0; + guchar *decoded = g_base64_decode(parts[3], &declen); + if(declen > 0) { + ptr = decoded; + for(i=0; i<argc; i++) { + gchar *argtype = argtypes[i]; + if( strcmp(argtype, "QString") == 0 ) { + gsize outlen; + response[i+3] = decode_string_arg(ptr, &outlen); + ptr += (outlen+4); + } + else if( strcmp(argtype, "bool") == 0 || strcmp(argtype, "int") == 0 ) { + response[i+3] = g_strdup_printf("%d", decode_int_arg(ptr)); + ptr += 4; + } + else + response[i+3] = g_strdup(""); + } + } + response[argc+3] = NULL; + } + g_strfreev(parts); } - else if((start=strstr(pc,") ")+2)) - { - /* Qtopia sends back a base64 encoded utf-16 (big-endian) string */ - guchar *decoded; - char *startc; - gsize len = 0; - gsize len2 = 0; - GError *err = NULL; - - decoded = g_base64_decode(start, &len); - if(len > 0) { - /* first four bytes seem to be \0 \0 \0 (string length) */ - len = decoded[3]; - startc = decoded + 4; - temp = g_convert(startc, len, "UTF8", "UTF16BE", NULL, &len2, &err); - if (err != NULL) { - fprintf(stderr, "UTF16 convert error: %s\n", err->message); - g_error_free(err); - if(temp) { - /* Don't accept partial conversions */ - g_free(temp); - temp = NULL; + else { + response = g_strsplit(pc, " ", 0); + g_free(pc); + if( !qconn->compatmode ) { + int i; + for(i=0; response[i]; i++) { + if(i > 1 && strchr(response[i], '&')) { + /* Replace entities in arguments with their corresponding characters */ + gchar *item1 = osync_strreplace(response[i], "&0x20;", " "); + g_free(response[i]); + gchar *item2 = osync_strreplace(item1, "&0x0d;", "\n"); + g_free(item1); + item1 = osync_strreplace(item2, "&0x0a;", "\r"); + g_free(item2); + item2 = osync_strreplace(item1, "&", "&"); + g_free(item1); + response[i] = item2; } } } } + + return response; +} - if(!temp) - qconn->resultmsg = g_strdup_printf("Unrecognised response: %s", pc); - g_free(pc); - return temp; +/* + * Get the root path on the remote device (ie, the user's home directory) + */ +char* qcop_get_root(qcop_conn* qconn) +{ + qcop_send(qconn, "QPE/System sendHandshakeInfo()", NULL ); + + gchar **resp = qcop_wait_for(qconn, "QPE/Desktop handshakeInfo(QString,bool)"); + if(!resp) + return NULL; + + gchar *rootpath; + if( g_strv_length(resp) > 3 ) + rootpath = g_strdup(resp[3]); + else + rootpath = NULL; + g_strfreev(resp); + + return rootpath; +} + + +/* + * Get the version of Opie on the remote device + */ +gboolean qcop_get_version(qcop_conn* qconn, qcop_version_info *version) +{ + qcop_send(qconn, "QPE/System sendVersionInfo()", NULL ); + gchar **resp = qcop_wait_for(qconn, "QPE/Desktop versionInfo(QString,QString)"); + if(!resp) + return FALSE; + + version->opie_major_version = 0; + version->opie_minor_version = 0; + version->opie_sub_version = 0; + if( g_strv_length(resp) > 4 ) { + gchar **verparts = g_strsplit(resp[4], " ", 0); + if( g_strv_length(verparts) > 1 && strcmp(verparts[0], "Opie") == 0 ) { + gchar **vernumparts = g_strsplit(verparts[1], ".", 0); + if( g_strv_length(vernumparts) > 2 ) { + version->opie_major_version = atoi(vernumparts[0]); + version->opie_minor_version = atoi(vernumparts[1]); + version->opie_sub_version = atoi(vernumparts[2]); + } + g_strfreev(vernumparts); + } + g_strfreev(verparts); + } + g_strfreev(resp); + + return TRUE; +} + +gboolean qcop_set_peer_info(qcop_conn* qconn, const char *peer_id, const char *peer_name) +{ + gchar **args = g_new (gchar*, 3); + args[0] = g_strdup(peer_id); + args[1] = g_strdup(peer_name); + args[2] = NULL; + qcop_send(qconn, "QPE/System setSyncPeerInfo(QString,QString)", args); + gchar **resp = qcop_wait_for(qconn, "QPE/Desktop syncPeerInfoSet()"); + g_strfreev(args); + if(!resp) + return FALSE; + + g_strfreev(resp); + return TRUE; +} + +gboolean qcop_start_app_sync(qcop_conn* qconn, const char *appname, gboolean request_slow_sync_read, gboolean request_slow_sync_write, gboolean *has_changelog, gboolean *slow_sync_read) +{ + gchar **args = g_new (gchar*, 4); + args[0] = g_strdup(appname); + args[1] = g_strdup_printf("%d", request_slow_sync_read); + args[2] = g_strdup_printf("%d", request_slow_sync_write); + args[3] = NULL; + qcop_send(qconn, "QPE/System startAppSync(QString,bool,bool)", args); + gchar **resp = qcop_wait_for(qconn, "QPE/Desktop appSyncStarted(bool,bool)"); + g_strfreev(args); + if(!resp) + return FALSE; + + gboolean result = FALSE; + if( g_strv_length(resp) > 4 ) { + result = TRUE; + *has_changelog = (atoi(resp[3]) != 0); + *slow_sync_read = (atoi(resp[4]) != 0); + } + + g_strfreev(resp); + return result; +} + +gboolean qcop_finish_app_sync(qcop_conn* qconn, const char *appname) +{ + gchar **args = g_new (gchar*, 2); + args[0] = g_strdup(appname); + args[1] = NULL; + qcop_send(qconn, "QPE/System finishAppSync(QString)", args); + gchar **resp = qcop_wait_for(qconn, "QPE/Desktop appSyncDone(QString)"); + g_strfreev(args); + if(!resp) + return FALSE; + + g_strfreev(resp); + return TRUE; } Modified: plugins/opie-sync/src/opie_qcop.h ============================================================================== --- plugins/opie-sync/src/opie_qcop.h Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_qcop.h Thu Feb 11 01:52:36 2010 (r6036) @@ -36,6 +36,7 @@ char* resultmsg; /* string associated with the result (error msg, etc) */ int socket; /* socket open to the QCopBridge server */ gboolean syncing; /* Tells us whether we are currently syncing */ + gboolean compatmode; /* True if we need to use base64 for arguments */ pthread_mutex_t access_mutex; /* At times we have two threads sharing access, so we need this */ } qcop_conn; @@ -47,12 +48,24 @@ } qcop_monitor_data; +typedef struct +{ + int opie_major_version; + int opie_minor_version; + int opie_sub_version; +} qcop_version_info; + + qcop_conn* qcop_connect(gchar* addr, gchar* username, gchar* password); void qcop_disconnect(qcop_conn* qconn); void qcop_freeqconn(qcop_conn* qconn); -gboolean qcop_send(qcop_conn* qconn, const char *message, const char *args); -char *qcop_wait_for(qcop_conn* qconn, const char *message); +gboolean qcop_send(qcop_conn* qconn, const char *message, gchar **args); +gchar **qcop_wait_for(qcop_conn* qconn, const char *message); char* qcop_get_root(qcop_conn* qconn); +gboolean qcop_get_version(qcop_conn* qconn, qcop_version_info *version); +gboolean qcop_set_peer_info(qcop_conn* qconn, const char *peer_id, const char *peer_name); +gboolean qcop_start_app_sync(qcop_conn* qconn, const char *appname, gboolean request_slow_sync_read, gboolean request_slow_sync_write, gboolean *has_changelog, gboolean *slow_sync_read); +gboolean qcop_finish_app_sync(qcop_conn* qconn, const char *appname); void qcop_start_sync(qcop_conn* qconn, void (*cancel_routine)()); void qcop_stop_sync(qcop_conn* qconn); Modified: plugins/opie-sync/src/opie_sync.c ============================================================================== --- plugins/opie-sync/src/opie_sync.c Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_sync.c Thu Feb 11 01:52:36 2010 (r6036) @@ -262,6 +262,7 @@ g_free(key); key = osync_rand_str(10, &error); env->plugin_env->password = g_strdup_printf("QtopiaXX%s", key); + osync_sink_state_set(state_db, "sync_key", env->plugin_env->password, &error); } else env->plugin_env->password = g_strdup(key); @@ -275,6 +276,56 @@ goto error; } env->plugin_env->connected = TRUE; + + env->plugin_env->opie_v1_2_5 = FALSE; + if(env->plugin_env->use_qcop) { + qcop_version_info version; + if(!qcop_get_version(env->plugin_env->qcopconn, &version)) { + char *errmsg = g_strdup_printf("qcop_get_version failed: %s", env->plugin_env->qcopconn->resultmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + g_mutex_unlock(env->plugin_env->plugin_mutex); + goto error; + } + osync_trace(TRACE_INTERNAL, "Opie version is %d.%d.%d", + version.opie_major_version, + version.opie_minor_version, + version.opie_sub_version); + + if(version.opie_major_version > 1 || version.opie_minor_version > 2 || + (version.opie_major_version == 1 && version.opie_minor_version == 2 && version.opie_sub_version >= 5)) + env->plugin_env->opie_v1_2_5 = TRUE; + } + } + + if(env->plugin_env->opie_v1_2_5) { + /* Get the peer ID */ + char *peer_id = osync_sink_state_get(state_db, "peer_id", &error); + if(!peer_id) { + g_mutex_unlock(env->plugin_env->plugin_mutex); + goto error; + } + g_free(env->plugin_env->peer_id); + if(strlen(peer_id) == 0) { + g_free(peer_id); + peer_id = osync_rand_str(20, &error); + env->plugin_env->peer_id = g_strdup(peer_id); + osync_sink_state_set(state_db, "peer_id", env->plugin_env->peer_id, &error); + } + else + env->plugin_env->peer_id = g_strdup(peer_id); + osync_free(peer_id); + /* FIXME: do we need to keep the peer ID global? */ + + /* Get hostname */ + const gchar *hostname = g_get_host_name(); + if(!qcop_set_peer_info(env->plugin_env->qcopconn, env->plugin_env->peer_id, hostname)) { + char *errmsg = g_strdup_printf("qcop_set_peer_info failed: %s", env->plugin_env->qcopconn->resultmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + g_mutex_unlock(env->plugin_env->plugin_mutex); + goto error; + } } if(!env->plugin_env->categories_doc) { @@ -298,10 +349,68 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); OpieSinkEnv *env = (OpieSinkEnv *)data; + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); OSyncError *error = NULL; + g_mutex_lock(env->plugin_env->plugin_mutex); + gboolean connected = env->plugin_env->connected; + g_mutex_unlock(env->plugin_env->plugin_mutex); + + if(!connected) { + char *errmsg; + errmsg = g_strdup_printf("Device not connected"); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + goto error; + } + + if(env->objtype == OPIE_OBJECT_TYPE_NOTE) { + /* Check if the notes resource has changed since the last sync */ + osync_bool state_match = FALSE; + if(!osync_sink_state_equal(state_db, "notes_path", env->plugin_env->notes_path, &state_match, &error)) + goto error; + if(!state_match) + osync_context_report_slowsync(ctx); + } + + env->fastcapable = FALSE; + gboolean force_slowsync = FALSE; + if(env->plugin_env->opie_v1_2_5 && env->plugin_env->use_qcop) { + env->slow_sync_en = FALSE; + if(!qcop_start_app_sync(env->plugin_env->qcopconn, env->appname, env->slow_sync_en, FALSE, &env->fastcapable, &force_slowsync)) { + char *errmsg; + errmsg = g_strdup_printf("Couldn't start application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + goto error; + } + if(env->fastcapable) { + osync_trace(TRACE_INTERNAL, "%s is fast capable", env->appname); + /* We won't be using the hashtable, so if Opie says we need to + slow-sync then we really do need to do that */ + if(force_slowsync) { + osync_trace(TRACE_INTERNAL, "%s - force slow-sync", env->appname); + env->slow_sync_en = TRUE; + } + if(env->slow_sync_en) { + osync_trace(TRACE_INTERNAL, "%s - reqesting slow-sync", env->appname); + osync_context_report_slowsync(ctx); + } + } + } + gchar *fastcapablestr = g_strdup_printf("%d", env->fastcapable); + char *lastfastcapablestr = osync_sink_state_get(state_db, "fastcapable", &error); + printf("&&&&& %s == %s\n", lastfastcapablestr, fastcapablestr); + if( !env->slow_sync_en && strcmp(lastfastcapablestr, fastcapablestr) ) { + /* We have changed between 1.2.5 and earlier or SQL and text backends + (one way or the other) so force a slow-sync */ + osync_trace(TRACE_INTERNAL, "%s - fast capable change - requesting slow-sync", env->appname); + osync_context_report_slowsync(ctx); + } + g_free(fastcapablestr); + osync_context_report_success(ctx); osync_trace(TRACE_EXIT, "%s", __func__); return; @@ -320,18 +429,19 @@ OSyncError *error = NULL; - g_mutex_lock(env->plugin_env->plugin_mutex); - gboolean connected = env->plugin_env->connected; - g_mutex_unlock(env->plugin_env->plugin_mutex); - - if(!connected) { - char *errmsg; - errmsg = g_strdup_printf("Device not connected"); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); - goto error; + if(slow_sync && !env->slow_sync_en && env->fastcapable) { + gboolean unused1, unused2; + /* Slow-sync requested by someone else, we have to tell Opie about it */ + if(!qcop_start_app_sync(env->plugin_env->qcopconn, env->appname, TRUE, FALSE, &unused1, &unused2)) { + char *errmsg; + errmsg = g_strdup_printf("Couldn't start application slow-sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + goto error; + } + env->slow_sync_en = TRUE; } - + /* pull the required data back */ if(!opie_fetch_sink(env, ctx)) { @@ -345,23 +455,15 @@ goto error; } - if(env->objtype == OPIE_OBJECT_TYPE_NOTE) { - /* Check if the notes resource has changed since the last sync */ - OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); - osync_bool state_match = FALSE; - if(!osync_sink_state_equal(state_db, "notes_path", env->plugin_env->notes_path, &state_match, &error)) - goto error; - if(!state_match) - osync_context_report_slowsync(ctx); - } - if (slow_sync) { osync_trace(TRACE_INTERNAL, "Slow sync requested"); - if (!osync_hashtable_slowsync(hashtable, &error)) { - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); - osync_context_report_osyncerror(ctx, error); - return; + if( !env->fastcapable ) { + if (!osync_hashtable_slowsync(hashtable, &error)) { + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); + osync_context_report_osyncerror(ctx, error); + return; + } } } @@ -389,14 +491,23 @@ char *hash = hash_xml_node(env->doc, item_node); osync_change_set_hash(change, hash); g_free(hash); + + OSyncChangeType changetype; + if( env->fastcapable ) { + /* Detect the type of change */ + changetype = opie_xml_get_change_type(item_node); + } + else { + /* Detect the type of change */ + changetype = osync_hashtable_get_changetype(hashtable, change); + + /* Update the hashtable with the hash of the object */ + osync_hashtable_update_change(hashtable, change); + } - /* Detect and set the type of change */ - OSyncChangeType changetype = osync_hashtable_get_changetype(hashtable, change); + /* Set the type of change */ osync_change_set_changetype(change, changetype); - - /* Update the hashtable with the hash of the object */ - osync_hashtable_update_change(hashtable, change); - + if (changetype != OSYNC_CHANGE_TYPE_UNMODIFIED) { /* Convert category IDs to names that other systems can use */ g_mutex_lock(env->plugin_env->plugin_mutex); @@ -437,40 +548,42 @@ item_node = opie_xml_get_next(item_node); } - /* Check for deleted entries using the hashtable */ - OSyncList *u, *uids = osync_hashtable_get_deleted(hashtable); - for (u = uids; u; u = u->next) { - const char *uid = u->data; - - OSyncChange *change = osync_change_new(&error); - if (!change) { - osync_context_report_osyncwarning(ctx, error); - osync_error_unref(&error); - continue; - } + if( !env->fastcapable ) { + /* Check for deleted entries using the hashtable */ + OSyncList *u, *uids = osync_hashtable_get_deleted(hashtable); + for (u = uids; u; u = u->next) { + const char *uid = u->data; + + OSyncChange *change = osync_change_new(&error); + if (!change) { + osync_context_report_osyncwarning(ctx, error); + osync_error_unref(&error); + continue; + } - osync_change_set_uid(change, uid); - osync_change_set_changetype(change, OSYNC_CHANGE_TYPE_DELETED); + osync_change_set_uid(change, uid); + osync_change_set_changetype(change, OSYNC_CHANGE_TYPE_DELETED); - OSyncData *odata = osync_data_new(NULL, 0, env->objformat, &error); - if (!odata) { - osync_change_unref(change); - osync_context_report_osyncwarning(ctx, error); - osync_error_unref(&error); - continue; - } + OSyncData *odata = osync_data_new(NULL, 0, env->objformat, &error); + if (!odata) { + osync_change_unref(change); + osync_context_report_osyncwarning(ctx, error); + osync_error_unref(&error); + continue; + } - osync_data_set_objtype(odata, osync_objtype_sink_get_name(sink)); - osync_change_set_data(change, odata); - osync_data_unref(odata); + osync_data_set_objtype(odata, osync_objtype_sink_get_name(sink)); + osync_change_set_data(change, odata); + osync_data_unref(odata); - osync_context_report_change(ctx, change); + osync_context_report_change(ctx, change); - osync_hashtable_update_change(hashtable, change); + osync_hashtable_update_change(hashtable, change); - osync_change_unref(change); + osync_change_unref(change); + } + osync_list_free(uids); } - osync_list_free(uids); //Now we need to answer the call osync_context_report_success(ctx); @@ -525,8 +638,11 @@ hash = hash_xml_node(env->doc, change_node); } } - - switch (osync_change_get_changetype(change)) { + + OSyncChangeType changetype = osync_change_get_changetype(change); + if( env->fastcapable ) + opie_xml_set_change_type(change_node, changetype); + switch (changetype) { case OSYNC_CHANGE_TYPE_DELETED: if(!opie_uid) { if(!strcmp(env->itemelement, "note")) @@ -573,7 +689,8 @@ if(change_doc) xmlFreeDoc(change_doc); - osync_hashtable_update_change(hashtable, change); + if( !env->fastcapable ) + osync_hashtable_update_change(hashtable, change); //Answer the call osync_context_report_success(ctx); @@ -594,7 +711,7 @@ OSyncError *error = NULL; if ( !opie_put_sink(env) ) { - osync_trace( TRACE_INTERNAL, "opie_connect_and_put failed" ); + osync_trace( TRACE_INTERNAL, "opie_put_sink failed" ); char *errmsg = g_strdup_printf( "Failed to send data to device %s", env->plugin_env->host ); /* FIXME specify which data */ osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); g_free(errmsg); @@ -607,6 +724,22 @@ goto error; } + if(env->plugin_env->opie_v1_2_5 && env->plugin_env->use_qcop) { + if(!qcop_finish_app_sync(env->plugin_env->qcopconn, env->appname)) { + osync_trace( TRACE_INTERNAL, "qcop_finish_app_sync failed" ); + char *errmsg; + errmsg = g_strdup_printf("Couldn't finish application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); + g_free(errmsg); + goto error; + } + } + + gchar *fastcapablestr = g_strdup_printf("%d", env->fastcapable); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + osync_sink_state_set(state_db, "fastcapable", fastcapablestr, &error); + g_free(fastcapablestr); + osync_context_report_success(ctx); osync_trace(TRACE_EXIT, "%s", __func__); return; @@ -659,7 +792,7 @@ osync_context_report_success(ctx); } -OpieSinkEnv *opie_sync_create_sink_env(OpiePluginEnv *env, OSyncPluginInfo *info, const char *objtype, const char *objformat, OPIE_OBJECT_TYPE opie_objtype, const char *remotefile, const char *listelement, const char *itemelement, OSyncError **error) +OpieSinkEnv *opie_sync_create_sink_env(OpiePluginEnv *env, OSyncPluginInfo *info, const char *appname, const char *objtype, const char *objformat, OPIE_OBJECT_TYPE opie_objtype, const char *remotefile, const char *listelement, const char *itemelement, OSyncError **error) { OSyncObjTypeSink *sink = osync_plugin_info_find_objtype(info, objtype); if (!sink) { @@ -675,6 +808,7 @@ sink_env->listelement = listelement; sink_env->itemelement = itemelement; sink_env->remotefile = remotefile; + sink_env->appname = appname; sink_env->objtype = opie_objtype; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); @@ -693,6 +827,9 @@ /* Request a hashtable from the framework. */ osync_objtype_sink_enable_hashtable(sink, TRUE); + + /* Request a state db from the framework. */ + osync_objtype_sink_enable_state_db(sink, TRUE); return sink_env; } @@ -727,25 +864,24 @@ osync_plugin_info_set_main_sink(info, env->main_sink_env->sink); /* Contacts sink */ - env->contact_env = opie_sync_create_sink_env(env, info, "contact", OPIE_FORMAT_XML_CONTACT, OPIE_OBJECT_TYPE_CONTACT, OPIE_ADDRESS_FILE, "Contacts", "Contact", error); + env->contact_env = opie_sync_create_sink_env(env, info, "addressbook", "contact", OPIE_FORMAT_XML_CONTACT, OPIE_OBJECT_TYPE_CONTACT, OPIE_ADDRESS_FILE, "Contacts", "Contact", error); if(!env->contact_env) goto error_free_env; /* Todos sink */ - env->todo_env = opie_sync_create_sink_env(env, info, "todo", OPIE_FORMAT_XML_TODO, OPIE_OBJECT_TYPE_TODO, OPIE_TODO_FILE, "Tasks", "Task", error); + env->todo_env = opie_sync_create_sink_env(env, info, "todolist", "todo", OPIE_FORMAT_XML_TODO, OPIE_OBJECT_TYPE_TODO, OPIE_TODO_FILE, "Tasks", "Task", error); if(!env->todo_env) goto error_free_env; /* Events sink */ - env->event_env = opie_sync_create_sink_env(env, info, "event", OPIE_FORMAT_XML_EVENT, OPIE_OBJECT_TYPE_EVENT, OPIE_CALENDAR_FILE, "events", "event", error); + env->event_env = opie_sync_create_sink_env(env, info, "datebook", "event", OPIE_FORMAT_XML_EVENT, OPIE_OBJECT_TYPE_EVENT, OPIE_CALENDAR_FILE, "events", "event", error); if(!env->event_env) goto error_free_env; /* Notes sink */ - env->note_env = opie_sync_create_sink_env(env, info, "note", OPIE_FORMAT_XML_NOTE, OPIE_OBJECT_TYPE_NOTE, NULL, "notes", "note", error); + env->note_env = opie_sync_create_sink_env(env, info, "notes", "note", OPIE_FORMAT_XML_NOTE, OPIE_OBJECT_TYPE_NOTE, NULL, "memos", "memo", error); if(!env->note_env) goto error_free_env; - osync_objtype_sink_enable_state_db(env->note_env->sink, TRUE); env->qcopconn = NULL; env->connected = FALSE; Modified: plugins/opie-sync/src/opie_sync.h ============================================================================== --- plugins/opie-sync/src/opie_sync.h Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_sync.h Thu Feb 11 01:52:36 2010 (r6036) @@ -71,9 +71,12 @@ gchar* localdir; /* path to local files if conntype = OPIE_CONN_NONE (for debugging) */ gchar* notes_path; + gchar* peer_id; + gboolean use_qcop; qcop_conn* qcopconn; gboolean connected; + gboolean opie_v1_2_5; gchar* dev_root_path; xmlDoc* categories_doc; @@ -92,9 +95,12 @@ OSyncObjTypeSink* sink; xmlDoc* doc; OSyncObjFormat* objformat; + const char* appname; const char* listelement; const char* itemelement; const char* remotefile; + gboolean fastcapable; /* Whether or not fast-sync is available for this sink */ + gboolean slow_sync_en; /* Whether or not Opie has been told we are slow-syncing */ OPIE_OBJECT_TYPE objtype; }; Modified: plugins/opie-sync/src/opie_xml.c ============================================================================== --- plugins/opie-sync/src/opie_xml.c Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_xml.c Thu Feb 11 01:52:36 2010 (r6036) @@ -392,8 +392,7 @@ uidattr = "uid"; } else if(!strcasecmp(node->name, "note")) { - /* Notes don't have a UID on the Opie side, but the name should be unique */ - uidattr = "name"; + uidattr = "uid"; } else if(!strcasecmp(node->name, "Category")) { uidattr = "id"; @@ -547,7 +546,7 @@ void opie_xml_set_categories(xmlNode *item_node, const char *value) { char *attr_name; - if(!strcasecmp(item_node->name, "event")) { + if(!strcasecmp(item_node->name, "event") || !strcasecmp(item_node->name, "memo")) { attr_name = "categories"; } else { @@ -557,6 +556,35 @@ xmlSetProp(item_node, attr_name, value); } +OSyncChangeType opie_xml_get_change_type(xmlNode *item_node) { + OSyncChangeType changetype = OSYNC_CHANGE_TYPE_ADDED; + char *value = xmlGetProp(item_node, "change_action"); + if(value) { + if(!strcmp(value, "U")) + changetype = OSYNC_CHANGE_TYPE_MODIFIED; + if(!strcmp(value, "D")) + changetype = OSYNC_CHANGE_TYPE_DELETED; + xmlFree(value); + } + return changetype; +} + +void opie_xml_set_change_type(xmlNode *item_node, OSyncChangeType changetype) { + const char * action; + switch(changetype) { + case OSYNC_CHANGE_TYPE_MODIFIED: + action = "U"; + break; + case OSYNC_CHANGE_TYPE_DELETED: + action = "D"; + break; + default: + action = "A"; + break; + } + xmlSetProp(item_node, "change_action", action); +} + xmlDoc *opie_xml_create_contacts_doc(void) { xmlDoc *doc = xmlNewDoc((xmlChar*)"1.0"); @@ -623,6 +651,8 @@ xmlNode *root = xmlNewNode(NULL, "notes"); xmlDocSetRootElement(doc, root); + xmlNode *cur = xmlNewNode(NULL, "memos"); + xmlAddChild(root, cur); return doc; } @@ -647,12 +677,12 @@ } xmlNode *opie_xml_add_note_node(xmlDoc *doc, const char *name, const char *direntry, const char *content) { - xmlNode *notes_node = opie_xml_get_collection(doc, "notes"); + xmlNode *notes_node = opie_xml_get_collection(doc, "memos"); if(!notes_node) { osync_trace(TRACE_INTERNAL, "Unable to create new XML document"); return NULL; } - xmlNode *note_node = xmlNewTextChild(notes_node, NULL, (xmlChar*)"note", NULL); + xmlNode *note_node = xmlNewTextChild(notes_node, NULL, (xmlChar*)"memo", NULL); /* FIXME this needs implementing @@ -681,8 +711,9 @@ } } */ - xmlSetProp(note_node, (xmlChar*)"name", name); - xmlNewTextChild(note_node, NULL, (xmlChar*)"content", content); + xmlSetProp(note_node, (xmlChar*)"uid", name); + xmlSetProp(note_node, (xmlChar*)"text", content); + // FIXME categories return note_node; } Modified: plugins/opie-sync/src/opie_xml.h ============================================================================== --- plugins/opie-sync/src/opie_xml.h Wed Feb 10 23:07:08 2010 (r6035) +++ plugins/opie-sync/src/opie_xml.h Thu Feb 11 01:52:36 2010 (r6036) @@ -54,6 +54,8 @@ void opie_xml_category_names_to_ids(xmlDoc *categories_doc, xmlNode *change_node); char *opie_xml_get_categories(xmlNode *item_node); void opie_xml_set_categories(xmlNode *item_node, const char *value); +OSyncChangeType opie_xml_get_change_type(xmlNode *item_node); +void opie_xml_set_change_type(xmlNode *item_node, OSyncChangeType changetype); xmlDoc *opie_xml_create_contacts_doc(void); xmlDoc *opie_xml_create_todos_doc(void); xmlDoc *opie_xml_create_calendar_doc(void); |
From: <svn...@op...> - 2010-02-11 00:53:52
|
Author: paule Date: Thu Feb 11 01:53:31 2010 New Revision: 6037 URL: http://www.opensync.org/changeset/6037 Log: opie-sync: update README for current status Modified: plugins/opie-sync/README Modified: plugins/opie-sync/README ============================================================================== --- plugins/opie-sync/README Thu Feb 11 01:52:36 2010 (r6036) +++ plugins/opie-sync/README Thu Feb 11 01:53:31 2010 (r6037) @@ -1,15 +1,15 @@ Opie Plugin for OpenSync README =============================== -This OpenSync plugin is intended to allow synchronisation with the Opie +This OpenSync plugin is intended to enable synchronisation with the Opie handheld environment (http://opie.handhelds.org). In theory it should also support some versions of Qtopia as found on the Sharp Zaurus, but no testing of this has been done. This plugin is a work in progress but should be able to sync contacts, -calendar events and todo list entries, minus a few fields, as well as support -for syncing notes. However, use is entirely at your own risk - back up your -data on both sides first! +calendar events, todo list entries, and notes. Support for the new +synchronisation features in Opie 1.2.5 is included. However, use is entirely +at your own risk - back up your data on both sides first! If you'd like to help, please try the plugin and send any questions to the opensync users list (ope...@li...) - although please @@ -21,11 +21,12 @@ Requirements ------------ + * A device running Opie 1.2.0 or later (however, the latest version + available is recommended) * Connection: the plugin assumes you have a working network connection set up between the device and the machine you are running OpenSync on. This could be ethernet over USB, PPP over serial, wifi, bluetooth etc. - as long as an IP network is available the transport is not important. - * The OpenSync xmlformat plugin (now split out from the core) is required. * libcurl, libxml2, glib-2.0 * OpenSSH for scp connections (optional) @@ -46,12 +47,13 @@ Port TCP port on the device to use for file transfers. Default is 4242 (which Opie's built-in FTP server listens on). See also the ConnType option - below. + below. Normally this should not be changed. Authentication Username - User name to log into the device as (default root). + User name to log into the device as (default is root, and this will + almost always be the value here unless you are testing on a PC). Advanced Options @@ -66,9 +68,10 @@ ConnType Type of connection to use: ftp - use FTP (default). Uses Opie's built-in FTP server to transfer - data without encryption. + data without encryption. For Opie 1.2.5 this is the only option. scp - use scp/ssh commands to transfer data securely. Note: this will - require you to set up key-based ssh authentication. + require you to set up key-based ssh authentication. *** See + Todo List below *** BackupDir (Optional) If you want the files from your device backed up prior to every @@ -93,7 +96,7 @@ Only one of these note resources can be enabled at once. -Additional options for debugging purposes only: +Additional options (for debugging purposes only!): ConnType An additional value for this option exists: @@ -162,12 +165,17 @@ If you have not done so you need to set up SSH public key authentication between the device running Opie and the machine running OpenSync. There is no way for a password to be passed to scp so key-based authentication must - be used. + be used. *** See Todo list below *** Todo list --------- +Secure syncing not supported on 1.2.5 + + The new synchronisation method in Opie 1.2.5 does not support exchange of + data using encryption. + Missing fields on contacts "Gender" and "Children" fields from the Opie side are not currently handled |
From: <svn...@op...> - 2010-02-10 22:07:17
|
Author: prahal Date: Wed Feb 10 23:07:08 2010 New Revision: 6035 URL: http://www.opensync.org/changeset/6035 Log: Adapt the number of formats and converters as I added any new ones Those added where in testcase for see #1207. Modified: trunk/tests/format-tests/check_format_env.c Modified: trunk/tests/format-tests/check_format_env.c ============================================================================== --- trunk/tests/format-tests/check_format_env.c Wed Feb 10 22:53:13 2010 (r6034) +++ trunk/tests/format-tests/check_format_env.c Wed Feb 10 23:07:08 2010 (r6035) @@ -384,8 +384,8 @@ fail_unless(osync_module_get_conversion_info(module, env, &error), NULL); fail_unless(error == NULL, NULL); - fail_unless(osync_format_env_num_objformats(env) == 3, NULL); - fail_unless(osync_format_env_num_converters(env) == 2, NULL); + fail_unless(osync_format_env_num_objformats(env) == 4, NULL); + fail_unless(osync_format_env_num_converters(env) == 4, NULL); osync_format_env_unref(env); |
Author: prahal Date: Wed Feb 10 22:53:13 2010 New Revision: 6034 URL: http://www.opensync.org/changeset/6034 Log: Add testcase for #1207 Ie if a change is shared (members have "same" entries) , the conversion in prepare write will apply more than once to this change. As the conversion path is cached, conversion will happens with a forced conversion path on data already converted to another format. Which can segfault and is anyway of no use and harmfull( change is not meant to be written). Added: trunk/tests/data/multisync_multiformats/ trunk/tests/data/multisync_multiformats/configs/ trunk/tests/data/multisync_multiformats/configs/group/ trunk/tests/data/multisync_multiformats/configs/group/1/ trunk/tests/data/multisync_multiformats/configs/group/1/mock-sync.conf trunk/tests/data/multisync_multiformats/configs/group/1/syncmember.conf trunk/tests/data/multisync_multiformats/configs/group/2/ trunk/tests/data/multisync_multiformats/configs/group/2/mock-sync.conf trunk/tests/data/multisync_multiformats/configs/group/2/syncmember.conf trunk/tests/data/multisync_multiformats/configs/group/3/ trunk/tests/data/multisync_multiformats/configs/group/3/mock-sync.conf trunk/tests/data/multisync_multiformats/configs/group/3/syncmember.conf trunk/tests/data/multisync_multiformats/configs/group/4/ trunk/tests/data/multisync_multiformats/configs/group/4/mock-sync.conf trunk/tests/data/multisync_multiformats/configs/group/4/syncmember.conf trunk/tests/data/multisync_multiformats/configs/group/syncgroup.conf trunk/tests/data/multisync_multiformats/data1/ trunk/tests/data/multisync_multiformats/data1/testdata (contents, props changed) trunk/tests/data/multisync_multiformats/data1/testdata_to_sync (contents, props changed) trunk/tests/data/multisync_multiformats/data2/ trunk/tests/data/multisync_multiformats/data2/testdata (contents, props changed) trunk/tests/data/multisync_multiformats/data3/ trunk/tests/data/multisync_multiformats/data3/testdata (contents, props changed) trunk/tests/data/multisync_multiformats/data4/ Modified: trunk/opensync/engine/opensync_sink_engine.c trunk/tests/CMakeLists.txt trunk/tests/mock-plugin/mock_format.c trunk/tests/sync-tests/check_multisync.c Modified: trunk/opensync/engine/opensync_sink_engine.c ============================================================================== --- trunk/opensync/engine/opensync_sink_engine.c Sun Feb 7 22:41:32 2010 (r6033) +++ trunk/opensync/engine/opensync_sink_engine.c Wed Feb 10 22:53:13 2010 (r6034) @@ -190,6 +190,11 @@ if (entry_engine->change == NULL) continue; + /* If change not meant to get written (change shared among multiple "same" mapping + entry engines), prevents conversions see #1207 */ + if (!osync_entry_engine_is_dirty(entry_engine)) + continue; + if (osync_change_get_changetype(entry_engine->change) == OSYNC_CHANGE_TYPE_DELETED) continue; Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Sun Feb 7 22:41:32 2010 (r6033) +++ trunk/tests/CMakeLists.txt Wed Feb 10 22:53:13 2010 (r6034) @@ -296,6 +296,7 @@ OSYNC_TESTCASE( multisync multisync_easy_new) OSYNC_TESTCASE( multisync multisync_dual_new) OSYNC_TESTCASE( multisync multisync_triple_new) +OSYNC_TESTCASE( multisync multisync_easy_same) OSYNC_TESTCASE( multisync multisync_easy_mod) OSYNC_TESTCASE( multisync multisync_dual_mod) OSYNC_TESTCASE( multisync multisync_triple_mod) Added: trunk/tests/data/multisync_multiformats/configs/group/1/mock-sync.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/1/mock-sync.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<config version="1.0"> + <Resources> + <Resource> + <Enabled>1</Enabled> + <Formats> + <Format> + <Name>mockformat1</Name> + </Format> + </Formats> + <ObjType>mockobjtype1</ObjType> + <Path>data1</Path> + </Resource> + </Resources> +</config> Added: trunk/tests/data/multisync_multiformats/configs/group/1/syncmember.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/1/syncmember.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<syncmember version="1.0"> + <pluginname>mock-sync</pluginname> + <objtype> + <name>mockobjtype1</name> + <enabled>1</enabled> + <read>1</read> + <getchanges>1</getchanges> + <write>1</write> + <objformat> + <name>mockformat1</name> + <config/> + </objformat> + </objtype> +</syncmember> Added: trunk/tests/data/multisync_multiformats/configs/group/2/mock-sync.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/2/mock-sync.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<config version="1.0"> + <Resources> + <Resource> + <Enabled>1</Enabled> + <Formats> + <Format> + <Name>mockformat1a</Name> + </Format> + </Formats> + <ObjType>mockobjtype1</ObjType> + <Path>data2</Path> + </Resource> + </Resources> +</config> Added: trunk/tests/data/multisync_multiformats/configs/group/2/syncmember.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/2/syncmember.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<syncmember version="1.0"> + <pluginname>mock-sync</pluginname> + <objtype> + <name>mockobjtype1</name> + <enabled>1</enabled> + <read>1</read> + <getchanges>1</getchanges> + <write>1</write> + <objformat> + <name>mockformat1a</name> + <config/> + </objformat> + </objtype> +</syncmember> Added: trunk/tests/data/multisync_multiformats/configs/group/3/mock-sync.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/3/mock-sync.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<config version="1.0"> + <Resources> + <Resource> + <Enabled>1</Enabled> + <Formats> + <Format> + <Name>mockformat1a</Name> + </Format> + </Formats> + <ObjType>mockobjtype1</ObjType> + <Path>data3</Path> + </Resource> + </Resources> +</config> Added: trunk/tests/data/multisync_multiformats/configs/group/3/syncmember.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/3/syncmember.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<syncmember version="1.0"> + <pluginname>mock-sync</pluginname> + <objtype> + <name>mockobjtype1</name> + <enabled>1</enabled> + <read>1</read> + <getchanges>1</getchanges> + <write>1</write> + <objformat> + <name>mockformat1a</name> + <config /> + </objformat> + </objtype> +</syncmember> Added: trunk/tests/data/multisync_multiformats/configs/group/4/mock-sync.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/4/mock-sync.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<config version="1.0"> + <Resources> + <Resource> + <Enabled>1</Enabled> + <Formats> + <Format> + <Name>mockformat1</Name> + </Format> + </Formats> + <ObjType>mockobjtype1</ObjType> + <Path>data4</Path> + </Resource> + </Resources> +</config> Added: trunk/tests/data/multisync_multiformats/configs/group/4/syncmember.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/4/syncmember.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<syncmember version="1.0"> + <pluginname>mock-sync</pluginname> + <objtype> + <name>mockobjtype1</name> + <enabled>1</enabled> + <read>1</read> + <getchanges>1</getchanges> + <write>1</write> + <objformat> + <name>mockformat1</name> + <config/> + </objformat> + </objtype> +</syncmember> Added: trunk/tests/data/multisync_multiformats/configs/group/syncgroup.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/data/multisync_multiformats/configs/group/syncgroup.conf Wed Feb 10 22:53:13 2010 (r6034) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<syncgroup><groupname>test</groupname></syncgroup> Added: trunk/tests/data/multisync_multiformats/data1/testdata ============================================================================== Binary file. No diff available. Added: trunk/tests/data/multisync_multiformats/data1/testdata_to_sync ============================================================================== Binary file. No diff available. Added: trunk/tests/data/multisync_multiformats/data2/testdata ============================================================================== Binary file. No diff available. Added: trunk/tests/data/multisync_multiformats/data3/testdata ============================================================================== Binary file. No diff available. Modified: trunk/tests/mock-plugin/mock_format.c ============================================================================== --- trunk/tests/mock-plugin/mock_format.c Sun Feb 7 22:41:32 2010 (r6033) +++ trunk/tests/mock-plugin/mock_format.c Wed Feb 10 22:53:13 2010 (r6034) @@ -102,7 +102,7 @@ osync_assert(file); file->path = osync_rand_str(g_random_int_range(1, 100), error); - osync_assert(error == NULL); + osync_assert(*error == NULL); file->data = input; file->size = inpsize - 1; @@ -112,6 +112,56 @@ return TRUE; } +static osync_bool conv_mockformat1a_to_mockformat1(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) +{ + osync_trace(TRACE_INTERNAL, "Converting fileA to file"); + + *free_input = FALSE; + OSyncFileFormat *fileA = (OSyncFileFormat *)input; + OSyncFileFormat *file = osync_try_malloc0(sizeof(OSyncFileFormat), error); + osync_assert(file); + + char *filedata = osync_try_malloc0(fileA->size - 2, error); + memcpy(filedata, fileA->data, fileA->size - 2); + + file->path = fileA->path; + osync_assert(*error == NULL); + + file->data = filedata; + file->size = fileA->size - 2; + + *output = (char *)file; + *outpsize = sizeof(OSyncFileFormat); + return TRUE; +} + +static osync_bool conv_mockformat1_to_mockformat1a(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) +{ + osync_trace(TRACE_INTERNAL, "Converting file to fileA"); + + *free_input = FALSE; + char *identifier = " "; + + OSyncFileFormat *file = (OSyncFileFormat *)input; + OSyncFileFormat *fileA = osync_try_malloc0(sizeof(OSyncFileFormat), error); + osync_assert(fileA); + + char *filedata = osync_try_malloc0(file->size + 2, error); + memcpy(filedata, file->data, file->size); + memcpy(filedata + file->size, identifier , 2); + + fileA->path = file->path; + osync_assert(*error == NULL); + + fileA->data = filedata; + fileA->size = file->size + 2; + + *output = (char *)fileA; + *outpsize = sizeof(OSyncFileFormat); + + return TRUE; +} + static osync_bool destroy_file(char *input, unsigned int inpsize, void *user_data, OSyncError **error) { OSyncFileFormat *file = (OSyncFileFormat *)input; @@ -211,7 +261,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p)", __func__, input, inpsize, marshal, error); OSyncFileFormat *file = (OSyncFileFormat *)input; - + if (!osync_marshal_write_string(marshal, file->path, error)) goto error; if (!osync_marshal_write_buffer(marshal, file->data, file->size, error)) @@ -296,6 +346,15 @@ osync_assert(osync_format_env_register_objformat(env, format, error)); osync_objformat_unref(format); + /* mockformat1a */ + format = osync_objformat_new("mockformat1a", "mockobjtype1", error); + osync_assert(format); + + _format_set_functions(format); + + osync_assert(osync_format_env_register_objformat(env, format, error)); + osync_objformat_unref(format); + return TRUE; } @@ -310,6 +369,9 @@ OSyncObjFormat *mockformat2 = osync_format_env_find_objformat(env, "mockformat2"); osync_assert(mockformat2); + OSyncObjFormat *mockformat1a = osync_format_env_find_objformat(env, "mockformat1a"); + osync_assert(mockformat1a); + conv = osync_converter_new(OSYNC_CONVERTER_ENCAP, mockformat1, mockformat2, conv_mockformat1_to_mockformat2, error); osync_assert(conv); @@ -322,6 +384,17 @@ osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); + conv = osync_converter_new(OSYNC_CONVERTER_ENCAP, mockformat1, mockformat1a, conv_mockformat1_to_mockformat1a, error); + osync_assert(conv); + + osync_format_env_register_converter(env, conv, error); + osync_converter_unref(conv); + + conv = osync_converter_new(OSYNC_CONVERTER_DECAP, mockformat1a, mockformat1, conv_mockformat1a_to_mockformat1, error); + osync_assert(conv); + + osync_format_env_register_converter(env, conv, error); + osync_converter_unref(conv); return TRUE; } Modified: trunk/tests/sync-tests/check_multisync.c ============================================================================== --- trunk/tests/sync-tests/check_multisync.c Sun Feb 7 22:41:32 2010 (r6033) +++ trunk/tests/sync-tests/check_multisync.c Wed Feb 10 22:53:13 2010 (r6034) @@ -471,6 +471,47 @@ osync_engine_unref(engine); } +/* Synchronize slow sync with two same data . +It ends up with two entry_engines pointing to the same change. +Which could lead to double conversion of the change pointed to. +This also lead to wrong conversion path cached if this shared change +appears first. This is the latter that I use to detect the bug. +*/ +START_TEST (multisync_easy_same) +{ + char *testbed = setup_testbed("multisync_multiformats"); + OSyncError *error = NULL; + OSyncEngine *engine = setup_engine(testbed); + fail_unless(osync_engine_initialize(engine, &error), NULL); + fail_unless(error == NULL, NULL); + + osync_testing_system_abort("cp data1/testdata data4/"); + + mark_point(); + + synchronize_once(engine, NULL); + + fail_unless(num_change_read == 5, NULL); + fail_unless(num_change_written == 3, NULL); + fail_unless(num_change_error == 0, NULL); + + fail_unless(num_mapping_conflicts == 0, NULL); + + fail_unless(num_engine_connected == 1, NULL); + fail_unless(num_engine_read == 1, NULL); + fail_unless(num_engine_written == 1, NULL); + fail_unless(num_engine_disconnected == 1, NULL); + fail_unless(num_engine_end_conflicts = 1, NULL); + + fail_unless(osync_testing_diff("data1", "data4")); + fail_unless(osync_testing_diff("data2", "data3")); + + destroy_engine(engine); + + destroy_testbed(testbed); +} +END_TEST + /* Sync the single item testdata from data 1 to data2 and data3 * then change testdata in data3 */ START_TEST (multisync_easy_mod) @@ -1968,6 +2009,8 @@ OSYNC_TESTCASE_ADD(multisync_dual_new) OSYNC_TESTCASE_ADD(multisync_triple_new) +OSYNC_TESTCASE_ADD(multisync_easy_same) + OSYNC_TESTCASE_ADD(multisync_easy_mod) OSYNC_TESTCASE_ADD(multisync_dual_mod) OSYNC_TESTCASE_ADD(multisync_triple_mod) |
From: <svn...@op...> - 2010-02-07 21:41:42
|
Author: markellis Date: Sun Feb 7 22:41:32 2010 New Revision: 6033 URL: http://www.opensync.org/changeset/6033 Log: correct func entry trace after possible failing statement Modified: trunk/opensync/client/opensync_client.c Modified: trunk/opensync/client/opensync_client.c ============================================================================== --- trunk/opensync/client/opensync_client.c Sat Feb 6 18:40:46 2010 (r6032) +++ trunk/opensync/client/opensync_client.c Sun Feb 7 22:41:32 2010 (r6033) @@ -964,11 +964,11 @@ unsigned int num_res = 0; OSyncPluginResource *resource = NULL; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, client, message, error); + config = osync_plugin_info_get_config(client->plugin_info); res = osync_plugin_config_get_resources(config); - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, client, message, error); - if (!osync_plugin_discover(client->plugin, client->plugin_data, client->plugin_info, error)) goto error; |
From: <svn...@op...> - 2010-02-06 17:40:56
|
Author: scriptor Date: Sat Feb 6 18:40:46 2010 New Revision: 6032 URL: http://www.opensync.org/changeset/6032 Log: I have removed several leaks. Please note: In order to avoid certain libxml leaks, the user CAN define the constant ENABLE_XML_CLEANUP_PARSER in ldap_plugin.h. This will lead to a call of xmlCleanupParser() somewhere in ldap_format.c. However, this is quite a dangerous function call. Especially in a library, and even more so in a plugin for this library. Therefore it's better to leave this undefined by default, as it seems. Modified: plugins/ldap-sync/misc/ldap_format_convert.c plugins/ldap-sync/src/ldap_connect.c plugins/ldap-sync/src/ldap_debug.c plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_format.h plugins/ldap-sync/src/ldap_plugin.c plugins/ldap-sync/src/ldap_plugin.h plugins/ldap-sync/tests/check_do_convert_from_to.c Modified: plugins/ldap-sync/misc/ldap_format_convert.c ============================================================================== --- plugins/ldap-sync/misc/ldap_format_convert.c Sat Feb 6 18:40:02 2010 (r6031) +++ plugins/ldap-sync/misc/ldap_format_convert.c Sat Feb 6 18:40:46 2010 (r6032) @@ -1141,6 +1141,7 @@ } + // Analyze the source format sourceformat = osync_format_env_detect_objformat(format_env, data); if (sourceformat == NULL) { @@ -1181,7 +1182,7 @@ if (!ldap_format_prepare_xmlformat_data(buffer, size, "todo", "xmlformat-todo", &data, &sourceformat, &error)) { goto error; } - } if (!strcmp(sourceformat_name, "xmlformat-note-doc")) { + } else if (!strcmp(sourceformat_name, "xmlformat-note-doc")) { if (!ldap_format_prepare_xmlformat_data(buffer, size, "note", "xmlformat-note", &data, &sourceformat, &error)) { goto error; } @@ -1257,32 +1258,53 @@ if (converter_path) osync_converter_path_unref(converter_path); + if (sourceformat_name) + { + if (!strncmp(sourceformat_name, "xmlformat-", 10)) { + if (sourceformat) + osync_objformat_unref(sourceformat); + + if (buffer) + osync_free(buffer); + } + } + if (format_env) osync_format_env_unref(format_env); - if (result) + if (result) { osync_free(result); - - xmlCleanupParser(); + result = NULL; + } out: osync_trace(TRACE_EXIT, "%s", __func__); return 0; -error: +error: if (data) osync_data_unref(data); if (converter_path) osync_converter_path_unref(converter_path); + if (sourceformat_name) { + if (!strncmp(sourceformat_name, "xmlformat-", 10)) { + if (sourceformat) + osync_objformat_unref(sourceformat); + + if (buffer) + osync_free(buffer); + } + } + if (format_env) osync_format_env_unref(format_env); - if (result) + if (result) { osync_free(result); - - xmlCleanupParser(); + result = NULL; + } if (!osync_error_is_set(&error)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unknown reason.\n", __FILE__, __LINE__); Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Sat Feb 6 18:40:02 2010 (r6031) +++ plugins/ldap-sync/src/ldap_connect.c Sat Feb 6 18:40:46 2010 (r6032) @@ -42,58 +42,6 @@ * @{ */ -/** - * @brief Frees a GList that consists of LDAPMod's - * @param ldapmods the GList with LDAPMod's - * @returns Nothing. - * - */ -void ldap_plugin_free_ldapmods_list(GList *ldapmods) -{ - GList *list = NULL; - - - if (ldapmods == NULL) { - return; - } - - - for (list = g_list_first(ldapmods) ; list ; list = g_list_next(list)) - { - if (list->data) { - - if (((LDAPMod *)(list->data))->mod_type) { - g_free(((LDAPMod *)(list->data))->mod_type); // from strdup() in ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods) - ((LDAPMod *)(list->data))->mod_type = NULL; - } - - if (((LDAPMod *)(list->data))->mod_bvalues) { - if (((LDAPMod *)(list->data))->mod_bvalues[0]) { - if (((LDAPMod *)(list->data))->mod_bvalues[0]->bv_val) { - g_free(((LDAPMod *)(list->data))->mod_bvalues[0]->bv_val); // from strdup() in ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods) - ((LDAPMod *)(list->data))->mod_bvalues[0]->bv_val = NULL; - } - - g_free(((LDAPMod *)(list->data))->mod_bvalues[0]); - ((LDAPMod *)(list->data))->mod_bvalues[0] = NULL; - } - - g_free(((LDAPMod *)(list->data))->mod_bvalues); - ((LDAPMod *)(list->data))->mod_bvalues = NULL; - } - - g_free(list->data); // this is an LDAPMod... So g_free() maybe insufficient? - list->data = NULL; - } - - } - - - g_list_free(ldapmods); - -} - - /** * @brief Connects with the LDAP server. @@ -1941,12 +1889,13 @@ * operational attributes are to be shown. * ldap_plugin.h defines 3 types: USER_ATTRIBUTES, * OPERATIONAL_ATTRIBUTES and OBJECTCLASSES. - * * @param sinkenv The object type specific environment - * @param results This function fills this struct with the search result. * @param ignore_no_such_object This variable tells this function whether * or not it should ignore "No such object" * messages by libldap. + * @param results This function fills this struct with the search result. + * It needs to be freed with ldap_msgfree() by the caller. + * * @param error The libopensync error pointer. * * @returns TRUE on success, FALSE, on failure. @@ -2073,7 +2022,8 @@ NULL, ///< client controls NULL, ///< timeout STRING_SIZE, ///< sizelimit - results ///< The result of the search + results ///< The result of the search. Needs to be freed with + ///< ldap_msgfree(). ); @@ -2643,7 +2593,7 @@ osync_error_unref(error); } - goto done; + goto free_all_results_and_done; } else { goto error; @@ -2670,10 +2620,10 @@ #endif if (result_code == LDAP_SUCCESS) { - goto done; + goto free_all_results_and_done; } else if (result_code == LDAP_NO_SUCH_OBJECT) { - goto done; + goto free_all_results_and_done; } else { char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, result_code); @@ -2803,13 +2753,15 @@ } // for (result = ldap_first_entry(sinkenv->ld, all_results) ; result ; result = ldap_next_entry(sinkenv->ld, result)) + + + +free_all_results_and_done: if (all_results) { ldap_msgfree(all_results); all_results = NULL; } - -done: osync_trace(TRACE_EXIT, "%s: *entrylist = %p", __func__, (void *) *entrylist); return TRUE; @@ -3364,7 +3316,8 @@ * @param uid The particular uid. This MUST NOT be the id of a subentry. It * MUST always be the DN of the top entry one level below * "ou=addressbook" or "ou=calendar" etc. - * @param actual_hash The resulting hash value. + * @param actual_hash The resulting hash value. This needs to be freed by the + * caller. * @param error The libopensync error pointer. * * @returns TRUE on success, FALSE otherwise. @@ -4289,12 +4242,17 @@ /* Free up attribute structures */ + ldap_plugin_free_ldap_mods_array(entry->mods); + entry->mods = NULL; + +#if 0 + // this is insufficient xxx jl for ( i = 0 ; entry->mods[i] ; i++ ) { g_free(entry->mods[i]); } g_free(entry->mods); - +#endif // Recreate the LDAP attributes @@ -4354,7 +4312,6 @@ } - g_free(list->data); i++; } @@ -4592,6 +4549,11 @@ ldap_plugin_printf("%s:%i: ldap attribute \"%s\" should have been deleted, actually. But it is part of the DN.\n", __FILE__, __LINE__, ldap_attribute); #endif } + + if (tmp) { + g_free(tmp); + tmp = NULL; + } } else { osync_trace(TRACE_INTERNAL, "%s:%i: ldap attribute \"%s\" should have actually been deleted, but it is equal to the key attribute.\n", __FILE__, __LINE__, ldap_attribute); @@ -4687,8 +4649,9 @@ out: - if (modifications) - g_list_free(modifications); + if (modifications) { + ldap_plugin_free_ldap_mods_list(modifications); + } @@ -4839,9 +4802,15 @@ ldap_plugin_rewrite_ldap_entry(entry, new_set_of_mods, error); if (osync_error_is_set(error)) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_plugin_rewrite_ldap_entry() has failed.", __FILE__, __LINE__); + + ldap_plugin_free_ldap_mods_list(new_set_of_mods); + new_set_of_mods = NULL; goto error; } + ldap_plugin_free_ldap_mods_list(new_set_of_mods); + new_set_of_mods = NULL; + #endif } // if (!found_attribute) Modified: plugins/ldap-sync/src/ldap_debug.c ============================================================================== --- plugins/ldap-sync/src/ldap_debug.c Sat Feb 6 18:40:02 2010 (r6031) +++ plugins/ldap-sync/src/ldap_debug.c Sat Feb 6 18:40:46 2010 (r6032) @@ -606,8 +606,13 @@ #endif } - if (msg3 && msg3[0]) { - strncat(buf, msg3, STRING_SIZE - 1 - strlen(buf)); + if (msg3) { + if (msg3[0]) { + strncat(buf, msg3, STRING_SIZE - 1 - strlen(buf)); + } + + ldap_memfree(msg3); + msg3 = NULL; } return buf; Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sat Feb 6 18:40:02 2010 (r6031) +++ plugins/ldap-sync/src/ldap_format.c Sat Feb 6 18:40:46 2010 (r6032) @@ -133,7 +133,8 @@ if (mod->mod_type) { - g_free(mod->mod_type); // from strdup() in ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods) + g_free(mod->mod_type); ///< @sa strdup() in ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods) + ///< @sa strdup() in ldap_format_append_ldapmod() mod->mod_type = NULL; } @@ -176,7 +177,9 @@ * ldap_format_free_ldap_entries(). * * @param entry The LDAP entry to be freed. - * @param user_data ??????? + * @param user_data This points to a user_data_carrier struct, that has + * been allocated either in ldap_format_initialize_converter() + * or in ldap_format_initialize_format1(). * * @returns Nothing. */ @@ -217,7 +220,8 @@ } if (entry->mods[i]->mod_type) { - g_free(entry->mods[i]->mod_type); + g_free(entry->mods[i]->mod_type); ///< from strdup() in ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods) + ///< @sa strdup() in ldap_format_append_ldapmod() entry->mods[i]->mod_type = NULL; } } @@ -1068,10 +1072,6 @@ } - // xxx jl: Das ist, glaube ich, falsch: Es kopiert die subentries - // auf eine hoehere Stufe. - // Siehe line 779 - // Add the resulting subentry to the just freshly created LDAP entry: if (entry) { if (target_subentry) { @@ -1175,75 +1175,78 @@ children_node = xmlnode->next; - if (children_node) { - for (node = children_node ; node; node = node->next) { - const xmlChar *child_name = NULL; + if (children_node == NULL) { + children_node = (xmlNode *)xmlnode; + } - child_name = node->name; - if (child_name == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name = NULL. Ignoring this node.\n", __FILE__, __LINE__); - continue; - } + for (node = children_node ; node; node = node->next) { + const xmlChar *child_name = NULL; + + + child_name = node->name; + if (child_name == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name = NULL. Ignoring this node.\n", __FILE__, __LINE__); + continue; + } - if (child_name[0] == 0) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name[0] = 0. Ignoring this node.\n", __FILE__, __LINE__); - continue; - } + if (child_name[0] == 0) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name[0] = 0. Ignoring this node.\n", __FILE__, __LINE__); + continue; + } - if (!xmlStrcmp(child_name, (xmlChar *)"attribute")) { + if (!xmlStrcmp(child_name, (xmlChar *)"attribute")) { #ifdef DEBUG_convert_xmlinternal2ldap - ldap_plugin_printf("%s:%i: attribute found! (2)", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: Attribute found (2):", __FILE__, __LINE__); #endif - for (attribute_node = node->children; attribute_node; attribute_node = attribute_node->next) { - if (!xmlStrcmp(attribute_node->name, (xmlChar *)"name")) { - xmlChar *buf = xmlNodeGetContent(attribute_node); - // if (xmlNodeGetContent(attribute_node) != NULL) { - if (buf) { - if (*attr1_name == NULL) { - // *attr1_name = g_strdup_printf("%s", xmlNodeGetContent(attribute_node)); - *attr1_name = g_strdup_printf("%s", buf); - - } else if (*attr2_name == NULL) { - // *attr2_name = g_strdup_printf("%s", xmlNodeGetContent(attribute_node)); - *attr2_name = g_strdup_printf("%s", buf); - } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: Maximal number of attributes already exhausted. Ignoring this one (name = \"%s\").\n", __FILE__, __LINE__, xmlNodeGetContent(attribute_node)); - } // if (*attr1_name == NULL) + for (attribute_node = node->children; attribute_node; attribute_node = attribute_node->next) { + if (!xmlStrcmp(attribute_node->name, (xmlChar *)"name")) { + xmlChar *buf = xmlNodeGetContent(attribute_node); + // if (xmlNodeGetContent(attribute_node) != NULL) { + if (buf) { + if (*attr1_name == NULL) { + // *attr1_name = g_strdup_printf("%s", xmlNodeGetContent(attribute_node)); + *attr1_name = g_strdup_printf("%s", buf); + + } else if (*attr2_name == NULL) { + // *attr2_name = g_strdup_printf("%s", xmlNodeGetContent(attribute_node)); + *attr2_name = g_strdup_printf("%s", buf); + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: Maximal number of attributes already exhausted. Ignoring this one (name = \"%s\").\n", __FILE__, __LINE__, xmlNodeGetContent(attribute_node)); + } // if (*attr1_name == NULL) - xmlFree(buf); - buf = NULL; + xmlFree(buf); + buf = NULL; + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: Empty attribute name returned. Ignoring this attribute.\n", __FILE__, __LINE__); + } // if (xmlNodeGetContent(attribute_node) != NULL) + } // if (!xmlStrcmp(attribute_node->name, (xmlChar *)"name")) + + if (!xmlStrcmp(attribute_node->name, (xmlChar *)"value")) { + xmlChar *content1 = xmlNodeGetContent(attribute_node); + if (content1 != NULL) { + + if (*attr1_value == NULL) { + *attr1_value = g_strdup_printf("%s", content1); + } else if (*attr2_value == NULL) { + *attr2_value = g_strdup_printf("%s", content1); } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: Empty attribute name returned. Ignoring this attribute.\n", __FILE__, __LINE__); - } // if (xmlNodeGetContent(attribute_node) != NULL) - } // if (!xmlStrcmp(attribute_node->name, (xmlChar *)"name")) - - if (!xmlStrcmp(attribute_node->name, (xmlChar *)"value")) { - xmlChar *content1 = xmlNodeGetContent(attribute_node); - if (content1 != NULL) { - - if (*attr1_value == NULL) { - *attr1_value = g_strdup_printf("%s", content1); - } else if (*attr2_value == NULL) { - *attr2_value = g_strdup_printf("%s", content1); - } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: Maximal number of attributes already exhausted. Ignoring this one (value = \"%s\").\n", __FILE__, __LINE__, xmlNodeGetContent(attribute_node)); - } // if (*attr1_value == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: Maximal number of attributes already exhausted. Ignoring this one (value = \"%s\").\n", __FILE__, __LINE__, xmlNodeGetContent(attribute_node)); + } // if (*attr1_value == NULL) { - xmlFree(content1); - content1 = NULL; + xmlFree(content1); + content1 = NULL; - } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: Empty attribute name returned. Ignoring this attribute.\n", __FILE__, __LINE__); - } // if (xmlNodeGetContent(attribute_node) != NULL) - } // if (!xmlStrcmp(attribute_node->name, (xmlChar *)"value")) - } // for (xmlNode *attribute_node... - } // if (!xmlStrcmp(child_name, (xmlChar *)"attribute")) - } // for (xmlNode *node = children_node - } // if (children_node) + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: Empty attribute name returned. Ignoring this attribute.\n", __FILE__, __LINE__); + } // if (xmlNodeGetContent(attribute_node) != NULL) + } // if (!xmlStrcmp(attribute_node->name, (xmlChar *)"value")) + } // for (xmlNode *attribute_node... + } // if (!xmlStrcmp(child_name, (xmlChar *)"attribute")) + } // for (xmlNode *node = children_node #ifdef DEBUG_convert_xmlinternal2ldap @@ -1391,7 +1394,7 @@ * @returns TRUE on success, FALSE in case of any errors. */ -static osync_bool ldap_format_parse_xml_subentry(const xmlNode *xmlnode, const gchar *dn, complex_elements *element_lists, GList **ldap_entries, OSyncError **error) +static osync_bool ldap_format_do_parse_xml_subentry(const xmlNode *xmlnode, const gchar *dn, complex_elements *element_lists, GList **ldap_entries, OSyncError **error) { xmlChar *name = NULL; xmlChar *value = NULL; @@ -1413,7 +1416,7 @@ if (!xmlnode) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: subentry_node = NULL.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlnode = NULL (was: subentry_node).\n", __FILE__, __LINE__); goto error; } @@ -1445,8 +1448,9 @@ goto error; } - - +#ifdef DEBUG_convert_xmlinternal2ldap + ldap_plugin_printf("%s:%i: name = \"%s\"", __FILE__, __LINE__, __NULLSTR((char *)name)); +#endif if (!strcmp((char *)name, "TimezoneComponent")) { if (!ldap_format_add_counter_suffix(&element_lists->timezone_components, &name, error)) @@ -1545,6 +1549,9 @@ if (!strncmp((char *)name, "AddressLabel", 12)) { + if (value) + xmlFree(value); + value = xmlNodeGetContent((xmlNode *)xmlnode); if (value == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: value = NULL.\n", __FILE__, __LINE__); @@ -1553,27 +1560,23 @@ } - ldapmods_subentry = ldap_format_append_ldapmod(ldapmods_subentry, (gchar *)"objectClass", (gchar *)"organizationalUnit"); -#if 1 - // xxx jl: Wasn't here before... if (name && name[0]) { ldapmods_subentry = ldap_format_append_ldapmod(ldapmods_subentry, (gchar *)"ou", (gchar *)name); } -#endif - if (value && value[0]) { - ldapmods_subentry = ldap_format_append_ldapmod(ldapmods_subentry, (gchar *)"description", (gchar *)value); + if (value) { + if (value[0]) { + ldapmods_subentry = ldap_format_append_ldapmod(ldapmods_subentry, (gchar *)"description", (gchar *)value); + } + xmlFree(value); value = NULL; } - - - // Look for any XML attributes if (!ldap_format_get_attributes(xmlnode, &attr1_name, &attr1_value, &attr2_name, &attr2_value, error)) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_get_attributes() has failed.\n", __FILE__, __LINE__); @@ -1597,9 +1600,6 @@ } - - - // Now create the ldap_subentry out of those mods ldap_subentry = ldap_format_create_ldap_entry_from_ldapmods(ldapmods_subentry); if (ldap_subentry == NULL) { @@ -1667,6 +1667,10 @@ for (node = children_node; node; node = node->next) { const xmlChar *child_name = node->name; + + + + if (child_name == NULL) { osync_trace(TRACE_ERROR, "%s:%i: WARNING: child_name = NULL. Ignoring this node.\n", __FILE__, __LINE__); @@ -1683,6 +1687,10 @@ continue; } +#ifdef DEBUG_convert_xmlinternal2ldap + ldap_plugin_printf("%s:%i: child_name = \"%s\"", __FILE__, __LINE__, __NULLSTR((char *)child_name)); +#endif + xmlChar *child_value = xmlNodeGetContent(node); @@ -1694,6 +1702,10 @@ if (child_value[0] == 0) { osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: child_value[0] = 0. Ignoring this node with child_name = \"%s\"\n", __FILE__, __LINE__, child_name); + + xmlFree(child_value); + child_value = NULL; + continue; } @@ -1781,7 +1793,7 @@ ldapmods_subentry = NULL; } - // new_name is freed in ldap_format_convert_xmlinternal2ldap() + // new_name will be freed in ldap_format_convert_xmlinternal2ldap() if (attr1_name) { g_free(attr1_name); @@ -1819,7 +1831,7 @@ ldapmods_subentry = NULL; } - // new_name is freed in ldap_format_convert_xmlinternal2ldap() + // new_name will be freed in ldap_format_convert_xmlinternal2ldap() if (attr1_name) { g_free(attr1_name); @@ -1965,7 +1977,7 @@ } - + // Free any references still present in user_data if (!ldap_format_finalize_format1(user_data, error)) { if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_finalize_format1() has failed.", __FILE__, __LINE__); @@ -1974,6 +1986,33 @@ } + // http://localhost/usr_share_doc/libxslt-devel-1.1.26/html/libxslt-xslt.html#xsltCleanupGlobals + xsltCleanupGlobals(); + + + // http://localhost/usr_share_doc/libxml2-devel-2.7.6/html/libxml-parser.html#xmlCleanupParser + /* + * "This function name is somewhat misleading. It does not clean up + * parser state, it cleans up memory allocated by the library itself. + * It is a cleanup function for the XML library. It tries to reclaim all + * related global memory allocated for the library processing. + * It doesn't deallocate any document related memory. One should call + * xmlCleanupParser() only when the process has finished using the library + * and all XML/HTML documents built with it. See also xmlInitParser() + * which has the opposite function of preparing the library for operations. + * WARNING: if your application is multithreaded or has + * plugin support calling this may crash the application if another thread + * or a plugin is still using libxml2. It's sometimes very hard to guess + * if libxml2 is in use in the application, some libraries or plugins + * may use it without notice. In case of doubt abstain from calling + * this function or do it just before calling exit() to avoid leak reports + * from valgrind!" + * + */ +#ifdef ENABLE_XML_CLEANUP_PARSER + xmlCleanupParser(); +#endif + osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -2045,7 +2084,7 @@ OSyncXMLFormatSchema *xmlformat_schema = osync_xmlformat_schema_new(objtype, error); if (xmlformat_schema) { if (osync_xmlformat_schema_validate (xmlformat_schema, xmlformat, error)) { -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: OK. XML result as produced by means of \"%s\" is valid.\n", __FILE__, __LINE__, stylesheet_file); #endif @@ -2209,19 +2248,19 @@ if (dtd) { -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("\n\n\n--------------"); #endif if (!xmlSchemaValidateDoc(dtd, xmlcard)) { -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: OK. XML result as produced by means of \"%s\" is valid.", __FILE__, __LINE__, stylesheet_file); #endif osync_trace(TRACE_INTERNAL, "%s:%i: OK. Resulting xmlformat as produced by means of \"%s\" is valid.", __FILE__, __LINE__, stylesheet_file); -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("-------------\n\n"); #endif @@ -2256,6 +2295,7 @@ xmlChar *xmlbuffer = NULL; int xmlbuffer_size = 0; + xmlIndentTreeOutput = 1; xmlDocDumpFormatMemory(xmlcard, &xmlbuffer, &xmlbuffer_size, 1); if (xmlbuffer) { @@ -2265,7 +2305,7 @@ } -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("-------------\n\n"); #endif @@ -2565,7 +2605,7 @@ * */ -static osync_bool ldap_format_do_apply_stylesheet(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, const char *config, void *user_data, const char *stylesheet_file, OSyncError **error) +static osync_bool ldap_format_apply_stylesheet(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, const char *config, void *user_data, const char *stylesheet_file, OSyncError **error) { unsigned int size = 0 ; char *str = NULL; @@ -2582,6 +2622,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %p, %p, %p, %p, %p)", __func__, (void *)input, inpsize, (void *)output, (void *)outpsize, (void *)config, (void *)user_data, (void *)stylesheet_file, (void *)error); + if (config) { if (config[0]) { osync_trace(TRACE_INTERNAL, "%s(): config = \"%s\"", __func__, config); @@ -2625,10 +2666,9 @@ -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("\n\n\n\n%s:%i:%s(): ", __FILE__, __LINE__, __func__); ldap_plugin_printf("inpsize = %u bytes", inpsize); - ldap_plugin_printf("input = \n\"%.*s\"\n", inpsize, input); #endif @@ -2637,32 +2677,68 @@ // First off, try and find out what type of data has been casted to char *: + osync_trace(TRACE_INTERNAL, "%s:%i: What is input? inpsize = %i", __FILE__, __LINE__, inpsize); + if (inpsize >= 6 && !strncmp(input, "<?xml ", 6)) { +#ifdef DEBUG_apply_stylesheet + ldap_plugin_printf("input = \n\"%.*s\"\n", inpsize, input); +#endif + osync_trace(TRACE_INTERNAL, "%s:%i: Looks like a human-readable XML string.", __FILE__, __LINE__); // Convert an xmlChar string of the input into an xmlDoc struct: input_doc = xmlParseMemory(input, inpsize); - } else { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input does not seem to be a human readable xml string.\n", __FILE__, __LINE__); + } else if (inpsize == osync_xmlformat_size()) { + unsigned int buf_size = 0; + char *buf = NULL; - osync_trace(TRACE_INTERNAL, "%s:%i: What is input? inpsize = %i", __FILE__, __LINE__, inpsize); - if (inpsize == osync_xmlformat_size()) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: Looks like opensync specific xmlformat.\n", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i: Looks like the opensync specific xmlformat.\n", __FILE__, __LINE__); - } else if (inpsize == 0) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: inpsize = 0.\n", __FILE__, __LINE__); - } else if (inpsize == sizeof(glist_container)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: Looks like a glist_container.", __FILE__, __LINE__); + // Convert from OSyncXMLFormat to a human-readable XML string: + xmlIndentTreeOutput = 1; + if (!osync_xmlformat_assemble((OSyncXMLFormat *)input, &buf, &buf_size, error)) + { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed.", __FILE__, __LINE__); + } - } else if (inpsize == sizeof(GList)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: Looks like a GList.", __FILE__, __LINE__); + goto error; + } - } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: Could be xmlinternal?\n", __FILE__, __LINE__); + if (buf == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed (1).\n", __FILE__, __LINE__); + goto error; + } + + if (buf_size == 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed (2).\n", __FILE__, __LINE__); + xmlFree(buf); + buf = NULL; + goto error; } + + // Convert an xmlChar string of the input into an xmlDoc struct: + input_doc = xmlParseMemory(buf, buf_size); + xmlFree(buf); + buf = NULL; + + } else if (inpsize == 0) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: inpsize = 0.\n", __FILE__, __LINE__); + goto error; + + } else if (inpsize == sizeof(glist_container)) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: Looks like a glist_container.", __FILE__, __LINE__); + goto error; + + } else if (inpsize == sizeof(GList)) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: Looks like a GList.", __FILE__, __LINE__); + goto error; + + } else { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: Don't know what that is.\n", __FILE__, __LINE__); goto error; } @@ -2741,12 +2817,12 @@ } if (xmlbuffer == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlDocDumpMemory() has failed.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlDocDumpFormatMemory() has failed.\n", __FILE__, __LINE__); goto error; } -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: %s: Result from conversion = \n\"%s\"", __FILE__, __LINE__, __func__, xmlbuffer); #endif @@ -2754,7 +2830,7 @@ if (xmlbuffer_size >= 6) { if (!strncmp((char *)xmlbuffer, "<?xml ", 6)) { -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: OK. xmlbuffer starts with <?xml.", __FILE__, __LINE__); #endif } else { @@ -2786,7 +2862,7 @@ -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: ---------- <osync_xmlformat_parse()> -----------", __FILE__, __LINE__); #endif @@ -2798,7 +2874,7 @@ osync_trace(TRACE_INTERNAL, "%s:%i: This needs to be freed eventually. But by whom? And where and when exactly?", __FILE__, __LINE__); -#ifdef DEBUG_do_apply_stylesheet +#ifdef DEBUG_apply_stylesheet ldap_plugin_printf("%s:%i: ---------- </osync_xmlformat_parse()> -----------", __FILE__, __LINE__); #endif @@ -2886,6 +2962,7 @@ *outpsize = osync_xmlformat_size(); // Returns the size of the OSyncXMLFormat struct. + xmlIndentTreeOutput = 1; if (!osync_xmlformat_assemble(xmlformat, &str, &size, error)) { if (!osync_error_is_set(error)) { @@ -2922,7 +2999,6 @@ } - if (xmlcard) { xmlFreeDoc(xmlcard); xmlcard = NULL; @@ -2990,7 +3066,7 @@ xmlFree(xmlbuffer); xmlbuffer = NULL; } - + if (fullpath) { g_free(fullpath); fullpath = NULL; @@ -3007,106 +3083,6 @@ -/** - * @brief Ensures that do_apply_stylesheet is always provided with - * human readable xml data rather than with a libopensync specific xmlformat - * struct. - * - * Sometimes a human readable xml document comes from the peer, and sometimes - * an xmlformat struct, specific to libopensync. This function converts - * the latter one to the human readable version. This is to make sure - * that the main conversion function will always be provided with one - * and the same format type. This does NOT mean that the result would - * not be accompanied with an xmlformat. - * - * @param input The document to be converted. - * @param inpsize Its size. - * @param output This will contain the result after conversion - * @param outpsize Its size. - * @param config ??? - * @param user_data Points to a user_data_carrier struct, that has been - * allocated in ldap_format_initialize_converter(). - * @param stylesheet The particular XSLT stylesheet to be used. - * @param error if something bad happens and you cannot convert, set the error! - * - * @returns TRUE on success, FALSE on failure - */ -static osync_bool ldap_format_apply_stylesheet_workaround(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, const char *config, void *user_data, const char *stylesheet, OSyncError **error) -{ - osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %p, %p, %p, %p, %p)", __func__, (void *)input, inpsize, (void *)output, (void *)outpsize, (void *)config, user_data, (void *)stylesheet, (void *)error); - - - if (stylesheet == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: stylesheet = NULL.\n", __FILE__, __LINE__); - goto error; - } - - - // EITHER this function is provided with a human readable xml string OR - // with an opensync specific xmlformat. But not sometimes the former, - // and at other times the latter format. So right now, we choose - // the human readable format. - if (inpsize >= 6 && !strncmp(input, "<?xml ", 6)) { - if (!ldap_format_do_apply_stylesheet(input, inpsize, output, outpsize, config, user_data, stylesheet, error)) { - if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_do_apply_stylesheet() has failed.\n\n", __FILE__, __LINE__); - - goto error; - } - - osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; - - - } else { - unsigned int size = 0; - char *buf = NULL; - - - if (!osync_xmlformat_assemble((OSyncXMLFormat *)input, &buf, &size, error)) - { - if (!osync_error_is_set(error)) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed.", __FILE__, __LINE__); - } - - goto error; - } - - if (buf == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed (1).\n", __FILE__, __LINE__); - goto error; - } - - if (size == 0) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_assemble() has failed (2).\n", __FILE__, __LINE__); - goto error; - } - - - - osync_bool rv = ldap_format_do_apply_stylesheet(buf, size, output, outpsize, config, user_data, stylesheet, error); - - if (buf) { - g_free(buf); - buf = NULL; - size = 0; - } - - - osync_trace(TRACE_EXIT, "%s(): Return value of ldap_format_do_apply_stylesheet(): %s", __func__, rv ? "TRUE" : "FALSE"); - return rv; - -error: - if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); - - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); - return FALSE; - } -} - - - /** * @brief This function adds a subentry to an XML tree. @@ -3292,13 +3268,6 @@ continue; } -#if 0 -#ifdef DEBUG_convert_ldap2xmlinternal - ldap_plugin_printf("%s:%i:", __FILE__, __LINE__); - ldap_plugin_printf("token = \"%s\"", token); - ldap_plugin_printf("node2->name = \"%s\"", node2->name); -#endif -#endif if (g_strstr_len((gchar *)token, -1, (gchar *)node2->name)) { possible_parent = node2; @@ -3421,6 +3390,10 @@ // This is the base entry. Its attribute name ("description") is // at the same time the name of the XML element *name = xmlStrdup((xmlChar *)mod->mod_type); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)mod->mod_bvalues[0]->bv_val); } else { @@ -3445,36 +3418,80 @@ if (!strncmp((char *)n, "TimezoneRule", 12)) { *name = xmlStrdup((xmlChar *)"TimezoneRule"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "TimezoneComponent", 17)) { *name = xmlStrdup((xmlChar *)"TimezoneComponent"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "postalAddress", 13)) { *name = xmlStrdup((xmlChar *)"postalAddress"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "AlarmAudio", 10)) { *name = xmlStrdup((xmlChar *)"AlarmAudio"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "AlarmDisplay", 12)) { *name = xmlStrdup((xmlChar *)"AlarmDisplay"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "AlarmEmail", 10)) { *name = xmlStrdup((xmlChar *)"AlarmEmail"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "AlarmProcedure", 14)) { *name = xmlStrdup((xmlChar *)"AlarmProcedure"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "RecurrenceRule", 14)) { *name = xmlStrdup((xmlChar *)"RecurrenceRule"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "RecurrenceRuleExtended", 22)) { *name = xmlStrdup((xmlChar *)"RecurrenceRuleExtended"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "AddressLabel", 12)) { *name = xmlStrdup((xmlChar *)"AddressLabel"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else if (!strncmp((char *)n, "Address", 7)) { *name = xmlStrdup((xmlChar *)"Address"); + + if (*value) + xmlFree(*value); + *value = xmlStrdup((xmlChar *)""); } else { *name = xmlStrdup((xmlChar *)(mod->mod_bvalues[0]->bv_val)); @@ -3491,6 +3508,9 @@ // "description" holds the value of an XML element. } else if (!strcmp(mod->mod_type, "description")) { + if (*value) + xmlFree(*value); + if ((xmlChar *)mod->mod_bvalues[0]->bv_val) { *value = xmlStrdup((xmlChar *)mod->mod_bvalues[0]->bv_val); } else { @@ -3563,7 +3583,7 @@ /** * @brief This function generates the head of an XML document. - * Helper function for ldap_format_convert_ldap2xmlinternal(). + * Helper function for ldap_format_do_convert_ldap2xmlinternal(). * * @param objtype The object type, such as "contact", "event", "todo" or "note". * @param ldap_format_name The format name, such as "ldap-evolutionperson". @@ -3575,7 +3595,7 @@ * @returns TRUE on success, FALSE in case of any error. */ osync_bool -ldap_format_convert_ldap2xmlinternal_create_head(const char *objtype, const char *ldap_format_name, xmlDoc **doc, xmlNode **root_node, OSyncError **error) +ldap_format_do_convert_ldap2xmlinternal_create_head(const char *objtype, const char *ldap_format_name, xmlDoc **doc, xmlNode **root_node, OSyncError **error) { @@ -3692,7 +3712,7 @@ /* * @brief This function generates the rest of an XML document, * after its head has been created. - * Helper function for ldap_format_convert_ldap2xmlinternal(). + * Helper function for ldap_format_do_convert_ldap2xmlinternal(). * * @param entry An LDAP entry struct, that is to be added as an * XML child. @@ -3705,7 +3725,7 @@ * @returns TRUE on success, FALSE in case of any error. */ osync_bool -ldap_format_convert_ldap2xmlinternal_add_child_nodes(const ldap_entry *entry, const osync_bool is_subentry, xmlNode **root_node, OSyncError **error) +ldap_format_do_convert_ldap2xmlinternal_add_child_nodes(const ldap_entry *entry, const osync_bool is_subentry, xmlNode **root_node, OSyncError **error) { xmlChar *name = NULL; xmlChar *value = NULL; @@ -3995,18 +4015,6 @@ continue; } -#if 0 -#ifdef DEBUG_convert_ldap2xmlinternal - if (token) { - ldap_plugin_printf("\n\ntoken = \"%s\"", token); - } else { - ldap_plugin_printf("\n\ntoken = NULL"); - } - ldap_plugin_printf("entry->dn = \"%s\"", entry->dn); - ldap_plugin_printf("entry->id = \"%s\"", entry->id); - ldap_plugin_printf("\n"); -#endif -#endif if (!ldap_format_add_xml_subsubentry(*root_node, (xmlChar *)token, name, value, attr1_name, attr1_value, attr2_name, attr2_value, error)) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_add_xml_subsubentry() has failed.\n", __FILE__, __LINE__); @@ -4145,7 +4153,7 @@ * */ -static xmlDoc *ldap_format_convert_ldap2xmlinternal(GList *ldap_entries, const char *objtype, const char *ldap_format_name, OSyncError **error) +static xmlDoc *ldap_format_do_convert_ldap2xmlinternal(GList *ldap_entries, const char *objtype, const char *ldap_format_name, OSyncError **error) { xmlDoc *doc = NULL; xmlNode *root_node = NULL; @@ -4185,9 +4193,9 @@ - if (!ldap_format_convert_ldap2xmlinternal_create_head(objtype, ldap_format_name, &doc, &root_node, error)) { + if (!ldap_format_do_convert_ldap2xmlinternal_create_head(objtype, ldap_format_name, &doc, &root_node, error)) { if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_convert_ldap2xmlinternal_create_head() has failed.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_do_convert_ldap2xmlinternal_create_head() has failed.", __FILE__, __LINE__); goto error; } @@ -4203,16 +4211,16 @@ } - if (!ldap_format_convert_ldap2xmlinternal_add_child_nodes(entry, i, &root_node, error)) { + if (!ldap_format_do_convert_ldap2xmlinternal_add_child_nodes(entry, i, &root_node, error)) { if (osync_error_is_set(error)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_convert_ldap2xmlinternal_add_child_nodes() has failed: \"%s\". Ignoring this ldap entry.", __FILE__, __LINE__, osync_error_print(error)); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_convert_ldap2xmlinternal_add_child_nodes() has failed: \"%s\". Ignoring this ldap entry.", __FILE__, __LINE__, osync_error_print(error)); osync_error_unref(error); } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_convert_ldap2xmlinternal_add_child_nodes() has failed. Ignoring this ldap entry.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_convert_ldap2xmlinternal_add_child_nodes() has failed. Ignoring this ldap entry.\n", __FILE__, __LINE__); } continue; - } // if (!ldap_format_convert_ldap2xmlinternal_add_child_nodes) + } // if (!ldap_format_do_convert_ldap2xmlinternal_add_child_nodes) // And now the subentries. @@ -4224,16 +4232,16 @@ ldap_entry *subentry = g_list_nth_data(entry->subentries, j); - if (!ldap_format_convert_ldap2xmlinternal_add_child_nodes(subentry, TRUE, &root_node, error)) { + if (!ldap_format_do_convert_ldap2xmlinternal_add_child_nodes(subentry, TRUE, &root_node, error)) { if (osync_error_is_set(error)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_convert_ldap2xmlinternal_add_child_nodes() has failed: \"%s\". Ignoring this LDAP subentry.", __FILE__, __LINE__, osync_error_print(error)); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_convert_ldap2xmlinternal_add_child_nodes() has failed: \"%s\". Ignoring this LDAP subentry.", __FILE__, __LINE__, osync_error_print(error)); osync_error_unref(error); } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_convert_ldap2xmlinternal_add_child_nodes() has failed. Ignoring this LDAP subentry.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_convert_ldap2xmlinternal_add_child_nodes() has failed. Ignoring this LDAP subentry.\n", __FILE__, __LINE__); } continue; - } // if (!ldap_format_convert_ldap2xmlinternal_add_child_nodes) + } // if (!ldap_format_do_convert_ldap2xmlinternal_add_child_nodes) } // for (j = 0; i < subentry_max; j++) } // if (entry->subentries) } // for (i = 0; i < g_list_length(ldap_entries); i++) @@ -4397,7 +4405,7 @@ ldap_plugin_printf("%s:%i:%s(): Input:", __FILE__, __LINE__, __func__); xmlIndentTreeOutput = 1; - xmlDocDumpMemory((xmlDoc *)xmldata, &b, &b_size); + xmlDocDumpFormatMemory((xmlDoc *)xmldata, &b, &b_size, 1); if (b) { if (b[0]) { @@ -4430,22 +4438,335 @@ - if (buf) { - g_free(buf); - buf = NULL; - } - + if (buf) { + g_free(buf); + buf = NULL; + } + + + + osync_trace(TRACE_EXIT, "%s(): *root = %p, (*root)->name = \"%s\"", __func__, (void *) *root, (*root)->name); + return TRUE; + +error: + if (buf) { + g_free(buf); + buf = NULL; + } + + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); + + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; +} + + + + +/** + * @brief This function maps from certain XML subnodes to LDAP subentries. + * Helper function for ldap_format_do_parse_xmlinternal_child_nodes(). + * + * @param subentry_node An XML node below of the top level (below of the + * root level) + * @param dn The distinguished name in terms of LDAP intended for this subentry. + * @param complex_element_lists Several glists of LDAP subentries for certain + * special elements. + * @param potential_subentries As a result of this function this glist will + * be filled with LDAP subentries. + * @param error The libopensync error pointer. + * + * @returns TRUE on success, FALSE in case of any error + */ + +osync_bool ldap_format_parse_xml_subentry(xmlNode *subentry_node, const char *dn, complex_elements *complex_element_lists, GList **potential_subentries, OSyncError **error) +{ + GList *ldap_subentries = NULL; + ldap_entry *ldap_subentry = NULL; + unsigned int i = 0; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, (void *)subentry_node, (void *)dn, (void *)complex_element_lists, (void *)potential_subentries, (void *)error); + + + + if (!subentry_node) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: subentry_node = NULL (was: subentry_node).\n", __FILE__, __LINE__); + goto error; + } + + if (complex_element_lists == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: complex_element_lists = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (potential_subentries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: potential_subentries = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (dn == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: dn = NULL.\n", __FILE__, __LINE__); + goto error; + } + + + if (!ldap_format_do_parse_xml_subentry(subentry_node, dn, complex_element_lists, &ldap_subentries, error)) { + if (!osync_error_is_set(error)) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_parse_xml_subentry() has failed. Ignoring this xml subentry.\n", __FILE__, __LINE__); + } else { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_do_parse_xml_subentry() has failed: \"%s\". Ignoring this xml subentry.\n", __FILE__, __LINE__, osync_error_print(error)); + osync_error_unref(error); + } + + goto out1; + } + + + if (ldap_subentries == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_subentries = NULL. Ignoring.\n", __FILE__, __LINE__); + goto out1; + } + + + // Add the result from the parsing of the subentry element to + // the GList *potential_subentries + unsigned int max = g_list_length(ldap_subentries); + +#ifdef DEBUG_convert_xmlinternal2ldap + osync_trace(TRACE_ERROR, "\n%s:%i: max = %u\n", __FILE__, __LINE__, max); +#endif + + for (i = 0; i < max; i++) { + ldap_subentry = g_list_nth_data(ldap_subentries, i); + if (!ldap_subentry) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_subentry is NULL. ldap_format_do_parse_xml_subentry() must have failed. Ignoring this xml subentry.\n", __FILE__, __LINE__); + continue; + } + + + if (ldap_subentry->id == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: id = NULL. Skipping this subentry.\n", __FILE__, __LINE__); + continue; + } + + osync_assert(potential_subentries != NULL); + *potential_subentries = g_list_append(*potential_subentries, ldap_subentry); + if (*potential_subentries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_list_append() has produced a NULL pointer.\n", __FILE__, __LINE__); + goto error; + } + } + + g_list_free(ldap_subentries); + ldap_subentries = NULL; + + +out1: + osync_trace(TRACE_EXIT, "%s()", __func__); + return TRUE; + + +error: + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); + + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; +} + + + + + +/** + * @brief This function parses the child nodes for a particular + * XML node and calls the necessary functions to translate them + * into LDAP subentries. + * + * @param dn The distinguished name in terms of LDAP intended for + * the LDAP entry that is to be created by this function. + * @param name The name of the current XML element. + * @param xmlnode The XML node with 0 or more child nodes that will + * become LDAP subentries. + * @param value The value of the current XML element. + * @param complex_element_lists GLists of LDAP entries for several special + * elements. + * @param potential_subentries As a result of this function this glist will + * be filled with LDAP subentries. These LDAP + * LDAP subentries will be derived from the + * XML child nodes. + * @param attr1_name The name of the first XML attribute, if present, at all. + * @param attr1_value The value of the first XML attribute, if present. + * @param attr2_name The name of the second XML attribute, if present, at all. + * @param attr2_value The value of the second XML attribute, if present. + * @param error The libopensync error pointer. + * + * @returns TRUE on succeess, FALSE in case of any error. + */ +osync_bool ldap_format_do_parse_xmlinternal_child_nodes(const char *dn, const xmlChar *name, const xmlNode *xmlnode, xmlChar **value, complex_elements *complex_element_lists, GList **potential_subentries, char **attr1_name, char **attr1_value, char **attr2_name, char **attr2_value, OSyncError **error) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p)", __func__, (void *)dn, (void *)name, (void *)xmlnode, (void *)value, (void *)complex_element_lists, (void *)potential_subentries, (void *)attr1_name, (void *)attr1_value, (void *)attr2_name, (void *)attr2_value, (void *)error); + + + if (dn == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: dn = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: name = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (xmlnode == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlnode = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (xmlnode->xmlChildrenNode == NULL) { + osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: xmlnode->xmlChildrenNode = NULL with dn = \"%s\". Ignoring.\n", __FILE__, __LINE__, __NULLSTR(dn)); + goto out1; + } + + if (complex_element_lists == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: complex_element_lists = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (potential_subentries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: potential_subentries = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (attr1_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: attr1_name = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (attr2_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: attr2_name = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (attr1_value == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: attr1_value = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (attr2_value == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: attr2_value = NULL.\n", __FILE__, __LINE__); + goto error; + } + + + // This is an XML element, that is intended to be located one level lower + // in the DIT: <subentry>...</subentry> + if (!strcmp((char *)name, "subentry")) { + xmlNode *subentry_node = NULL; + + + subentry_node = xmlnode->xmlChildrenNode->next; + if (subentry_node && strcmp((char *)subentry_node->name, "subentry") && strcmp((char *)subentry_node->name, "attribute")) { + +#ifdef DEBUG_convert_xmlinternal2ldap + ldap_plugin_printf("%s:%i: subentry_node->name = \"%s\"", __FILE__, __LINE__, __NULLSTR((char *)subentry_node->name)); +#endif + + if (!ldap_format_parse_xml_subentry(subentry_node, dn, complex_element_lists, potential_subentries, error)) { + goto error; + } + + } else { + subentry_node = xmlnode->xmlChildrenNode; + + while (subentry_node) { +#ifdef DEBUG_convert_xmlinternal2ldap + ldap_plugin_printf("%s:%i: subentry_node->name = \"%s\"", __FILE__, __LINE__, __NULLSTR((char *)subentry_node->name)); +#endif + + if (subentry_node->name == NULL) + break; + + if (strcmp((char *)subentry_node->name, "subentry") && strcmp((char *)subentry_node->name, "attribute")) { + if (!ldap_format_parse_xml_subentry(subentry_node, dn, complex_element_lists, potential_subentries, error)) { + goto error; + } + } + + subentry_node = subentry_node->next; + } + } + } // if (!strcmp((char *)name, "subentry")) + + + + + // Look for any XML attribute elements + if (!strcmp((char *)xmlnode->xmlChildrenNode->name, "attribute")) { + + osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: XML attributes are NOT allowed on the level of the base entry, because there is not a single LDAP attribute that could be abused for this. name = \"%s\"\n", __FILE__, __LINE__, name); + + if (!ldap_format_get_attributes(xmlnode->xmlChildrenNode, attr1_name, attr1_value, attr2_name, attr2_value, error)) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_get_attributes() has failed.\n", __FILE__, __LINE__); + + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_get_attributes() has failed.\n", __FILE__, __LINE__); + } + + goto error; + } // if (!ldap_format_get_attributes(xmlnode->xmlChildrenNode, &attr1_name, &attr1_value, &attr2_name, &attr2_value, error)) + + + xmlNode *m = xmlnode->xmlChildrenNode; + while(m) { + if (m->name == NULL) + break; + + if (strcmp((char *)m->name, "attribute")) { + *value = xmlNodeGetContent(m); + } + + m = m->next; + } + + } // if (!strcmp((char *)xmlnode->xmlChildrenNode->name, "attribute")) + + + +#ifdef DEBUG_convert_xmlinternal2ldap + if (attr1_name && attr1_name[0]) { + if (attr1_value) { + ldap_plugin_printf("%s:%i: Attribute found (1):", __FILE__, __LINE__); + ldap_plugin_printf("\"%s\" - \"%s\"", attr1_name, attr1_value); + + } else { + ldap_plugin_printf("%s:%i: ERROR: attr1_value = NULL", __FILE__, __LINE__); + } + } + + if (attr2_name && attr2_name[0]) { + if (attr2_value) { + ldap_plugin_printf("%s:%i: Attribute found (1):", __FILE__, __LINE__); + ldap_plugin_printf("\"%s\" - \"%s\"", attr2_name, attr2_value); + } else { + ldap_plugin_printf("%s:%i: ERROR: attr2_value = NULL.", __FILE__, __LINE__); + } + } +#endif + + + - osync_trace(TRACE_EXIT, "%s(): *root = %p, (*root)->name = \"%s\"", __func__, (void *) *root, (*root)->name); + +out1: + osync_trace(TRACE_EXIT, "%s()", __func__); return TRUE; -error: - if (buf) { - g_free(buf); - buf = NULL; - } +error: if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -4455,6 +4776,13 @@ + + + + + + + /** * @brief This function parses the XML document and extracts the bare * ldapmods and subentries. They will have to be supplemented by @@ -4514,7 +4842,6 @@ for (; xmlnode; xmlnode = xmlnode->next) { const xmlChar *name = NULL; xmlChar *value = NULL; - unsigned int i = 0; gchar *attr1_name = NULL; gchar *attr1_value = NULL; gchar *attr2_name = NULL; @@ -4523,192 +4850,95 @@ // Skip certain elements - if (xmlnode && xmlnode->name) { - // Omit "<contact>...</contact>" or "<note>...</note>" - if (!strcmp((char *)xmlnode->name, objtype)) { - osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); - continue; - } + if (xmlnode) { + if (xmlnode->name) { + // Omit "<contact>...</contact>" or "<note>...</note>" + if (!strcmp((char *)xmlnode->name, objtype)) { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); + continue; + } - if (!strcmp((char *)xmlnode->name, "text")) { - osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); - continue; - } + // Omit "<text>...</text>" + if (!strcmp((char *)xmlnode->name, "text")) { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); + continue; + } - if (!strcmp((char *)xmlnode->name, "comment")) { - osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); + // Skip comments + if (!strcmp((char *)xmlnode->name, "comment")) { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping \"<%s>\" with objtype \"%s\"", __FILE__, __LINE__, __func__, (char *)xmlnode->name, objtype); + continue; + } + + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: xmlnode->name = NULL. Advancing to the next xmlnode.", __FILE__, __LINE__); continue; } + + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: xmlnode = NULL. Advancing to the next xmlnode.", __FILE__, __LINE__); + continue; } // Extract the name of this XML node name = xmlnode->name; if (name == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: name = NULL. Skipping this xmlnode.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: name = NULL. Skipping this xmlnode.\n", __FILE__, __LINE__); continue; } if (name[0] == 0) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: name[0] = 0. Skipping this xmlnode.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: name[0] = 0. Skipping this xmlnode.\n", __FILE__, __LINE__); continue; } - - - - // This is an XML element, that is intended to be located one level lower - // in the DIT: <subentry>...</subentry> - if (!strcmp((char *)name, "subentry")) { - xmlNode *subentry_node = NULL; - GList *ldap_subentries = NULL; - ldap_entry *ldap_subentry = NULL; - - - if (xmlnode->xmlChildrenNode) { - subentry_node = xmlnode->xmlChildrenNode->next; - } else { - osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: xmlnode->xmlChildrenNode = NULL with dn = \"%s\". Ignoring.\n", __FILE__, __LINE__, dn); - continue; - } - - - if (!subentry_node) { - osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: subentry_node = NULL with dn = \"%s\". Ignoring.\n", __FILE__, __LINE__, dn); - continue; - - } else { - if (!ldap_format_parse_xml_subentry(subentry_node, dn, complex_element_lists, &ldap_subentries, error)) { - if (!osync_error_is_set(error)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_parse_xml_subentry() has failed. Ignoring this xml subentry.\n", __FILE__, __LINE__); - } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_format_parse_xml_subentry() has failed: \"%s\". Ignoring this xml subentry.\n", __FILE__, __LINE__, osync_error_print(error)); - osync_error_unref(error); - } - - continue; - } - - - if (ldap_subentries == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_subentries = NULL. Ignoring.\n", __FILE__, __LINE__); - continue; - } - - - // Add the result from the parsing of the subentry element to - // the GList *potential_subentries - unsigned int max = g_list_length(ldap_subentries); - for (i = 0; i < max; i++) { - ldap_subentry = g_list_nth_data(ldap_subentries, i); - if (!ldap_subentry) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_subentry is NULL. ldap_format_parse_xml_subentry() must have failed. Ignoring this xml subentry.\n", __FILE__, __LINE__); - continue; - } - - - if (ldap_subentry->id == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: id = NULL. Skipping this subentry.\n", __FILE__, __LINE__); - continue; - } - - - *potential_subentries = g_list_append(*potential_subentries, ldap_subentry); - if (*potential_subentries == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_list_append() has produced a NULL pointer.\n", __FILE__, __LINE__); - goto error; - } - } - - g_list_free(ldap_subentries); - ldap_subentries = NULL; - } - - - continue; // advance to the next xmlnode. - } // if (!strcmp((char *)name, "subentry")) - - - - - // Look for any XML attribute elements - if (xmlnode->xmlChildrenNode) { - - - if (!strcmp((char *)xmlnode->xmlChildre... [truncated message content] |
From: <svn...@op...> - 2010-02-06 17:40:11
|
Author: scriptor Date: Sat Feb 6 18:40:02 2010 New Revision: 6031 URL: http://www.opensync.org/changeset/6031 Log: Photos are probably being handled incorrectly. And so is base64 encoding, I suppose. Not fully sure, though. References and continuations in terms of LDAP are not implemented, at all. Modified: plugins/ldap-sync/BUGS Modified: plugins/ldap-sync/BUGS ============================================================================== --- plugins/ldap-sync/BUGS Sat Feb 6 18:37:11 2010 (r6030) +++ plugins/ldap-sync/BUGS Sat Feb 6 18:40:02 2010 (r6031) @@ -20,6 +20,20 @@ and the calendar on another LDAP server. +III. Photos: + +Photos are treated as every other kind of LDAP attribute: Without any +special measures. For example, paths are not being resolved. +This is probably wrong. + + +IV. Base64 encoding: + +The plugin does not make any difference between ordinary strings and base64 +encoded strings. Both categories are treated as the same kind of +ordinary strings. + + B. Design: |
From: <svn...@op...> - 2010-01-31 20:46:58
|
Author: scriptor Date: Sun Jan 31 21:46:48 2010 New Revision: 6028 URL: http://www.opensync.org/changeset/6028 Log: Added missing library. Modified: plugins/ldap-sync/misc/CMakeLists.txt Modified: plugins/ldap-sync/misc/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/misc/CMakeLists.txt Sun Jan 31 18:06:57 2010 (r6027) +++ plugins/ldap-sync/misc/CMakeLists.txt Sun Jan 31 21:46:48 2010 (r6028) @@ -28,7 +28,7 @@ ADD_EXECUTABLE(ldap_format_convert ldap_format_convert.c) -TARGET_LINK_LIBRARIES( ldap_format_convert ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ) +TARGET_LINK_LIBRARIES( ldap_format_convert ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARIES} ) INSTALL( TARGETS ldap_format_convert DESTINATION ${BIN_INSTALL_DIR} ) |
From: <svn...@op...> - 2010-01-31 17:07:07
|
Author: dgollub Date: Sun Jan 31 18:06:57 2010 New Revision: 6027 URL: http://www.opensync.org/changeset/6027 Log: Don't call _osync_obj_engine_clone_and_demerge_change() in _osync_obj_engine_mapping_find() if the merge is disabled by the group configuration. Otherwise this would cause: "Couldn't handle the capabilities in format" Patch by Nicolas, fixes #1206 Modified: trunk/opensync/engine/opensync_obj_engine.c Modified: trunk/opensync/engine/opensync_obj_engine.c ============================================================================== --- trunk/opensync/engine/opensync_obj_engine.c Mon Jan 25 21:01:11 2010 (r6026) +++ trunk/opensync/engine/opensync_obj_engine.c Sun Jan 31 18:06:57 2010 (r6027) @@ -281,6 +281,11 @@ for (m=mapping_engines; m && (result != OSYNC_CONV_DATA_SAME); m=m->next) { OSyncMappingEngine *tmp_mapping_engine = m->data; + OSyncObjEngine *engine = tmp_mapping_engine->parent; + OSyncGroup *group = osync_engine_get_group(engine->parent); + + osync_bool merger_enabled = osync_group_get_merger_enabled(group); + /* Go through the already existing mapping entries. We only consider mappings * which dont have a entry on our side and where the data comparsion does not * return MISMATCH */ @@ -300,9 +305,13 @@ OSyncMember *member1 = osync_client_proxy_get_member(sinkengine->proxy); OSyncMember *member2 = osync_client_proxy_get_member(entry_engine->sink_engine->proxy); + OSyncCapabilities *caps1 = NULL; + OSyncCapabilities *caps2 = NULL; - OSyncCapabilities *caps1 = osync_member_get_capabilities(member1); - OSyncCapabilities *caps2 = osync_member_get_capabilities(member2); + if (merger_enabled) { + caps1 = osync_member_get_capabilities(member1); + caps2 = osync_member_get_capabilities(member2); + } OSyncChange *clone_change1 = NULL, *clone_change2 = NULL; OSyncChange *change1 = change; |
From: <svn...@op...> - 2010-01-25 20:01:21
|
Author: scriptor Date: Mon Jan 25 21:01:11 2010 New Revision: 6026 URL: http://www.opensync.org/changeset/6026 Log: I have cleaned up my test suite. Regular runs and runs under valgrind are now more strictly separated. All tests that have anything to do with libopensync - be it via osynplugin, osynctool, check_detector1 or check_do_convert_from_to - can now be run under valgrind. For runs under valgrind no separate check-scripts are necessary any more. Modified: plugins/ldap-sync/CMakeLists.txt plugins/ldap-sync/tests/check_fastsync plugins/ldap-sync/tests/check_init Modified: plugins/ldap-sync/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/CMakeLists.txt Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/CMakeLists.txt Mon Jan 25 21:01:11 2010 (r6026) @@ -322,6 +322,21 @@ ENDIF ( CHECK_FOUND ) +# Setting a custom timeout for ctest is a hassle. +# The only variable that seems to be considered by cmake/ctest is +# DART_TESTING_TIMEOUT. And this works ONLY, if one adds "FORCE". +# +# DART_TESTING_TIMEOUT must be set in CTestConfig.cmake rather than here. +# At least, it seems so... +OPTION ( RUN_LONG_TESTS "Should the tests be run under valgrind?" OFF ) +OPTION ( WITH_VALGRIND "Should the tests be run under valgrind? " OFF ) + +IF (RUN_LONG_TESTS OR WITH_VALGRIND) + SET ( ENV{WITH_VALGRIND} ON ) + SET ( ENV{WITH_VALGRIND} ON PARENT_SCOPE ) +ENDIF(RUN_LONG_TESTS OR WITH_VALGRIND) + + # Workaround for wrong setting of CMAKE_BUILD_TYPE: First of two steps: IF (CMAKE_BUILD_TYPE) SET(CORRECT_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "The CMAKE_BUILD_TYPE definition in /usr/local/share/libopensync1/cmake/modules/OpenSyncInternal.cmake overrides even the command line settings here. This variable aims to fix this." FORCE ) @@ -426,7 +441,6 @@ IF (SHOWSTATUS_MODULE) SHOW_STATUS( ENABLE_UNITTESTS "Build the test suite:\t\t" ) - SHOW_STATUS( RUN_LONG_TESTS "Run rather time consuming tests, as well:" ) SHOW_STATUS( RUN_AUTH_TESTS "Run the authentication specific tests, too:" ) ENDIF (SHOWSTATUS_MODULE) Modified: plugins/ldap-sync/tests/check_fastsync ============================================================================== --- plugins/ldap-sync/tests/check_fastsync Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/tests/check_fastsync Mon Jan 25 21:01:11 2010 (r6026) @@ -1,11 +1,13 @@ #!/bin/bash -# Call as check_fastsync /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir +# Usage: ./check_fastsync /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir # # E.g.: +# # ./check_fastsync testname /home/user1/dev/plugins/ldap-sync/build_debug /home/user1/dev/plugins/ldap-sync +# -set -x +# set -x FILE=$0 test_name="$1" @@ -15,19 +17,6 @@ rv=0 -OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) -if test ! -f "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could not be found. Exiting." - exit 1 -fi - -if test ! -x "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin 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." @@ -39,9 +28,18 @@ exit 1 fi +if test ! -r "$SOURCE_DIR/check_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/check_common.inc\" could not be read. Exiting." + exit 1 +fi + + source "$SOURCE_DIR/test.conf" source "$SOURCE_DIR/check_common.inc" +setup_osyncplugin +setup_valgrind + enable_tracing "$test_name" eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME @@ -59,15 +57,15 @@ exit 1 fi - - - - -echo "${PLUGINPATH} ${CFG}" - TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 -$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize +if test "$WITH_VALGRIND" = "yes" -o "$WITH_VALGRIND" = "YES" -o "$WITH_VALGRIND" = "on" -o "$WITH_VALGRIND" = "ON"; then + cmd="$VALGRIND $OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize" +else + cmd="$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize" +fi + +eval $cmd rv=$? if test -d "$TMPDIR"; then @@ -76,6 +74,7 @@ if test $rv -ne 0; then echo "$FILE:$LINENO: ERROR: osyncplugin has failed. Exiting." + echo -e "Command was:\n$cmd\n" exit 1 fi Modified: plugins/ldap-sync/tests/check_init ============================================================================== --- plugins/ldap-sync/tests/check_init Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/tests/check_init Mon Jan 25 21:01:11 2010 (r6026) @@ -1,11 +1,13 @@ #!/bin/bash -# Call as check_init /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir +# Usage: ./check_init /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir # # E.g.: +# # ./check_init testname /home/user1/dev/plugins/ldap-sync/build_debug /home/user1/dev/plugins/ldap-sync +# -set -x +# set -x FILE=$0 test_name="$1" @@ -15,18 +17,6 @@ rv=0 -OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) -if test ! -f "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could not be found. Exiting." - exit 1 -fi - -if test ! -x "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin 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." @@ -38,17 +28,24 @@ exit 1 fi +if test ! -r "$SOURCE_DIR/check_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/check_common.inc\" could not be read. Exiting." + exit 1 +fi + + source "$SOURCE_DIR/test.conf" source "$SOURCE_DIR/check_common.inc" -eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME - +setup_osyncplugin +setup_valgrind -enable_tracing "$test_name" +eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME +enable_tracing "$test_name" echo "PLUGINPATH = \"$PLUGINPATH\"" @@ -66,11 +63,16 @@ fi -echo "${PLUGINPATH} ${CFG}" - TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 -$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize + +if test "$WITH_VALGRIND" = "yes" -o "$WITH_VALGRIND" = "YES" -o "$WITH_VALGRIND" = "on" -o "$WITH_VALGRIND" = "ON"; then + cmd="$VALGRIND $OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize" +else + cmd="$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize" +fi + +eval $cmd rv=$? @@ -81,6 +83,7 @@ if test $rv -ne 0; then echo "$FILE:$LINENO: ERROR: osyncplugin has failed. Exiting." + echo -e "Command was:\n${cmd}\n" exit 1 fi |
From: <svn...@op...> - 2010-01-25 19:59:22
|
Author: scriptor Date: Mon Jan 25 20:59:09 2010 New Revision: 6025 URL: http://www.opensync.org/changeset/6025 Log: I have cleaned up my test suite. Regular runs and runs under valgrind are now more strictly separated. All tests that have anything to do with libopensync - be it via osynplugin, osynctool, check_detector1 or check_do_convert_from_to - can now be run under valgrind. For runs under valgrind no separate check-scripts are necessary any more. Added: plugins/ldap-sync/tests/check_detector_wrapper (contents, props changed) plugins/ldap-sync/tests/set_environment_variable.cmake plugins/ldap-sync/tests/valgrind.cmake.in Deleted: plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_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_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Modified: plugins/ldap-sync/INSTALL plugins/ldap-sync/tests/CMakeLists.txt plugins/ldap-sync/tests/check_add_modify_delete_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_common.inc plugins/ldap-sync/tests/check_connect plugins/ldap-sync/tests/check_convert_from_to plugins/ldap-sync/tests/check_convert_from_to_many plugins/ldap-sync/tests/check_convert_to_xmlformat plugins/ldap-sync/tests/check_ldap_add_entry plugins/ldap-sync/tests/check_ldap_base_entries_objtype plugins/ldap-sync/tests/check_ldap_delete_entry plugins/ldap-sync/tests/check_ldap_modify_entry plugins/ldap-sync/tests/check_ldap_read_entryCSN plugins/ldap-sync/tests/check_modify_and_fastsync plugins/ldap-sync/tests/check_mozldap_auth plugins/ldap-sync/tests/check_openldap_auth plugins/ldap-sync/tests/check_osyncplugin1 plugins/ldap-sync/tests/check_osynctool1 plugins/ldap-sync/tests/check_osynctool2 plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_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_file1 plugins/ldap-sync/tests/check_plugin_auth plugins/ldap-sync/tests/check_slowsync plugins/ldap-sync/tests/check_stylesheet1 plugins/ldap-sync/tests/check_stylesheet2 plugins/ldap-sync/tests/check_stylesheet3 plugins/ldap-sync/tests/check_stylesheet4 plugins/ldap-sync/tests/check_stylesheet5 plugins/ldap-sync/tests/check_sync plugins/ldap-sync/tests/clean_up plugins/ldap-sync/tests/opensync.suppr plugins/ldap-sync/tests/remove_trace_dirs plugins/ldap-sync/tests/test.conf Modified: plugins/ldap-sync/INSTALL ============================================================================== --- plugins/ldap-sync/INSTALL Mon Jan 25 20:57:02 2010 (r6024) +++ plugins/ldap-sync/INSTALL Mon Jan 25 20:59:09 2010 (r6025) @@ -32,7 +32,7 @@ cd libopensync-plugin-ldap-0.40 mkdir build_debug cd build_debug -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON .. +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=OFF .. make -s make -w install ldconfig @@ -94,24 +94,29 @@ mkdir build_debug cd build_debug -# Without authentification specific tests and without longer valgrind tests: -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DRUN_AUTH_TESTS=off -DRUN_LONG_TESTS=off .. +# Without the authentification specific tests and without valgrind: +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=OFF -DRUN_AUTH_TESTS=off -DWITH_VALGRIND=off .. # or: -# Without authentification specific tests, but with time-consuming valgrind testts: -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DRUN_AUTH_TESTS=off -DRUN_LONG_TESTS=on .. +# Without the authentification specific tests, but with most of the tests +# running under valgrind. Tests without any relation to libopensync and +# the LDAP plugin never run under valgrind, because I do not want to +# debug bash or xmllint or the LDAP utilities (This, however, is not true +# for targets like "make ExperimentalMemCheck"): +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=OFF -DRUN_AUTH_TESTS=off -DWITH_VALGRIND=on .. # or: -# With authentification specific tests and with time-consuming valgrind tests: -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DRUN_AUTH_TESTS=on -DRUN_LONG_TESTS=on .. +# With the authentification specific tests and with most of the tests +# running under valgrind: +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=OFF -DRUN_AUTH_TESTS=on -DWITH_VALGRIND=on .. # or: # When preparing for code coverage (gcov or lcov), and without authentication -# specific tests and without longer valgrind tests: -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Profiling -DCMAKE_VERBOSE_MAKEFILE=ON -DRUN_LONG_TESTS=off -DRUN_AUTH_TESTS=off .. +# specific tests and without valgrind: +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Profiling -DCMAKE_VERBOSE_MAKEFILE=OFF -DWITH_VALGRIND=off -DRUN_AUTH_TESTS=off .. make @@ -119,23 +124,15 @@ make test +The test suite running under valgrind takes quite some time. So valgrind +is only envoked with "-DWITH_VALGRIND=on". -Tests with valgrind take quite some time: They are run only when cmake -is run with "-DRUN_LONG_TESTS=on". - -Authentication specific tests are disabled by default, because the -require appropriate configuration of the LDAP servers. They can -be enabled by "-DRUN_AUTH_TESTS=on". - - -reset; time make test -(...) -100% tests passed, 0 tests failed out of 162 - -real 277m22.568s -user 217m33.966s -sys 24m59.372s +The authentication specific tests are disabled by default, because they +require appropriate configuration of two LDAP servers: +- slapd from openldap and +- ns-slapd from 389-ds (= fedora-ds). +They can be enabled by "-DRUN_AUTH_TESTS=on". @@ -179,7 +176,7 @@ Example: -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Profiling -DCMAKE_VERBOSE_MAKEFILE=ON -DRUN_AUTH_TESTS=on -DRUN_LONG_TESTS=off .. +PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DUPDATE_TYPE=svn -DCMAKE_BUILD_TYPE=Profiling -DCMAKE_VERBOSE_MAKEFILE=OFF -DRUN_AUTH_TESTS=on -DWITH_VALGRIND=off .. Compile and install it and run as many tests as possible: @@ -209,6 +206,9 @@ FindLibMozLdap.cmake FindLibSASL2.cmake FindLibGSSAPIV2.cmake +FindLibXml2.cmake +FindLibXslt.cmake + See cmake/modules. Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Mon Jan 25 20:57:02 2010 (r6024) +++ plugins/ldap-sync/tests/CMakeLists.txt Mon Jan 25 20:59:09 2010 (r6025) @@ -4,15 +4,24 @@ # So I have simply commented out those tests, where some data is missing # or where the errors are known to me. -OPTION ( RUN_LONG_TESTS "Should the tests with osynctool running under valgrind be run? They take quite some time." off) OPTION ( RUN_AUTH_TESTS "Should the tests about authentication towards the LDAP server be run?" off ) + SET ( TESTDIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Path where the test scripts are located.") SET ( XSLDIR "${CMAKE_SOURCE_DIR}/src/xslt" CACHE STRING "Path where the stylesheeets are located.") SET ( XMLDIR "${CMAKE_SOURCE_DIR}/tests" CACHE STRING "Path where any *.xml files are located.") SET ( SCHEMADIR "${LDAP_PLUGIN_OPENSYNC_SCHEMASDIR}" CACHE STRING "Path where any *.xml files are located.") +IF (RUN_LONG_TESTS OR WITH_VALGRIND) + # The following two set commands do not seem to provoke anything: + SET ( ENV{WITH_VALGRIND} ON ) + SET ( ENV{WITH_VALGRIND} ON PARENT_SCOPE ) + # But this one does: + SET_DIRECTORY_PROPERTIES( PROPERTIES TEST_INCLUDE_FILE ${CMAKE_SOURCE_DIR}/tests/set_environment_variable.cmake ) +ENDIF(RUN_LONG_TESTS OR WITH_VALGRIND) + + MESSAGE(STATUS "checking for xmllint...") FIND_PROGRAM( XMLLINT_EXECUTABLE xmllint ) IF (XMLLINT_EXECUTABLE) @@ -71,6 +80,25 @@ FIND_PROGRAM( VALGRIND_EXECUTABLE valgrind ) IF (VALGRIND_EXECUTABLE) MESSAGE( STATUS " Found ${VALGRIND_EXECUTABLE}") + + CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/valgrind.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/valgrind.cmake" + IMMEDIATE @ONLY) + + ADD_CUSTOM_TARGET( valgrind + COMMENT "make valgrind: The tests run under valgrind." + COMMAND $(CMAKE_COMMAND) -E echo "CTEST_TEST_TIMEOUT = ${CTEST_TEST_TIMEOUT}" + COMMAND $(CMAKE_COMMAND) -E echo "CTEST_TESTING_TIMEOUT = ${CTEST_TESTING_TIMEOUT}" + COMMAND $(CMAKE_COMMAND) -E echo "CMAKE_LONG_TEST_TIMEOUT = ${CMAKE_LONG_TEST_TIMEOUT}" + COMMAND $(CMAKE_COMMAND) -E echo "DART_TESTING_TIMEOUT = ${DART_TESTING_TIMEOUT}" + COMMAND $(CMAKE_COMMAND) -E echo "CTEST_TIME_LIMIT = ${CTEST_TIME_LIMIT}" + # COMMAND $(CMAKE_COMMAND) -E environment + COMMAND $(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..." + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND $(CMAKE_COMMAND) -P "${CMAKE_CURRENT_BINARY_DIR}/valgrind.cmake" ) + + ELSE (VALGRIND_EXECUTABLE) MESSAGE( STATUS " Could NOT find valgrind. Corresponding tests will be ignored.") ENDIF (VALGRIND_EXECUTABLE) @@ -82,10 +110,11 @@ MESSAGE(STATUS "XMLDIR = ${XMLDIR}") MESSAGE(STATUS "SCHEMADIR = ${SCHEMADIR}") MESSAGE(STATUS "CTEST_TEST_TIMEOUT = ${CTEST_TEST_TIMEOUT}") +MESSAGE(STATUS "CTEST_TESTING_TIMEOUT = ${CTEST_TESTING_TIMEOUT}") MESSAGE(STATUS "CMAKE_LONG_TEST_TIMEOUT = ${CMAKE_LONG_TEST_TIMEOUT}") MESSAGE(STATUS "DART_TESTING_TIMEOUT = ${DART_TESTING_TIMEOUT}") MESSAGE(STATUS "CTEST_TIME_LIMIT = ${CTEST_TIME_LIMIT}") - +MESSAGE(STATUS "WITH_VALGRIND = $ENV{WITH_VALGRIND}") #################################################### @@ -257,44 +286,52 @@ ADD_TEST( plugin1 ${TESTDIR}/check_osyncplugin1 "plugin1" ) ADD_TEST( plugin2 ${TESTDIR}/check_osynctool1 "plugin2" ) ADD_TEST( plugin3 ${TESTDIR}/check_osynctool2 "plugin3" ) -ADD_TEST( plugin4 ${TESTDIR}/check_osynctool_file1 "plugin4" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) +ADD_TEST( plugin4 ${TESTDIR}/check_osynctool_file1 "plugin4" ${CMAKE_BINARY_DIR} ) ############################################### # Check the detector functions: - LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ) INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ) ADD_EXECUTABLE( check_detector1 check_detector1.c ) TARGET_LINK_LIBRARIES( check_detector1 ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ) -ADD_TEST( detect1 check_detector1 ${TESTDIR}/contact1.xml ) +ADD_TEST( detect1 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect1" ${TESTDIR}/contact1.xml ) -ADD_TEST( detect2 check_detector1 ${TESTDIR}/contact2.xml ) +ADD_TEST( detect2 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect2" ${TESTDIR}/contact1.ldif ) -ADD_TEST( detect3 check_detector1 ${TESTDIR}/event1.xml ) +ADD_TEST( detect3 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect3" ${TESTDIR}/contact2.xml ) -ADD_TEST( detect4 check_detector1 ${TESTDIR}/todo1.xml ) +ADD_TEST( detect4 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect4" ${TESTDIR}/contact2.ldif ) -ADD_TEST( detect5 check_detector1 ${TESTDIR}/note1.xml ) +ADD_TEST( detect5 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect5" ${TESTDIR}/event1.xml ) -ADD_TEST( detect6 check_detector1 ${TESTDIR}/note2.xml ) +ADD_TEST( detect6 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect6" ${TESTDIR}/todo1.xml ) -# This would be a "correct negative", if I may say so: -# We expect the script to fail. And this failing would be OK. -#ADD_TEST( false_result check_detector1 ${TESTDIR}/check_detector1.c ) +ADD_TEST( detect7 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect7" ${TESTDIR}/note1.xml ) +ADD_TEST( detect8 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "detect8" ${TESTDIR}/note2.xml ) +# The following three tests are expected to fail. The LDAP formats for the object types +# "event", "todo" and "note" are way too general to be qualified as one particular object type. +# This is a design bug that needs to be fixed, eventually. +ADD_TEST( erroneous_detect1 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "erroneous_detect1" ${TESTDIR}/event1.ldif ) + +ADD_TEST( erroneous_detect2 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "erroneous_detect1" ${TESTDIR}/todo1.ldif ) + +ADD_TEST( erroneous_detect3 ${TESTDIR}/check_detector_wrapper ${CMAKE_BINARY_DIR}/tests/check_detector1 "erroneous_detect1" ${TESTDIR}/note1.ldif ) + +SET_TESTS_PROPERTIES( erroneous_detect1 erroneous_detect2 erroneous_detect3 + PROPERTIES PASS_REGULAR_EXPRESSION "ERROR: sourceformat = NULL. Source format could NOT be recognized." ) ######################################################### # Check the converter functions: - LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ) -INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ) +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIR}) ADD_EXECUTABLE( check_do_convert_from_to check_do_convert_from_to.c ) TARGET_LINK_LIBRARIES( check_do_convert_from_to ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ) @@ -305,7 +342,7 @@ ADD_TEST( convert_vevents1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vevents/*.?c?" "--to-ldap-event" ) -# ADD_TEST( convert_vtodos1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vtodos/*.vc?" "--to-ldap-todo" ) +ADD_TEST( convert_vtodos1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vtodos/*.vc?" "--to-ldap-todo" ) ADD_TEST( convert_vnotes1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vnotes/*.vnt" "--to-ldap-note" ) @@ -343,19 +380,19 @@ -ADD_TEST( conv_val_ldap_evo_person1_xml ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_evolutionperson*.xml" "contact" ${SCHEMADIR}/xmlformat-contact.xsd) +ADD_TEST( conv_val_ldap_evo_person1_xml ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_evolutionperson*.xml" "contact" ${SCHEMADIR}/xmlformat-contact.xsd ) -ADD_TEST( conv_val_ldap_evo_person1_ldif ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact1.ldif" "contact" ${SCHEMADIR}/xmlformat-contact.xsd) +ADD_TEST( conv_val_ldap_evo_person1_ldif ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact1.ldif" "contact" ${SCHEMADIR}/xmlformat-contact.xsd ) -ADD_TEST( conv_val_ldap_inetorgpers1_xml ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_inetorgperson*.xml" "contact" ${SCHEMADIR}/xmlformat-contact.xsd) +ADD_TEST( conv_val_ldap_inetorgpers1_xml ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_inetorgperson*.xml" "contact" ${SCHEMADIR}/xmlformat-contact.xsd ) -ADD_TEST( conv_val_ldap_inetorgpers1_ldif ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact2.ldif" "contact" ${SCHEMADIR}/xmlformat-contact.xsd) +ADD_TEST( conv_val_ldap_inetorgpers1_ldif ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact2.ldif" "contact" ${SCHEMADIR}/xmlformat-contact.xsd ) -ADD_TEST( conv_val_ldap_event1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_event*.xml" "event" ${SCHEMADIR}/xmlformat-event.xsd) +ADD_TEST( conv_val_ldap_event1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_event*.xml" "event" ${SCHEMADIR}/xmlformat-event.xsd ) -ADD_TEST( conv_val_ldap_todo1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_todo*.xml" "todo" ${SCHEMADIR}/xmlformat-todo.xsd) +ADD_TEST( conv_val_ldap_todo1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_todo*.xml" "todo" ${SCHEMADIR}/xmlformat-todo.xsd ) -ADD_TEST( conv_val_ldap_note1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_note*.xml" "note" ${SCHEMADIR}/xmlformat-note.xsd) +ADD_TEST( conv_val_ldap_note1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_note*.xml" "note" ${SCHEMADIR}/xmlformat-note.xsd ) @@ -455,9 +492,13 @@ # present, the script removes them. # Otherwise the first test trying to add an already exising DN will fail # just because of "Already exists (68)" error. -ADD_TEST( clean_up1 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) +ADD_TEST( clean_up1 ${TESTDIR}/clean_up ) + +# Some basic tests of the LDAP server. Especially the authentication +# could be a problem. If not even these tests success, the LDAP plugin +# will certainly not work, either. IF (LDAPADD_EXECUTABLE) ADD_TEST( ldap_add_contact1 ${TESTDIR}/check_ldap_add_entry ${TESTDIR}/contact1.ldif ) ENDIF (LDAPADD_EXECUTABLE) @@ -537,8 +578,11 @@ # Interact with the LDAP server using osyncplugin... # Requires the LDAP server being configured in a way, that the # default settings in ldap-sync lead to 1. authentication, 2. write access. -# -ADD_TEST( clean_up2 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + + +############################################################ +# Here is being tested only the very basic functionality of the LDAP plugin: +ADD_TEST( clean_up2 ${TESTDIR}/clean_up ) ADD_TEST( check_init ${TESTDIR}/check_init "check_init" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) @@ -552,6 +596,13 @@ ADD_TEST( check_fastsync ${TESTDIR}/check_fastsync "check_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + + +############################################# +# Authentication specific tests. +# Require two fully configured and running LDAP servers: +# - slapd from openldap and +# - ns-slapd from 389-ds (= fedora-ds) IF (RUN_AUTH_TESTS) ADD_TEST( plugin_auth_simple_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} ) @@ -599,83 +650,62 @@ - +########################################################### +# Now, write *.ldif files to the directory of the LDAP server using ldapadd. +# Then try and synchronize between the LDAP server and the file-sync plugin using osyncplugin. +# After that modify the LDAP entries using ldapmodify and synchronize using osyncplugin. +# Finally, delete the LDAP entries using ldapdelete and synchronize using osyncplugin. +# These tests basically check read-access of the LDAP plugin to the LDAP server. +# BTW: a_m_d is short for "add_modify_delete". IF (LDAPADD_EXECUTABLE) IF (LDAPMODIFY_EXECUTABLE) IF (LDAPDELETE_EXECUTABLE) - ADD_TEST( clean_up3 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( clean_up3 ${TESTDIR}/clean_up ) - ADD_TEST( a_m_d_contact1_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact1_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--fastsync") + ADD_TEST( a_m_d_contact1_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact1_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--fastsync") - ADD_TEST( a_m_d_contact2_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact2_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--fastsync") + ADD_TEST( a_m_d_contact2_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact2_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--fastsync") - ADD_TEST( a_m_d_event_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_event_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--fastsync") + ADD_TEST( a_m_d_event_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_event_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--fastsync") - ADD_TEST( a_m_d_todo_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_todo_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--fastsync" ) + ADD_TEST( a_m_d_todo_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_todo_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--fastsync" ) - ADD_TEST( a_m_d_note_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_note_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--fastsync") + ADD_TEST( a_m_d_note_and_fastsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_note_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--fastsync") - ADD_TEST( a_m_d_contact1_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact1_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--sync") + ADD_TEST( a_m_d_contact1_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact1_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--sync") - ADD_TEST( a_m_d_contact2_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact2_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--sync") + ADD_TEST( a_m_d_contact2_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact2_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--sync") - ADD_TEST( a_m_d_event_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_event_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--sync") + ADD_TEST( a_m_d_event_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_event_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--sync") - ADD_TEST( a_m_d_todo_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_todo_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--sync" ) + ADD_TEST( a_m_d_todo_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_todo_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--sync" ) - ADD_TEST( a_m_d_note_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_note_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--sync") + ADD_TEST( a_m_d_note_and_sync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_note_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--sync") - ADD_TEST( a_m_d_contact1_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact1_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--slowsync") + ADD_TEST( a_m_d_contact1_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact1_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--slowsync") - ADD_TEST( a_m_d_contact2_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_contact2_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--slowsync") + ADD_TEST( a_m_d_contact2_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_contact2_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--slowsync") - ADD_TEST( a_m_d_event_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_event_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--slowsync") + ADD_TEST( a_m_d_event_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_event_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--slowsync") - ADD_TEST( a_m_d_todo_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_todo_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--slowsync" ) + ADD_TEST( a_m_d_todo_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_todo_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--slowsync" ) - ADD_TEST( a_m_d_note_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "add_mod_del_note_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--slowsync") + ADD_TEST( a_m_d_note_and_slowsync ${TESTDIR}/check_add_modify_delete_and_sync "a_m_d_note_and_slowsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--slowsync") - - ADD_TEST( a_m_d_all_four_objtypes_and_fastsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "add_mod_del_all_four_objtypes_and_fastsync" ${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 "--fastsync") - ADD_TEST( a_m_d_all_four_objtypes_and_sync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "add_mod_del_all_four_objtypes_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 "--sync") + ADD_TEST( clean_up4 ${TESTDIR}/clean_up ) - ADD_TEST( a_m_d_all_four_objtypes_and_slowsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "add_mod_del_all_four_objtypes_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 "--slowsync") - - ENDIF (LDAPDELETE_EXECUTABLE) - ENDIF (LDAPMODIFY_EXECUTABLE) -ENDIF (LDAPADD_EXECUTABLE) - - - -############################ -# Now osyncplugin under valgrind... -IF (LDAPADD_EXECUTABLE) - IF (LDAPMODIFY_EXECUTABLE) - IF (LDAPDELETE_EXECUTABLE) - IF (VALGRIND_EXECUTABLE) - - ADD_TEST( clean_up4 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - - - ADD_TEST( vg_a_m_d_contact1_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact1_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - - ADD_TEST( vg_a_m_d_contact2_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact2_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - - ADD_TEST( vg_a_m_d_event_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_event_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - - ADD_TEST( vg_a_m_d_todo_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_todo_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - - ADD_TEST( vg_a_m_d_note_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_note_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( a_m_d_all_four_objtypes_and_fastsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "a_m_d_all_four_objtypes_and_fastsync" ${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 "--fastsync") - ADD_TEST( vg_a_m_d_all_four_objtypes_and_fastsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_add_mod_del_all_four_objtypes_and_fastsync" ${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 "--fastsync") + ADD_TEST( a_m_d_all_four_objtypes_and_sync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "a_m_d_all_four_objtypes_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 "--sync") + + ADD_TEST( a_m_d_all_four_objtypes_and_slowsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_sync "a_m_d_all_four_objtypes_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 "--slowsync") - ENDIF (VALGRIND_EXECUTABLE) ENDIF (LDAPDELETE_EXECUTABLE) ENDIF (LDAPMODIFY_EXECUTABLE) ENDIF (LDAPADD_EXECUTABLE) @@ -689,182 +719,201 @@ IF (LDAPMODIFY_EXECUTABLE) IF (LDAPDELETE_EXECUTABLE) - ADD_TEST( clean_up5 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ################################### + # These tests add an *.ldif file to the directory of the LDAP server and try and + # synchronize with the file plugin using osynctool. + # This kind of tests basically checks read-access to the LDAP server (get the changes and tell libopensync about them.) + ADD_TEST( clean_up5 ${TESTDIR}/clean_up ) + + ADD_TEST( otool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "otool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) - ADD_TEST( otool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "osynctool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) + ADD_TEST( otool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "otool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) - #ADD_TEST( otool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "osynctool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) + ADD_TEST( otool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "otool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) - ADD_TEST( otool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "osynctool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) + ADD_TEST( otool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "otool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) - ADD_TEST( otool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) + ADD_TEST( otool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "otool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) - ADD_TEST( otool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_slowsync "osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) - ADD_TEST( clean_up6 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ################################### + # Whereas all the following tests add XML files or VCARDs or VEVENTS etc. to the file plugin, and after that they + # try and synchronize with the LDAP server using osynctool. So these tests check the write-access to the LDAP server, + # i.e. commit changes having received from libopensync to the directory of the LDAP server. + # Here all kinds of issues can occur: Authentication failures, format failures, conversion failures, syntax errors + # in terms of the rules of the related LDAP schemata. + ADD_TEST( clean_up6 ${TESTDIR}/clean_up ) - ADD_TEST( otool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) + ADD_TEST( otool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) - ADD_TEST( otool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) + ADD_TEST( otool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) - ADD_TEST( otool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) + ADD_TEST( otool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) - ADD_TEST( otool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) + ADD_TEST( otool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) - ADD_TEST( otool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) + ADD_TEST( otool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) - ADD_TEST( otool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) + ADD_TEST( otool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) - ADD_TEST( otool_add_evo2-full1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-full1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full1.vcf") + ADD_TEST( otool_add_evo2-full1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-full1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full1.vcf") - ADD_TEST( otool_add_evo2-full2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-full2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full2.vcf") + ADD_TEST( otool_add_evo2-full2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-full2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full2.vcf") - ADD_TEST( otool_add_evo2-multiline_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-multiline_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-multiline.vcf") + ADD_TEST( otool_add_evo2-multiline_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-multiline_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-multiline.vcf") - ADD_TEST( otool_add_evo2-photo_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-photo_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-photo.vcf") + ADD_TEST( otool_add_evo2-photo_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-photo_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-photo.vcf") - ADD_TEST( otool_add_evo2-special_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-special_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-special.vcf") + ADD_TEST( otool_add_evo2-special_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-special_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-special.vcf") - ADD_TEST( otool_add_evo2-umlaute.vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evo2-umlaute_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-umlaute.vcf") + ADD_TEST( otool_add_evo2-umlaute.vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evo2-umlaute_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-umlaute.vcf") - ADD_TEST( otool_add_kdepim-full1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-full1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full1-2.1.vcf") + ADD_TEST( otool_add_kdepim-full1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-full1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full1-2.1.vcf") - ADD_TEST( otool_add_kdepim-full1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-full1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full1-3.0.vcf") + ADD_TEST( otool_add_kdepim-full1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-full1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full1-3.0.vcf") - ADD_TEST( otool_add_kdepim-full2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-full2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full2-2.1.vcf") + ADD_TEST( otool_add_kdepim-full2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-full2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full2-2.1.vcf") - ADD_TEST( otool_add_kdepim-full2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-full2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full2-3.0.vcf") + ADD_TEST( otool_add_kdepim-full2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-full2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-full2-3.0.vcf") - ADD_TEST( otool_add_kdepim-multiline-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-multiline-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-multiline-2.1.vcf") + ADD_TEST( otool_add_kdepim-multiline-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-multiline-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-multiline-2.1.vcf") - ADD_TEST( otool_add_kdepim-multiline-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-multiline-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-multiline-3.0.vcf") + ADD_TEST( otool_add_kdepim-multiline-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-multiline-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-multiline-3.0.vcf") - ADD_TEST( otool_add_kdepim-nonuid-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-nonuid-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-nonuid-2.1.vcf") + ADD_TEST( otool_add_kdepim-nonuid-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-nonuid-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-nonuid-2.1.vcf") - ADD_TEST( otool_add_kdepim-photo1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-photo1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo1-2.1.vcf") + ADD_TEST( otool_add_kdepim-photo1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-photo1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo1-2.1.vcf") - ADD_TEST( otool_add_kdepim-photo1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-photo1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo1-3.0.vcf") + ADD_TEST( otool_add_kdepim-photo1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-photo1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo1-3.0.vcf") - ADD_TEST( otool_add_kdepim-photo2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-photo2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo2-2.1.vcf") + ADD_TEST( otool_add_kdepim-photo2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-photo2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo2-2.1.vcf") - ADD_TEST( otool_add_kdepim-photo2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-photo2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo2-3.0.vcf") + ADD_TEST( otool_add_kdepim-photo2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-photo2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-photo2-3.0.vcf") - ADD_TEST( otool_add_kdepim-sound1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-sound1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound1-2.1.vcf") + ADD_TEST( otool_add_kdepim-sound1-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-sound1-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound1-2.1.vcf") - ADD_TEST( otool_add_kdepim-sound1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-sound1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound1-3.0.vcf") + ADD_TEST( otool_add_kdepim-sound1-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-sound1-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound1-3.0.vcf") - ADD_TEST( otool_add_kdepim-sound2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-sound2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound2-2.1.vcf") + ADD_TEST( otool_add_kdepim-sound2-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-sound2-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound2-2.1.vcf") - ADD_TEST( otool_add_kdepim-sound2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-sound2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound2-3.0.vcf") + ADD_TEST( otool_add_kdepim-sound2-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-sound2-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-sound2-3.0.vcf") - ADD_TEST( otool_add_kdepim-special-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-special-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-special-2.1.vcf") + ADD_TEST( otool_add_kdepim-special-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-special-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-special-2.1.vcf") - ADD_TEST( otool_add_kdepim-special-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-special-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-special-3.0.vcf") + ADD_TEST( otool_add_kdepim-special-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-special-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-special-3.0.vcf") - ADD_TEST( otool_add_kdepim-umlaute-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-umlaute-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-umlaute-2.1.vcf") + ADD_TEST( otool_add_kdepim-umlaute-2.1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-umlaute-2.1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-umlaute-2.1.vcf") - ADD_TEST( otool_add_kdepim-umlaute-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-umlaute-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-umlaute-3.0.vcf") + ADD_TEST( otool_add_kdepim-umlaute-3.0_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-umlaute-3.0_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/kdepim-umlaute-3.0.vcf") - ADD_TEST( otool_add_evo2-1-hour-alarm2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-1-hour-alarm2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour-alarm2.vcf") + ADD_TEST( otool_add_evo2-1-hour-alarm2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-1-hour-alarm2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour-alarm2.vcf") - ADD_TEST( otool_add_evo2-1-hour-alarm_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-1-hour-alarm_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour-alarm.vcf") + ADD_TEST( otool_add_evo2-1-hour-alarm_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-1-hour-alarm_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour-alarm.vcf") - ADD_TEST( otool_add_evo2-1-hour_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-1-hour_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour.vcf") + ADD_TEST( otool_add_evo2-1-hour_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-1-hour_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-1-hour.vcf") - ADD_TEST( otool_add_evo2-all-day2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-all-day2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-all-day2.vcf") + ADD_TEST( otool_add_evo2-all-day2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-all-day2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-all-day2.vcf") - ADD_TEST( otool_add_evo2-all-day_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-all-day_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-all-day.vcf") + ADD_TEST( otool_add_evo2-all-day_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-all-day_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-all-day.vcf") - ADD_TEST( otool_add_evo2-evo2-recur-until_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-evo2-recur-until_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-evo2-recur-until.vcf") + ADD_TEST( otool_add_evo2-evo2-recur-until_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-evo2-recur-until_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-evo2-recur-until.vcf") - ADD_TEST( otool_add_evo2-free-busy_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-free-busy_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-free-busy.vcf") + ADD_TEST( otool_add_evo2-free-busy_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-free-busy_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-free-busy.vcf") - ADD_TEST( otool_add_evo2-full-special_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-full-special_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-full-special.vcf") + ADD_TEST( otool_add_evo2-full-special_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-full-special_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-full-special.vcf") - ADD_TEST( otool_add_evo2-rec-every-year_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-rec-every-year_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-every-year.vcf") + ADD_TEST( otool_add_evo2-rec-every-year_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-rec-every-year_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-every-year.vcf") - ADD_TEST( otool_add_evo2-rec-except_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-rec-except_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-except.vcf") + ADD_TEST( otool_add_evo2-rec-except_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-rec-except_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-except.vcf") - ADD_TEST( otool_add_evo2-rec-forever_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-rec-forever_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-forever.vcf") + ADD_TEST( otool_add_evo2-rec-forever_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-rec-forever_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-forever.vcf") - ADD_TEST( otool_add_evo2-rec-for_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-rec-for_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-for.vcf") + ADD_TEST( otool_add_evo2-rec-for_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-rec-for_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-for.vcf") - ADD_TEST( otool_add_evo2-rec-until_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-rec-until_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-until.vcf") + ADD_TEST( otool_add_evo2-rec-until_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-rec-until_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/evolution2-rec-until.vcf") - ADD_TEST( otool_add_kdepim-1-hour-1.0_vcs ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-1-hour-1.0_vcs" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/kdepim-1-hour-1.0.vcs") + ADD_TEST( otool_add_kdepim-1-hour-1.0_vcs ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-1-hour-1.0_vcs" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/kdepim-1-hour-1.0.vcs") - ADD_TEST( otool_add_kdepim-1-hour-2.0_ics ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-1-hour-2.0_ics" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/kdepim-1-hour-2.0.ics") + ADD_TEST( otool_add_kdepim-1-hour-2.0_ics ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_kdepim-1-hour-2.0_ics" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/vevents/kdepim-1-hour-2.0.ics") - ADD_TEST( otool_add_evo2-todo-full1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full1.vcf") + ADD_TEST( otool_add_evo2-todo-full1_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full1.vcf") - ADD_TEST( otool_add_evo2-todo-full2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full2.vcf") + ADD_TEST( otool_add_evo2-todo-full2_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full2.vcf") - ADD_TEST( otool_add_evo2-todo-full3_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full3_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full3.vcf") + ADD_TEST( otool_add_evo2-todo-full3_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full3_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full3.vcf") - ADD_TEST( otool_add_evo2-todo-full4_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full4_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full4.vcf") + ADD_TEST( otool_add_evo2-todo-full4_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full4_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full4.vcf") - ADD_TEST( otool_add_evo2-todo-full5_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full5_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full5.vcf") + ADD_TEST( otool_add_evo2-todo-full5_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full5_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full5.vcf") - ADD_TEST( otool_add_evo2-todo-full6_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full6_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full6.vcf") + ADD_TEST( otool_add_evo2-todo-full6_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full6_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full6.vcf") - ADD_TEST( otool_add_evo2-todo-full7_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-full7_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full7.vcf") + ADD_TEST( otool_add_evo2-todo-full7_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-full7_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-full7.vcf") - ADD_TEST( otool_add_evo2-todo-simple_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_evolution2-todo-simple_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-simple.vcf") + ADD_TEST( otool_add_evo2-todo-simple_vcf ${TESTDIR}/check_osynctool_add_file_and_slowsync "otool_add_evolution2-todo-simple_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/evolution2-todo-simple.vcf") - ADD_TEST( otool_add_kdepim-todoful1_vcs ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_kdepim-todoful1_vcs" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/vtodos/kdepim-todoful1.vcs") + ADD_TEST( otool_add_kdepim-todoful1_vcs ${TESTDIR}... [truncated message content] |