You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-09-21 21:19:59
|
Author: dgollub Date: Mon Sep 21 23:19:45 2009 New Revision: 5826 URL: http://www.opensync.org/changeset/5826 Log: Increase version to 0.40 in advance for snapshot builds Modified: plugins/file-sync/CMakeLists.txt Modified: plugins/file-sync/CMakeLists.txt ============================================================================== --- plugins/file-sync/CMakeLists.txt Mon Sep 21 23:19:14 2009 (r5825) +++ plugins/file-sync/CMakeLists.txt Mon Sep 21 23:19:45 2009 (r5826) @@ -4,7 +4,7 @@ SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) -SET( OPENSYNC_MIN_VERSION "0.39" ) +SET( OPENSYNC_MIN_VERSION "0.40" ) CMAKE_MINIMUM_REQUIRED( VERSION 2.4.4 ) |
From: <svn...@op...> - 2009-09-21 21:19:27
|
Author: dgollub Date: Mon Sep 21 23:19:14 2009 New Revision: 5825 URL: http://www.opensync.org/changeset/5825 Log: Increase version to 0.40 in advance for snapshot builds Modified: trunk/CMakeLists.txt trunk/docs/examples/plugins/CMakeLists.txt Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Mon Sep 21 21:33:30 2009 (r5824) +++ trunk/CMakeLists.txt Mon Sep 21 23:19:14 2009 (r5825) @@ -1,7 +1,7 @@ PROJECT( libopensync C ) SET( OPENSYNC_VERSION_MAJOR "0" ) -SET( OPENSYNC_VERSION_MINOR "39" ) +SET( OPENSYNC_VERSION_MINOR "40" ) # The most recent interface number that this library implements. #UPDATE: If any interface have been added, removed or changed since Modified: trunk/docs/examples/plugins/CMakeLists.txt ============================================================================== --- trunk/docs/examples/plugins/CMakeLists.txt Mon Sep 21 21:33:30 2009 (r5824) +++ trunk/docs/examples/plugins/CMakeLists.txt Mon Sep 21 23:19:14 2009 (r5825) @@ -1,6 +1,6 @@ PROJECT( libopensync-plugin-example ) -SET( VERSION "0.38" ) +SET( VERSION "0.40" ) # Look for 3rd Party CMake modules SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) |
From: <svn...@op...> - 2009-09-21 19:33:43
|
Author: scriptor Date: Mon Sep 21 21:33:30 2009 New Revision: 5824 URL: http://www.opensync.org/changeset/5824 Log: I have disabled a timeout on the side of the LDAP server when the ldap_search command is performed. Modified: plugins/ldap-sync/src/ldap_connect.c Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Mon Sep 21 18:10:41 2009 (r5823) +++ plugins/ldap-sync/src/ldap_connect.c Mon Sep 21 21:33:30 2009 (r5824) @@ -1506,9 +1506,6 @@ const char *scope_str = NULL; - struct timeval timeout; - timeout.tv_sec = 10; - timeout.tv_usec = 0; const char *userattributes[2]; userattributes[1] = NULL; @@ -1609,7 +1606,7 @@ 0, ///< attrsonly NULL, ///< server controls NULL, ///< client controls - &timeout, ///< timeout + NULL, ///< timeout 4096, ///< sizelimit results ///< The result of the search ); |
From: <svn...@op...> - 2009-09-21 16:10:59
|
Author: henrik Date: Mon Sep 21 18:10:41 2009 New Revision: 5823 URL: http://www.opensync.org/changeset/5823 Log: Update to latest OpenSync API changes Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Sun Sep 20 22:19:53 2009 (r5822) +++ plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Mon Sep 21 18:10:41 2009 (r5823) @@ -285,7 +285,10 @@ LOG_EXIT_REPORT_ERROR_OSYNC(0, pOSyncContext, pError); return FALSE; } - osync_xmlformat_sort(pXMLFormat); + if (!osync_xmlformat_sort(pXMLFormat, &pError)) { + LOG_EXIT_REPORT_ERROR_OSYNC(0, pOSyncContext, pError); + return FALSE; + } GFREE(szXML); OSyncData *odata = NULL; @@ -714,6 +717,7 @@ OSyncHashTable *pHT = osync_objtype_sink_get_hashtable(pOSyncObjTypeSink); gboolean f; + OSyncError *pError = NULL; OSyncData *pOSyncData=osync_change_get_data(pChange); if (!pOSyncData) { LOG_EXIT_REPORT_ERROR_SZ(10, pOSyncContext, "Change has no data"); return; } @@ -734,8 +738,14 @@ if ( (changeType==OSYNC_CHANGE_TYPE_ADDED) || (changeType==OSYNC_CHANGE_TYPE_MODIFIED) ) { OSyncXMLFormat *pXMLFormat = (OSyncXMLFormat *)pVoidBuffer; unsigned int size; - osync_xmlformat_assemble(pXMLFormat, &szXML, &size); - osync_xmlformat_sort(pXMLFormat); + if (!osync_xmlformat_assemble(pXMLFormat, &szXML, &size, &pError)) { + LOG_EXIT_REPORT_ERROR_OSYNC(0, pOSyncContext, pError); + return; + } + if (!osync_xmlformat_sort(pXMLFormat, &pError)) { + LOG_EXIT_REPORT_ERROR_OSYNC(0, pOSyncContext, pError); + return; + } LOG_SENSITIVE(1000, "%s", szXML); } ThunderbirdAddressbook *pAB = pOSyncMozillaDatabase->pThunderbirdAddressbook; @@ -895,23 +905,31 @@ } + +// ---------------------------------------- + typedef struct _CapDef { - OSyncCapabilities *pCapabilities; - const char* szObject; + OSyncCapabilitiesObjType *pCapabilitiesObjType; const char* szCap; gboolean fError; OSyncError **ppOSyncError; } CapDef; + +// ---------------------------------------- + void addCapabilityEvent(void* voidSz, void* voidPCapDef) { CapDef *pCapDef=(CapDef*) voidPCapDef; if (pCapDef->fError) return; char *sz = (char*) voidSz; - LOG(10, "Capability: [%s] [%s]", pCapDef->szObject, sz); - OSyncCapability *c=osync_capability_new(pCapDef->pCapabilities, g_strdup(pCapDef->szObject), g_strdup(sz), pCapDef->ppOSyncError); - if (!c) pCapDef->fError=TRUE; + LOG(10, "Capability: [%s]", sz); + + OSyncCapability *pCapability = osync_capability_new(pCapDef->pCapabilitiesObjType, pCapDef->ppOSyncError); + if (!pCapability) pCapDef->fError=TRUE; + osync_capability_set_name(pCapability, g_strdup(sz)); } + // ---------------------------------------- /** @brief Discover sinks @@ -1081,32 +1099,40 @@ } - OSyncCapabilities *pCapabilities = osync_capabilities_new(ppOSyncError); + OSyncCapabilities *pCapabilities=NULL; CapDef capDef; - capDef.pCapabilities=pCapabilities; capDef.fError=FALSE; capDef.ppOSyncError=ppOSyncError; - GList *pGList; if (pOSyncMozillaEnv->mozillaConfig.szCalendarId) { + pCapabilities=osync_capabilities_new("vformat", ppOSyncError); + if (!pCapabilities) goto error; + capDef.pCapabilitiesObjType=osync_capabilities_objtype_new(pCapabilities, "event", ppOSyncError); + if (!capDef.pCapabilitiesObjType) goto error; pGList=PGListEventCapabilities(); - capDef.szObject="event"; g_list_foreach(pGList, addCapabilityEvent, &capDef); } if (pOSyncMozillaEnv->mozillaConfig.szAddressbookFile) { + pCapabilities=osync_capabilities_new("xmlformat", ppOSyncError); + if (!pCapabilities) goto error; + capDef.pCapabilitiesObjType=osync_capabilities_objtype_new(pCapabilities, "contact", ppOSyncError); + if (!capDef.pCapabilitiesObjType) goto error; pGList=ThunderbirdCard::PGListCapabilities(); - capDef.szObject="contact"; g_list_foreach(pGList, addCapabilityEvent, &capDef); - osync_plugin_info_set_capabilities(pOSyncPluginInfo, pCapabilities); } + osync_plugin_info_set_capabilities(pOSyncPluginInfo, pCapabilities); if (capDef.fError) { LOG_EXIT_ERROR_OSYNC_SZ(10, capDef.ppOSyncError, "Could not add capability"); return NULL; } LOG_EXIT(10, "(%p)", pOSyncMozillaEnv); return (void*) pOSyncMozillaEnv; + +error: + LOG_EXIT_ERROR_OSYNC_SZ(10, capDef.ppOSyncError, "Could not add capabilities"); + return NULL; } @@ -1168,8 +1194,15 @@ osync_plugin_set_initialize_timeout(pOSyncPlugin, 5*60); // 3 minutes osync_plugin_set_finalize_timeout(pOSyncPlugin, 5*60); // 3 minutes - osync_plugin_env_register_plugin(pOSyncPluginEnv, pOSyncPlugin); + + osync_bool f; + f=osync_plugin_env_register_plugin(pOSyncPluginEnv, pOSyncPlugin, ppOSyncError); osync_plugin_unref(pOSyncPlugin); + + if (!f) { + LOG_EXIT(10, "FALSE"); + return FALSE; + } LOG_EXIT(10, "TRUE"); return TRUE; |
From: <svn...@op...> - 2009-09-20 20:20:05
|
Author: dgollub Date: Sun Sep 20 22:19:53 2009 New Revision: 5822 URL: http://www.opensync.org/changeset/5822 Log: Tagged version 0.39 of the plugins Added: tags/plugins-0.39/ - copied from r5821, plugins/ |
From: <svn...@op...> - 2009-09-20 20:19:48
|
Author: dgollub Date: Sun Sep 20 22:19:35 2009 New Revision: 5821 URL: http://www.opensync.org/changeset/5821 Log: Tagged version 0.39 of the format plugins Added: tags/format-plugins-0.39/ - copied from r5820, format-plugins/ |
From: <svn...@op...> - 2009-09-20 20:19:13
|
Author: dgollub Date: Sun Sep 20 22:19:00 2009 New Revision: 5820 URL: http://www.opensync.org/changeset/5820 Log: Need to do a new tag due to missing version bump Deleted: tags/format-plugins-0.39/ tags/plugins-0.39/ |
From: <svn...@op...> - 2009-09-20 20:18:35
|
Author: dgollub Date: Sun Sep 20 22:18:23 2009 New Revision: 5819 URL: http://www.opensync.org/changeset/5819 Log: Bump vformat plugin to 0.39 Modified: format-plugins/vformat/CMakeLists.txt Modified: format-plugins/vformat/CMakeLists.txt ============================================================================== --- format-plugins/vformat/CMakeLists.txt Sun Sep 20 22:17:41 2009 (r5818) +++ format-plugins/vformat/CMakeLists.txt Sun Sep 20 22:18:23 2009 (r5819) @@ -1,6 +1,6 @@ PROJECT( libopensync-plugin-vformat C ) -SET( VERSION "0.38" ) +SET( VERSION "0.39" ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) @@ -11,7 +11,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.4.4 ) -SET( OPENSYNC_MIN_VERSION "0.36" ) +SET( OPENSYNC_MIN_VERSION "0.39" ) FIND_PACKAGE( OpenSync REQUIRED ) FIND_PACKAGE( GLIB2 REQUIRED ) FIND_PACKAGE( Check ) |
From: <svn...@op...> - 2009-09-20 20:17:55
|
Author: dgollub Date: Sun Sep 20 22:17:41 2009 New Revision: 5818 URL: http://www.opensync.org/changeset/5818 Log: Bump plugins version to 0.39 Modified: plugins/evolution2/CMakeLists.txt plugins/file-sync/CMakeLists.txt plugins/syncml/CMakeLists.txt Modified: plugins/evolution2/CMakeLists.txt ============================================================================== --- plugins/evolution2/CMakeLists.txt Sun Sep 20 22:15:55 2009 (r5817) +++ plugins/evolution2/CMakeLists.txt Sun Sep 20 22:17:41 2009 (r5818) @@ -1,11 +1,11 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.4.4 ) PROJECT( libopensync-plugin-evolution2 C ) -SET( VERSION "0.38" ) +SET( VERSION "0.39" ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) -SET( OPENSYNC_MIN_VERSION "0.37" ) +SET( OPENSYNC_MIN_VERSION "0.39" ) FIND_PACKAGE( EPackage REQUIRED ) FIND_PACKAGE( OpenSync REQUIRED ) Modified: plugins/file-sync/CMakeLists.txt ============================================================================== --- plugins/file-sync/CMakeLists.txt Sun Sep 20 22:15:55 2009 (r5817) +++ plugins/file-sync/CMakeLists.txt Sun Sep 20 22:17:41 2009 (r5818) @@ -1,10 +1,10 @@ PROJECT( libopensync-plugin-file C ) -SET( VERSION "0.38" ) +SET( VERSION "0.39" ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) -SET( OPENSYNC_MIN_VERSION "0.37" ) +SET( OPENSYNC_MIN_VERSION "0.39" ) CMAKE_MINIMUM_REQUIRED( VERSION 2.4.4 ) Modified: plugins/syncml/CMakeLists.txt ============================================================================== --- plugins/syncml/CMakeLists.txt Sun Sep 20 22:15:55 2009 (r5817) +++ plugins/syncml/CMakeLists.txt Sun Sep 20 22:17:41 2009 (r5818) @@ -1,6 +1,6 @@ PROJECT( libopensync-plugin-syncml C ) -SET( VERSION "0.38" ) +SET( VERSION "0.39" ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) #SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/opensync-1.0/cmake/modules/") @@ -11,7 +11,7 @@ # find requirements SET ( LIBSYNCML_MIN_VERSION "0.5.0" ) -SET ( OPENSYNC_MIN_VERSION "0.37" ) +SET ( OPENSYNC_MIN_VERSION "0.39" ) FIND_PACKAGE( OpenSync REQUIRED ) FIND_PACKAGE( GLIB2 REQUIRED ) |
From: <svn...@op...> - 2009-09-20 20:16:09
|
Author: scriptor Date: Sun Sep 20 22:15:55 2009 New Revision: 5817 URL: http://www.opensync.org/changeset/5817 Log: I have increased the short timeout to 10 minutes. Moreover, I have corrected opensync.suppr, so that it covers more memory faults of the same kind. Modified: plugins/ldap-sync/tests/CMakeLists.txt plugins/ldap-sync/tests/opensync.suppr plugins/ldap-sync/tests/test.conf Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Sun Sep 20 22:10:01 2009 (r5816) +++ plugins/ldap-sync/tests/CMakeLists.txt Sun Sep 20 22:15:55 2009 (r5817) @@ -22,7 +22,7 @@ IF (RUN_LONG_TESTS) SET ( TIMEOUT 3600 CACHE STRING "General timeout value." FORCE ) ELSE(RUN_LONG_TESTS) - SET ( TIMEOUT 480 CACHE STRING "General timeout value." FORCE ) + SET ( TIMEOUT 600 CACHE STRING "General timeout value." FORCE ) ENDIF(RUN_LONG_TESTS) SET ( CTEST_TEST_TIMEOUT ${TIMEOUT} CACHE STRING "The most natural variable for a timeout setting does NOT work. Great!" FORCE ) @@ -551,7 +551,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ) LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ) - + ADD_TEST( plugin_auth_simple_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_simple_slapd" ) ADD_TEST( plugin_auth_digest_md5_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_digest_md5_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_digest_md5_slapd" ) Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Sun Sep 20 22:10:01 2009 (r5816) +++ plugins/ldap-sync/tests/opensync.suppr Sun Sep 20 22:15:55 2009 (r5817) @@ -4331,8 +4331,6 @@ fun:g_strdup_vprintf fun:osync_trace fun:osync_plugin_config_file_load - fun:init - fun:main } { @@ -4345,8 +4343,6 @@ fun:g_strdup_vprintf fun:osync_trace fun:osync_plugin_config_file_load - fun:init - fun:main } { @@ -4359,8 +4355,6 @@ fun:g_strdup_vprintf fun:osync_trace fun:osync_plugin_config_file_load - fun:init - fun:main } Modified: plugins/ldap-sync/tests/test.conf ============================================================================== --- plugins/ldap-sync/tests/test.conf Sun Sep 20 22:10:01 2009 (r5816) +++ plugins/ldap-sync/tests/test.conf Sun Sep 20 22:15:55 2009 (r5817) @@ -97,7 +97,7 @@ ########## Set a more realistic timeout in seconds for each test: # Default would be 1500 s (= 25 minutes!) -export TIMEOUT=300 +export TIMEOUT=600 export CTEST_TEST_TIMEOUT=${TIMEOUT} export DART_TESTING_TIMEOUT=${TIMEOUT} export CMAKE_LONG_TEST_TIMEOUT=${TIMEOUT} |
From: <svn...@op...> - 2009-09-20 20:10:15
|
Author: dgollub Date: Sun Sep 20 22:10:01 2009 New Revision: 5816 URL: http://www.opensync.org/changeset/5816 Log: Tagged version 0.39 of the format plugins Added: tags/format-plugins-0.39/ - copied from r5815, format-plugins/ |
From: <svn...@op...> - 2009-09-20 20:09:42
|
Author: dgollub Date: Sun Sep 20 22:09:27 2009 New Revision: 5815 URL: http://www.opensync.org/changeset/5815 Log: Tagged version 0.39 of the plugins Added: tags/plugins-0.39/ - copied from r5814, plugins/ |
From: <svn...@op...> - 2009-09-20 20:04:04
|
Author: dgollub Date: Sun Sep 20 22:03:50 2009 New Revision: 5814 URL: http://www.opensync.org/changeset/5814 Log: Tagged osynctool 0.39 Added: osynctool/tags/osynctool-0.39/ (props changed) - copied from r5813, osynctool/trunk/ |
From: <svn...@op...> - 2009-09-20 20:02:37
|
Author: dgollub Date: Sun Sep 20 22:02:21 2009 New Revision: 5813 URL: http://www.opensync.org/changeset/5813 Log: Tagged version 0.39 Added: tags/opensync-0.39/ (props changed) - copied from r5812, trunk/ |
From: <svn...@op...> - 2009-09-19 20:39:17
|
Author: scriptor Date: Sat Sep 19 22:39:02 2009 New Revision: 5812 URL: http://www.opensync.org/changeset/5812 Log: Update to the state of libopensync as of Sept 19th, 2009. Modified: plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Sat Sep 19 22:38:37 2009 (r5811) +++ plugins/ldap-sync/tests/opensync.suppr Sat Sep 19 22:39:02 2009 (r5812) @@ -4322,4 +4322,45 @@ } +{ + <opensync_plugin_config.c_line_755_is_buggy1> + Memcheck:Cond + fun:vfprintf + fun:__vasprintf_chk + fun:g_vasprintf + fun:g_strdup_vprintf + fun:osync_trace + fun:osync_plugin_config_file_load + fun:init + fun:main +} + +{ + <opensync_plugin_config.c_line_755_is_buggy2> + Memcheck:Value8 + fun:_itoa_word + fun:vfprintf + fun:__vasprintf_chk + fun:g_vasprintf + fun:g_strdup_vprintf + fun:osync_trace + fun:osync_plugin_config_file_load + fun:init + fun:main +} + +{ + <opensync_plugin_config.c_line_755_is_buggy3> + Memcheck:Cond + fun:_itoa_word + fun:vfprintf + fun:__vasprintf_chk + fun:g_vasprintf + fun:g_strdup_vprintf + fun:osync_trace + fun:osync_plugin_config_file_load + fun:init + fun:main +} + |
From: <svn...@op...> - 2009-09-19 20:38:53
|
Author: scriptor Date: Sat Sep 19 22:38:37 2009 New Revision: 5811 URL: http://www.opensync.org/changeset/5811 Log: Adjusting to several API changes - among them being: http://www.opensync.org/changeset/5795 http://www.opensync.org/changeset/5790 http://www.opensync.org/changeset/5772 http://www.opensync.org/changeset/5769 Besides, I have changed an error reporting function in that it now displays file name and line number of the calling function rather than file name and line number of ldap_debug.c. This is really the last possibility, where the actual problem lies. 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/src/ldap_sasl.c 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 Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/misc/ldap_format_convert.c Sat Sep 19 22:38:37 2009 (r5811) @@ -713,7 +713,14 @@ // Sort the format object: - osync_xmlformat_sort(xmlformat); + if (!osync_xmlformat_sort(xmlformat, error)) + { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_sort() has failed."); + } + + goto error; + } if (osync_xmlformat_is_sorted(xmlformat)) { osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced IS sorted.\n", __FILE__, __LINE__); @@ -822,7 +829,7 @@ converter_path = osync_format_env_find_path(format_env, sourceformat, targetformat, error); if (converter_path == NULL) { if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: converter_pathcould not be found for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: converter_pathcould not be found for sourceformat_name = \"%s\" and targetformat_name = \"%s\".", __FILE__, __LINE__, sourceformat_name, targetformat_name); goto error; } @@ -873,7 +880,7 @@ // Now, convert the data from sourceformat to targetformat if (!osync_format_env_convert(format_env, converter_path, *data, error)) { if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: conversion could not be performed for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: conversion could not be performed for sourceformat_name = \"%s\" and targetformat_name = \"%s\".", __FILE__, __LINE__, sourceformat_name, targetformat_name); goto error; } @@ -1171,12 +1178,17 @@ // Care about the output - result = osync_data_get_printable(data); - if (result == NULL) { + result = osync_data_get_printable(data, &error); + if (result == NULL || osync_error_is_set(&error)) { char *buf = NULL; unsigned int buf_size = 0; + if (osync_error_is_set(&error)) + { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: %s", __FILE__, __LINE__, osync_error_print(&error)); + } + osync_trace(TRACE_ERROR, "%s:%i: WARNING: result = NULL. Has the conversion failed?", __FILE__, __LINE__); osync_trace(TRACE_ERROR, "%s:%i: Resulting format = \"%s\"", __FILE__, __LINE__, (char *)osync_objformat_get_name(osync_data_get_objformat(data))); osync_trace(TRACE_ERROR, "%s:%i: Resulting objtype = \"%s\"", __FILE__, __LINE__, osync_data_get_objtype (data)); Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_connect.c Sat Sep 19 22:38:37 2009 (r5811) @@ -1207,7 +1207,7 @@ if (res == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_call_ldap_search() must have failed.\n", __FILE__, __LINE__); - ldap_plugin_dump_ldap_error_message(sinkenv, "cn=Subschema", "(objectClass=subschema)", "ldap_plugin_call_ldap_search()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, "cn=Subschema", "(objectClass=subschema)", "ldap_plugin_call_ldap_search()"); goto error; } @@ -1236,7 +1236,7 @@ if (res == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_call_ldap_search() must have failed.\n", __FILE__, __LINE__); - ldap_plugin_dump_ldap_error_message(sinkenv, "cn=schema", "(objectClass=subschema)", "ldap_plugin_call_ldap_search()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, "cn=schema", "(objectClass=subschema)", "ldap_plugin_call_ldap_search()"); goto error; } @@ -1773,7 +1773,7 @@ // xxx jl: TODO: Produce an osync error message ldap_plugin_printf("%s:%i: ERROR: ldap_plugin_call_ldap_search() has failed.", __FILE__, __LINE__); - ldap_plugin_dump_ldap_error_message(sinkenv, dn, "(objectClass=*)", "ldap_plugin_call_ldap_search()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, dn, "(objectClass=*)", "ldap_plugin_call_ldap_search()"); *rv = result_code; @@ -1838,7 +1838,7 @@ // Delete children: int rv2 = ldap_delete_ext_s (sinkenv->ld, buf, NULL, NULL); if (rv2 != LDAP_SUCCESS && rv2 != LDAP_NO_SUCH_OBJECT) { - ldap_plugin_dump_ldap_error_message(sinkenv, id_values[0]->bv_val, "", "ldap_delete_ext_s()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, id_values[0]->bv_val, "", "ldap_delete_ext_s()"); } } else { osync_trace(TRACE_ERROR, "%s:%i: ERROR: id_values[0]->bv_val = NULL.\n", __FILE__, __LINE__); @@ -1858,7 +1858,7 @@ // Delete base: *rv = ldap_delete_ext_s (sinkenv->ld, dn, NULL, NULL); if (*rv != LDAP_SUCCESS && *rv != LDAP_NO_SUCH_OBJECT) { - ldap_plugin_dump_ldap_error_message(sinkenv, "", "", "ldap_delete_ext_s()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, "", "", "ldap_delete_ext_s()"); } @@ -2230,7 +2230,7 @@ LDAPMessage *subentry_result = ldap_first_entry(sinkenv->ld, possible_subentries) ; if (subentry_result == NULL) { - ldap_plugin_dump_ldap_error_message(sinkenv, entry->dn, subentry_filter, "ldap_first_entry()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, entry->dn, subentry_filter, "ldap_first_entry()"); } else { for ( ; subentry_result ; subentry_result = ldap_next_entry(sinkenv->ld, subentry_result)) { // keyattribute for subentries: "ou" @@ -2588,7 +2588,7 @@ ldap_plugin_printf("%s:%i: ", __FILE__, __LINE__); // TODO - ldap_plugin_dump_ldap_error_message(sinkenv, sinkenv->searchbase, filter, "ldap_first_entry()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, sinkenv->searchbase, filter, "ldap_first_entry()"); #endif @@ -2747,7 +2747,7 @@ // -------------------------------------------------- one_entry = ldap_first_entry(sinkenv->ld, all_entries); if (one_entry == NULL) { - ldap_plugin_dump_ldap_error_message(sinkenv, base, filter, "ldap_first_entry()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, base, filter, "ldap_first_entry()"); ldap_plugin_printf("%s:%i: WARNING: one_entry = NULL. Skipping this dn.", __FILE__, __LINE__); goto error; @@ -2922,7 +2922,7 @@ } if (all_entries == NULL) { - ldap_plugin_dump_ldap_error_message(sinkenv, base, filter, "ldap_plugin_call_ldap_search()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, base, filter, "ldap_plugin_call_ldap_search()"); osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: WARNING: all_entries = NULL. No hash available for this uid.\n", __FILE__, __LINE__); goto error; Modified: plugins/ldap-sync/src/ldap_debug.c ============================================================================== --- plugins/ldap-sync/src/ldap_debug.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_debug.c Sat Sep 19 22:38:37 2009 (r5811) @@ -91,13 +91,17 @@ /** * @brief Prints errors messages by the LDAP server to the screen + * * @param sinkenv The environment for one particular object type + * @param file From which file has this function been called? + * @param line From which line in the source code has this function been called? * @param base The searchbase as used for any libldap query. * @param filter The searchfilter as used for any libldap query. * @param command The particular libldap query command. + * * @returns Nothing. */ -void ldap_plugin_dump_ldap_error_message(const sink_environment *sinkenv, const char *base, const char *filter, const char *command) +void ldap_plugin_dump_ldap_error_message(const sink_environment *sinkenv, const char *file, const int line, const char *base, const char *filter, const char *command) { int result_code = 0; @@ -135,10 +139,19 @@ ldap_plugin_printf("%s:%i: ERROR: ldap_get_option() has failed. result_code could not be filled in.", __FILE__, __LINE__); } else { if (result_code != 0) { - ldap_plugin_printf("%s:%i: ERROR: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK?", __FILE__, __LINE__, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); - ldap_plugin_printf("ERROR: %s", ldap_err2string(result_code)); + if (file) { + ldap_plugin_printf("%s:%i: ERROR: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK?", file, line, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); + ldap_plugin_printf("%s:%i: LDAP ERROR: \"\033[0;31;1m%s\033[0m\". ", file, line, ldap_err2string(result_code)); + } else { + ldap_plugin_printf("%s:%i: ERROR: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK?", __FILE__, __LINE__, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); + ldap_plugin_printf("%s:%i: LDAP ERROR: \"\033[0;31;1m%s\033[0m\". ", __FILE__, __LINE__, ldap_err2string(result_code)); + } } else { - ldap_plugin_printf("%s:%i: WARNING: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK? Or is there really not a single entry under the searchbase?", __FILE__, __LINE__, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); + if (file) { + ldap_plugin_printf("%s:%i: WARNING: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK? Or is there really not a single entry under the searchbase?", file, line, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); + } else { + ldap_plugin_printf("%s:%i: WARNING: \"%s\" has returned NULL. Are your searchbase \"%s\" and your filter \"%s\" for this particular objtype \"%s\" OK? Or is there really not a single entry under the searchbase?", __FILE__, __LINE__, command, base, filter, osync_objtype_sink_get_name(sinkenv->sink)); + } } } } @@ -457,6 +470,11 @@ if (sinkenv == NULL) { ldap_plugin_printf("%s:%i: ERROR: sinkenv = NULL. Returning.", __FILE__, __LINE__); + if (buf) { + g_free(buf); + buf = NULL; + } + return NULL; } @@ -522,17 +540,21 @@ */ void ldap_plugin_compose_ldap_error_message(sink_environment *sinkenv, const char *file, const int line, ldap_entry *entry, const char *dn, OSyncChange *change, int ldap_errno, OSyncError **error) { - if (sinkenv == NULL) + if (sinkenv == NULL) { + ldap_plugin_printf("%s:%i: ERROR: sinkenv = NULL.", __FILE__, __LINE__); return; + } - if (change == NULL) + if (change == NULL) { + ldap_plugin_printf("%s:%i: ERROR: change = NULL.", __FILE__, __LINE__); return; + } if (ldap_errno == LDAP_ALREADY_EXISTS) { if (file) { - osync_trace(TRACE_INTERNAL, "%s:%i: LDAP ERROR \"Already exists\" is ignored, because otherwise hashtable and anchor are not updated, slow-sync is requested again and again, and this error message reappears for ever.", file, line); + osync_trace(TRACE_INTERNAL, "%s:%i: LDAP ERROR \"Already exists\" is being ignored, right now, because otherwise hashtable and anchor are not updated, slow-sync is requested again and again, and this error message reappears for ever.", file, line); } else { - osync_trace(TRACE_INTERNAL, "LDAP ERROR \"Already exists\" is ignored, because otherwise hashtable and anchor are not updated, slow-sync is requested again and again, and this error message reappears for ever."); + osync_trace(TRACE_INTERNAL, "LDAP ERROR \"Already exists\" is being ignored, right now, because otherwise hashtable and anchor are not updated, slow-sync is requested again and again, and this error message reappears for ever."); } } else { char *msg = NULL; @@ -543,11 +565,7 @@ if (msg && msg[0]) { osync_error_set(error, OSYNC_ERROR_GENERIC, msg); osync_trace(TRACE_INTERNAL, msg); - if (file) { - ldap_plugin_printf("%s:%i: %s", file, line, msg); - } else { - ldap_plugin_printf("%s:%i: %s", __FILE__, __LINE__, msg); - } + ldap_plugin_printf("%s", msg); } if (entry) { Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_format.c Sat Sep 19 22:38:37 2009 (r5811) @@ -1580,6 +1580,7 @@ * @param rightdata * @param rightsize * @param user_data + * @param error * * The possible result of the comparison are: * @@ -1596,10 +1597,10 @@ * This means the objects are not the same and not similar. */ -static OSyncConvCmpResult ldap_format_compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data) +static OSyncConvCmpResult ldap_format_compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data, OSyncError **error) { - osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %u, %p) TODO ", __func__, leftdata, leftsize, rightdata, rightsize, user_data); + osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %u, %p, %p) TODO ", __func__, leftdata, leftsize, rightdata, rightsize, user_data, error); osync_trace(TRACE_EXIT, "%s", __func__); @@ -2434,7 +2435,14 @@ // Sort the format object: - osync_xmlformat_sort(xmlformat); + if (!osync_xmlformat_sort(xmlformat, error)) + { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_sort() has failed.", __FILE__, __LINE__); + } + + goto error; + } if (osync_xmlformat_is_sorted(xmlformat)) { osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced IS sorted.\n", __FILE__, __LINE__); @@ -2448,7 +2456,14 @@ *outpsize = osync_xmlformat_size(); // Returns the size of the OSyncXMLFormat struct. - osync_xmlformat_assemble(xmlformat, &str, &size); + if (!osync_xmlformat_assemble(xmlformat, &str, &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 (str) { osync_trace(TRACE_INTERNAL, "%s:%i: Resulting output format is: \n\"%s\"\n", __FILE__, __LINE__, str); @@ -2609,7 +2624,14 @@ char *buf = NULL; - osync_xmlformat_assemble((OSyncXMLFormat *)input, &buf, &size); + 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__); @@ -4478,7 +4500,14 @@ - osync_xmlformat_assemble(xmlformat, &pre_output, &pre_outpsize); + if (!osync_xmlformat_assemble(xmlformat, &pre_output, &pre_outpsize, 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 (pre_output == NULL) { @@ -4784,8 +4813,13 @@ - if (!osync_xmlformat_assemble((OSyncXMLFormat *)input, (char **) &xmlbuff, (unsigned int *)&size)) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed for an unknown reason. Giving up.", __FILE__, __LINE__); + if (!osync_xmlformat_assemble((OSyncXMLFormat *)input, (char **) &xmlbuff, (unsigned int *)&size, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed for an unknown reason. Giving up.", __FILE__, __LINE__); + } else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed: \"%s\". Giving up.", __FILE__, __LINE__, osync_error_print(error)); + } + osync_trace(TRACE_ERROR, "%s:%i: ERROR: osync_xmlformat_assemble() has failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); goto error; } @@ -5753,15 +5787,13 @@ * freed in ldap_plugin_get_changes() otherwise. * @param inpsize * @param user_data And what is this, anyway??? + * @param error The libopensync error pointer * */ -static void ldap_format_destroy_format1(char *input , unsigned int inpsize, void *user_data) +static osync_bool ldap_format_destroy_format1(char *input , unsigned int inpsize, void *user_data, OSyncError **error) { - OSyncError *error = NULL; - - - osync_trace(TRACE_ENTRY, "%s(%p, %d, %p) TODO ", __func__, input, inpsize, user_data); + osync_trace(TRACE_ENTRY, "%s(%p, %d, %p, %p) TODO ", __func__, input, inpsize, user_data, error); osync_trace(TRACE_INTERNAL, "%s:%i:%s():\n\n\ndestroy function has been called for input = %p\n\n\n", __FILE__, __LINE__, __func__, input); @@ -5772,15 +5804,15 @@ GString *str = NULL; - ldap_plugin_dump_bytes((unsigned char *)input, inpsize < 128 ? inpsize : 128, &str, &error); + ldap_plugin_dump_bytes((unsigned char *)input, inpsize < 128 ? inpsize : 128, &str, error); if (str == NULL) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: str = NULL.", __FILE__, __LINE__); - return; + return FALSE; } if (str->str == NULL) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: str->str = NULL.", __FILE__, __LINE__); - return; + return FALSE; } osync_trace(TRACE_INTERNAL, "%s:%i:\n\"%s\"\n", __FILE__, __LINE__, (char *)(str->str)); @@ -5828,6 +5860,7 @@ osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; } @@ -5874,13 +5907,14 @@ * @param data The GList containing one or more LDAP entries. * @param size The size of the first element of the GList. * @param user_data ????????? + * @param error The libopensync error pointer * * @returns a string describing the format data. This string was previously * a GString and as such it is to be freed eventually by means of * g_string_free(). */ -static char *ldap_format_print_format1(const char *data, unsigned int size, void *user_data) +static char *ldap_format_print_format1(const char *data, unsigned int size, void *user_data, OSyncError **error) { GList *list = NULL; unsigned int i = 0, j = 0; @@ -5888,10 +5922,9 @@ GString *str = NULL; xmlChar *xmlbuff = NULL; unsigned int xmlbuff_size = 0; - OSyncError *error = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %d, %p) ", __func__, data, size, user_data); + osync_trace(TRACE_ENTRY, "%s(%p, %d, %p, %p) ", __func__, data, size, user_data, error); @@ -5918,11 +5951,11 @@ // First off, try and find out what type of data has been casted to char *: if (size == sizeof(glist_container) && ((glist_container *)data)->magic && !strcmp(((glist_container *)data)->magic, "glist_container")) { - if (!ldap_plugin_get_glist(data, &list, &error)) { + if (!ldap_plugin_get_glist(data, &list, error)) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_plugin_get_glist() has failed.\n", __FILE__, __LINE__); - if (!osync_error_is_set(&error)) - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_get_glist() has failed.\n", __FILE__, __LINE__); + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_get_glist() has failed.\n", __FILE__, __LINE__); goto error; } @@ -5935,7 +5968,7 @@ list = (GList *)data; } else if (size == sizeof(ldap_entry)) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: data looks like an ldap_entry. This is completely wrong.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: data looks like an ldap_entry. This is completely wrong.", __FILE__, __LINE__); goto error; } else if (size == osync_xmlformat_size()) { @@ -5956,19 +5989,24 @@ - if (!osync_xmlformat_assemble((OSyncXMLFormat *)data, (char **) &xmlbuff, &xmlbuff_size)) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); + if (!osync_xmlformat_assemble((OSyncXMLFormat *)data, (char **) &xmlbuff, &xmlbuff_size, error)) { + if (osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed: \"%s\". Giving up.\n", __FILE__, __LINE__, osync_error_print(error)); + } else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But osync_xmlformat_assemble() has failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); + } + goto error; } if (xmlbuff == NULL) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But xmlbuff = NULL. osync_xmlformat_assemble() must have failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But xmlbuff = NULL. osync_xmlformat_assemble() must have failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); goto error; } if (xmlbuff_size < 6) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But xmlbuff_size = %i. sync_xmlformat_assemble() must have failed for an unknown reason. Giving up. size = %i.", __FILE__, __LINE__, xmlbuff_size, size); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data is NOT a glist_container. Looks like an OSyncXMLFormat. But xmlbuff_size = %i. sync_xmlformat_assemble() must have failed for an unknown reason. Giving up. size = %i.", __FILE__, __LINE__, xmlbuff_size, size); goto error; } @@ -5989,26 +6027,26 @@ // unreachable - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Don't know what that is. Bailing out."); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Don't know what that is. Bailing out."); goto error; } if (list == NULL) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: list = NULL.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: list = NULL.", __FILE__, __LINE__); goto error; } if (g_list_length(list) < 1) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: list has %u elements. Returning NULL.", __FILE__, __LINE__, g_list_length(list)); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: list has %u elements. Returning NULL.", __FILE__, __LINE__, g_list_length(list)); goto error; } str = g_string_new((const gchar *)"\n"); if (str == NULL) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: str = NULL. Returning NULL.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: str = NULL. Returning NULL.\n", __FILE__, __LINE__); goto error; } @@ -6078,11 +6116,11 @@ error: - if (!osync_error_is_set(&error)) - osync_error_set(&error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); + 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)); - osync_error_unref(&error); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + osync_error_unref(error); return NULL; } @@ -6906,11 +6944,45 @@ - osync_format_env_register_objformat(env, contact1_format); - osync_format_env_register_objformat(env, contact2_format); - osync_format_env_register_objformat(env, event_format); - osync_format_env_register_objformat(env, todo_format); - osync_format_env_register_objformat(env, note_format); + if (!osync_format_env_register_objformat(env, contact1_format, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_objformat() has failed.", __FILE__, __LINE__); + + goto error; + } + + if (!osync_format_env_register_objformat(env, contact2_format, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_objformat() has failed.", __FILE__, __LINE__); + + goto error; + } + + if (!osync_format_env_register_objformat(env, event_format, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_objformat() has failed.", __FILE__, __LINE__); + + goto error; + } + + if (!osync_format_env_register_objformat(env, todo_format, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_objformat() has failed.", __FILE__, __LINE__); + + goto error; + } + + if (!osync_format_env_register_objformat(env, note_format, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_objformat() has failed.", __FILE__, __LINE__); + + goto error; + } osync_objformat_unref(contact1_format); @@ -7014,7 +7086,14 @@ } #ifdef ENABLE_DETECTOR_FUNCTIONS - osync_format_env_register_converter(env, conv, error); + if (!osync_format_env_register_converter(env, conv, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_converter() has failed.", __FILE__, __LINE__); + + osync_converter_unref(conv); + goto error; + } #endif osync_converter_unref(conv); @@ -7055,7 +7134,15 @@ } /* register converter */ - osync_format_env_register_converter(env, conv, error); + if (!osync_format_env_register_converter(env, conv, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_converter() has failed.", __FILE__, __LINE__); + + osync_converter_unref(conv); + goto error; + } + osync_converter_unref(conv); osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Registering conversion from \"%s\" to \"%s\" for objtype \"%s\" with the converter function being located at address %p\n", __FILE__, __LINE__, __func__, format_name, other_format_name, objtype, converter1); @@ -7071,7 +7158,15 @@ } /* register converter */ - osync_format_env_register_converter(env, conv, error); + if (!osync_format_env_register_converter(env, conv, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_register_converter() has failed.", __FILE__, __LINE__); + + osync_converter_unref(conv); + goto error; + } + osync_converter_unref(conv); osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Registering conversion from \"%s\" to \"%s\" for objtype \"%s\" with the converter function being located at address %p\n", __FILE__, __LINE__, __func__, other_format_name, format_name, objtype, converter2); Modified: plugins/ldap-sync/src/ldap_format.h ============================================================================== --- plugins/ldap-sync/src/ldap_format.h Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_format.h Sat Sep 19 22:38:37 2009 (r5811) @@ -52,7 +52,7 @@ static osync_bool ldap_format_check_adequate_stylesheet(xmlNode *root_element, const char *stylesheet_file, OSyncError **error); static osync_bool ldap_format_check_root_element(const xmlDoc *xmldata, const char *objtype, const char *ldap_format_name, const gchar *dn, xmlNode **root, OSyncError **error); osync_bool ldap_format_check_xml(const char *data, int size, OSyncError **error); -static OSyncConvCmpResult ldap_format_compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data); +static OSyncConvCmpResult ldap_format_compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data, OSyncError **error); static osync_bool ldap_format_conv_ldap_event_to_xmlformat_event(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error); static osync_bool ldap_format_conv_ldap_evolutionperson_to_xmlformat_contact(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error); static osync_bool ldap_format_conv_ldap_note_to_xmlformat_note(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error); Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_plugin.c Sat Sep 19 22:38:37 2009 (r5811) @@ -3494,7 +3494,7 @@ } if (res != LDAP_SUCCESS && res != LDAP_ALREADY_EXISTS) { - ldap_plugin_compose_ldap_error_message(sinkenv, __FILE__, __LINE__, entry, NULL, change, res, error); + ldap_plugin_compose_ldap_error_message(sinkenv, __FILE__, __LINE__, entry, entry->dn, change, res, error); goto error; } else @@ -4233,8 +4233,18 @@ // Update latest_timestamp: time_t tt = time(NULL); if (tt) { - char *timestamp = osync_time_unix2vtime(&tt); + char *timestamp = osync_time_unix2vtime(&tt, &error); + + + if (osync_error_is_set(&error)) { + goto error; + } + + if (timestamp == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: timestamp = NULL.\n", __FILE__, __LINE__); + goto error; + } sinkenv->latest_timestamp = g_strdup(timestamp); if (timestamp) { @@ -4244,6 +4254,8 @@ } else { sinkenv->latest_timestamp = NULL; osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: tt = NULL.\n", __FILE__, __LINE__); + + goto error; } // Store it in state database. @@ -4977,7 +4989,15 @@ osync_plugin_set_discover(plugin, ldap_plugin_discover); - osync_plugin_env_register_plugin(env, plugin); + if (!osync_plugin_env_register_plugin(env, plugin, error)) + { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_plugin_env_register_plugin() has failed.", __FILE__, __LINE__); + + osync_plugin_unref(plugin); + goto error; + } + osync_plugin_unref(plugin); Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_plugin.h Sat Sep 19 22:38:37 2009 (r5811) @@ -491,7 +491,7 @@ void ldap_plugin_dump_ldap_attributes(const ldap_entry *ldapdata); void ldap_plugin_dump_ldap_entries(GList *data_buf); void ldap_plugin_dump_change(const OSyncChange *change); -void ldap_plugin_dump_ldap_error_message(const sink_environment *sinkenv, const char *base, const char *filter, const char *command); +void ldap_plugin_dump_ldap_error_message(const sink_environment *sinkenv, const char *file, const int line, const char *base, const char *filter, const char *command); void ldap_plugin_printf(const char *format, ...); char *ldap_plugin_report_ldap_error(const sink_environment *sinkenv, const char *file, const int line, const int result); void ldap_plugin_compose_ldap_error_message(sink_environment *sinkenv, const char *file, const int line, ldap_entry *entry, const char *dn, OSyncChange *change, int ldap_errno, OSyncError **error); Modified: plugins/ldap-sync/src/ldap_sasl.c ============================================================================== --- plugins/ldap-sync/src/ldap_sasl.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/src/ldap_sasl.c Sat Sep 19 22:38:37 2009 (r5811) @@ -376,7 +376,7 @@ osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_call_ldap_search() has failed.\n", __FILE__, __LINE__); - ldap_plugin_dump_ldap_error_message(sinkenv, "", "supportedSASLMechanisms", "ldap_plugin_call_ldap_search()"); + ldap_plugin_dump_ldap_error_message(sinkenv, __FILE__, __LINE__, "", "supportedSASLMechanisms", "ldap_plugin_call_ldap_search()"); goto error; } Modified: plugins/ldap-sync/tests/check_do_convert_from_to.c ============================================================================== --- plugins/ldap-sync/tests/check_do_convert_from_to.c Sat Sep 19 18:19:02 2009 (r5810) +++ plugins/ldap-sync/tests/check_do_convert_from_to.c Sat Sep 19 22:38:37 2009 (r5811) @@ -713,7 +713,14 @@ // Sort the format object: - osync_xmlformat_sort(xmlformat); + if (!osync_xmlformat_sort(xmlformat, error)) + { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_sort() has failed."); + } + + goto error; + } if (osync_xmlformat_is_sorted(xmlformat)) { osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced IS sorted.\n", __FILE__, __LINE__); @@ -822,7 +829,7 @@ converter_path = osync_format_env_find_path(format_env, sourceformat, targetformat, error); if (converter_path == NULL) { if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: converter_pathcould not be found for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: converter_pathcould not be found for sourceformat_name = \"%s\" and targetformat_name = \"%s\".", __FILE__, __LINE__, sourceformat_name, targetformat_name); goto error; } @@ -873,7 +880,7 @@ // Now, convert the data from sourceformat to targetformat if (!osync_format_env_convert(format_env, converter_path, *data, error)) { if (!osync_error_is_set(error)) - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: conversion could not be performed for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: conversion could not be performed for sourceformat_name = \"%s\" and targetformat_name = \"%s\".", __FILE__, __LINE__, sourceformat_name, targetformat_name); goto error; } @@ -1171,8 +1178,8 @@ // Care about the output - result = osync_data_get_printable(data); - if (result == NULL) { + result = osync_data_get_printable(data, &error); + if (result == NULL || osync_error_is_set(&error)) { char *buf = NULL; unsigned int buf_size = 0; |
From: <svn...@op...> - 2009-09-19 16:19:21
|
Author: cdfrey Date: Sat Sep 19 18:19:02 2009 New Revision: 5810 URL: http://www.opensync.org/changeset/5810 Log: Fixed osync_time_utcoffset2sec()'s mistaken reliance on sscanf() Tightened up checking for input format validation, according to the documented comments. Added an OSyncError parameter, for the error case. Added a test for osync_time_utcoffset2sec() -This line, and those below, will be ignored-- M opensync/format/opensync_time.h M opensync/format/opensync_time.c M tests/format-tests/check_time.c Modified: trunk/opensync/format/opensync_time.c trunk/opensync/format/opensync_time.h trunk/tests/format-tests/check_time.c Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sat Sep 19 00:46:49 2009 (r5809) +++ trunk/opensync/format/opensync_time.c Sat Sep 19 18:19:02 2009 (r5810) @@ -21,6 +21,7 @@ */ #include <time.h> +#include <ctype.h> #include "opensync.h" #include "opensync_time.h" @@ -627,19 +628,31 @@ return NULL; } -int osync_time_utcoffset2sec(const char *offset) +int osync_time_utcoffset2sec(const char *offset, OSyncError **error) { char csign = 0; int seconds = 0, sign = 1; int hours = 0, minutes = 0; osync_trace(TRACE_ENTRY, "%s(%s)", __func__, offset); - sscanf(offset, "%c%2d%2d", &csign, &hours, &minutes); - - if (csign == '-') - sign = -1; - - seconds = (hours * 3600 + minutes * 60) * sign; + // make sure the format of offset is what we expect: [-+][0-9]{4} + if( strlen(offset) >= 5 && + (offset[0] == '-' || offset[0] == '+') && + isdigit(offset[1]) && isdigit(offset[2]) && + isdigit(offset[3]) && isdigit(offset[4]) && + sscanf(offset, "%c%2d%2d", &csign, &hours, &minutes) == 3 ) + { + + if (csign == '-') + sign = -1; + + seconds = (hours * 3600 + minutes * 60) * sign; + + } + else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s: unable to parse utc offset into seconds: %s", __func__, offset); + osync_trace(TRACE_INTERNAL, "%s: unable to parse utc offset into seconds: %s", __func__, offset); + } osync_trace(TRACE_EXIT, "%s: %i", __func__, seconds); return seconds; Modified: trunk/opensync/format/opensync_time.h ============================================================================== --- trunk/opensync/format/opensync_time.h Sat Sep 19 00:46:49 2009 (r5809) +++ trunk/opensync/format/opensync_time.h Sat Sep 19 18:19:02 2009 (r5810) @@ -263,9 +263,11 @@ /** @brief Function converts UTC offset string in offset in seconds * * @param offset The offset string of the form a timezone field (Example +0200) - * @returns seconds of UTC offset + * @error An OSyncError struct + * @returns seconds of UTC offset. On error, osync_error_is_set(error) is + * true, and the return value is 0. */ -OSYNC_EXPORT int osync_time_utcoffset2sec(const char *offset); +OSYNC_EXPORT int osync_time_utcoffset2sec(const char *offset, OSyncError **error); /*@}*/ Modified: trunk/tests/format-tests/check_time.c ============================================================================== --- trunk/tests/format-tests/check_time.c Sat Sep 19 00:46:49 2009 (r5809) +++ trunk/tests/format-tests/check_time.c Sat Sep 19 18:19:02 2009 (r5810) @@ -211,9 +211,45 @@ } END_TEST +START_TEST (time_utc_offset) +{ + OSyncError *error = NULL; + int seconds; + + // UTC offset format is %c%2d%2d, i.e. +0200 + + // test missing lead char + osync_time_utcoffset2sec("0400", &error); + fail_unless(osync_error_is_set(&error), NULL); + osync_error_unref(&error); + error = NULL; + + // test missing numbers + osync_time_utcoffset2sec("-040", &error); + fail_unless(osync_error_is_set(&error), NULL); + osync_error_unref(&error); + error = NULL; + + // test correct operation [1] + seconds = osync_time_utcoffset2sec("-0400", &error); + fail_unless(!osync_error_is_set(&error), NULL); + fail_unless(seconds == -(4 * 60 * 60), NULL); + osync_error_unref(&error); + error = NULL; + + // test correct operation, with trailing chars [2] + seconds = osync_time_utcoffset2sec("-0400555", &error); + fail_unless(!osync_error_is_set(&error), NULL); + fail_unless(seconds == -(4 * 60 * 60), NULL); + osync_error_unref(&error); + error = NULL; +} +END_TEST + OSYNC_TESTCASE_START("time") OSYNC_TESTCASE_ADD(time_timezone_diff) OSYNC_TESTCASE_ADD(time_relative2tm) OSYNC_TESTCASE_ADD(time_unix_converters) +OSYNC_TESTCASE_ADD(time_utc_offset) OSYNC_TESTCASE_END |
From: <svn...@op...> - 2009-09-18 22:47:08
|
Author: cdfrey Date: Sat Sep 19 00:46:49 2009 New Revision: 5809 URL: http://www.opensync.org/changeset/5809 Log: Updated callbacks to use new OSyncError style API Modified: format-plugins/vformat/src/vnote.c Modified: format-plugins/vformat/src/vnote.c ============================================================================== --- format-plugins/vformat/src/vnote.c Sat Sep 19 00:22:53 2009 (r5808) +++ format-plugins/vformat/src/vnote.c Sat Sep 19 00:46:49 2009 (r5809) @@ -24,7 +24,7 @@ #include <glib.h> #include <string.h> -static OSyncConvCmpResult compare_vnote(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data) +static OSyncConvCmpResult compare_vnote(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize, void *user_data, OSyncError **error) { /* Consider empty block equal NULL pointers */ if (!leftsize) leftdata = NULL; @@ -53,9 +53,10 @@ return g_pattern_match_simple("*BEGIN:VNOTE*VERSION:1.1*", data); } -static void destroy_vnote(char *input, unsigned int inpsize, void *user_data) +static osync_bool destroy_vnote(char *input, unsigned int inpsize, void *user_data, OSyncError **error) { g_free(input); + return TRUE; } osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error) |
From: <svn...@op...> - 2009-09-18 22:23:13
|
Author: cdfrey Date: Sat Sep 19 00:22:53 2009 New Revision: 5808 URL: http://www.opensync.org/changeset/5808 Log: Clarified error return values in time function documentation Modified: trunk/opensync/format/opensync_time.c trunk/opensync/format/opensync_time.h Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Fri Sep 18 14:11:02 2009 (r5807) +++ trunk/opensync/format/opensync_time.c Sat Sep 19 00:22:53 2009 (r5808) @@ -482,8 +482,10 @@ return zonediff; error: osync_trace(TRACE_EXIT, "%s", __func__); - //TODO which value has to be returned in an error case? - return -1; + // Positive and negative values are valid here, so only + // osync_error_is_set(error) can tell if this is an error. + // Return 0 here as a random default. + return 0; } struct tm *osync_time_tm2utc(const struct tm *ltime, int offset, OSyncError **error) Modified: trunk/opensync/format/opensync_time.h ============================================================================== --- trunk/opensync/format/opensync_time.h Fri Sep 18 14:11:02 2009 (r5807) +++ trunk/opensync/format/opensync_time.h Sat Sep 19 00:22:53 2009 (r5808) @@ -87,7 +87,7 @@ * * @param vtime The formatted timestamp (YYYYMMDDTHHMMSS) * @param error An OSyncError struct - * @returns struct tm (caller is responsible for freeing) + * @returns struct tm (caller is responsible for freeing), NULL on error */ OSYNC_EXPORT struct tm *osync_time_vtime2tm(const char *vtime, OSyncError **error); @@ -122,7 +122,7 @@ * @param offset Seconds of UTC offset * @param vtime The osync formmatted timestamp * @param error An OSyncError struct - * @returns Unix timestamp in time_t (UTC) + * @returns Unix timestamp in time_t (UTC), ((time_t)-1) on error */ OSYNC_EXPORT time_t osync_time_vtime2unix(const char *vtime, int offset, OSyncError **error); @@ -143,7 +143,7 @@ * * @param localtime The struct tm, in localtime, which gets converted * @param error An OSyncError struct - * @returns time_t (in UTC of course) + * @returns time_t (in UTC of course), ((time_t)-1) on error */ OSYNC_EXPORT time_t osync_time_localtm2unix(const struct tm *localtime, OSyncError **error); @@ -151,7 +151,7 @@ * * @param utctime The struct tm, in utc, which gets converted * @param error An OSyncError struct - * @returns time_t (in UTC of course) + * @returns time_t (in UTC of course), ((time_t)-1) on error * * This algorithm abuses the POSIX time functions, only because * there seems to be no standard API to do this more simply. @@ -170,7 +170,8 @@ * * @param timestamp The unixtimestamp which gets converted * @param error An OSyncError struct - * @returns: struct tm (in localtime) (Caller is responsible for freeing!) + * @returns: struct tm (in localtime) (Caller is responsible for freeing!), + * NULL on error */ OSYNC_EXPORT struct tm *osync_time_unix2localtm(const time_t *timestamp, OSyncError **error); @@ -180,7 +181,7 @@ * * @param timestamp The unixtimestamp which gets converted * @paran error An OSyncError struct - * @returns: struct tm (in UTC) (Caller is responsible for freeing) + * @returns: struct tm (in UTC) (Caller is responsible for freeing), NULL on error */ OSYNC_EXPORT struct tm *osync_time_unix2utctm(const time_t *timestamp, OSyncError **error); @@ -207,9 +208,10 @@ * * @param local The point in time when the offset have to be calculated, * specified in localtime (need for CEST/CET) - * @param error An OSyncError struct. Always check if error is set before - * using the return value - * @return Seconds of timezone offset + * @param error An OSyncError struct. Always check if error is set using + * osync_error_is_set(error) before using the return value + * @return Seconds of timezone offset. On error, sets the error parameter, + * and the return value cannot be relied upon. */ OSYNC_EXPORT int osync_time_timezone_diff(const struct tm *local, OSyncError **error); @@ -221,7 +223,7 @@ * @param ltime The struct tm which gets converted to UTC timezone * @param offset Seconds of UTC offset, in seconds east of UTC. * @param error An OSyncError struct - * @returns struct tm in UTC (caller is responsible for freeing) + * @returns struct tm in UTC (caller is responsible for freeing), NULL on error */ OSYNC_EXPORT struct tm *osync_time_tm2utc(const struct tm *ltime, int offset, OSyncError **error); @@ -233,7 +235,8 @@ * @param utime The struct tm which gets converted to localtime * @param offset Seconds of UTC offset, in seconds east of UTC. * @param error An OSyncError struct - * @returns struct tm in localtime (caller is responsible for freeing) + * @returns struct tm in localtime (caller is responsible for freeing), + * NULL on error */ OSYNC_EXPORT struct tm *osync_time_tm2localtime(const struct tm *utime, int offset, OSyncError **error); @@ -242,7 +245,8 @@ * @param localtime The local timestamp in vtime format * @param offset Seconds of UTC offset, in seconds east of UTC. * @param error An OSyncError struct - * @returns vtime in UTC timezone (caller is responsible for freeing) + * @returns vtime in UTC timezone (caller is responsible for freeing), + * NULL on error */ OSYNC_EXPORT char *osync_time_vtime2utc(const char* localtime, int offset, OSyncError **error); @@ -251,7 +255,8 @@ * @param utc The timestap in UTC timezone which gets converted to localtime * @param offset The offset in seconds between UTC and localtime * @param error An OSyncError struct - * @returns vtime in local timezon (caller is preponsible for freeing) + * @returns vtime in local timezon (caller is preponsible for freeing), + * NULL on error */ OSYNC_EXPORT char *osync_time_vtime2localtime(const char* utc, int offset, OSyncError **error); @@ -282,7 +287,8 @@ * * @param vcal The vcalendar which has to be converted. * @param error An OSyncError struct - * @return modified vcalendar with local timestamps (related to system time) + * @return modified vcalendar with local timestamps (related to system time). + * Rely on error to detect error, not return value. */ OSYNC_EXPORT char *osync_time_vcal2localtime(const char *vcal, OSyncError **error); @@ -290,7 +296,8 @@ * * @param vcal The vcalendar which has to be converted. * @param error An OSyncError struct - * @return modified vcalendar with UTC timestamps (related to system time) + * @return modified vcalendar with UTC timestamps (related to system time) + * Rely on error to detect error, not return value. */ OSYNC_EXPORT char *osync_time_vcal2utc(const char *vcal, OSyncError **error); |
From: <svn...@op...> - 2009-09-18 12:11:16
|
Author: bricks Date: Fri Sep 18 14:11:02 2009 New Revision: 5807 URL: http://www.opensync.org/changeset/5807 Log: don't free dbus structs in tomboy-sync finalize Modified: plugins/tomboy-sync/src/tomboy_sync.c plugins/tomboy-sync/src/tomboy_sync_dbus.c plugins/tomboy-sync/src/tomboy_sync_dbus.h Modified: plugins/tomboy-sync/src/tomboy_sync.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.c Fri Sep 18 14:09:31 2009 (r5806) +++ plugins/tomboy-sync/src/tomboy_sync.c Fri Sep 18 14:11:02 2009 (r5807) @@ -215,8 +215,8 @@ OSyncTomboyEnv *tomboyenv; tomboyenv = (OSyncTomboyEnv*)data; - osync_free(tomboyenv->connection); - osync_free(tomboyenv->proxy); + osync_tomboysync_dbus_finalize(tomboyenv); + } /* Here we actually tell opensync which sinks are available. For this plugin, we Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.c Fri Sep 18 14:09:31 2009 (r5806) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.c Fri Sep 18 14:11:02 2009 (r5807) @@ -448,3 +448,8 @@ osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); osync_error_unref(&error); } + +void osync_tomboysync_dbus_finalize(OSyncTomboyEnv *env) { + osync_assert(env); + dbus_g_connection_unref(tomboyenv->connection); +} Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.h Fri Sep 18 14:09:31 2009 (r5806) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.h Fri Sep 18 14:11:02 2009 (r5807) @@ -32,6 +32,7 @@ void osync_tomboysync_dbus_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); osync_bool osync_tomboysync_dbus_initalize(OSyncTomboyEnv *tomboyenv, OSyncError **error); +void osync_tomboysync_dbus_finalize(OSyncTomboyEnv *env); void osync_tomboysync_dbus_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); |
From: <svn...@op...> - 2009-09-18 12:09:51
|
Author: bricks Date: Fri Sep 18 14:09:31 2009 New Revision: 5806 URL: http://www.opensync.org/changeset/5806 Log: added some error checks for tomboy-note osync_xmlfield_set_key_value doesn't create a xml tag if value is "" Modified: format-plugins/tomboy-note/src/tomboy_note.c format-plugins/tomboy-note/src/tomboy_note_internal.h format-plugins/tomboy-note/tests/parser_test.c Modified: format-plugins/tomboy-note/src/tomboy_note.c ============================================================================== --- format-plugins/tomboy-note/src/tomboy_note.c Fri Sep 18 10:44:28 2009 (r5805) +++ format-plugins/tomboy-note/src/tomboy_note.c Fri Sep 18 14:09:31 2009 (r5806) @@ -223,7 +223,7 @@ } } -void tomboynote_parse_content(xmlDocPtr doc, GString * output) { +void tomboynote_parse_content(xmlDocPtr doc, GString * output, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s (%p,%p)", __func__, doc, output); osync_assert(doc); @@ -237,13 +237,12 @@ xpathCtx = xmlXPathNewContext(doc); if (xpathCtx == NULL) { - osync_trace(TRACE_EXIT, "%s", __func__); - return; + osync_error_set(error, OSYNC_ERROR_GENERIC, "could not initialize xml xpath context for tomboy-format"); + goto error; } if( xmlXPathRegisterNs(xpathCtx, BAD_CAST "tomboy", BAD_CAST "http://beatniksoftware.com/tomboy") != 0 ) { - xmlXPathFreeContext(xpathCtx); - osync_trace(TRACE_EXIT, "%s", __func__); - return; + osync_error_set(error, OSYNC_ERROR_GENERIC, "could not register xml namespace for tomboy-format"); + goto error_free_xpath; } xpathObj = xmlXPathEvalExpression(BAD_CAST "/tomboy:note/tomboy:text/tomboy:note-content/node()", xpathCtx); if ( xpathObj != NULL ) { @@ -255,8 +254,20 @@ tomboynote_parse_content_node(cur, output); } } + else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "could not apply xml xpath for tomboy-format. couldn't find note-content tag."); + goto error_free_xpath; + } + xmlXPathFreeContext(xpathCtx); osync_trace(TRACE_EXIT, "%s", __func__); + return; + +error_free_xpath: + xmlXPathFreeContext(xpathCtx); +error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return; } // converter functions @@ -277,7 +288,9 @@ if (!data) { return FALSE; } - + + osync_trace(TRACE_SENSITIVE, "... Input tomboy-note is: \n%s", data); + ctxt = xmlNewParserCtxt(); if ( ctxt == NULL ) { osync_trace(TRACE_EXIT, "%s", __func__); @@ -311,9 +324,17 @@ } // parse content as description - tomboynote_parse_content(doc, str); + tomboynote_parse_content(doc, str, error); + char * content = str->str; + /* sanity check + /* if content is null or strlen is 0 then osync_xmlfield_set_key_value + * doesn't create an new xml tag + */ + if (!content || strlen(content) == 0 ) { + content = " "; + } xmlfield = osync_xmlfield_new(xmlformat, "Description", error); - osync_xmlfield_set_key_value(xmlfield, "Content", str->str, error); + osync_xmlfield_set_key_value(xmlfield, "Content", content, error); //parse last-change-date as lastmodified node_data = tomboynote_parse_node(doc, "last-change-date"); @@ -395,8 +416,8 @@ unsigned int size; char *str; osync_xmlformat_assemble(xmlformat, &str, &size, error); - osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); -// osync_trace(TRACE_SENSITIVE, "Input XMLFormat is:\n%s", str); +// osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); + osync_trace(TRACE_SENSITIVE, "Input XMLFormat is:\n%s", str); g_free(str); //TODO: always free old content_text @@ -480,6 +501,8 @@ goto error; } + osync_trace(TRACE_SENSITIVE, "... Output tomboy-note is:\n%s", *output); + osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; error: Modified: format-plugins/tomboy-note/src/tomboy_note_internal.h ============================================================================== --- format-plugins/tomboy-note/src/tomboy_note_internal.h Fri Sep 18 10:44:28 2009 (r5805) +++ format-plugins/tomboy-note/src/tomboy_note_internal.h Fri Sep 18 14:09:31 2009 (r5806) @@ -34,7 +34,7 @@ }; void tomboynote_parse_content_node(xmlNodePtr node, GString * output); -void tomboynote_parse_content(xmlDocPtr doc, GString * output); +void tomboynote_parse_content(xmlDocPtr doc, GString * output, OSyncError **error); const char * tomboynote_parse_node(xmlDocPtr doc, const char * nodename); GList * tomboynote_parse_tags(xmlDocPtr doc); Modified: format-plugins/tomboy-note/tests/parser_test.c ============================================================================== --- format-plugins/tomboy-note/tests/parser_test.c Fri Sep 18 10:44:28 2009 (r5805) +++ format-plugins/tomboy-note/tests/parser_test.c Fri Sep 18 14:09:31 2009 (r5806) @@ -86,9 +86,10 @@ START_TEST (tomboynote_test_parse_content) { GString *str; + OSyncError *error = NULL; str = g_string_new(""); - tomboynote_parse_content(good_doc, str); + tomboynote_parse_content(good_doc, str, &error); //printf("Good: len %d %s\n", str->len, str->str ); g_string_free(str,TRUE); |
From: <svn...@op...> - 2009-09-18 08:44:42
|
Author: bricks Date: Fri Sep 18 10:44:28 2009 New Revision: 5805 URL: http://www.opensync.org/changeset/5805 Log: adapted tomboy-sync to latest api changes tomboy-sync requires now dbus Modified: plugins/tomboy-sync/CMakeLists.txt plugins/tomboy-sync/src/CMakeLists.txt plugins/tomboy-sync/src/tomboy-sync plugins/tomboy-sync/src/tomboy_sync.c plugins/tomboy-sync/src/tomboy_sync.h plugins/tomboy-sync/src/tomboy_sync_dbus.c plugins/tomboy-sync/src/tomboy_sync_dbus.h Modified: plugins/tomboy-sync/CMakeLists.txt ============================================================================== --- plugins/tomboy-sync/CMakeLists.txt Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/CMakeLists.txt Fri Sep 18 10:44:28 2009 (r5805) @@ -4,7 +4,7 @@ SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" ) -SET( OPENSYNC_MIN_VERSION "0.37" ) +SET( OPENSYNC_MIN_VERSION "0.38" ) CMAKE_MINIMUM_REQUIRED( VERSION 2.4.4 ) @@ -12,8 +12,8 @@ FIND_PACKAGE( GLIB2 REQUIRED ) FIND_PACKAGE( LibXml2 REQUIRED ) FIND_PACKAGE( LibUuid REQUIRED ) -FIND_PACKAGE( LibDbus ) -FIND_PACKAGE( LibDbusGlib ) +FIND_PACKAGE( LibDbus REQUIRED ) +FIND_PACKAGE( LibDbusGlib REQUIRED ) INCLUDE( OpenSyncInternal ) INCLUDE( Testing ) @@ -22,8 +22,6 @@ OPTION( ENABLE_DBUS "Enable DBus" ON ) ENDIF ( LIBDBUSGLIB_FOUND AND LIBDBUS_FOUND ) -CONFIGURE_FILE( "config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) - # add uninstall target CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) Modified: plugins/tomboy-sync/src/CMakeLists.txt ============================================================================== --- plugins/tomboy-sync/src/CMakeLists.txt Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/CMakeLists.txt Fri Sep 18 10:44:28 2009 (r5805) @@ -1,11 +1,7 @@ LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBUUID_LIBRARY_DIRS} ${LIBDBUS_LIBRARY_DIRS} ${LIBDBUSGLIB_LIBRARY_DIRS} ) INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBUUID_INCLUDE_DIRS} ${LIBDBUS_INCLUDE_DIRS} ${LIBDBUSGLIB_INCLUDE_DIRS} ) -SET( TOMBOY_SYNC_SRC tomboy_sync.c tomboy_sync_file.c ) - -IF ( ENABLE_DBUS ) - SET ( TOMBOY_SYNC_SRC ${TOMBOY_SYNC_SRC} tomboy_sync_dbus.c ) -ENDIF( ENABLE_DBUS ) +SET( TOMBOY_SYNC_SRC tomboy_sync.c tomboy_sync_dbus.c ) OPENSYNC_PLUGIN_ADD( tomboy-sync ${TOMBOY_SYNC_SRC} ) Modified: plugins/tomboy-sync/src/tomboy-sync ============================================================================== --- plugins/tomboy-sync/src/tomboy-sync Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/tomboy-sync Fri Sep 18 10:44:28 2009 (r5805) @@ -1,14 +1,5 @@ <?xml version="1.0"?> <config version="1.0"> - <AdvancedOptions> - <AdvancedOption> - <!-- Use Dbus for synchronisation of Tomboy. Set "true" to enable dbus --> - <DisplayName>Enable Dbus</DisplayName> - <Name>UseDbus</Name> - <Type>bool</Type> - <Value>true</Value> - </AdvancedOption> - </AdvancedOptions> <Resources> <Resource> <Enabled>1</Enabled> Modified: plugins/tomboy-sync/src/tomboy_sync.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.c Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/tomboy_sync.c Fri Sep 18 10:44:28 2009 (r5805) @@ -18,14 +18,11 @@ * */ -#include "config.h" - #include "tomboy_sync.h" #include <opensync/opensync-version.h> #include <uuid/uuid.h> -#include "tomboy_sync_file.h" #include "tomboy_sync_dbus.h" static void free_dir(OSyncTomboyDir *dir) @@ -140,8 +137,6 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, info, error); - osync_bool usedbus = FALSE; - OSyncTomboyEnv *tomboyenv = osync_try_malloc0(sizeof(OSyncTomboyEnv), error); if (!tomboyenv) { goto error; @@ -150,20 +145,6 @@ OSyncPluginConfig *config = osync_plugin_info_get_config(info); osync_assert(config); - OSyncList *optslist = osync_plugin_config_get_advancedoptions(config); - for (; optslist; optslist = optslist->next) { - OSyncPluginAdvancedOption *option = optslist->data; - - const char *val = osync_plugin_advancedoption_get_value(option); - const char *name = osync_plugin_advancedoption_get_name(option); - osync_assert(name); - osync_assert(val); - if (!strcmp(name,"UseDbus")) { - if (!strcmp(val, "true")) { - usedbus = TRUE; - } - } - } OSyncList *objtypes = osync_plugin_info_get_objtype_sinks(info); OSyncList *o = NULL; for (o = objtypes; o; o = o->next) { @@ -199,26 +180,11 @@ } /* All sinks have the same functions of course */ -#ifdef ENABLE_DBUS - if ( usedbus ) { - osync_trace(TRACE_INTERNAL, "using dbus for sync."); - osync_objtype_sink_set_connect_func(dir->sink, osync_tomboysync_dbus_connect); - osync_objtype_sink_set_get_changes_func(dir->sink, osync_tomboysync_dbus_get_changes); - osync_objtype_sink_set_commit_func(dir->sink, osync_tomboysync_dbus_commit_change); - osync_objtype_sink_set_read_func(dir->sink, osync_tomboysync_dbus_read); - osync_objtype_sink_set_sync_done_func(dir->sink, osync_tomboysync_dbus_sync_done); - } - else { -#endif /* ENABLE_DBUS */ - osync_trace(TRACE_INTERNAL, "using file for sync."); - osync_objtype_sink_set_connect_func(dir->sink, osync_tomboysync_file_connect); - osync_objtype_sink_set_get_changes_func(dir->sink, osync_tomboysync_file_get_changes); - osync_objtype_sink_set_commit_func(dir->sink, osync_tomboysync_file_commit_change); - osync_objtype_sink_set_read_func(dir->sink, osync_tomboysync_file_read); - osync_objtype_sink_set_sync_done_func(dir->sink, osync_tomboysync_file_sync_done); -#ifdef ENABLE_DBUS - } -#endif /* ENABLE_DBUS */ + osync_objtype_sink_set_connect_func(dir->sink, osync_tomboysync_dbus_connect); + osync_objtype_sink_set_get_changes_func(dir->sink, osync_tomboysync_dbus_get_changes); + osync_objtype_sink_set_commit_func(dir->sink, osync_tomboysync_dbus_commit_change); + osync_objtype_sink_set_read_func(dir->sink, osync_tomboysync_dbus_read); + osync_objtype_sink_set_sync_done_func(dir->sink, osync_tomboysync_dbus_sync_done); /* We pass the OSyncTomboyDir object to the sink, so we dont have to look it up * again once the functions are called */ @@ -230,11 +196,6 @@ /* Enable Anchors */ osync_objtype_sink_enable_state_db(dir->sink, TRUE); - if ( !usedbus ) { - if (!osync_tomboysync_file_initalize(tomboyenv, error)) { - goto error; - } - } } osync_trace(TRACE_EXIT, "%s: %p", __func__); @@ -253,10 +214,9 @@ } OSyncTomboyEnv *tomboyenv; tomboyenv = (OSyncTomboyEnv*)data; -#ifdef ENABLE_DBUS + osync_free(tomboyenv->connection); osync_free(tomboyenv->proxy); -#endif } /* Here we actually tell opensync which sinks are available. For this plugin, we @@ -300,14 +260,13 @@ osync_plugin_set_finalize(plugin, osync_tomboysync_finalize); osync_plugin_set_discover(plugin, osync_tomboysync_discover); - osync_plugin_env_register_plugin(env, plugin); + osync_plugin_env_register_plugin(env, plugin, error); osync_plugin_unref(plugin); return TRUE; error: - osync_trace(TRACE_ERROR, "Unable to register: %s", osync_error_print(error)); - osync_error_unref(error); + osync_trace(TRACE_ERROR, "Unable to register tomboy-sync plugin: %s", osync_error_print(error)); return FALSE; } Modified: plugins/tomboy-sync/src/tomboy_sync.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.h Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/tomboy_sync.h Fri Sep 18 10:44:28 2009 (r5805) @@ -35,18 +35,13 @@ #include <libxml/xmlmemory.h> #include <libxml/parser.h> -#ifdef ENABLE_DBUS - #include <dbus/dbus.h> #include <dbus/dbus-glib.h> -#endif /* ENABLE_DBUS */ typedef struct OSyncTomboyEnv { -#ifdef ENABLE_DBUS DBusGConnection *connection; DBusGProxy *proxy; -#endif /* ENABLE_DBUS */ const char *homedir_path; } OSyncTomboyEnv; Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.c Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.c Fri Sep 18 10:44:28 2009 (r5805) @@ -18,13 +18,9 @@ * */ -#include "config.h" - #include "tomboy_sync.h" #include "tomboy_sync_dbus.h" -#ifdef ENABLE_DBUS - char * osync_tomboysync_noteuri_to_uuid(char *noteuri) { GString *guid; char *uuid; @@ -452,6 +448,3 @@ osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); osync_error_unref(&error); } - -#endif /* ENABLE_DBUS */ - Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.h Fri Sep 18 10:18:41 2009 (r5804) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.h Fri Sep 18 10:44:28 2009 (r5805) @@ -21,8 +21,6 @@ #ifndef TOMBOY_SYNC_DBUS_H_ #define TOMBOY_SYNC_DBUS_H_ -#ifdef ENABLE_DBUS - #define TOMBOY_DBUS_NAME "org.gnome.Tomboy" #define TOMBOY_DBUS_PATH "/org/gnome/Tomboy/RemoteControl" #define TOMBOY_DBUS_INTERFACE "org.gnome.Tomboy.RemoteControl" @@ -31,12 +29,10 @@ void osync_tomboysync_dbus_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); void osync_tomboysync_dbus_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata); osync_bool osync_tomboysync_dbus_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); -osync_bool osync_tomboysync_dbus_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); +void osync_tomboysync_dbus_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); osync_bool osync_tomboysync_dbus_initalize(OSyncTomboyEnv *tomboyenv, OSyncError **error); void osync_tomboysync_dbus_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); -#endif /* ENABLE_DBUS */ - #endif /* TOMBOY_SYNC_DBUS_H_ */ |
From: <svn...@op...> - 2009-09-18 08:18:57
|
Author: bricks Date: Fri Sep 18 10:18:41 2009 New Revision: 5804 URL: http://www.opensync.org/changeset/5804 Log: Adapted tomboy-note to latest api changes Modified: format-plugins/tomboy-note/src/tomboy_note.c Modified: format-plugins/tomboy-note/src/tomboy_note.c ============================================================================== --- format-plugins/tomboy-note/src/tomboy_note.c Fri Sep 18 09:49:51 2009 (r5803) +++ format-plugins/tomboy-note/src/tomboy_note.c Fri Sep 18 10:18:41 2009 (r5804) @@ -298,14 +298,14 @@ if ( list_tags != NULL ) { xmlfield = osync_xmlfield_new(xmlformat, "Categories", error); for ( list_tag = g_list_first(list_tags); list_tag != NULL; list_tag = list_tag->next ) { - osync_xmlfield_add_key_value(xmlfield, "Category", list_tag->data); + osync_xmlfield_add_key_value(xmlfield, "Category", list_tag->data, error); } } // parse create-date as created node_data = tomboynote_parse_node(doc, "create-date"); if ( node_data != NULL ) { xmlfield = osync_xmlfield_new(xmlformat, "Created", error); - osync_xmlfield_set_key_value(xmlfield, "Content", node_data); + osync_xmlfield_set_key_value(xmlfield, "Content", node_data, error); osync_xmlfield_set_attr(xmlfield, "Value", "DATE-TIME"); osync_xmlfield_set_attr(xmlfield, "TimezoneID", "UTC" ); //TODO get timezone info } @@ -313,13 +313,13 @@ // parse content as description tomboynote_parse_content(doc, str); xmlfield = osync_xmlfield_new(xmlformat, "Description", error); - osync_xmlfield_set_key_value(xmlfield, "Content", str->str); + osync_xmlfield_set_key_value(xmlfield, "Content", str->str, error); //parse last-change-date as lastmodified node_data = tomboynote_parse_node(doc, "last-change-date"); if ( node_data != NULL ) { xmlfield = osync_xmlfield_new(xmlformat, "LastModified", error); - osync_xmlfield_set_key_value(xmlfield, "Content", node_data); + osync_xmlfield_set_key_value(xmlfield, "Content", node_data, error); osync_xmlfield_set_attr(xmlfield, "Value", "DATE-TIME"); osync_xmlfield_set_attr(xmlfield, "TimezoneID", "UTC" ); //TODO get timezone info } @@ -328,15 +328,15 @@ node_data = tomboynote_parse_node(doc, "title"); if ( node_data != NULL ) { xmlfield = osync_xmlfield_new(xmlformat, "Summary", error); - osync_xmlfield_set_key_value(xmlfield, "Content", node_data); + osync_xmlfield_set_key_value(xmlfield, "Content", node_data, error); } // debug output unsigned int size; char *cstr; - osync_xmlformat_assemble(xmlformat, &cstr, &size); + osync_xmlformat_assemble(xmlformat, &cstr, &size, error); //TODO xmlformat should be sorted automatically - osync_xmlformat_sort(xmlformat); + osync_xmlformat_sort(xmlformat, error); osync_trace(TRACE_SENSITIVE, "... Output XMLFormat is: \n%s", cstr); *free_input = TRUE; *output = (char *)xmlformat; @@ -394,7 +394,7 @@ OSyncXMLFormat *xmlformat = (OSyncXMLFormat *)input; unsigned int size; char *str; - osync_xmlformat_assemble(xmlformat, &str, &size); + osync_xmlformat_assemble(xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); // osync_trace(TRACE_SENSITIVE, "Input XMLFormat is:\n%s", str); g_free(str); @@ -499,9 +499,10 @@ // format functions -static void destroy_tomboynote(char *input, unsigned int inpsize, void *user_data) +static osync_bool destroy_tomboynote(char *input, unsigned int inpsize, void *user_data, OSyncError **error) { g_free(input); + return TRUE; } osync_bool validate_tomboynote(const char *data, unsigned int size, void *user_data, OSyncError **error) @@ -547,7 +548,7 @@ return FALSE; } -static void create_tomboynote(char **data, unsigned int *size, void *user_data) { +static osync_bool create_tomboynote(char **data, unsigned int *size, void *user_data, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s (%p,%p)", __func__, data, size); xmlNsPtr ns; @@ -564,13 +565,23 @@ xmlDocDumpFormatMemory(doc, (xmlChar **)data, (int *)size, 1); if (!*data) { - osync_trace(TRACE_ERROR, "%s: Unable to create tomboy-note %s", __func__); + goto error; } xmlFreeDoc(doc); xmlFreeNode(node); xmlFreeNs(ns); osync_trace(TRACE_EXIT, "%s", __func__ ); + return TRUE; +error: + xmlFreeDoc(doc); + xmlFreeNode(node); + xmlFreeNs(ns); + + osync_error_set(error, OSYNC_ERROR_CONVERT, "Unable to create tomboy-note from xmlformat"); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + + return FALSE; } /* @@ -603,7 +614,7 @@ osync_objformat_set_demarshal_func(format, demarshal_xmlformat); */ - osync_format_env_register_objformat(env, format); + osync_format_env_register_objformat(env, format, error); osync_objformat_unref(format); return TRUE; |
From: <svn...@op...> - 2009-09-18 07:50:02
|
Author: bricks Date: Fri Sep 18 09:49:51 2009 New Revision: 5803 URL: http://www.opensync.org/changeset/5803 Log: Fixed the example format plugin for converter finalize api changes Modified: trunk/docs/examples/plugins/src/format.c Modified: trunk/docs/examples/plugins/src/format.c ============================================================================== --- trunk/docs/examples/plugins/src/format.c Fri Sep 18 09:41:01 2009 (r5802) +++ trunk/docs/examples/plugins/src/format.c Fri Sep 18 09:49:51 2009 (r5803) @@ -198,7 +198,7 @@ return (void*)userdata; } -void finalize_converter(void *userdata) +osync_bool finalize_converter(void *userdata, OSyncError **error) { /* * Here you can free all your converter specific data. @@ -206,6 +206,11 @@ converter_data *converterdata = (converter_data*)userdata; osync_free(converterdata->data); osync_free(converterdata); + + /* + * return TRUE if the conversion was successful + */ + return TRUE; } osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error) |
From: <svn...@op...> - 2009-09-18 07:41:19
|
Author: dgollub Date: Fri Sep 18 09:41:01 2009 New Revision: 5802 URL: http://www.opensync.org/changeset/5802 Log: Don't unref the error in get_sync_info() Spotted by Chris Frey Modified: trunk/docs/examples/plugins/src/plugin.c trunk/docs/examples/plugins/src/simple_plugin.c Modified: trunk/docs/examples/plugins/src/plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/plugin.c Fri Sep 18 09:22:14 2009 (r5801) +++ trunk/docs/examples/plugins/src/plugin.c Fri Sep 18 09:41:01 2009 (r5802) @@ -416,7 +416,6 @@ return TRUE; error: osync_trace(TRACE_ERROR, "Unable to register: %s", osync_error_print(error)); - osync_error_unref(error); return FALSE; } Modified: trunk/docs/examples/plugins/src/simple_plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/simple_plugin.c Fri Sep 18 09:22:14 2009 (r5801) +++ trunk/docs/examples/plugins/src/simple_plugin.c Fri Sep 18 09:41:01 2009 (r5802) @@ -336,7 +336,6 @@ return TRUE; error: osync_trace(TRACE_ERROR, "Unable to register: %s", osync_error_print(error)); - osync_error_unref(error); return FALSE; } |