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-01-25 19:57:12
|
Author: scriptor Date: Mon Jan 25 20:57:02 2010 New Revision: 6024 URL: http://www.opensync.org/changeset/6024 Log: The FindLibXslt.cmake and FindLibXml2.cmake from cmake version 2.6.4 use LIBXML2_INCLUDE_DIR rather than LIBXML2_INCLUDE_DIRS and LIBXSLT_INCLUDE_DIR rather than LIBXSLT_INCLUDE_DIRS. I have added the new name and left the old one to keep backwards-compatibility. Modified: plugins/ldap-sync/misc/CMakeLists.txt plugins/ldap-sync/src/CMakeLists.txt Modified: plugins/ldap-sync/misc/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/misc/CMakeLists.txt Mon Jan 25 20:56:09 2010 (r6023) +++ plugins/ldap-sync/misc/CMakeLists.txt Mon Jan 25 20:57:02 2010 (r6024) @@ -22,7 +22,8 @@ LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ) -INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ) +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} +${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ) INCLUDE( Compiler ) Modified: plugins/ldap-sync/src/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/src/CMakeLists.txt Mon Jan 25 20:56:09 2010 (r6023) +++ plugins/ldap-sync/src/CMakeLists.txt Mon Jan 25 20:57:02 2010 (r6024) @@ -43,10 +43,10 @@ IF (LIBSASL2_FOUND) LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ${_LDAP_LIBRARY_DIRS} ${SASL2_LIBRARY_DIRS} ${GSSAPIV2_LIBRARY_DIRS}) - INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ${_LDAP_INCLUDE_DIRS} ${SASL2_INCLUDE_DIRS} ${GSSAPIV2_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} ${_LDAP_INCLUDE_DIRS} ${SASL2_INCLUDE_DIRS} ${GSSAPIV2_INCLUDE_DIRS}) ELSE (LIBSASL2_FOUND) LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ${_LDAP_LIBRARY_DIRS} ${GSSAPIV2_LIBRARY_DIRS}) - INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ${_LDAP_INCLUDE_DIRS} ${GSSAPIV2_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} ${_LDAP_INCLUDE_DIRS} ${GSSAPIV2_INCLUDE_DIRS}) ENDIF (LIBSASL2_FOUND) INCLUDE( Compiler ) |
From: <svn...@op...> - 2010-01-25 19:56:19
|
Author: scriptor Date: Mon Jan 25 20:56:09 2010 New Revision: 6023 URL: http://www.opensync.org/changeset/6023 Log: Forgot one argument in osync_trace command. Modified: plugins/ldap-sync/src/ldap_connect.c Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Mon Jan 25 20:56:01 2010 (r6022) +++ plugins/ldap-sync/src/ldap_connect.c Mon Jan 25 20:56:09 2010 (r6023) @@ -4646,7 +4646,7 @@ osync_bool found_attribute = FALSE; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, (void *)entry, (void *)ldap_attribute, (void *)error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, (void *)entry, (void *)ldap_attribute, (void *)value, (void *)error); if (entry == NULL) { @@ -4693,8 +4693,8 @@ // Supplement it, if necessary if (!found_attribute) { - GList *new_set_of_mods = NULL; #ifndef CALL_ABORT + GList *new_set_of_mods = NULL; int j = 0; #endif |
From: <svn...@op...> - 2010-01-25 19:56:11
|
Author: scriptor Date: Mon Jan 25 20:56:01 2010 New Revision: 6022 URL: http://www.opensync.org/changeset/6022 Log: Fixed a bug in the destroy function. Corrected the lines enclosed by the HANDLE_OSYNC_XMLFORMAT define. If multiple entries are to be synchronized, libopensync has difficulties, that in the end can even lead to segmentation faults. In these situations it happens, that the ldap_format plugin gets provided with unexpected types of formats. Enabling HANDLE_OSYNC_XMLFORMAT would allow for the detection of an LDAP related format inside of an OSyncXMLFormat struct. Finally, I have reenabled the HANDLE_OSYNC_XMLFORMAT define. At least for the time being... Modified: plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sat Jan 23 18:33:22 2010 (r6021) +++ plugins/ldap-sync/src/ldap_format.c Mon Jan 25 20:56:01 2010 (r6022) @@ -148,11 +148,15 @@ ((LDAPMod *)(list->data))->mod_bvalues = NULL; } - g_free(list->data); // this is an LDAPMod... So g_free() maybe insufficient? - list->data = NULL; - } + memset(list->data, 0, sizeof(LDAPMod *)); - } + g_free(list->data); // this is an LDAPMod... So g_free() may be insufficient? + // seg faults, even without that preceding memset(): + // ldap_mods_free((LDAPMod **)&(list->data), 0); + + list->data = NULL; + } // if (list->data) + } // for (list = g_list_first(ldapmods) g_list_free(ldapmods); @@ -633,7 +637,7 @@ gsize n = len > 1024 ? len : 1024; (*destination_entry)->dn = g_strndup(source_entry->dn, n); } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: source_entry->dn = NULL. Ignoring.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: source_entry->dn = NULL. Ignoring.\n", __FILE__, __LINE__); (*destination_entry)->dn = NULL; } @@ -6292,6 +6296,22 @@ goto error; } + + // We do not really know, what input exactly is. So any cast is dangerous. + // It SHOULD be a glist_container. Well, who knows... + if (inpsize != sizeof(glist_container)) { + +#ifdef CALL_ABORT + osync_trace(TRACE_ERROR, "%s:%i: ERROR: inpsize = %u. Calling abort()\n", __FILE__, __LINE__, inpsize); + ldap_plugin_printf("%s:%i: ERROR: inpsize = %u. Calling abort()\n", __FILE__, __LINE__, inpsize); + abort(); +#else + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i:%s(): ERROR: inpsize = %i.\n", __FILE__, __LINE__, __func__, inpsize); + goto error; +#endif + } + + if (strncmp(real_input->magic, "glist_container", 15)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input was NOT the glist_container that had been expected here in this function.", __FILE__, __LINE__); goto error; @@ -6357,13 +6377,16 @@ } // for (i = 0; i < length; i++) + osync_assert(pre_output != NULL); *output = (char *) pre_output; - *outpsize = sizeof(pre_output); + *outpsize = sizeof(* pre_output); #ifdef DEBUG_destroy_function ldap_plugin_printf("\n%s:%i:%s(): *output = %p\n", __FILE__, __LINE__, __func__, (void *)pre_output); #endif + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): pre_output->magic = \"%s\", pre_output->format_name = \"%s\"", __FILE__, __LINE__, __func__, __NULLSTR(pre_output->magic), __NULLSTR(pre_output->format_name)); + osync_trace(TRACE_INTERNAL, "\n%s:%i:%s(): *output = %p, *outpsize = %u\n", __FILE__, __LINE__, __func__, *output, *outpsize); osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -6437,9 +6460,10 @@ unsigned int i = 0, j = 0; ldap_entry *entry = NULL; GString *str = NULL; +#ifndef CALL_ABORT xmlChar *xmlbuff = NULL; unsigned int xmlbuff_size = 0; - +#endif osync_trace(TRACE_ENTRY, "%s(%p, %d, %p, %p) ", __func__, (void *)data, size, (void *)user_data, (void *)error); @@ -7698,7 +7722,7 @@ if (container->magic) { if (!strcmp(container->magic, "glist_container")) { - osync_trace(TRACE_INTERNAL, "%s:%i: data looks like a glist_container.", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i: Looks like a glist_container.", __FILE__, __LINE__); if (container->format_name == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: container->format_name = NULL.", __FILE__, __LINE__); @@ -7747,14 +7771,14 @@ unsigned int xmlbuff_size = 0; #endif - osync_trace(TRACE_INTERNAL, "%s:%i: data looks like an OSyncXMLFormat. This is most probably NOT an LDAP specific format.", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i: Looks like an OSyncXMLFormat. This is probably NOT an LDAP specific format.", __FILE__, __LINE__); #ifdef CALL_ABORT osync_trace(TRACE_ERROR, "%s:%i: Where does that come from? Calling abort().", __FILE__, __LINE__); ldap_plugin_printf("%s:%i: Where does that come from? Calling abort().", __FILE__, __LINE__); - printf(stderr, "%s:%i: Where does that come from? Calling abort().\n\n", __FILE__, __LINE__); + fprintf(stderr, "%s:%i: Where does that come from? Calling abort().\n\n", __FILE__, __LINE__); fflush(stderr); abort(); #endif @@ -7764,8 +7788,10 @@ #ifdef HANDLE_OSYNC_XMLFORMAT osync_assert(data); - if (!osync_xmlformat_assemble((OSyncXMLFormat *)data, &xmlbuff, &xmlbuff_size)) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: osync_xmlformat_assemble() has failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); + if (!osync_xmlformat_assemble((OSyncXMLFormat *)data, &xmlbuff, &xmlbuff_size, error)) { + if (!osync_error_is_set(error)) + osync_trace(TRACE_ERROR, "%s:%i: ERROR: osync_xmlformat_assemble() has failed for an unknown reason. Giving up.\n", __FILE__, __LINE__); + goto error; } @@ -7790,25 +7816,27 @@ osync_trace(TRACE_INTERNAL, "%s:%i: This is the content of the OSyncXMLFormat:\n\n\n\"%.*s\"\n\n\n", __FILE__, __LINE__, xmlbuff_size, xmlbuff); -#endif - +#else + osync_trace(TRACE_ERROR, "%s:%i:%s(): WARNING: HANDLE_OSYNC_XMLFORMAT has not been defined. So we refuse to detect this kind of format, although we possibly could process it to a certain extent.", __FILE__, __LINE__, __func__); osync_trace(TRACE_EXIT, "%s(): Returning FALSE.", __func__); return FALSE; +#endif + } else if (size == sizeof(ldap_entry)) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data looks like an ldap_entry struct. This is totally wrong. How could that even happen?", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Looks like an ldap_entry struct. This is totally wrong. How could that even happen?", __FILE__, __LINE__); goto error; } else if (size == sizeof(xmlDoc)) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data looks like an xmlDoc.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Looks like an xmlDoc.", __FILE__, __LINE__); goto error; } else if (size == sizeof(GList)) { unsigned int i = 0; - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data looks like a GList.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Looks like a GList.", __FILE__, __LINE__); osync_trace(TRACE_ERROR, "ERROR: data looks like a GList with %u elements.", g_list_length((GList *)data)); @@ -8718,8 +8746,8 @@ */ int dont_free(void) { - ldap_plugin_printf("%s:%i: \n\n\ndont_free() has been called!\n\n", __FILE__, __LINE__); - return 1; + ldap_plugin_printf("%s:%i: \n\n\ndont_free() has been called!\n\n", __FILE__, __LINE__); + return 1; } #endif Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Sat Jan 23 18:33:22 2010 (r6021) +++ plugins/ldap-sync/src/ldap_plugin.h Mon Jan 25 20:56:01 2010 (r6022) @@ -155,7 +155,7 @@ #define ENABLE_DETECTOR_FUNCTIONS 1 ///< Let the detector functions register ///< and thus take into effect. -// define HANDLE_OSYNC_XMLFORMAT 1 ///< Include some lines about trying to detect +#define HANDLE_OSYNC_XMLFORMAT 1 ///< Include some lines about trying to detect ///< what kind of format is inside an ///< OSyncXMLFormat in ///< ldap_format_do_detect_plain_as_ldap_format(). |
From: <svn...@op...> - 2010-01-23 17:33:32
|
Author: dgollub Date: Sat Jan 23 18:33:22 2010 New Revision: 6021 URL: http://www.opensync.org/changeset/6021 Log: Avoid string-pointer NULL dereference in TRACE_ENTRY calls in opensync_client_proxy.c This might be often the case, since main-sinks are identified by objtype = NULL. This got spotted by scriptor. Extended patch, by using __NULLSTR() macro a fixed all other TRACE_ENTRY places where a string got used. fixes #1204 Modified: trunk/opensync/client/opensync_client_proxy.c Modified: trunk/opensync/client/opensync_client_proxy.c ============================================================================== --- trunk/opensync/client/opensync_client_proxy.c Sat Jan 23 17:58:40 2010 (r6020) +++ trunk/opensync/client/opensync_client_proxy.c Sat Jan 23 18:33:22 2010 (r6021) @@ -1003,7 +1003,7 @@ char *writefd = NULL; char *name = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %i, %s, %s, %p)", __func__, proxy, type, path, __NULLSTR(external_command), error); + osync_trace(TRACE_ENTRY, "%s(%p, %i, %s, %s, %p)", __func__, proxy, type, __NULLSTR(path), __NULLSTR(external_command), error); osync_assert(proxy); osync_assert(type != OSYNC_START_TYPE_UNKNOWN); @@ -1284,7 +1284,7 @@ long long int memberid = 0; #endif - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p)", __func__, proxy, callback, userdata, formatdir, plugindir, plugin, groupname, configdir, config, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %s, %s, %s, %s, %p, %p)", __func__, proxy, callback, userdata, __NULLSTR(formatdir), __NULLSTR(plugindir), __NULLSTR(plugin), __NULLSTR(groupname), __NULLSTR(configdir), config, error); osync_assert(proxy); @@ -1520,7 +1520,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %i, %p)", __func__, proxy, callback, userdata, objtype, slowsync, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %i, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), slowsync, error); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_CONNECT; @@ -1572,7 +1572,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, objtype, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), error); osync_assert(proxy); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_CONNECTDONE; @@ -1625,7 +1625,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, objtype, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), error); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_DISCONNECT; @@ -1723,7 +1723,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %i, %p)", __func__, proxy, callback, userdata, objtype, slowsync, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %i, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), slowsync, error); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_GETCHANGES; @@ -1826,7 +1826,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, objtype, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), error); osync_assert(proxy); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_COMMITTEDALL; @@ -1878,7 +1878,7 @@ OSyncObjTypeSink *sink = NULL; OSyncMessage *message = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, objtype, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, proxy, callback, userdata, __NULLSTR(objtype), error); osync_assert(proxy); timeout = OSYNC_CLIENT_PROXY_TIMEOUT_SYNCDONE; |
From: <svn...@op...> - 2010-01-23 16:58:49
|
Author: scriptor Date: Sat Jan 23 17:58:40 2010 New Revision: 6020 URL: http://www.opensync.org/changeset/6020 Log: Not fully sure about those calls to osync_change_unref(). They do not seem to play well together with my destroy function. Anyway, I haven't finished testing it, yet. Modified: plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Sat Jan 23 17:49:49 2010 (r6019) +++ plugins/ldap-sync/src/ldap_plugin.c Sat Jan 23 17:58:40 2010 (r6020) @@ -1473,7 +1473,7 @@ osync_hashtable_update_change(hashtable, change); - osync_change_unref(change); + // osync_change_unref(change); osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; } @@ -1484,7 +1484,6 @@ OSyncObjFormat *format_type = sinkenv->objformat; if (format_type == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_type = NULL. Objtype = \"%s\"\n", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink)); - osync_change_unref(change); goto error; } #ifdef DEBUG_convert_ldap2xmlinternal @@ -1532,7 +1531,6 @@ osync_trace(TRACE_INTERNAL, "%s:%i: sizeof(*to_be_reported) = %lu", __FILE__, __LINE__, sizeof(*to_be_reported)); if (sizeof(*to_be_reported) == 0) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sizeof(*to_be_reported) is 0.\n", __FILE__, __LINE__); - osync_change_unref(change); goto error; } @@ -1541,7 +1539,6 @@ odata = osync_data_new((char *)to_be_reported, sizeof(*to_be_reported), format_type, error); if (!odata) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_data_new() has failed.\n", __FILE__, __LINE__); - osync_change_unref(change); goto error; } @@ -1582,8 +1579,8 @@ if (odata) osync_data_unref(odata); - if (change) - osync_change_unref(change); + // if (change) + // osync_change_unref(change); if (uid) g_free(uid); @@ -1600,8 +1597,8 @@ if (odata) osync_data_unref(odata); - if (change) - osync_change_unref(change); + // if (change) + // osync_change_unref(change); if (uid) g_free(uid); |
From: <svn...@op...> - 2010-01-23 16:49:59
|
Author: scriptor Date: Sat Jan 23 17:49:49 2010 New Revision: 6019 URL: http://www.opensync.org/changeset/6019 Log: I have removed some leaks. I have also reenabled the destroy function. This was not possible, until I added a copy function. After all, the formats I throw around are container formats: structs with pointers to the actual data. Therefore the name of the struct: "glist_container" ;-) Modified: plugins/ldap-sync/misc/ldap_format_convert.c plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_format.h 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 Fri Jan 22 16:45:55 2010 (r6018) +++ plugins/ldap-sync/misc/ldap_format_convert.c Sat Jan 23 17:49:49 2010 (r6019) @@ -27,6 +27,16 @@ #include <errno.h> +#include <glib.h> +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <libxml/xmlmemory.h> +#include <libxml/xmlreader.h> +#include <libxml/xmlschemas.h> +#include <libxml/xpath.h> +#include <libxslt/xslt.h> +#include <libxslt/xsltutils.h> +#include <libxslt/transform.h> #include <opensync/opensync.h> #include <opensync/opensync-data.h> #include <opensync/opensync-format.h> @@ -857,6 +867,9 @@ osync_trace(TRACE_INTERNAL, "Edge converter: \"%s\"\n", osync_objformat_get_name(osync_converter_get_targetformat(l->data))); } } + + osync_list_free(list); + list = NULL; } else { osync_trace(TRACE_ERROR, "%s:%i: WARNING: list = NULL.", __FILE__, __LINE__); } @@ -871,6 +884,9 @@ osync_trace(TRACE_INTERNAL, "Converter: \"%s\"\n", osync_objformat_get_name(osync_converter_get_targetformat(l->data))); } } + + osync_list_free(list); + list = NULL; } else { osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: list = NULL.", __FILE__, __LINE__); } @@ -1238,6 +1254,10 @@ if (format_env) osync_format_env_unref(format_env); + if (result) + osync_free(result); + + xmlCleanupParser(); out: osync_trace(TRACE_EXIT, "%s", __func__); @@ -1253,6 +1273,10 @@ if (format_env) osync_format_env_unref(format_env); + if (result) + osync_free(result); + + xmlCleanupParser(); 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_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Fri Jan 22 16:45:55 2010 (r6018) +++ plugins/ldap-sync/src/ldap_format.c Sat Jan 23 17:49:49 2010 (r6019) @@ -238,6 +238,27 @@ + +void ldap_format_call_free_ldap_entry_function(void *data, void *user_data) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, data, user_data); + + + if (data == NULL) { + ldap_plugin_printf("%s:%i: ERROR: data == NULL. Returning.", __FILE__, __LINE__); + osync_trace(TRACE_EXIT_ERROR, "%s: ERROR: data = NULL.", __func__); + return; + } + + + ldap_format_free_ldap_entry(data); + + osync_trace(TRACE_EXIT, "%s", __func__); +} + + + + /** * @brief Frees all data allocated by a GList entry list * @param entrylist List of LDAP entries to be freed. @@ -245,12 +266,6 @@ */ static void ldap_format_free_ldap_entries (GList **entrylist) { - unsigned int i; - - - osync_trace(TRACE_ENTRY, "%s(%p)", __func__, (void *)entrylist); - - if (entrylist == NULL) { goto out; } @@ -260,56 +275,24 @@ } if (g_list_length(*entrylist) < 1) { - goto out; - } - -/* - for (i = 0 ; i < g_list_length(*entrylist) ; i++) - { - ldap_entry *ptr = g_list_nth_data(*entrylist, i); - - ldap_plugin_printf("\n\n%u: About to call ldap_format_free_ldap_entry() for ptr = %p\n\n", i, ptr); + g_list_free(*entrylist); + *entrylist = NULL; - if (ptr) { - ldap_format_free_ldap_entry (ptr); - } - - *entrylist = g_list_remove(*entrylist, ptr); + goto out; } -*/ - GList *list = NULL; - i = 0; - for (list = g_list_first(*entrylist); list; list = g_list_next(list)) { - if (g_list_length(*entrylist) < 1) { - break; - } + // Free the elements of the list: + g_list_foreach(*entrylist, ldap_format_call_free_ldap_entry_function, NULL); - ldap_entry *ptr = list->data; - - ldap_plugin_printf("\n%u: About to call ldap_format_free_ldap_entry() for ptr = %p\n", i, ptr); - - if (ptr) { - ldap_format_free_ldap_entry (ptr); - } - - *entrylist = g_list_remove(*entrylist, ptr); - - i++; - } - - - - - /* Free GList */ + // Now, free the list itself: g_list_free(*entrylist); *entrylist = NULL; + out: - osync_trace(TRACE_EXIT, "%s", __func__); return; } @@ -593,28 +576,227 @@ } + + + + + +/** + * This is NOT just a "shallow" copy of the source_entry. Everything will + * be allocated freshly. + * + */ +osync_bool ldap_format_copy_ldap_entry(const ldap_entry *source_entry, ldap_entry **destination_entry, OSyncError **error) +{ + unsigned int i = 0, j = 0; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, (void *)source_entry, (void *)destination_entry, (void *)error); + + + if (source_entry == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: source_entry = NULL.", __FILE__, __LINE__); + + goto error; + } + + if (destination_entry == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: destination_entry = NULL.", __FILE__, __LINE__); + + goto error; + } + + + + // We copy the source LDAP entries by creating a destination LDAP entry. + // The memory regions used by the source and the destination LDAP entries + // must be independent from each other, so that they can be freed + // separately. + *destination_entry = (ldap_entry *)g_malloc0(sizeof(ldap_entry)); + if (*destination_entry == NULL) { + ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + memset(*destination_entry, 0, sizeof(ldap_entry)); + + if (source_entry->id) { + (*destination_entry)->id = g_strdup(source_entry->id); + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: source_entry->id = NULL. Ignoring.\n", __FILE__, __LINE__); + (*destination_entry)->id = NULL; + } + + if (source_entry->dn) { + unsigned int len = strlen(source_entry->dn); + gsize n = len > 1024 ? len : 1024; + (*destination_entry)->dn = g_strndup(source_entry->dn, n); + } else { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: source_entry->dn = NULL. Ignoring.\n", __FILE__, __LINE__); + (*destination_entry)->dn = NULL; + } + + + // Count the number of mods: + unsigned int counter; + for ( + counter = 0; + source_entry && source_entry->mods && source_entry->mods[counter]; + counter++ + ) + { + // sic! + ; + } + + + // There are counter plus 1 elements in the mods array. + + // At first, allocate memory just for the pointers to the LDAPMod's. + (*destination_entry)->mods = (LDAPMod **)g_malloc0((counter + 2) * sizeof(LDAPMod *)); + if ((*destination_entry)->mods == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0() problem. Exiting.\n", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + memset((*destination_entry)->mods, 0, (counter + 2) * sizeof(LDAPMod *)); + + if (counter == 0) { + (*destination_entry)->mods[0] = NULL; + (*destination_entry)->mods[1] = NULL; + } + + + for (j = 0, i = 0; j < counter; j++) + { + LDAPMod *mod = source_entry->mods[j]; + + + (*destination_entry)->mods[i] = NULL; // This will become a real LDAPMod + (*destination_entry)->mods[i + 1] = NULL; // And this is the terminating NULL. + + if (mod) { + // Then allocate memory for the struct LDAPMod. + (*destination_entry)->mods[i] = g_malloc0(sizeof(LDAPMod)); + if ((*destination_entry)->mods[i] == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + memset((*destination_entry)->mods[i], 0, sizeof(LDAPMod)); + + if ((*destination_entry)->mods[i]) { + (*destination_entry)->mods[i]->mod_op = LDAP_MOD_BVALUES; + (*destination_entry)->mods[i]->mod_type = g_strdup(mod->mod_type); + + // Allocate memory just for the pointers to the struct berval's: + (*destination_entry)->mods[i]->mod_bvalues = (struct berval **)g_malloc0(2 * sizeof(struct berval *)); + if ((*destination_entry)->mods[i]->mod_bvalues == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + memset((*destination_entry)->mods[i]->mod_bvalues, 0, 2 * sizeof(struct berval *)); + + if ((*destination_entry)->mods[i]->mod_bvalues) { + (*destination_entry)->mods[i]->mod_bvalues[1] = NULL; // terminating NULL. + // And now allocate memory for the structs themselves: + (*destination_entry)->mods[i]->mod_bvalues[0] = (struct berval *)g_malloc0(sizeof(struct berval)); + if ((*destination_entry)->mods[i]->mod_bvalues[0]) { + memset((*destination_entry)->mods[i]->mod_bvalues[0], 0, sizeof(struct berval)); + (*destination_entry)->mods[i]->mod_bvalues[0]->bv_val = g_strdup(mod->mod_bvalues[0]->bv_val); + (*destination_entry)->mods[i]->mod_bvalues[0]->bv_len = mod->mod_bvalues[0]->bv_len; + } else { + osync_trace(TRACE_ERROR, "%s:%i: g_malloc0() problem. Exiting.", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: g_malloc0() problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + } else { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + // Advance in loop + i = i + 1; + + // Safety check + if (i > counter) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: i = %i, counter = %i, j = %i", __FILE__, __LINE__, i, counter, j); + goto error; + } + } // if ((*destination_entry)->mods[i]) + else { + ldap_plugin_printf("%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + } else { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: mod = NULL. Ignoring. i = %i, j = %i\n", __FILE__, __LINE__, i, j); + } + } // for (j = 0, i = 0; j < counter; j++) + + + 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 creates a GList of ldap entries a GList of * any possible ldap subentries out of list of ldapmods * * @param dn The distinguished name (DN) of the LDAP entry. - * This is the location in the DIT where the entry and - * its subentries are to be stored. - * @param ldapmods - * @param potential_subentries The resulting list of LDAP subentries. They have + * This is the location in the DIT where the entry and + * its subentries are to be stored. + * @param ldapmods These LDAPMod's are the result from having parsed the + * XML file. + * @param potential_subentries The list of LDAP subentries. They have * id and dn set, already. - * @param ldap_entries The resulting list of LDAP entries. None of them - * has set id and dn, yet. + * @param ldap_entries As a result of this function this list of LDAP entries + * will be created. None of them has set id and dn, yet. * @param error The libopensync error pointer. * * @returns TRUE on success, FALSE in case of any error. */ -static osync_bool ldap_format_create_ldap_entries_list_from_ldapmods(const char *dn, GList *ldapmods, GList **potential_subentries, GList **ldap_entries, OSyncError **error) +static osync_bool ldap_format_create_ldap_entries_list_from_ldapmods(const char *dn, GList *ldapmods, GList *potential_subentries, GList **ldap_entries, OSyncError **error) { ldap_entry *entry = NULL; GList *list = NULL; - unsigned int i = 0; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, (void *)dn, (void *)ldapmods, (void *)potential_subentries, (void *)ldap_entries, (void *)error); @@ -631,10 +813,13 @@ goto error; } +// Uhmmm, this can be NULL, can't it? +/* if (potential_subentries == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: potential_subentries = NULL.\n", __FILE__, __LINE__); goto error; } +*/ if (ldap_entries == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.\n", __FILE__, __LINE__); @@ -649,10 +834,7 @@ } - if (ldapmods) { - ldap_format_free_ldapmods_list(ldapmods); - ldapmods = NULL; - } + @@ -672,111 +854,19 @@ - - - // Any further entries are subentries one level below of this // base entry in the DIT. // Walk through the source list of LDAP entries. - for (list = g_list_first(*potential_subentries); list; list = g_list_next(list)) { + for (list = g_list_first(potential_subentries); list; list = g_list_next(list)) { ldap_entry *single_entry = NULL; if (list->data) { - // We copy the source LDAP entries by creating a destination LDAP entry. - // The memory regions used by the source and the destination LDAP entries - // must be independent from each other, so that they can be freed - // separately. - single_entry = (ldap_entry *)g_malloc0(sizeof(ldap_entry)); - if (single_entry == NULL) { - ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - exit(1); - } - - if (((ldap_entry *)(list->data))->id) { - single_entry->id = g_strdup(((ldap_entry *)(list->data))->id); - } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: (list->data)->id = NULL. Ignoring.\n", __FILE__, __LINE__); - single_entry->id = NULL; - } - - if (((ldap_entry *)(list->data))->dn) { - single_entry->dn = g_strdup(((ldap_entry *)(list->data))->dn); - } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: (list->data)->dn = NULL. Ignoring.\n", __FILE__, __LINE__); - single_entry->dn = NULL; - } - - - // Count the number of mods: - unsigned int counter; - for (counter = 0; ((ldap_entry *)(list->data))->mods[counter]; counter++) - ; - - - // There are counter plus 1 elements in the mods array. + if (!ldap_format_copy_ldap_entry((ldap_entry *)(list->data), &single_entry, error)) { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_copy_ldap_entry() has failed.", __FILE__, __LINE__); - // At first, allocate memory just for the pointers to the LDAPMod's. - single_entry->mods = (LDAPMod **)g_malloc0((counter + 2) * sizeof(LDAPMod *)); - if (single_entry->mods == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0() problem. Exiting.\n", __FILE__, __LINE__); - ldap_plugin_printf("%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); - exit(1); + goto error; } - - unsigned int j = 0; - for (j = 0, i = 0; j < counter; j++) - { - LDAPMod *mod = ((ldap_entry *)(list->data))->mods[j]; - - - if (mod) { - // Then allocate memory for the struct LDAPMod. - single_entry->mods[i] = g_malloc0(sizeof(LDAPMod)); - if (single_entry->mods[i] == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - exit(1); - } - - if (single_entry->mods[i]) { - single_entry->mods[i]->mod_op = LDAP_MOD_BVALUES; - single_entry->mods[i]->mod_type = g_strdup(mod->mod_type); - single_entry->mods[i]->mod_bvalues = (struct berval **)g_malloc0(2 * sizeof(struct berval *)); - if (single_entry->mods[i]->mod_bvalues) { - single_entry->mods[i]->mod_bvalues[1] = NULL; // terminating NULL. - single_entry->mods[i]->mod_bvalues[0] = (struct berval *)g_malloc0(sizeof(struct berval)); - if (single_entry->mods[i]->mod_bvalues[0]) { - single_entry->mods[i]->mod_bvalues[0]->bv_val = g_strdup(mod->mod_bvalues[0]->bv_val); - single_entry->mods[i]->mod_bvalues[0]->bv_len = mod->mod_bvalues[0]->bv_len; - } else { - osync_trace(TRACE_ERROR, "%s:%i: g_malloc0() problem. Exiting.", __FILE__, __LINE__); - ldap_plugin_printf("%s:%i: g_malloc0() problem. Exiting.", __FILE__, __LINE__); - exit(1); - } - } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); - exit(1); - } - - i = i + 1; - - if (i > counter) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: i = %i, counter = %i, j = %i", __FILE__, __LINE__, i, counter, j); - goto error; - } - } // if (single_entry->mods[i]) - else { - ldap_plugin_printf("%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); - osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0() problem. Exiting.", __FILE__, __LINE__); - exit(1); - } - } else { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: mod = NULL. Ignoring. i = %i, j = %i\n", __FILE__, __LINE__, i, j); - } - } // for (j = 0, i = 0; j < counter; j++) - } else { osync_trace(TRACE_ERROR, "%s:%i: ERROR: list->data = NULL. Ignoring.\n", __FILE__, __LINE__); } @@ -786,13 +876,13 @@ - + // Add the resulting subentry to the GList of ldap_entry structs: if (single_entry) { *ldap_entries = g_list_append(*ldap_entries, single_entry); } else { osync_trace(TRACE_ERROR, "%s:%i: ERROR: single_entry = NULL. The whole copy procedure has failed. Ignoring.\n", __FILE__, __LINE__); } - } // for (GList *list = g_list_first(*potential_subentries); list; list = g_list_next(list)) + } // for (GList *list = g_list_first(potential_subentries); list; list = g_list_next(list)) @@ -1697,7 +1787,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; } @@ -1937,7 +2026,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; } @@ -2445,7 +2533,7 @@ } - +#if 0 /** * @note * The following call to osync_xmlformat_copy() is a workaround for @@ -2494,6 +2582,8 @@ goto error; } +#endif + // Report the results to the calling function *output = (char *) xmlformat; @@ -3545,6 +3635,7 @@ if (name) { if (name[0]) { if (!strncmp((char *)name, "EMail", 5)) { + xmlFree(name); name = xmlStrdup((xmlChar *)"EMail"); } } @@ -3556,6 +3647,7 @@ if (name) { if (name[0]) { if (!strncmp((char *)name, "AddressLabel", 12)) { + xmlFree(name); name = xmlStrdup((xmlChar *)"AddressLabel"); } } @@ -3567,6 +3659,7 @@ if (name) { if (name[0]) { if (!strncmp((char *)name, "Telephone", 9)) { + xmlFree(name); name = xmlStrdup((xmlChar *)"Telephone"); } } @@ -4404,7 +4497,7 @@ GList *ldapmods = NULL; - // Parse child nodes of root + // Parse child nodes of root and write them to potential_subentries GList and to the ldapmods list. if (!ldap_format_parse_xmlinternal_child_nodes(xmlnode, objtype, dn, &complex_element_lists, potential_subentries, &ldapmods, error)) { if (!osync_error_is_set(error)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_parse_child_nodes() has failed.\n", __FILE__, __LINE__); @@ -4413,9 +4506,14 @@ } + if (potential_subentries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: potential_subentries has become NULL after having called ldap_format_parse_xmlinternal_child_nodes(). Returning NULL.\n", __FILE__, __LINE__); + goto error; + } + // Create a list of LDAP entries and a list of LDAP subentries out of these ldapmods: - if (!ldap_format_create_ldap_entries_list_from_ldapmods(dn, ldapmods, potential_subentries, ldap_entries, error)) { + if (!ldap_format_create_ldap_entries_list_from_ldapmods(dn, ldapmods, *potential_subentries, ldap_entries, error)) { if (!osync_error_is_set(error)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR ldap_format_ldap_entry_from_ldapmods_wrapper() has failed.", __FILE__, __LINE__); } @@ -4442,11 +4540,20 @@ ldap_format_free_complex_element_lists(&complex_element_lists.address); ldap_format_free_complex_element_lists(&complex_element_lists.telephone); + if (ldapmods) { + ldap_format_free_ldapmods_list(ldapmods); + ldapmods = NULL; + } osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; error: + if (ldapmods) { + ldap_format_free_ldapmods_list(ldapmods); + ldapmods = NULL; + } + if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -4755,6 +4862,13 @@ * Problem: This does not seem to work. I have always set it to FALSE. * But libopensync does not care about it. * See also ldap_format_destroy_format1() + * The problem lies in osync_format_env_detect_objformat_full(), + * which does not take notice of free_input: + * + * 1127 // Make a copy of the data + * 1128 new_data = osync_data_clone(input, error); + * (...) + * 1164 osync_data_unref(new_data); * * @param ldap_format_name The name of the source format. * @param xmlformat_name The name of the target format. @@ -4835,7 +4949,7 @@ ldap_plugin_printf("%s:%i: ERROR: inpsize = %i. Calling abort()\n", __FILE__, __LINE__, inpsize); abort(); #else - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: inpsize = %i.\n", __FILE__, __LINE__, inpsize); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i:%s(): ERROR: inpsize = %i.\n", __FILE__, __LINE__, __func__, inpsize); goto error; #endif @@ -4926,6 +5040,11 @@ if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_parse_ldif() has failed.\n", __FILE__, __LINE__); + if (ldap_entries) { + ldap_format_free_ldap_entries(&ldap_entries); + ldap_entries = NULL; + } + goto error; } @@ -4940,10 +5059,21 @@ if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_pre_stylesheet() has failed.\n", __FILE__, __LINE__); + if (ldap_entries) { + ldap_format_free_ldap_entries(&ldap_entries); + ldap_entries = NULL; + } + goto error; } + // Free ldap_entries + if (ldap_entries) { + ldap_format_free_ldap_entries(&ldap_entries); + ldap_entries = NULL; + } + // Now, xmlbuff and size should be set: goto applying_stylesheet; @@ -4960,7 +5090,7 @@ } goto error; - } + } // if (inpsize != sizeof(glist_container)) // Assuming it is a glist_container struct: @@ -4999,7 +5129,9 @@ goto error; } - + + + applying_stylesheet: if (xmlbuff == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlbuff = NULL. Nothing to do here.\n", __FILE__, __LINE__); @@ -5023,9 +5155,9 @@ } - osync_trace(TRACE_INTERNAL, "%s:%i: Setting *free_input to FALSE.", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Setting *free_input to FALSE.", __FILE__, __LINE__, __func__); *free_input = FALSE; // But the destroy function is called, anyway??? - + // *free_input = TRUE; // Clean up if (xmlbuff) { @@ -5343,7 +5475,7 @@ *outpsize = sizeof(glist_container); - osync_trace(TRACE_INTERNAL, "%s:%i: Setting *free_input to FALSE.", __FILE__, __LINE__); + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Setting *free_input to FALSE.", __FILE__, __LINE__, __func__); *free_input = FALSE; // But the destroy function is called, anyway??? @@ -5909,20 +6041,29 @@ osync_trace(TRACE_INTERNAL, "%s:%i:%s():\n\n\ndestroy function has been called for input = %p\n\n\n", __FILE__, __LINE__, __func__, (void *)input); - // First off, try and find out what type of data has been casted to char * + if (input == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input = NULL.", __FILE__, __LINE__); + goto error; + } + +#ifdef DEBUG_destroy_function + ldap_plugin_printf("\n%s:%i:%s(): input = %p\n", __FILE__, __LINE__, __func__, (void *)input); +#endif + + // First off, print some bytes of input to the trace files. osync_trace(TRACE_INTERNAL, "%s:%i: What is input? inpsize = %u", __FILE__, __LINE__, inpsize); GString *str = NULL; 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 FALSE; + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: str = NULL.", __FILE__, __LINE__); + goto error; } if (str->str == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: str->str = NULL.", __FILE__, __LINE__); - return FALSE; + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: str->str = NULL.", __FILE__, __LINE__); + goto error; } osync_trace(TRACE_INTERNAL, "%s:%i:\n\"%s\"\n", __FILE__, __LINE__, (char *)(str->str)); @@ -5931,6 +6072,8 @@ g_string_free(str, TRUE); + + // Try and find out what type of data has been casted to char * if (inpsize == osync_xmlformat_size()) { osync_trace(TRACE_INTERNAL, "Looks like the opensync specific xmlformat.\n"); @@ -5941,40 +6084,304 @@ osync_trace(TRACE_INTERNAL, "Looks like an xmlDoc."); } else if (inpsize == sizeof(glist_container)) { + glist_container *tmp = NULL; + + osync_trace(TRACE_INTERNAL, "Looks like a glist_container."); + tmp = (glist_container *)input; + if (tmp->magic) { + if (!strncmp(tmp->magic, "glist_container", 15)) { + osync_trace(TRACE_INTERNAL, "It is a glist_container."); + if (tmp->format_name) { + osync_trace(TRACE_INTERNAL, "format_name = \"%s\"", tmp->format_name); + } + + osync_trace(TRACE_INTERNAL, "Address of glist: %p", (void *)(tmp->list)); +#ifdef DEBUG_destroy_function + ldap_plugin_printf("%s:%i:%s(): Address of glist: %p", __FILE__, __LINE__, __func__, (void *)(tmp->list)); +#endif + + if (tmp->list) { + osync_trace(TRACE_INTERNAL, "Number of elements: %i", g_list_length(tmp->list)); +#ifdef DEBUG_destroy_function + ldap_plugin_printf("%s:%i:%s(): Number of elements: %i\n\n", __FILE__, __LINE__, __func__, g_list_length(tmp->list)); +#endif + + +#if 0 +/* + +When number of elements is just 1, I got: + +Number of elements: 1 + + +==14006== Thread 5: +==14006== Invalid free() / delete / delete[] +==14006== at 0x4A04D72: free (vg_replace_malloc.c:325) +==14006== by 0x58D7A69: ldap_format_free_ldap_entry_function (ldap_format.c:192) +==14006== by 0x58D7CDD: ldap_format_call_free_ldap_entry (ldap_format.c:254) +==14006== by 0x38EA636C1B: g_list_foreach (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x58E45B1: ldap_format_destroy_format1 (ldap_format.c:6117) +==14006== by 0x4C7162A: osync_objformat_destroy (opensync_objformat.c:152) +==14006== by 0x4C576E7: osync_data_unref (opensync_data.c:65) +==14006== by 0x4C56AE8: osync_change_unref (opensync_change.c:60) +==14006== by 0x4C4BA7A: _osync_client_handle_commit_change (opensync_client.c:1378) +==14006== by 0x4C4C1EF: _osync_client_message_handler (opensync_client.c:1574) +==14006== by 0x4C81825: _incoming_dispatch (opensync_queue.c:391) +==14006== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38E9606A39: start_thread (in /lib64/libpthread-2.11.so) +==14006== Address 0xa16e9a0 is 416 bytes inside a block of size 496 alloc'd +==14006== at 0x4A04360: memalign (vg_replace_malloc.c:532) +==14006== by 0x4A043B9: posix_memalign (vg_replace_malloc.c:660) +==14006== by 0x38EA655D51: ??? (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA656DF1: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA637145: g_list_append (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x741C272: vformat_attribute_get_values_decoded (vformat.c:1663) +==14006== by 0x741C598: vformat_attribute_get_nth_value (vformat.c:1737) +==14006== by 0x740A53C: handle_telephone_attribute (xmlformat-vcard.c:689) +==14006== by 0x7407991: handle_attribute (xmlformat-common.c:379) +==14006== by 0x740B7E8: conv_vcard_to_xmlformat (xmlformat-vcard.c:1037) +==14006== by 0x4C6BBAF: osync_converter_invoke (opensync_converter.c:194) +==14006== by 0x4C70BB0: osync_format_env_convert (opensync_format_env.c:1213) +==14006== by 0x4C6EC16: osync_format_env_find_path_fn (opensync_format_env.c:638) +==14006== by 0x4C7113D: osync_format_env_find_path_formats_with_detectors (opensync_format_env.c:1308) +==14006== by 0x4C64FD3: osync_entry_engine_convert (opensync_mapping_entry_engine.c:237) +==14006== by 0x4C69C34: osync_sink_engine_convert_to_dest (opensync_sink_engine.c:196) +==14006== by 0x4C69269: osync_obj_engine_prepare_write (opensync_obj_engine.c:1469) +==14006== by 0x4C68913: osync_obj_engine_command (opensync_obj_engine.c:1217) +==14006== by 0x4C608AB: osync_engine_event (opensync_engine.c:2045) +==14006== by 0x4C5E139: _osync_engine_generate_multiplied_event (opensync_engine.c:1208) +==14006== by 0x4C5F30A: _osync_engine_generate_event (opensync_engine.c:1536) +==14006== by 0x4C5F411: _osync_engine_event_callback (opensync_engine.c:1570) +==14006== by 0x4C68C47: osync_obj_engine_event (opensync_obj_engine.c:1315) +==14006== by 0x4C688FB: osync_obj_engine_command (opensync_obj_engine.c:1212) +==14006== by 0x4C601C4: osync_engine_command (opensync_engine.c:1884) +==14006== by 0x4C5B89C: _command_dispatch (opensync_engine.c:383) +==14006== by 0x38EA63922D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA63CC17: ??? (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA63D064: g_main_loop_run (in /lib64/libglib-2.0.so.0.2200.2) +==14006== by 0x38EA662133: ??? (in /lib64/libglib-2.0.so.0.2200.2) +==14006== + +*/ +#endif + + +/* + And with the following workaround - a pretty poor workaround, I should add - + I get: + +src/ldap_format.c:6059:ldap_format_destroy_format1(): input = 0x5032e10 + +src/ldap_format.c:6110:ldap_format_destroy_format1(): Address of glist: 0x9dd8180 +src/ldap_format.c:6114:ldap_format_destroy_format1(): Number of elements: 1 + + + +src/ldap_format.c:6059:ldap_format_destroy_format1(): input = 0xa1bcbf0 + +src/ldap_format.c:6110:ldap_format_destroy_format1(): Address of glist: 0x9dd8180 +src/ldap_format.c:6114:ldap_format_destroy_format1(): Number of elements: 1 + + +So these are two different glist_container structs, but in both cases +with the same address of the glist. This is a bug. Different glist_containers +should have different glist pointers, so that they can be free'd +independently. + +*/ + if (g_list_length(tmp->list) > 1) { + // Free the elements of the list: + g_list_foreach(tmp->list, ldap_format_call_free_ldap_entry_function, NULL); + + osync_trace(TRACE_INTERNAL, "Number of elements after having freed its elements: %i", g_list_length(tmp->list)); + + // Free the list itself: + g_list_free(tmp->list); + + // This should prevent the list and its elements from being freed + // for a second time... Well, who knows... + tmp->list = NULL; + + // And now, the glist_container itself: + memset(tmp, 0, sizeof(glist_container)); + g_free(tmp); + tmp = NULL; + + } else { + + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Skipping all the calls to the free() functions, because the number of elements is suspiciously low.", __FILE__, __LINE__, __func__); + + } + } // if (tmp->list) + + osync_trace(TRACE_INTERNAL, "\n\n"); + } // if (!strncmp(tmp->magic, "glist_container", 15)) + else + { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): WARNING: tmp->magic does NOT contain a valid magic string. So this is NOT a glist_container. Skipping all the calls to free any memory.", __FILE__, __LINE__, __func__); + } + } // if (tmp->magic) + else + { + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): WARNING: tmp->magic = NULL. So this is NOT a glist_container. Skipping all the calls to free any memory.", __FILE__, __LINE__, __func__); + } + } else if (inpsize == sizeof(GList)) { unsigned int length = 0; GList *list = (GList *)input; + osync_trace(TRACE_INTERNAL, "Looks like a GList."); length = g_list_length(list); osync_trace(TRACE_INTERNAL, "With %u elements.", length); + if (input) { + if (g_list_length(list) > 0) { + ldap_plugin_printf("\n\n\n%s:%i:%s():\nAbout to call ldap_format_free_ldap_entries with input = %p\n\n\n", __FILE__, __LINE__, __func__, input); + ldap_format_free_ldap_entries((GList **)&input); // new + } + } + } else if (inpsize > 6 && ldap_format_check_xml((char *)input, (int)inpsize, error)) { + osync_trace(TRACE_INTERNAL, "Looks like a string with a human readable XML document."); + + } else if (inpsize > 6 && ldap_format_check_ldif((char *)input, (int)inpsize, FORMAT_LDAP_INETORGPERSON, error)) { + osync_trace(TRACE_INTERNAL, "Looks like a string with a human readable document in LDIF with data that belongs to the inetorgperson object class."); + + } else if (inpsize > 6 && ldap_format_check_ldif((char *)input, (int)inpsize, FORMAT_LDAP_EVOLUTIONPERSON, error)) { + osync_trace(TRACE_INTERNAL, "Looks like a string with a human readable document in LDIF with data that belongs to the evolutionperson object class."); + } else { - osync_trace(TRACE_INTERNAL, "Don't know."); + osync_trace(TRACE_INTERNAL, "%s:%i:%s(): Don't know, what that is. Returning without having freed anything.", __FILE__, __LINE__, __func__); } - // Temporarily disabled because of bugs in libopensync. -/* - if (input) { - GList *list = (GList *)input; - if (g_list_length(list) > 0) { - ldap_plugin_printf("\n\n\n%s:%i:%s():\nAbout to call ldap_format_free_ldap_entries with input = %p\n\n\n", __FILE__, __LINE__, __func__, input); - ldap_format_free_ldap_entries((GList **)&input); // new - } + 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; +} + + + + + +osync_bool ldap_format_copy_format1(const char *input, unsigned int inpsize, char **output, unsigned int *outpsize, void *user_data, OSyncError **error) +{ + glist_container *real_input = (glist_container *)input; + glist_container *pre_output = NULL; + guint length = 0; + unsigned int i = 0; + + + osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %p, %p, %p) ", __func__, (void *)input, inpsize, (void *)output, (void *)outpsize, (void *)user_data, (void *)error); + + + if (input == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input = NULL.", __FILE__, __LINE__); + goto error; } -*/ + if (strncmp(real_input->magic, "glist_container", 15)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input was NOT the glist_container that had been expected here in this function.", __FILE__, __LINE__); + goto error; + } + + if (output == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: output = NULL.", __FILE__, __LINE__); + goto error; + } + + if (outpsize == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: outpsize = NULL.", __FILE__, __LINE__); + goto error; + } + + + pre_output = (glist_container *)g_malloc0(sizeof(glist_container)); + if (pre_output == NULL) { + ldap_plugin_printf("%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: ERROR: g_malloc0 problem. Exiting.", __FILE__, __LINE__); + exit(1); + } + + memset(pre_output, 0, sizeof(glist_container)); + + pre_output->magic = "glist_container"; + pre_output->format_name = g_strdup(real_input->format_name); + pre_output->list = NULL; + + + length = g_list_length(real_input->list); + for (i = 0; i < length; i++) { + ldap_entry *source_entry = (ldap_entry *)g_list_nth_data(real_input->list, i); + ldap_entry *target_entry = NULL; + + + if (source_entry == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: source_entry = NULL.", __FILE__, __LINE__); + + goto error; + } + + + // Now, copy an ldap_entry struct. Allocate everything fresh. + // Not just a "shallow" copy. + if (!ldap_format_copy_ldap_entry(source_entry, &target_entry, error)) { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_copy_ldap_entry() has failed.", __FILE__, __LINE__); + + goto error; + } + + + + if (target_entry == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: target_entry = NULL. ldap_format_copy_ldap_entry() must have failed.", __FILE__, __LINE__); + + goto error; + } + + + pre_output->list = g_list_append(pre_output->list, target_entry); + + } // for (i = 0; i < length; i++) + *output = (char *) pre_output; + *outpsize = sizeof(pre_output); + +#ifdef DEBUG_destroy_function + ldap_plugin_printf("\n%s:%i:%s(): *output = %p\n", __FILE__, __LINE__, __func__, (void *)pre_output); +#endif 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 Not implemented, yet. And I have not even understood the * following description: @@ -6060,7 +6467,7 @@ // 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 (size == sizeof(glist_container) && ((glist_container *)data)->magic && !strncmp(((glist_container *)data)->magic, "glist_container", 15)) { if (!ldap_plugin_get_glist(data, &list, error)) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: ldap_plugin_get_glist() has failed.\n", __FILE__, __LINE__); @@ -6337,6 +6744,9 @@ return rv; error: + if (regex) + g_regex_unref(regex); + if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -6374,6 +6784,7 @@ { GRegex *replace_regex = NULL; GError *gerror = NULL; + gchar *old_string = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p)", __func__, (void *)string, (void *)replace_pattern, compile_options, (void *)target_pattern, (void *)error); @@ -6415,6 +6826,7 @@ } + old_string = *string; *string = g_regex_replace_literal(replace_regex, *string, -1, 0, target_pattern, 0, &gerror); if (gerror != NULL) { @@ -6429,11 +6841,26 @@ goto error; } + if (old_string != *string) { + g_free(old_string); + old_string = NULL; + } + + if (replace_regex) + g_regex_unref(replace_regex); osync_trace(TRACE_EXIT, "%s()", __func__); return TRUE; error: + if (replace_regex) + g_regex_unref(replace_regex); + + if (old_string) { + g_free(old_string); + old_string = NULL; + } + if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -6541,7 +6968,6 @@ osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; - } @@ -6745,12 +7171,17 @@ gchar *id = NULL; if (dn) { gchar **tokens = g_strsplit(dn, ",", 0); + + if (tokens) { if (tokens[1]) { id = g_strdup(tokens[1]); } else { ldap_plugin_printf("%s:%i: ERROR: tokens[1] = NULL. Ignoring for now.", __FILE__, __LINE__); } + + g_strfreev(tokens); + tokens = NULL; } else { ldap_plugin_printf("%s:%i: ERROR: tokens = NULL. Ignoring for now.", __FILE__, __LINE__); } @@ -6783,6 +7214,17 @@ g_free (line); line = NULL; + + if (dn) { + g_free(dn); + dn = NULL; + } + + if (id) { + g_free(id); + id = NULL; + } + goto error; } @@ -6797,10 +7239,22 @@ if (single_ldap_entry == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: single_ldap_entry = NULL. ldap_format_create_ldap_entry_from_ldapmods() must have failed.", __FILE__, __LINE__); + + if (dn) { + g_free(dn); + dn = NULL; + } + + if (id) { + g_free(id); + id = NULL; + } + goto error; } single_ldap_entry->dn = g_strdup(dn); + single_ldap_entry->id = g_strdup(id); single_ldap_entry->subentries = NULL; @@ -6809,6 +7263,12 @@ dn = NULL; } + if (id) { + g_free(id); + id = NULL; + } + + if (ldap_entries) { *ldap_entries = g_list_append(*ldap_entries, single_ldap_entry); } else { @@ -6960,18 +7420,27 @@ goto error; } - if (*ldap_entries == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: *ldap_entries = NULL. ldap_format_read_ldap_entries_from_ldif() must have failed.", __FILE__, __LINE__); goto error; } + if (string) { + g_free(string); + string = NULL; + } osync_trace(TRACE_EXIT, "%s()", __func__); return TRUE; error: + if (string) { + g_free(string); + string = NULL; + } + + if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); @@ -7770,7 +8239,12 @@ if (!contact1_format) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: contact_format = NULL.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: contact1_format = NULL.\n", __FILE__, __LINE__); + goto error; + } + + if (!contact2_format) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: contact2_format = NULL.\n", __FILE__, __LINE__); goto error; } @@ -7792,6 +8266,7 @@ osync_objformat_set_compare_func(contact1_format, ldap_format_compare_format1); + osync_objformat_set_copy_func(contact1_format, ldap_format_copy_format1); osync_objformat_set_destroy_func(contact1_format, ldap_format_destroy_format1); osync_objformat_set_duplicate_func(contact1_format, ldap_format_duplicate_format1); osync_objformat_set_print_func(contact1_format, ldap_format_print_format1); @@ -7800,6 +8275,7 @@ osync_objformat_set_compare_func(contact2_format, ldap_format_compare_format1); + osync_objformat_set_copy_func(contact2_format, ldap_format_copy_format1); osync_objformat_set_destroy_func(contact2_format, ldap_format_destroy_format1); osync_objformat_set_duplicate_func(contact2_format, ldap_format_duplicate_format1); osync_objformat_set_print_func(contact2_format, ldap_format_print_format1); @@ -7807,6 +8283,7 @@ osync_objformat_set_compare_func(event_format, ldap_format_compare_format1); + osync_objformat_set_copy_func(event_format, ldap_format_copy_format1); osync_objformat_set_destroy_func(event_format, ldap_format_destroy_format1); osync_objformat_set_duplicate_func(event_format, ldap_format_duplicate_format1); osync_objformat_set_print_func(event_format, ldap_format_print_format1); @@ -7814,6 +8291,7 @@ osync_objformat_set_compare_func(todo_format, ldap_format_compare_format1); + osync_objformat_set_copy_func(todo_format, ldap_format_copy_format1); osync_objformat_set_destroy_func(todo_format, ldap_format_destroy_format1); osync_objformat_set_duplicate_func(todo_format, ldap_format_duplicate_format1); osync_objformat_set_print_func(todo_format, ldap_format_print_format1); @@ -7821,6 +8299,7 @@ osync_objformat_set_compare_func(note_format, ldap_format_compare_format1); + osync_objformat_set_copy_func(note_format, ldap_format_copy_format1); osync_objformat_set_destroy_func(note_format, ldap_format_destroy_format1); osync_objformat_set_duplicate_func(note_format, ldap_format_duplicate_format1); osync_objformat_set_print_func(note_format, ldap_format_print_format1); Modified: plugins/ldap-sync/src/ldap_format.h ============================================================================== --- plugins/ldap-sync/src/ldap_format.h Fri Jan 22 16:45:55 2010 (r6018) +++ plugins/ldap-sync/src/ldap_format.h Sat Jan 23 17:49:49 2010 (r6019) @@ -49,6 +49,7 @@ static GList *ldap_format_append_ldapmod(GList *list, gchar *ldapattr, gchar *value); static osync_bool ldap_format_apply_stylesheet_workaround(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, const char *config, void *userdata, const char *stylesheet, OSyncError **error); static int ldap_format_avoid_duplicate_attribute(GList *ldapmods, const char *name); +void ldap_format_call_free_ldap_entry_function(void *data, void *user_data); static osync_bool ldap_format_check_adequate_stylesheet(xmlNode *root_element, const char *stylesheet_file, OSyncError **error); osync_bool ldap_format_check_ldif(const char *data, int size, const char *format_name, 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); @@ -63,7 +64,9 @@ static osync_bool ldap_format_conv_xmlformat_note_to_ldap_note(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_xmlformat_todo_to_ldap_todo(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_convert_xmlinternal2ldap (const xmlDoc *xmldata, const char *objtype, const char *ldap_format_name, const gchar *dn, GList **potential_subentries, GList **ldap_entries, OSyncError **error); -static osync_bool ldap_format_create_ldap_entries_list_from_ldapmods(const char *dn, GList *ldapmods, GList **potential_subentries, GList **ldap_entries, OSyncError **error); +osync_bool ldap_format_copy_format1(const char *input, unsigned int inpsize, char **output, unsigned int *outpsize, void *user_data, OSyncError **error); +osync_bool ldap_format_copy_ldap_entry(const ldap_entry *source_entry, ldap_entry **destination_entry, OSyncError **error); +static osync_bool ldap_format_create_ldap_entries_list_from_ldapmods(const char *dn, GList *ldapmods, GList *potential_subentries, GList **ldap_entries, OSyncError **error); static ldap_entry *ldap_format_create_ldap_entry_from_ldapmods(GList *ldapmods); osync_bool ldap_format_detect_plain_as_ldap_evolutionperson(const char *data, int size, void *userdata); Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Fri Jan 22 16:45:55 2010 (r6018) +++ plugins/ldap-sync/src/ldap_plugin.h Sat Jan 23 17:49:49 2010 (r6019) @@ -167,6 +167,7 @@ #define DEBUG_detection 1 #define DEBUG_ldapdata_from_server 1 #define DEBUG_convert_ldap2xmlinternal 1 +#define DEBUG_destroy_function 1 #define DEBUG_do_apply_stylesheet 1 #define DEBUG_convert_xmlinternal2ldap 1 #define DEBUG_ldapdata_to_server 1 @@ -188,6 +189,7 @@ #undef DEBUG_detection #undef DEBUG_ldapdata_from_server #undef DEBUG_convert_ldap2xmlinternal +#undef DEBUG_destroy_function #undef DEBUG_do_apply_stylesheet #undef DEBUG_convert_xmlinternal2ldap #undef DEBUG_ldapdata_to_server Modified: plugins/ldap-sync/tests/check_do_convert_from_to.c ============================================================================== --- plugins/ldap-sync/tests/check_do_convert_from_to.c Fri Jan 22 16:45:55 2010 (r6018) +++ plugins/ldap-sync/tests/check_do_convert_from_to.c Sat Jan 23 17:49:49 2010 (r6019) @@ -27,6 +27,16 @@ #include <errno.h> +#include <glib.h> +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <libxml/xmlmemory.h> +#include <libxml/xmlreader.h> +#include <libxml/xmlschemas.h> +#include <libxml/xpath.h> +#include <libxslt/xslt.h> +#include <libxslt/xsltutils.h> +#include <libxslt/transform.h> #include <opensync/opensync.h> #include <opensync/opensync-data.h> #include <opensync/opensync-format.h> @@ -857,6 +867,9 @@ osync_trace(TRACE_INTERNAL, "Edge converter: \"%s\"\n", osync_objformat_get_name(osync_converter_get_targetformat(l->data))); } } + + osync_list_free(list); + list = NULL; } else { osync_trace(TRACE_ERROR, "%s:%i: WARNING: list = NULL.", __FILE__, __LINE__); } @@ -871,6 +884,9 @@ osync_trace(TRACE_INTERNAL, "Converter: \"%s\"\n", osync_objformat_get_name(osync_converter_get_targetformat(l->data))); } } + + osync_list_free(list); + list = NULL; } else { osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: list = NULL.", __FILE__, __LINE__); } @@ -1184,6 +1200,11 @@ 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)); @@ -1233,6 +1254,10 @@ if (format_env) osync_format_env_unref(format_env); + if (result) + osync_free(result); + + xmlCleanupParser(); out: osync_trace(TRACE_EXIT, "%s", __func__); @@ -1248,6 +1273,10 @@ if (format_env) osync_format_env_unref(format_env); + if (result) + osync_free(result); + + xmlCleanupParser(); if (!osync_error_is_set(&error)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unknown reason.\n", __FILE__, __LINE__); |
From: <svn...@op...> - 2010-01-22 15:46:21
|
Author: dgollub Date: Fri Jan 22 16:45:55 2010 New Revision: 6018 URL: http://www.opensync.org/changeset/6018 Log: Added more trace hints to hunt down more easily Changes/Entries with wrong format or malformed OSyncData object. For debugging purposes only. Modified: trunk/opensync/engine/opensync_mapping_entry_engine.c Modified: trunk/opensync/engine/opensync_mapping_entry_engine.c ============================================================================== --- trunk/opensync/engine/opensync_mapping_entry_engine.c Fri Jan 22 16:22:29 2010 (r6017) +++ trunk/opensync/engine/opensync_mapping_entry_engine.c Fri Jan 22 16:45:55 2010 (r6018) @@ -219,7 +219,14 @@ OSyncChange *change = entry_engine->change; OSyncFormatConverterPath *path; - osync_trace(TRACE_INTERNAL, "Starting to convert from objtype %s and format %s", osync_change_get_objtype(entry_engine->change), osync_objformat_get_name(osync_change_get_objformat(entry_engine->change))); + osync_trace(TRACE_INTERNAL, "Starting to convert change(%p:%s)/entry(uid:%s/id:%llu) from objtype %s and format %s", + entry_engine->change, + __NULLSTR(osync_change_get_uid(entry_engine->change)), + osync_change_get_uid(entry_engine->change), + osync_mapping_entry_get_id(entry_engine->entry), + osync_change_get_objtype(entry_engine->change), + osync_objformat_get_name(osync_change_get_objformat(entry_engine->change))); + /* We have to save the objtype of the change so that it does not get * overwritten by the conversion */ objtype = osync_strdup(osync_change_get_objtype(change)); |
From: <svn...@op...> - 2010-01-22 15:22:39
|
Author: dgollub Date: Fri Jan 22 16:22:29 2010 New Revision: 6017 URL: http://www.opensync.org/changeset/6017 Log: Give summary of conversion results in trace files. This is for debugging purposes only. Modified: trunk/opensync/format/opensync_converter.c Modified: trunk/opensync/format/opensync_converter.c ============================================================================== --- trunk/opensync/format/opensync_converter.c Mon Jan 18 20:41:36 2010 (r6016) +++ trunk/opensync/format/opensync_converter.c Fri Jan 22 16:22:29 2010 (r6017) @@ -197,7 +197,7 @@ goto error; } - osync_trace(TRACE_EXIT, "Converter function"); + osync_trace(TRACE_EXIT, "Converter function. output_size: %u, output_data: %p", output_size, output_data); if (output_size == 0) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Converter Bug (%s -> %s). Conversion result is data with size 0.", osync_objformat_get_name(converter->source_format), osync_objformat_get_name(converter->target_format)); |
From: <svn...@op...> - 2010-01-18 19:48:46
|
Author: scriptor Date: Mon Jan 18 20:41:09 2010 New Revision: 6013 URL: http://www.opensync.org/changeset/6013 Log: Smaller fixes of several versions of the AUTH variable. This is the most important variable in test.conf. It will have to be changed almost certainly, if somebody wants to run the test suite. Please remember: The test suite with the LDAP plugin expects at least one fully configured, prepared and running LDAP server. Modified: plugins/ldap-sync/tests/test.conf Modified: plugins/ldap-sync/tests/test.conf ============================================================================== --- plugins/ldap-sync/tests/test.conf Sun Jan 17 19:01:31 2010 (r6012) +++ plugins/ldap-sync/tests/test.conf Mon Jan 18 20:41:09 2010 (r6013) @@ -65,11 +65,12 @@ # The AUTH variable is used for the command lines tools ldapsearch, # ldapadd etc. only. It is NOT used for the ldap-sync plugin of libopensync. ### Examples for slapd from openldap for the ldap utilities from openldap: ### -#AUTH="-Y DIGEST-MD5 -U ${AUTH_CID} -w ${PASSWORD} -Q" -AUTH="-h ${LDAP_SERVER_ADDRESS} -Y GSSAPI -Q" +#AUTH="-h ${LDAP_SERVER_ADDRESS} -p ${LDAP_SERVER_PORT} -Y DIGEST-MD5 -U ${AUTH_CID} -w ${PASSWORD} -Q" +AUTH="-h ${LDAP_SERVER_ADDRESS} -p ${LDAP_SERVER_PORT} -Y GSSAPI -Q" ### Example for ns-slapd from the fedora directory server for the ldap ### utilities from openldap: ### -#AUTH="-x -D "${BINDDN}" -w ${PASSWORD} -h ${LDAP_SERVER_ADDRESS} -p ${LDAP_SERVER2_PORT}" +#AUTH="-h ${LDAP_SERVER2_ADDRESS} -p ${LDAP_SERVER2_PORT} -x -D \"${BINDDN}\" -w ${PASSWORD} " +#AUTH="-h ${LDAP_SERVER2_ADDRESS} -p ${LDAP_SERVER2_PORT} -Y GSSAPI -Q " ######################### |
From: <svn...@op...> - 2010-01-18 19:48:45
|
Author: scriptor Date: Mon Jan 18 20:41:28 2010 New Revision: 6015 URL: http://www.opensync.org/changeset/6015 Log: Comments need to be removed from LDIF data, as well. I have added the corresponding function and some missing doxygen annotations. Some of the aleady existing annotations have been slightly changed. Modified: plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_format.h Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Mon Jan 18 20:41:19 2010 (r6014) +++ plugins/ldap-sync/src/ldap_format.c Mon Jan 18 20:41:28 2010 (r6015) @@ -2447,6 +2447,7 @@ /** + * @note * The following call to osync_xmlformat_copy() is a workaround for * the problem, that libxml2 may or may not free some cur->node * pointers: @@ -2457,8 +2458,8 @@ * * xmlNodePtr xmlAddChild (xmlNodePtr parent, xmlNodePtr cur) * - * Add a new node to @parent, at the end of the child (or property) list - * merging adjacent TEXT nodes (in which case @cur is freed). + * Add a new node to parent, at the end of the child (or property) list + * merging adjacent TEXT nodes (in which case cur is freed). * * If the new node is ATTRIBUTE, it is added into properties instead of * children. @@ -5064,12 +5065,12 @@ /** * @brief Entry function for converting from the ldap-sync plugin internal - * format to xmlformat-contact. - * @param input The data you need to convert - * @param inpsize The size of the input data + * format to xmlformat-contact. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5123,12 +5124,12 @@ /** * @brief Entry function for converting from the ldap-sync plugin internal - * format to xmlformat-contact. - * @param input The data you need to convert - * @param inpsize The size of the input data + * format to xmlformat-contact. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5514,12 +5515,12 @@ /** * @brief Entry function for converting from the ldap-sync plugin internal - * format to xmlformat-event. - * @param input The data you need to convert - * @param inpsize The size of the input data + * format to xmlformat-event. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5625,12 +5626,12 @@ /** * @brief Entry function for converting from the ldap-sync plugin internal - * format to xmlformat-todo. - * @param input The data you need to convert - * @param inpsize The size of the input data + * format to xmlformat-todo. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5677,12 +5678,12 @@ /** * @brief Entry function for converting from xmlformat-note to the - * ldap-sync plugin internal format. - * @param input The data you need to convert - * @param inpsize The size of the input data + * ldap-sync plugin internal format. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize This will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize This will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5739,12 +5740,12 @@ /** * @brief Entry function for converting from the ldap-sync plugin internal - * format to xmlformat-note. - * @param input The data you need to convert - * @param inpsize The size of the input data + * format to xmlformat-note. + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -5797,13 +5798,13 @@ /** * @brief Entry function for converting from xmlformat-note to the - * ldap-sync plugin internal format. + * ldap-sync plugin internal format. * - * @param input The data you need to convert - * @param inpsize The size of the input data + * @param input The data you need to convert. + * @param inpsize The size of the input data. * - * @param output This will contain the result of the conversion - * @param outpsize The will contain the size of the output + * @param output This will contain the result of the conversion. + * @param outpsize The will contain the size of the output. * * @param free_input * "You need to set this to TRUE if opensync @@ -6348,15 +6349,34 @@ +/** + * @brief This function performs replacements in a string on the basis + * of regular expressions. Currently it is a helper function + * for ldap_format_remove_comments() and ldap_format_remove_newlines() + * only. Those functions prepare LDIF data for further conversions + * by this plugin. See man 5 ldif for information about LDIF. + * + * @param string This could be any kind of text. Currently, however, + * it will only be filled with the contents of an LDIF file. + * @param replace_pattern This is the pattern that is to be replaced. + * The source pattern, so to speak. + * @param compile_options This int comprises the enum GRegexCompileFlags, such + * as G_REGEX_CASELESS or G_REGEX_MULTILINE. + * @param target_pattern This describes how the replace_pattern should look like + * afterwards. + * @param error The libopensync error pointer. + * + * @returns TRUE on success, FALSE in case of any errors. + * + */ osync_bool -ldap_format_remove_newlines(gchar **string, OSyncError **error) +ldap_format_replace_pattern(gchar **string, const gchar *replace_pattern, const int compile_options, const gchar *target_pattern, OSyncError **error) { GRegex *replace_regex = NULL; - const gchar *replace_pattern = "\\R[ \\t]"; GError *gerror = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, (void *)string, (void *)error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p)", __func__, (void *)string, (void *)replace_pattern, compile_options, (void *)target_pattern, (void *)error); if (string == NULL) { @@ -6364,8 +6384,23 @@ goto error; } + if (replace_pattern == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: replace_pattern = NULL.", __FILE__, __LINE__); + goto error; + } - replace_regex = g_regex_new(replace_pattern, G_REGEX_MULTILINE, 0, &gerror); + if (replace_pattern[0] == 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: replace_pattern[0] = 0.", __FILE__, __LINE__); + goto error; + } + + if (target_pattern == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: target_pattern = NULL.", __FILE__, __LINE__); + goto error; + } + + + replace_regex = g_regex_new(replace_pattern, compile_options, 0, &gerror); if (gerror != NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_new() has failed: %s", __FILE__, __LINE__, gerror->message); @@ -6379,7 +6414,8 @@ goto error; } - *string = g_regex_replace_literal(replace_regex, *string, -1, 0, (const gchar *)"", 0, &gerror); + + *string = g_regex_replace_literal(replace_regex, *string, -1, 0, target_pattern, 0, &gerror); if (gerror != NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_replace_literal() has failed: %s", __FILE__, __LINE__, gerror->message); @@ -6407,8 +6443,124 @@ +/** + * @brief The LDIF format knows of a particular kind of line continuation. + * This function eliminates the line continuation in that it merges + * two consecutive lines into just one line. Helper function for + * ldap_format_parse_ldif(). + * + * @param string An arbitrary string. Currently it is only the contents + * of an LDIF file. + * @param error The libopensync error pointer. + * + * @returns TRUE on success, FALSE in case of any error. + */ +osync_bool +ldap_format_remove_newlines(gchar **string, OSyncError **error) +{ + const gchar *replace_pattern = "\\R[ \\t]"; + const int compile_options = G_REGEX_MULTILINE; + const gchar *target_pattern = ""; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, (void *)string, (void *)error); + + + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + + if (!ldap_format_replace_pattern(string, replace_pattern, compile_options, target_pattern, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + } + + goto error; + } + + + 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 removes comments (= lines beginning with '#') + * from LDIF data. Helper function for ldap_format_parse_ldif(). + * + * @param string An arbitrary string. Currently it is only the contents + * of an LDIF file. + * @param error The libopensync error pointer. + * + * @returns TRUE on success, FALSE in case of any error. + */ + +osync_bool +ldap_format_remove_comments(gchar **string, OSyncError **error) +{ + const gchar *replace_pattern = "^[ \\t]*#.*\\R"; + const int compile_options = G_REGEX_MULTILINE; + const gchar *target_pattern = ""; + + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, (void *)string, (void *)error); + + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + + if (!ldap_format_replace_pattern(string, replace_pattern, compile_options, target_pattern, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + } + + goto error; + } + + + 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 reads the LDAP attributes of an LDAP entry of an + * LDIF string into a list of LDAPMod's. + * See also ldap_format_append_ldapmod() and /usr/include/ldap.h. + * + * @param string This string contains the LDIF data. + * @param format_name The name of the format, as defined, for example, + * in FORMAT_XMLFORMAT_CONTACT or FORMAT_LDAP_EVOLUTIONPERSON. + * @param ldapmods A Glist, which gets filled with LDAPMod's as a result of + * this function. + * @param error The libopensync error pointer. + * + * @returns TRUE on succes, FALSE in case of any error. + */ osync_bool ldap_format_extract_attributes_from_ldif(const gchar *string, const char *format_name, GList **ldapmods, OSyncError **error) { @@ -6523,7 +6675,21 @@ - +/** + * @brief This function extracts LDAP entries out of LDIF data and prepares + * them for further conversion steps performed by this plugin. + * See also man 5 ldif. + * Helper function for ldap_format_parse_ldif(). + * + * @param string This string contains the LDIF data. + * @param format_name The name of the format, as defined, for example, + * in FORMAT_XMLFORMAT_CONTACT or FORMAT_LDAP_EVOLUTIONPERSON. + * @param ldap_entries A Glist, which gets filled with LDAPMod's as a result of + * this function. + * @param error The libopensync error pointer. + * + * @returns TRUE on succes, FALSE in case of any error. + */ osync_bool ldap_format_read_ldap_entries_from_ldif(const gchar *string, const char *format_name, GList **ldap_entries, OSyncError **error) @@ -6702,6 +6868,21 @@ +/* + * @brief This function reads in LDIF data and prepares it for further + * conversion steps performed by this plugin. + * See also man 5 ldif. + * + * @param data This string contains the LDIF data. + * @param size The length of this string. + * @param format_name The name of the format, as defined, for example, + * in FORMAT_XMLFORMAT_CONTACT or FORMAT_LDAP_EVOLUTIONPERSON. + * @param ldap_entries A Glist, which gets filled with LDAPMod's as a result of + * this function. + * @param error The libopensync error pointer. + * + * @returns TRUE on succes, FALSE in case of any error. +*/ osync_bool ldap_format_parse_ldif(const char *data, const int size, const char *format_name, GList **ldap_entries, OSyncError **error) { @@ -6740,6 +6921,20 @@ // string is NULL-terminated. string = g_strndup(data, size); + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + + if (!ldap_format_remove_comments(&string, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_remove_comments() has failed.", __FILE__, __LINE__); + } + + goto error; + } + // LDIF uses a strange way of continuation on the next line. This call // merges two of such lines into one line @@ -6751,6 +6946,11 @@ goto error; } + +#ifdef DEBUG_detection + ldap_plugin_printf("%s:%i: string = \n\"%s\"\n", __FILE__, __LINE__, string); +#endif + if (!ldap_format_read_ldap_entries_from_ldif(string, format_name, ldap_entries, error)) { if (!osync_error_is_set(error)) { @@ -6782,6 +6982,22 @@ +/* + * @brief This function checks whether a certain string consists of LDIF data. + * See also man 5 ldif. This is a helper function for + * ldap_format_do_conv_ldap_to_xmlformat() which is part of the + * converter functions, and it is a helper function for + * ldap_format_do_detect_plain_as_ldap_format which is part of the + * detector functions. + * + * @param data This string contains the LDIF data. + * @param size The length of this string. + * @param format_name The name of the format, as defined, for example, + * in FORMAT_XMLFORMAT_CONTACT or FORMAT_LDAP_EVOLUTIONPERSON. + * @param error The libopensync error pointer. + * + * @returns TRUE on succes, FALSE in case of any error. +*/ osync_bool ldap_format_check_ldif(const char *data, int size, const char *format_name, OSyncError **error) Modified: plugins/ldap-sync/src/ldap_format.h ============================================================================== --- plugins/ldap-sync/src/ldap_format.h Mon Jan 18 20:41:19 2010 (r6014) +++ plugins/ldap-sync/src/ldap_format.h Mon Jan 18 20:41:28 2010 (r6015) @@ -87,7 +87,9 @@ static osync_bool ldap_format_post_stylesheet(OSyncXMLFormat *xmlformat, const char *objtype, const char *ldap_format_name, GList **ldap_entries, OSyncError **error); static osync_bool ldap_format_pre_stylesheet(GList *ldap_entries, const char *objtype, const char *ldap_format_name, xmlChar **xmlbuff, int *xmlbuff_size, OSyncError **error); osync_bool ldap_format_read_ldap_entries_from_ldif(const gchar *string, const char *format_name, GList **ldap_entries, OSyncError **error); +osync_bool ldap_format_remove_comments(gchar **string, OSyncError **error); osync_bool ldap_format_remove_newlines(gchar **string, OSyncError **error); +osync_bool ldap_format_replace_pattern(gchar **string, const gchar *replace_pattern, const int compile_options, const gchar *target_pattern, OSyncError **error); static osync_bool ldap_format_validate_xmlformat_by_libopensync(const char *input, const int inpsize, OSyncXMLFormat *xmlformat, const char *str, const char *stylesheet_file, OSyncError **error); static osync_bool ldap_format_validate_xmlformat_by_libxml(const char *input, const int inpsize, xmlDocPtr xmlcard, const char *stylesheet_file, OSyncError **error); static xmlDoc *ldap_format_xmlchars2xmlinternal(xmlChar *xmlchars); |
From: <svn...@op...> - 2010-01-18 19:41:46
|
Author: scriptor Date: Mon Jan 18 20:41:36 2010 New Revision: 6016 URL: http://www.opensync.org/changeset/6016 Log: The schema discovery still had issues. Should be fixed, now. Modified: plugins/ldap-sync/src/ldap_connect.c plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Mon Jan 18 20:41:28 2010 (r6015) +++ plugins/ldap-sync/src/ldap_connect.c Mon Jan 18 20:41:36 2010 (r6016) @@ -703,10 +703,9 @@ /** - * @brief Sets the LDAP protocol version to be used (2 or 3) + * @brief This function sets the LDAP protocol version to be used (2 or 3). * * @param ctx The libopensync environment. - * @param info The environment for the whole plugin. * @param sinkenv Sink specific environment. * @param error The libopensync error pointer. * @@ -1304,34 +1303,46 @@ + + + + + + + + + /** - * @brief Check whether the LDAP server offers support for a - * particular LDAP schema, like - * "mozillaAbPersonAlpha", - * "evolutionPerson" or - * "InetOrgPerson" (RFC 2798). - * - * @param ctx The libopensync context - * @param sinkenv The object type specific environment - * @param ldap_schema The name of the LDAP schema to ask whether or not it - * is supported by the LDAP server. - * @param result As a result of this function this boolean variable is set - * to TRUE, if the LDAP schema requested is supported by the - * LDAP server. - * @param error The libopensync error pointer. + * @brief This function tries and find out which one is the correct search base + * to start a search from, when looking for the available schemata. + * This is the first step in what is called "the schema discovery". + * + * See also ldap_plugin_check_ldap_schema_support(). + * + * @param[in] ctx The libopensync context. + * @param[in] sinkenv The object type specific environment. + * @param[in] attribute_type This will indicate the attribute to search for + * when calling ldap_search(). + * @param[out] search_base As a result of this function, this will be filled + * with the search base to use when performing the + * second step of the schema discovery. Usually + * "cn=Subschema" with slapd from openldap, or + * "cn=schema" with ns-slapd from 389-ds (fedora-ds). + * @param[out] error * - * @returns TRUE if this function could perform the check successfully (regardless of the result), FALSE on error. + * @returns TRUE on success, FALSE in case of any error. */ -osync_bool ldap_plugin_check_ldap_schema_support(OSyncContext *ctx, sink_environment *sinkenv, const char *ldap_schema, osync_bool *result, OSyncError **error) +osync_bool +ldap_plugin_schema_discovery_first_step(OSyncContext *ctx, sink_environment *sinkenv, int attribute_type, char **search_base, OSyncError **error) { - LDAPMessage *res = NULL, *res2 = NULL, *res3 = NULL, *res4 = NULL; - int i = 0; - struct berval **ber = NULL, **ber2 = NULL; + struct berval **ber2 = NULL; BerElement *ber3 = NULL; - char *search_base = NULL, *attr = NULL; + LDAPMessage *res3 = NULL, *res4 = NULL; + char *attr = NULL; + int i = 0; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, (void *)ctx, (void *)sinkenv, (void *)ldap_schema, (void *)result, (void *)error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p)", __func__, (void *)ctx, (void *)sinkenv, attribute_type, (void *)search_base, (void *)error); if (ctx == NULL) { @@ -1339,37 +1350,20 @@ goto error; } - if (sinkenv == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL. Returning.\n", __FILE__, __LINE__); goto error; } - if (result == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: result = NULL. Returning.\n", __FILE__, __LINE__); - goto error; - } - - if (ldap_schema == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_schema = NULL. Returning.\n", __FILE__, __LINE__); + if (search_base == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: search_base = NULL. Returning.\n", __FILE__, __LINE__); goto error; } - if (ldap_schema[0] == 0) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_schema[0] = 0. Returning.\n", __FILE__, __LINE__); - goto error; - } - *result = FALSE; - - // Get the relevant search_base. It may differ from server to server. -#ifdef USE_MOZLDAP - if (!ldap_plugin_call_ldap_search(ctx, sinkenv->ld, "", "(objectClass=*)", LDAP_SCOPE_BASE, FEDORADSsubschemaSubentry, sinkenv, TRUE, &res3, error)) -#else - if (!ldap_plugin_call_ldap_search(ctx, sinkenv->ld, "", "(objectClass=*)", LDAP_SCOPE_BASE, OPERATIONAL_ATTRIBUTES, sinkenv, TRUE, &res3, error)) -#endif + if (!ldap_plugin_call_ldap_search(ctx, sinkenv->ld, "", "(objectClass=*)", LDAP_SCOPE_BASE, attribute_type, sinkenv, TRUE, &res3, error)) { if (!osync_error_is_set(error)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_call_ldap_search() has failed.\n", __FILE__, __LINE__); @@ -1430,7 +1424,7 @@ #ifdef DEBUG_subschema_discovery ldap_plugin_printf("%s ", ber2[i]->bv_val); #endif - search_base = g_strdup(ber2[i]->bv_val); + *search_base = g_strdup(ber2[i]->bv_val); break; } @@ -1440,17 +1434,18 @@ #ifdef DEBUG_subschema_discovery ldap_plugin_printf("\n-------------------------\n"); #endif - if (search_base != NULL && search_base[0] != 0) { + if (*search_base != NULL && (*search_base)[0] != 0) { break; } } else { ldap_plugin_printf("%s:%i: WARNING: ber2 = NULL.", __FILE__, __LINE__); } - ldap_memfree(attr); + ldap_memfree(attr); + attr = NULL; } - if (search_base != NULL && search_base[0] != 0) { + if (*search_base != NULL && (*search_base)[0] != 0) { break; } } @@ -1460,7 +1455,162 @@ - // We haven't found the real search_base, yet. So let's assume, it is + if (attr) { + ldap_memfree(attr); + attr = NULL; + } + + if (res3) { + ldap_msgfree(res3); + res3 = NULL; + } + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; + + +error: + if (attr){ + ldap_memfree(attr); + attr = NULL; + } + + if (res3){ + ldap_msgfree(res3); + res3 = 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 Check whether the LDAP server offers support for a + * particular LDAP schema, like + * "mozillaAbPersonAlpha", + * "evolutionPerson" or + * "InetOrgPerson" (RFC 2798). + * + * @remarks Schema discovery must be performed in two steps: + * 1. Which one is the search base to start the search from? + * 2. Which are the objectclasses that can be found at this + * very search base? + * + * @example slapd from openldap: + * + * 1. + * ldapsearch -h 192.168.1.2 -p 389 -Y GSSAPI -LLL -Q -b "" -s base subschemaSubentry + * dn: + * subschemaSubentry: cn=Subschema + * + * 2. + * ldapsearch -h 192.168.1.2 -p 389 -Y GSSAPI -LLL -Q -b 'cn=Subschema' -s base '(objectClass=subschema)' objectClasses + * + * + * + * @example ns-slapd (389-ds = fedora-ds): + * + * 1. + * ldapsearch -h 192.168.1.2 -p 3890 -Y GSSAPI -LLL -Q -b "" -s base subschemaSubentry + * dn: + * subschemaSubentry: cn=schema + * + * 2. + * ldapsearch -h 192.168.1.2 -p 3890 -Y GSSAPI -LLL -Q -b 'cn=schema' -s base '(objectClass=subschema)' objectClasses + * + * + * @param ctx The libopensync context. + * @param sinkenv The object type specific environment. + * @param ldap_schema The name of the LDAP schema to ask whether or not it + * is supported by the LDAP server. + * @param result As a result of this function this boolean variable is set + * to TRUE, if the LDAP schema requested is supported by the + * LDAP server. + * @param error The libopensync error pointer. + * + * @returns TRUE if this function could perform the check successfully (regardless of the result), FALSE on error. + */ +osync_bool ldap_plugin_check_ldap_schema_support(OSyncContext *ctx, sink_environment *sinkenv, const char *ldap_schema, osync_bool *result, OSyncError **error) +{ + LDAPMessage *res = NULL, *res2 = NULL; + int i = 0; + struct berval **ber = NULL; + char *search_base = NULL; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, (void *)ctx, (void *)sinkenv, (void *)ldap_schema, (void *)result, (void *)error); + + + if (ctx == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ctx = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + + if (sinkenv == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (result == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: result = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (ldap_schema == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_schema = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (ldap_schema[0] == 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_schema[0] = 0. Returning.\n", __FILE__, __LINE__); + goto error; + } + + + *result = FALSE; + + + /****************** Schema discovery, 1st step **********************/ + // Get the relevant search_base. It may differ from server to server. + // And from library to library. + if (!ldap_plugin_schema_discovery_first_step(ctx, sinkenv, SUBSCHEMASUBENTRY, &search_base, error)){ + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_schema_discovery_first_step() has failed.\n", __FILE__, __LINE__); + } + + goto error; + } + + + /************* Schema discovery, 1st step has failed **************/ + if (search_base == NULL) { + // Fall back to a slightly modified search, that would at least work + // with slapd from openldap: + if (!ldap_plugin_schema_discovery_first_step(ctx, sinkenv, OPERATIONAL_ATTRIBUTES, &search_base, error)){ + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_plugin_schema_discovery_first_step() has failed.\n", __FILE__, __LINE__); + } + + goto error; + } + } + + + /********* Schema discovery, 1st step has failed, again ************/ + // We still haven't found the real search_base, yet. So let's assume, it is // "cn=Subschema" or "cn=schema" for ns-slapd. if (search_base == NULL) { #ifdef USE_MOZLDAP @@ -1473,6 +1623,7 @@ } + /***************** Schema discovery, 2nd step ***********************/ // Look for all the LDAP subschemata (as used by slapd from openldap): if (!ldap_plugin_call_ldap_search(ctx, sinkenv->ld, search_base, "(objectClass=subschema)", LDAP_SCOPE_BASE, OBJECTCLASSES, sinkenv, TRUE, &res, error)) { if (!osync_error_is_set(error)) { @@ -1533,6 +1684,7 @@ if (ber) { while (ber[i]) { if (strstr(ber[i]->bv_val, ldap_schema)) { + // Found! *result = TRUE; break; } @@ -1550,9 +1702,6 @@ if (res) ldap_msgfree(res); - if (res3) - ldap_msgfree(res3); - if (search_base) g_free(search_base); @@ -1568,16 +1717,12 @@ if (res) ldap_msgfree(res); - if (res3) - ldap_msgfree(res3); - if (search_base) g_free(search_base); if (!osync_error_is_set(error)) osync_error_set(error, OSYNC_ERROR_GENERIC, "Unknown reason.\n"); - osync_context_report_osyncwarning(ctx, *error); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; } @@ -1843,7 +1988,7 @@ userattributes[0] = "modifyTimestamp"; break; - case FEDORADSsubschemaSubentry: + case SUBSCHEMASUBENTRY: userattributes[0] = "subschemaSubentry"; break; Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Mon Jan 18 20:41:28 2010 (r6015) +++ plugins/ldap-sync/src/ldap_plugin.h Mon Jan 18 20:41:36 2010 (r6016) @@ -238,7 +238,7 @@ ///< LDAP_ALL_USER_ATTRIBUTES and ///< LDAP_ALL_OPERATIONAL_ATTRIBUTES. ///< This is sloppy. -#define FEDORADSsubschemaSubentry 5 ///< dto. +#define SUBSCHEMASUBENTRY 5 ///< dto. @@ -533,6 +533,7 @@ osync_bool ldap_plugin_report_sasl_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const struct berval passwd, char *tmp_authmech, char *tmp_authcid, OSyncError **error); osync_bool ldap_plugin_report_simple_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const char *binddn, const struct berval passwd, OSyncError **error); osync_bool ldap_plugin_rewrite_ldap_entry(ldap_entry *entry, GList *modifications, OSyncError **error); +osync_bool ldap_plugin_schema_discovery_first_step(OSyncContext *ctx, sink_environment *sinkenv, int attribute_type, char **search_base, OSyncError **error); osync_bool ldap_plugin_set_ldap_protocol (OSyncContext *ctx, sink_environment *sinkenv, OSyncError **error); |
From: <svn...@op...> - 2010-01-18 19:41:32
|
Author: scriptor Date: Mon Jan 18 20:41:19 2010 New Revision: 6014 URL: http://www.opensync.org/changeset/6014 Log: I have changed/corrected some of the doxygen annotations. Modified: plugins/ldap-sync/src/ldap_plugin.c plugins/ldap-sync/src/ldap_sasl.c Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Mon Jan 18 20:41:09 2010 (r6013) +++ plugins/ldap-sync/src/ldap_plugin.c Mon Jan 18 20:41:19 2010 (r6014) @@ -2072,11 +2072,12 @@ * * This is necessary because of the following design decision: * Quoting from http://www.opensync.org/doxygen/group__OSyncHashtableAPI.html - * + * + * @note{ * "Entries get determined as deleted if they got * not reported as osync_hashtable_update_change(), independent of the * changetype." - * + * } * * @param ctx Libopensync context. * @param sinkenv The object type specific environment Modified: plugins/ldap-sync/src/ldap_sasl.c ============================================================================== --- plugins/ldap-sync/src/ldap_sasl.c Mon Jan 18 20:41:09 2010 (r6013) +++ plugins/ldap-sync/src/ldap_sasl.c Mon Jan 18 20:41:19 2010 (r6014) @@ -42,6 +42,8 @@ + +#ifdef LIBSASL2_FOUND /** * @brief This is a callback-function for ldap_sasl_interactive_bind_s(). * It fills the "struct sasl_interact in" (see also sasl/sasl.h) with @@ -64,7 +66,6 @@ * @returns LDAP_SASL_BIND_IN_PROGRESS in case of error, or LDAP_SUCCESS otherwise */ -#ifdef LIBSASL2_FOUND int ldap_plugin_lutil_sasl_interact (LDAP *ld, unsigned int flags, lutilSASLdefaults *defaults, void *in) { OSyncError *error = NULL; @@ -143,7 +144,8 @@ /** * - * @brief Reads in SASL authentication settings and defines some defaults. + * @brief This function reads in the SASL authentication settings and + * defines some default values. * * @param ld The LDAP connection handle. * @param mech The SASL authentication mechanism. |
From: <svn...@op...> - 2010-01-17 18:01:40
|
Author: scriptor Date: Sun Jan 17 19:01:31 2010 New Revision: 6012 URL: http://www.opensync.org/changeset/6012 Log: For the object type "contact" the ldap_format plugin accepts now data in LDIF. Usage: ldap_format_convert contact1.ldif ldap_format_convert --to-vcard21 contact1.ldif ldap_format_convert contact2.ldif ldap_format_convert -h See man 5 ldif for information about LDIF. This man page is part of the openldap package. Added: plugins/ldap-sync/tests/check_convert_to_xmlformat (contents, props changed) Modified: plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_format.h plugins/ldap-sync/tests/CMakeLists.txt Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Sun Jan 17 19:01:19 2010 (r6011) +++ plugins/ldap-sync/src/ldap_format.c Sun Jan 17 19:01:31 2010 (r6012) @@ -1455,7 +1455,7 @@ *ldap_entries = g_list_append(*ldap_entries, ldap_subentry); ldap_subentry = NULL; } else { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ldap_entries = NULL.\n", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.\n", __FILE__, __LINE__); if (child_value) { xmlFree(child_value); @@ -4186,7 +4186,7 @@ // Workaround for one particular telephone number that does not comply // with the syntax requirements of the LDAP schema "evolutionPerson": if ((!strcmp((char *)name, "telephoneNumber") || (!strcmp((char *)name, "mobile"))) && !strcmp((char *)value, "*100#")) { - osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: Omitting this attribute (\"%s: %s\") because of syntax violation of the underlying LDAP schema and because of a strange behaviour of slapd afterwards: It keeps this error message for all kinds of succeeding entries, even if they do not contain any telephoneNumber attributes, at all.\n", __FILE__, __LINE__, name, value); + ldap_plugin_printf("%s:%i: WARNING: Omitting this attribute (\"%s: %s\") because of syntax violation of the underlying LDAP schema and because of a strange behaviour of slapd afterwards: It keeps this error message for all kinds of succeeding entries, even if they do not contain any telephoneNumber attributes, at all.\n", __FILE__, __LINE__, name, value); if (value) { @@ -4198,6 +4198,20 @@ } + // Workaround for a telephone number, which the LDAP server does + // not accept: "Invalid syntax. homePhone: value #0 invalid per syntax" + // The value "company phoneöä" occurs in tests/vcards/evo2-umlaute.vcf + if (!strcmp((char *)name, "homePhone") && !strcmp((char *)value, "company phoneöä")) { + ldap_plugin_printf("%s:%i: WARNING: Omitting this attribute (\"%s: %s\") completely because of syntax violation of the underlying LDAP schema.\n", __FILE__, __LINE__, name, value); + + + if (value) { + xmlFree(value); + value = NULL; + } + + continue; + } @@ -4758,6 +4772,7 @@ int size = 0; xmlChar *xmlbuff = NULL; GList *list = NULL; + GString *buffer = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %u, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p)", __func__, (void *)input, inpsize, (void *)output, (void *)outpsize, (void *)free_input, (void *)ldap_format_name, (void *)xmlformat_name, (void *)stylesheet_name, (void *)objtype, (void *)config, (void *)userdata, (void *)error); @@ -4895,8 +4910,52 @@ goto applying_stylesheet; + } else if (inpsize > 6 && ldap_format_check_ldif((char *)input, (int)inpsize, ldap_format_name, error)) { + GList *ldap_entries = NULL; + + +#ifdef DEBUG_detection + ldap_plugin_printf("%s:%i: This is an \"%s\" format in form of LDIF.", __FILE__, __LINE__, ldap_format_name); +#endif + + xmlbuff = NULL; + size = 0; + + if (!ldap_format_parse_ldif((char *)input, (int)inpsize, ldap_format_name, &ldap_entries, error)) { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_parse_ldif() has failed.\n", __FILE__, __LINE__); + + goto error; + } + + if (ldap_entries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries == NULL. ldap_format_parse_ldif() must have failed.\n", __FILE__, __LINE__); + + goto error; + } + + // And from LDAP entries in a GList into xmlbuff, size: + if (!ldap_format_pre_stylesheet(ldap_entries, objtype, ldap_format_name, &xmlbuff, &size, error)) { + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_pre_stylesheet() has failed.\n", __FILE__, __LINE__); + + goto error; + } + + + // Now, xmlbuff and size should be set: + goto applying_stylesheet; + } else { - osync_trace(TRACE_ERROR, "%s:%i: Don't know. inpsize = %u\n", __FILE__, __LINE__, inpsize); + osync_trace(TRACE_ERROR, "%s:%i: Don't know what kind of data that is. inpsize = %u\n", __FILE__, __LINE__, inpsize); + + ldap_plugin_dump_bytes((unsigned char *)input, inpsize < 64 ? inpsize : 64, &buffer, error); + if (buffer && buffer->str) { + ldap_plugin_printf("%s\n\n", buffer->str); + g_string_free(buffer, TRUE); + } + + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Don't know what kind of data that is. inpsize = %u. Giving up.\n", __FILE__, __LINE__, inpsize); } goto error; @@ -4941,7 +5000,15 @@ applying_stylesheet: + if (xmlbuff == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: xmlbuff = NULL. Nothing to do here.\n", __FILE__, __LINE__); + goto error; + } + if (size <= 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: size = 0. Nothing to do here. xmlbuff = %p\n", __FILE__, __LINE__, (void *)xmlbuff); + goto error; + } // Apply stylesheet if (!ldap_format_do_apply_stylesheet((char *)xmlbuff, size, output, outpsize, config, userdata, stylesheet_name, error)) { @@ -6278,6 +6345,560 @@ + + + +osync_bool +ldap_format_remove_newlines(gchar **string, OSyncError **error) +{ + GRegex *replace_regex = NULL; + const gchar *replace_pattern = "\\R[ \\t]"; + GError *gerror = NULL; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, (void *)string, (void *)error); + + + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + + replace_regex = g_regex_new(replace_pattern, G_REGEX_MULTILINE, 0, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_new() has failed: %s", __FILE__, __LINE__, gerror->message); + g_error_free (gerror); + gerror = NULL; + goto error; + } + + if (replace_regex == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: replace_regex = NULL. g_regex_new() must have failed.", __FILE__, __LINE__); + goto error; + } + + *string = g_regex_replace_literal(replace_regex, *string, -1, 0, (const gchar *)"", 0, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_replace_literal() has failed: %s", __FILE__, __LINE__, gerror->message); + g_error_free (gerror); + gerror = NULL; + goto error; + } + + if (*string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: *string = NULL. g_regex_replace_literal() must have failed.", __FILE__, __LINE__); + goto error; + } + + + 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; +} + + + + + +osync_bool +ldap_format_extract_attributes_from_ldif(const gchar *string, const char *format_name, GList **ldapmods, OSyncError **error) +{ + GRegex *regex = NULL; + GMatchInfo *match_info = NULL; + GError *gerror = NULL; + const gchar *pattern = "^[ \\t]*([-\\w!-^]+):[ \\t]*([-\\w!-^][-\\w !-^]+)[ \\t]*$"; + const int compile_options = G_REGEX_CASELESS | G_REGEX_MULTILINE; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, (void *)string, (void *)format_name, (void *)error); + + + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + if (format_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name = NULL.", __FILE__, __LINE__); + goto error; + } + + + + regex = g_regex_new (pattern, compile_options, 0, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_new() has failed: %s", __FILE__, __LINE__, gerror->message); + goto error; + } + + if (regex == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: regex = NULL. g_regex_new() must have failed.", __FILE__, __LINE__); + goto error; + } + + + g_regex_match(regex, string, 0, &match_info); + g_match_info_matches(match_info); + +#ifdef DEBUG_detection + printf("\n--------\n"); +#endif + + while (g_match_info_matches(match_info)) + { + gchar *attribute_name = g_match_info_fetch(match_info, 1); + gchar *attribute_value = g_match_info_fetch(match_info, 2); + + if (attribute_name && attribute_value) { +#ifdef DEBUG_detection + printf("\"%s\": \"%s\"\n", attribute_name, attribute_value); +#endif + + // Append it only, if it is NOT the "dn:" + if (strcmp(attribute_name, "dn") && strcmp(attribute_name, "DN")) { + *ldapmods = ldap_format_append_ldapmod(*ldapmods, attribute_name, attribute_value); + } + + g_free(attribute_name); + g_free(attribute_value); + attribute_name = NULL; + attribute_value = NULL; + } else { + printf("%s:%i: ERROR: attribute_name or attribute_value is 0.\n", __FILE__, __LINE__); + } + + + // Procede in loop + g_match_info_next (match_info, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_match_info_next() has failed: %s", __FILE__, __LINE__, gerror->message); + goto error; + } + } + +#ifdef DEBUG_detection + printf("\n--------\n"); +#endif + + + + if (match_info){ + g_match_info_free (match_info); + } + + if (regex){ + g_regex_unref (regex); + } + + osync_trace(TRACE_EXIT, "%s()", __func__); + return TRUE; + +error: + if (match_info){ + g_match_info_free (match_info); + } + + if (regex){ + g_regex_unref (regex); + } + + 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; +} + + + + + + +osync_bool +ldap_format_read_ldap_entries_from_ldif(const gchar *string, const char *format_name, GList **ldap_entries, OSyncError **error) +{ + GRegex *regex = NULL; + GMatchInfo *match_info = NULL; + GError *gerror = NULL; + const gchar *pattern = "^[ \\t]*(?:dn:|dn::|dn:<)[ \\t]*((?:[-\\w]+=[-\\w]+[ \\t]*,?[ \\t]*)+)(.+?)(?=dn:)"; + const int compile_options = G_REGEX_CASELESS | G_REGEX_MULTILINE | G_REGEX_DOTALL; + + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, (void *)string, (void *)format_name, (void *)ldap_entries, (void *)error); + + + if (string == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: string = NULL.", __FILE__, __LINE__); + goto error; + } + + if (format_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name = NULL.", __FILE__, __LINE__); + goto error; + } + + if (ldap_entries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.", __FILE__, __LINE__); + goto error; + } + + + regex = g_regex_new (pattern, compile_options, 0, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_regex_new() has failed: %s", __FILE__, __LINE__, gerror->message); + goto error; + } + + if (regex == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: regex = NULL. g_regex_new() must have failed.", __FILE__, __LINE__); + goto error; + } + + *ldap_entries = NULL; + + g_regex_match(regex, string, 0, &match_info); + g_match_info_matches(match_info); + while (g_match_info_matches(match_info)) + { + ldap_entry *single_ldap_entry = NULL; + GList *ldapmods = NULL; + gchar *line = g_match_info_fetch(match_info, 0); + gchar *dn = g_match_info_fetch(match_info, 1); + gchar *id = NULL; + if (dn) { + gchar **tokens = g_strsplit(dn, ",", 0); + if (tokens) { + if (tokens[1]) { + id = g_strdup(tokens[1]); + } else { + ldap_plugin_printf("%s:%i: ERROR: tokens[1] = NULL. Ignoring for now.", __FILE__, __LINE__); + } + } else { + ldap_plugin_printf("%s:%i: ERROR: tokens = NULL. Ignoring for now.", __FILE__, __LINE__); + } + } else { + ldap_plugin_printf("%s:%i: ERROR: dn = NULL. Ignoring for now.", __FILE__, __LINE__); + } + +#ifdef DEBUG_detection + if (dn) { + g_print("\nDN: \"%s\"\n", dn); + } + + if (id) { + g_print("id: \"%s\"\n", id); + } + + g_print("------------\n"); +#endif + + if (line) { +#ifdef DEBUG_detection + g_print ("%s\n", line); +#endif + + + if (!ldap_format_extract_attributes_from_ldif(line, format_name, &ldapmods, error)) { + if (!osync_error_is_set(error)){ + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_extract_attributes_from_ldif() has failed.", __FILE__, __LINE__); + } + + g_free (line); + line = NULL; + goto error; + } + + g_free (line); + line = NULL; + + single_ldap_entry = ldap_format_create_ldap_entry_from_ldapmods(ldapmods); + if (ldapmods) { + ldap_format_free_ldapmods_list(ldapmods); + ldapmods = NULL; + } + + if (single_ldap_entry == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: single_ldap_entry = NULL. ldap_format_create_ldap_entry_from_ldapmods() must have failed.", __FILE__, __LINE__); + goto error; + } + + single_ldap_entry->dn = g_strdup(dn); + + single_ldap_entry->subentries = NULL; + + if (dn) { + g_free(dn); + dn = NULL; + } + + if (ldap_entries) { + *ldap_entries = g_list_append(*ldap_entries, single_ldap_entry); + } else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.\n", __FILE__, __LINE__); + goto error; + } + + } + + +#ifdef DEBUG_detection + g_print("------------\n"); + gint number_substrings = g_match_info_get_match_count(match_info); + g_print("number_substrings = %i\n", number_substrings); + g_print("------------\n"); +#endif + + + // Procede in loop + g_match_info_next (match_info, &gerror); + if (gerror != NULL) + { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: g_match_info_next() has failed: %s", __FILE__, __LINE__, gerror->message); + goto error; + } + } + + + if (match_info){ + g_match_info_free (match_info); + } + + if (regex){ + g_regex_unref (regex); + } + + + osync_trace(TRACE_EXIT, "%s()", __func__); + return TRUE; + +error: + if (match_info){ + g_match_info_free (match_info); + } + + if (regex){ + g_regex_unref (regex); + } + + + 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; +} + + + +osync_bool +ldap_format_parse_ldif(const char *data, const int size, const char *format_name, GList **ldap_entries, OSyncError **error) +{ + char *string = NULL; + + + osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p)", __func__, (void *)data, size, (void *)format_name, (void *)ldap_entries, (void *)error); + + + + if (data == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data = NULL.", __FILE__, __LINE__); + goto error; + } + + if (data[0] == 0) { + osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: data is empty. Returning FALSE.", __FILE__, __LINE__); + goto error; + } + + if (format_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name = NULL.", __FILE__, __LINE__); + goto error; + } + + if (format_name[0] == 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name[0] = 0.", __FILE__, __LINE__); + goto error; + } + + if (ldap_entries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.", __FILE__, __LINE__); + goto error; + } + + + // string is NULL-terminated. + string = g_strndup(data, size); + + // LDIF uses a strange way of continuation on the next line. This call + // merges two of such lines into one line + if (!ldap_format_remove_newlines(&string, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_remove_newlines() has failed.", __FILE__, __LINE__); + } + + goto error; + } + + + if (!ldap_format_read_ldap_entries_from_ldif(string, format_name, ldap_entries, error)) { + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_format_read_ldap_entries_from_ldif() has failed.", __FILE__, __LINE__); + } + + goto error; + } + + + if (*ldap_entries == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: *ldap_entries = NULL. ldap_format_read_ldap_entries_from_ldif() must have failed.", __FILE__, __LINE__); + goto error; + } + + + + 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; +} + + + + + +osync_bool +ldap_format_check_ldif(const char *data, int size, const char *format_name, OSyncError **error) +{ + const gchar *dn_minimal_pattern = "^[ \\t]*dn:{1,2}[ \\t]*[\\w]+=[\\w]+"; + const gchar *inetorgperson_pattern = "^[ \\t]*objectclass:[ \\t]*inetorgperson"; + const gchar *evolutionperson_pattern = "^[ \\t]*objectclass:[ \\t]*evolutionperson"; + + osync_bool rv = FALSE; + + + osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p)", __func__, (void *)data, size, (void *)format_name, (void *)error); + + + if (data == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data = NULL.", __FILE__, __LINE__); + goto error; + } + + if (data[0] == 0) { + osync_trace(TRACE_INTERNAL, "%s:%i: WARNING: data is empty. Returning FALSE.", __FILE__, __LINE__); + rv = FALSE; + goto regular_out; + } + + if (format_name == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name = NULL.", __FILE__, __LINE__); + goto error; + } + + if (format_name[0] == 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_name[0] = 0.", __FILE__, __LINE__); + goto error; + } + + + if (!strcmp(format_name, FORMAT_LDAP_EVOLUTIONPERSON)){ + if (g_regex_match_simple(dn_minimal_pattern, data, G_REGEX_CASELESS | G_REGEX_MULTILINE, 0)) { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: OK. \"dn:\" detected. Looks like LDIF data.", __FILE__, __LINE__); +#endif + + if (g_regex_match_simple(evolutionperson_pattern, data, G_REGEX_CASELESS | G_REGEX_MULTILINE, 0)) { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: OK. \"ldap-evolutionperson\" in LDIF data detected.", __FILE__, __LINE__); +#endif + + rv = TRUE; + } else { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: No, it is not \"ldap-evolutionperson\" in LDIF data.", __FILE__, __LINE__); +#endif + + rv = FALSE; + } + + } else { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: No, could not even detect a \"dn:\" line. Does NOT look like LDIF data.", __FILE__, __LINE__); +#endif + + rv = FALSE; + } + } else if (!strcmp(format_name, FORMAT_LDAP_INETORGPERSON)){ + if (g_regex_match_simple(dn_minimal_pattern, data, G_REGEX_CASELESS | G_REGEX_MULTILINE, 0)) { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: OK. \"dn:\" detected. Looks like LDIF data.", __FILE__, __LINE__); +#endif + + if (g_regex_match_simple(inetorgperson_pattern, data, G_REGEX_CASELESS | G_REGEX_MULTILINE, 0)) { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: OK. \"ldap-inetorgperson\" in LDIF data detected.", __FILE__, __LINE__); +#endif + + rv = TRUE; + } else { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: ", __FILE__, __LINE__); +#endif + + rv = FALSE; + } + } else { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: No, could not even detect a \"dn:\" line. Does NOT look like LDIF data.", __FILE__, __LINE__); +#endif + + rv = FALSE; + } + } else { +#ifdef DEBUG_detection + osync_trace(TRACE_INTERNAL, "%s:%i: The format \"%s\" is not yet supported by the LDIF related detector functions of the LDAP plugin.\n", __FILE__, __LINE__, format_name); +#endif + + rv = FALSE; + } + + +regular_out: + osync_trace(TRACE_EXIT, "%s(): rv = %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 performs the check of a byte sequence whether * or not it is of the type of format the calling function @@ -6529,6 +7150,12 @@ if (!ldap_format_check_xml(data, size, error)) { osync_trace(TRACE_INTERNAL, "%s:%i: ldap_format_check_xml() has NOT recognized input as an XML document.", __FILE__, __LINE__); + + if (ldap_format_check_ldif(data, size, format_name, error)) { + osync_trace(TRACE_EXIT, "%s(): Returning TRUE.", __func__); + return TRUE; + } + osync_trace(TRACE_EXIT, "%s(): Returning FALSE.", __func__); return FALSE; } Modified: plugins/ldap-sync/src/ldap_format.h ============================================================================== --- plugins/ldap-sync/src/ldap_format.h Sun Jan 17 19:01:19 2010 (r6011) +++ plugins/ldap-sync/src/ldap_format.h Sun Jan 17 19:01:31 2010 (r6012) @@ -50,6 +50,7 @@ static osync_bool ldap_format_apply_stylesheet_workaround(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, const char *config, void *userdata, const char *stylesheet, OSyncError **error); static int ldap_format_avoid_duplicate_attribute(GList *ldapmods, const char *name); static osync_bool ldap_format_check_adequate_stylesheet(xmlNode *root_element, const char *stylesheet_file, OSyncError **error); +osync_bool ldap_format_check_ldif(const char *data, int size, const char *format_name, 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, OSyncError **error); @@ -74,15 +75,19 @@ static osync_bool ldap_format_do_conv_ldap_to_xmlformat(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *ldap_format_name, const char *xmlformat_name, const char *stylesheet_name, const char *objtype, const char *config, void *userdata, OSyncError **error); static osync_bool ldap_format_do_conv_xmlformat_to_ldap(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *xmlformat_name, const char *ldap_format_name, const char *stylesheet_name, const char *objtype, const char *config, void *userdata, OSyncError **error); osync_bool ldap_format_do_detect_plain_as_ldap_format(const char *data, const int size, const char *format_name, const char *opening_tag, const char *closing_tag, const void *userdata, OSyncError **error); +osync_bool ldap_format_extract_attributes_from_ldif(const gchar *string, const char *format_name, GList **ldapmods, OSyncError **error); void ldap_format_free_complex_element_lists(GList **list); static void ldap_format_free_ldap_entry (ldap_entry *entry); static void ldap_format_free_ldap_entries (GList **entrylist); static void ldap_format_free_ldapmods_list(GList *ldapmods); static osync_bool ldap_format_get_attributes(const xmlNode *xmlnode, gchar **attr1_name, gchar **attr1_value, gchar **attr2_name, gchar **attr2_value, OSyncError **error); +osync_bool ldap_format_parse_ldif(const char *data, const int size, const char *format_name, GList **ldap_entries, OSyncError **error); static osync_bool ldap_format_parse_xml_subentry(const xmlNode *xmlnode, const gchar *dn, complex_elements *complex_elements, GList **ldap_entries, OSyncError **error); static osync_bool ldap_format_parse_xmlinternal_child_nodes(xmlNode *xmlnode, const char *objtype, const char *dn, complex_elements *complex_elements, GList **potential_subentries, GList **ldapmods, OSyncError **error); static osync_bool ldap_format_post_stylesheet(OSyncXMLFormat *xmlformat, const char *objtype, const char *ldap_format_name, GList **ldap_entries, OSyncError **error); static osync_bool ldap_format_pre_stylesheet(GList *ldap_entries, const char *objtype, const char *ldap_format_name, xmlChar **xmlbuff, int *xmlbuff_size, OSyncError **error); +osync_bool ldap_format_read_ldap_entries_from_ldif(const gchar *string, const char *format_name, GList **ldap_entries, OSyncError **error); +osync_bool ldap_format_remove_newlines(gchar **string, OSyncError **error); static osync_bool ldap_format_validate_xmlformat_by_libopensync(const char *input, const int inpsize, OSyncXMLFormat *xmlformat, const char *str, const char *stylesheet_file, OSyncError **error); static osync_bool ldap_format_validate_xmlformat_by_libxml(const char *input, const int inpsize, xmlDocPtr xmlcard, const char *stylesheet_file, OSyncError **error); static xmlDoc *ldap_format_xmlchars2xmlinternal(xmlChar *xmlchars); Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Sun Jan 17 19:01:19 2010 (r6011) +++ plugins/ldap-sync/tests/CMakeLists.txt Sun Jan 17 19:01:31 2010 (r6012) @@ -327,9 +327,13 @@ -ADD_TEST( convert_ldap_evolutionperson1 ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_evolutionperson*.xml" "contact" ) +ADD_TEST( convert_ldap_evo_person1_xml ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_evolutionperson*.xml" "contact" ) -ADD_TEST( convert_ldap_inetorgperson1 ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_inetorgperson*.xml" "contact" ) +ADD_TEST( convert_ldap_evo_person1_ldif ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact2.ldif" "contact" ) + +ADD_TEST( convert_ldap_inetorgpers1_xml ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_inetorgperson*.xml" "contact" ) + +ADD_TEST( convert_ldap_inetorgpers1_ldif ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/contact1.ldif" "contact" ) ADD_TEST( convert_ldap_event1 ${TESTDIR}/check_convert_from_to_many ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_event*.xml" "event" ) @@ -339,6 +343,22 @@ +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_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_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_note1 ${TESTDIR}/check_convert_to_xmlformat ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap_note*.xml" "note" ${SCHEMADIR}/xmlformat-note.xsd) + + + ########################################################## # Interact with the LDAP server using external tools only... # This set of tests checks whether the LDAP server is sufficiently Added: plugins/ldap-sync/tests/check_convert_to_xmlformat ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_convert_to_xmlformat Sun Jan 17 19:01:31 2010 (r6012) @@ -0,0 +1,269 @@ +#!/bin/bash + +set -x + +FILE=$0 +PLUGINNAME="ldap-sync" +PLUGINPATH="$1/src" +BUILDDIR=$1 +SOURCEFORMAT_EXPRESSION="$3" +OBJTYPE="$4" +SCHEMA="$5" +rv=0 + + + +if test -z "$SOURCEFORMAT_EXPRESSION"; then + echo "$FILE:$LINENO: ERROR: \$SOURCEFORMAT_EXPRESSION is empty. Exiting." + exit 1; +fi + +if test -z "$OBJTYPE"; then + echo "$FILE:$LINENO: ERROR: \$OBJTYPE is empty. Exiting." + exit 1; +fi + +if test -z "$SCHEMA"; then + echo "$FILE:$LINENO: ERROR: \$SCHEMA is empty. Exiting." + exit 1; +fi + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +CHECK_DO_CONVERT_FROM_TO=$(which check_do_convert_from_to 2> /dev/null) +if test -z "$CHECK_DO_CONVERT_FROM_TO"; then + if test -f "./check_do_convert_from_to"; then + CHECK_DO_CONVERT_FROM_TO="./check_do_convert_from_to" + else + dir=$(dirname $FILE) + if test -d "$dir"; then + if test -f "${dir}/check_do_convert_from_to"; then + CHECK_DO_CONVERT_FROM_TO="${dir}/check_do_convert_from_to" + else + if test -d "$BUILDDIR"; then + CHECK_DO_CONVERT_FROM_TO="${BUILDDIR}/tests/check_do_convert_from_to" + fi + fi + fi + fi +fi + + + +if test -z "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: \$CHECK_DO_CONVERT_FROM_TO is empty. Exiting." + exit 1; +fi + +if test ! -f "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: $CHECK_DO_CONVERT_FROM_TO could not be found. Exiting." + exit 1; +fi + +if test ! -x "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: $CHECK_DO_CONVERT_FROM_TO could be found, but is not executable. Exiting." + exit 1; +fi + +XMLLINT=$(which xmllint) +if test ! -f "$XMLLINT"; then + echo "$FILE:$LINENO: ERROR: Could not find xmllint. Exiting."; + exit 1; +fi + +if test ! -x "$XMLLINT"; then + echo "$FILE:$LINENO: ERROR: xmllint could be found, but it is not executable. Exiting."; + exit 1; +fi + + +source "$SOURCE_DIR/test.conf" +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" +TARGET_FILE="${TMPDIR}/out.xml" +if test -z "$TARGET_FILE"; then + echo "$FILE:$LINENO: ERROR: \$TARGET_FILE is empty. Exiting." + exit 1; +fi + + + +echo -e "\n\n\nAbout to be converted:" +for f in $SOURCEFORMAT_EXPRESSION; do + echo "$f" +done +echo -e "\n\n\n" + + + +do_conversion() +{ + file="$1" + targetformat="$2" + + if test -z "$file"; then + echo "$FILE:$LINENO: ERROR: \$file is empty. Returning." + return 1; + fi + + if test -z "$targetformat"; then + echo "$FILE:$LINENO: ERROR: \$targetformat is empty. Returning." + return 1; + fi + + + cmd="$CHECK_DO_CONVERT_FROM_TO $file $targetformat --out $TARGET_FILE" + echo -e "\n\n\nRunning \"$cmd\"" + eval $cmd + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi + echo -e "\n\n\n" +} + + + + + + +validate() +{ + schema="$1" + target_file="$2" + + if test -z "$schema"; then + echo "$FILE:$LINENO: ERROR: \$schema is empty. Returning." + return 1; + fi + + if test -z "$target_file"; then + echo "$FILE:$LINENO: ERROR: \$target_file is empty. Returning." + return 1; + fi + + if test ! -e "$schema"; then + echo "$FILE:$LINENO: ERROR: \"$schema\" could not be found. Returning." + return 1; + fi + + if test ! -e "$target_file"; then + echo "$FILE:$LINENO: ERROR: \"$target_file\" could not be found. Returning." + return 1; + fi + + if test ! -r "$schema"; then + echo "$FILE:$LINENO: ERROR: \"$schema\" could be found, but it is not readable. Returning." + return 1; + fi + + if test ! -r "$target_file"; then + echo "$FILE:$LINENO: ERROR: \"$target_file\" could be found, but it is not readable. Returning." + return 1; + fi + + + $XMLLINT --noout --schema $schema $target_file + rv=$? + return $rv +} + + + + + + + + +rv=1 +for f in $SOURCEFORMAT_EXPRESSION; do + if test "$OBJTYPE" == "contact"; then + do_conversion $f "--to-xmlformat" + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi + + validate $SCHEMA $TARGET_FILE + rv=$? + + elif test "$OBJTYPE" == "event"; then + do_conversion $f "--to-xmlformat" + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi + + validate $SCHEMA $TARGET_FILE + rv=$? + + elif test "$OBJTYPE" == "todo"; then + do_conversion $f "--to-xmlformat" + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi + + validate $SCHEMA $TARGET_FILE + rv=$? + + elif test "$OBJTYPE" == "note"; then + do_conversion $f "--to-xmlformat" + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi + + validate $SCHEMA $TARGET_FILE + rv=$? + + else + echo "$FILE:$LINENO: ERROR: Object type \"$OBJTYPE\" is unknown." + rv=1 + break; + + fi + +done + + + + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + +exit $rv + |
From: <svn...@op...> - 2010-01-17 18:01:28
|
Author: scriptor Date: Sun Jan 17 19:01:19 2010 New Revision: 6011 URL: http://www.opensync.org/changeset/6011 Log: Fixed some smaller bugs in the test scripts. Modified: plugins/ldap-sync/tests/check_convert_from_to_many plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Modified: plugins/ldap-sync/tests/check_convert_from_to_many ============================================================================== --- plugins/ldap-sync/tests/check_convert_from_to_many Sun Jan 17 19:01:05 2010 (r6010) +++ plugins/ldap-sync/tests/check_convert_from_to_many Sun Jan 17 19:01:19 2010 (r6011) @@ -149,7 +149,7 @@ else echo "$FILE:$LINENO: ERROR: Object type \"$OBJTYPE\" is unknown." - rv = 1 + rv=1 break; fi Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Sun Jan 17 19:01:05 2010 (r6010) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Sun Jan 17 19:01:19 2010 (r6011) @@ -125,7 +125,8 @@ fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1). Trying to remove \"$XMLFILE\"" + delete_file "$OBJECTTYPE" "$XMLFILE" exit 1; fi @@ -152,7 +153,8 @@ fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2). Trying to remove \"$XMLFILE\"" + delete_file "$OBJECTTYPE" "$XMLFILE" exit 1; fi Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync Sun Jan 17 19:01:05 2010 (r6010) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync Sun Jan 17 19:01:19 2010 (r6011) @@ -129,7 +129,8 @@ valgrind_fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1). Trying to remove \"$XMLFILE\"" + delete_file "$OBJECTTYPE" "$XMLFILE" exit 1; fi @@ -156,7 +157,8 @@ valgrind_fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2). Trying to remove \"$XMLFILE\"" + delete_file "$OBJECTTYPE" "$XMLFILE" exit 1; fi Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Sun Jan 17 19:01:05 2010 (r6010) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Sun Jan 17 19:01:19 2010 (r6011) @@ -118,7 +118,8 @@ fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1). Trying to remove \"$LDIF\"" + run_ldapdelete "$LDIF" exit 1; fi @@ -141,7 +142,8 @@ fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2). Trying to remove \"$LDIF\"" + run_ldapdelete "$LDIF" exit 1; fi @@ -162,7 +164,7 @@ fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (3)." exit 1; fi echo -e "\n\n\n" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Sun Jan 17 19:01:05 2010 (r6010) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Sun Jan 17 19:01:19 2010 (r6011) @@ -124,7 +124,8 @@ valgrind_fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1). Trying to remove \"$LDIF\"" + run_ldapdelete "$LDIF" exit 1; fi @@ -147,7 +148,8 @@ valgrind_fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (2). Trying to remove \"$LDIF\"" + run_ldapdelete "$LDIF" exit 1; fi @@ -168,7 +170,7 @@ valgrind_fast_sync rv=$? if test $rv -ne 0; then - echo "$FILE:$LINENO: ERROR: fast_sync() has failed (1)." + echo "$FILE:$LINENO: ERROR: fast_sync() has failed (3)." exit 1; fi echo -e "\n\n\n" |
From: <svn...@op...> - 2010-01-17 18:01:16
|
Author: scriptor Date: Sun Jan 17 19:01:05 2010 New Revision: 6010 URL: http://www.opensync.org/changeset/6010 Log: I have moved some error messages into separate functions. For readability's sake. Modified: plugins/ldap-sync/src/ldap_connect.c plugins/ldap-sync/src/ldap_debug.c plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Thu Jan 14 21:57:04 2010 (r6009) +++ plugins/ldap-sync/src/ldap_connect.c Sun Jan 17 19:01:05 2010 (r6010) @@ -780,6 +780,222 @@ + +/** + * @brief This function tries and builds an appropriate error message + * when ldap_sasl_interactive_bind_s() has failed. + * + * @param sinkenv The object type specific environment. + * @param file The file of the source code where the error appeared. + * @param line The line in this file where the error appeared. + * @param ldap_errno The error code as returned by libldap / libldap60. + * @param passwd This is the password for those authentication mechanisms + * that use a password. + * @param tmp_authmech This is the SASL authentication mechanism, such as + * DIGEST-MD5, CRAM-MD5, GSSAPI or EXTERNAL. + * @param tmp_authcid This is the authentication identifier for those + * mechanisms that use such an identifier. + * @param error The libopensync error pointer. + * + * @returns TRUE when building the error message was successful, + * FALSE when building the error message itself has failed. + * In both cases the error pointer is being set: In the former + * case it is the LDAP error, in the latter case a programming + * error. + * + */ +osync_bool +ldap_plugin_report_sasl_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const struct berval passwd, char *tmp_authmech, char *tmp_authcid, OSyncError **error) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %i, %i, %p, %p, %p, %p)", __func__, (void *)sinkenv, (void *)file, line, ldap_errno, (int)passwd.bv_len, (void *)passwd.bv_val, (void *)tmp_authmech, (void *)tmp_authcid, (void *)error); + + + if (sinkenv == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (file == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: file = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (tmp_authmech == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: tmp_authmech = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (tmp_authcid == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: tmp_authcid = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + + + char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, ldap_errno); + char *extra_error = NULL; + + + + if ( + (ldap_errno == LDAP_AUTH_METHOD_NOT_SUPPORTED) || + (ldap_errno == LDAP_AUTH_UNKNOWN) + ) + { + if (sinkenv->url && sinkenv->url[0]) { + ldap_plugin_list_libsasl2_mechanisms(sinkenv->url); + // Does not work: + // ldap_plugin_list_libldap_sasl_mechanisms(ctx, sinkenv, error); + } else if (sinkenv->servername && sinkenv->servername[0]) { + ldap_plugin_list_libsasl2_mechanisms(sinkenv->servername); + // Does not work: + // ldap_plugin_list_libldap_sasl_mechanisms(ctx, sinkenv, error); + } else { + ldap_plugin_printf("%s:%i: ERROR: Could not call ldap_plugin_list_sasl_libsasl2_mechanisms(), because both sinkenv->url and sinkenv->servername are NULL or empty.", __FILE__, __LINE__); + } + } // LDAP_AUTH_METHOD_NOT_SUPPORTED, LDAP_AUTH_UNKNOWN + else if (ldap_errno == LDAP_LOCAL_ERROR) { + if (ldap_error && ldap_error[0] && tmp_authmech && tmp_authmech[0]) { + if (!strcmp(tmp_authmech, "GSSAPI")) { + if (strstr(ldap_error, "Unspecified GSS failure")) { + /* + For "gss_accept_sec_context", see: + + krb5-1.6.3/src/lib/gssapi/mechglue/g_accept_sec_context.c + + */ + + if ( + strstr(ldap_error, "No credentials cache found") || + strstr(ldap_error, "Ticket expired") + ) + { + if (tmp_authcid && tmp_authcid[0]) { + ldap_plugin_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V %s\n", __FILE__, __LINE__, tmp_authcid); + + extra_error = g_strdup_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V %s\n", __FILE__, __LINE__, tmp_authcid); + } else { + ldap_plugin_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V ...\n", __FILE__, __LINE__); + + extra_error = g_strdup_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V ...\n", __FILE__, __LINE__); + } + } + } + } + } + } + + + // Give hint about empty password only for authentication mechanisms + // other than EXTERNAL and GSSAPI + if (passwd.bv_len == 0 && strcmp(tmp_authmech, "EXTERNAL") && strcmp(tmp_authmech, "GSSAPI")) { + if (ldap_error == NULL) { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" with an empty password, using \"%s\" as authentication mechanism. Maybe the LDAP server does not allow an anonymous bind.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech); + } else { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" with an empty password, using \"%s\" as authentication mechanism. Maybe the LDAP server does not allow an anonymous bind: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error); + } + } else { + if (ldap_error == NULL) { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech); + } else { + if (extra_error && extra_error[0]) { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism: \"%s\". %s", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error, extra_error); + } else { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error); + } + } + } + + + + + 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 tries and builds an appropriate error message + * when ldap_sasl_interactive_bind_s() has failed. + * + * @param sinkenv The object type specific environment. + * @param file The file of the source code where the error appeared. + * @param line The line in this file where the error appeared. + * @param ldap_errno The error code as returned by libldap / libldap60. + * @param binddn This is the distinguished name the user has tried to + * authenticate with when doing the simple bind. + * @param passwd This is the password for the simple bind. + * @param error The libopensync error pointer. + * + * @returns TRUE when building the error message was successful, + * FALSE when building the error message itself has failed. + * In both cases the error pointer is being set: In the former + * case it is the LDAP error, in the latter case a programming + * error. + * + */ +osync_bool +ldap_plugin_report_simple_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const char *binddn, const struct berval passwd, OSyncError **error) +{ + osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %i, %p, %i, %p, %p)", __func__, (void *)sinkenv, (void *)file, line, ldap_errno, (void *)binddn, (int)passwd.bv_len, passwd.bv_val, (void *)error); + + + if (sinkenv == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sinkenv = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + if (file == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: file = NULL. Returning.\n", __FILE__, __LINE__); + goto error; + } + + char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, file, line, ldap_errno); + + if (passwd.bv_len == 0) { + if (ldap_error == NULL) { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\" with an empty password. Maybe the LDAP server does not allow anonymous binds.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn); + } else { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\" with an empty password. Maybe the LDAP server does not allow anonymous binds: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn, ldap_error); + } + } else { + if (ldap_error == NULL) { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\".", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn); + } else { + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\": \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn, ldap_error); + } + } + + + 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 Binds with the LDAP server. * @@ -875,23 +1091,10 @@ ldap_errno = ldap_sasl_bind_s(sinkenv->ld, binddn, LDAP_SASL_SIMPLE, &passwd, NULL, NULL, NULL); if (ldap_errno != LDAP_SUCCESS) { - char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, ldap_errno); - - if (passwd.bv_len == 0) { - if (ldap_error == NULL) { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\" with an empty password. Maybe the LDAP server does not allow anonymous binds.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn); - } else { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\" with an empty password. Maybe the LDAP server does not allow anonymous binds: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn, ldap_error); - } - - } else { - if (ldap_error == NULL) { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\".", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn); - } else { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and bind with \"%s\" as \"%s\": \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, binddn, ldap_error); - } - } - + ldap_plugin_report_simple_authentication_error(sinkenv, __FILE__, __LINE__, ldap_errno, binddn, passwd, error); + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: ERROR: ldap_sasl_bind_s() has failed (ldap_errno = %i).\n", __FILE__, __LINE__, ldap_errno); + rv = FALSE; goto out1; } @@ -922,7 +1125,7 @@ } if (tmp_authmech[0] == 0) { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: tmp_authmech is a empty string. Setting it to \"SIMPLE\".", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: tmp_authmech is an empty string. Setting it to \"SIMPLE\".", __FILE__, __LINE__); g_free(tmp_authmech); tmp_authmech = g_strdup("SIMPLE"); @@ -1000,86 +1203,13 @@ if (ldap_errno != LDAP_SUCCESS) { + ldap_plugin_report_sasl_authentication_error(sinkenv, __FILE__, __LINE__, ldap_errno, passwd, tmp_authmech, tmp_authcid, error); - char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, ldap_errno); - char *extra_error = NULL; - - - ldap_plugin_printf("%s:%i: ERROR: ldap_errno = %i", __FILE__, __LINE__, ldap_errno); - - if ( - (ldap_errno == LDAP_AUTH_METHOD_NOT_SUPPORTED) || - (ldap_errno == LDAP_AUTH_UNKNOWN) - ) { - - if (sinkenv->url && sinkenv->url[0]) { - ldap_plugin_list_libsasl2_mechanisms(sinkenv->url); - // Does not work: - // ldap_plugin_list_libldap_sasl_mechanisms(ctx, sinkenv, error); - } else if (sinkenv->servername && sinkenv->servername[0]) { - ldap_plugin_list_libsasl2_mechanisms(sinkenv->servername); - // Does not work: - // ldap_plugin_list_libldap_sasl_mechanisms(ctx, sinkenv, error); - } else { - ldap_plugin_printf("%s:%i: ERROR: Could not call ldap_plugin_list_sasl_libsasl2_mechanisms(), because both sinkenv->url and sinkenv->servername are NULL or empty.", __FILE__, __LINE__); - } - } // LDAP_AUTH_METHOD_NOT_SUPPORTED, LDAP_AUTH_UNKNOWN - else if (ldap_errno == LDAP_LOCAL_ERROR) { - if (ldap_error && ldap_error[0] && tmp_authmech && tmp_authmech[0]) { - if (!strcmp(tmp_authmech, "GSSAPI")) { - if (strstr(ldap_error, "Unspecified GSS failure")) { - /* - For "gss_accept_sec_context", see: - - /root/rpmbuild/SOURCES/krb5-1.6.3/src/lib/gssapi/mechglue/g_accept_sec_context.c - - */ - - if ( - strstr(ldap_error, "No credentials cache found") || - strstr(ldap_error, "Ticket expired") - ) - { - if (tmp_authcid && tmp_authcid[0]) { - ldap_plugin_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V %s\n", __FILE__, __LINE__, tmp_authcid); - - extra_error = g_strdup_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V %s\n", __FILE__, __LINE__, tmp_authcid); - } else { - ldap_plugin_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V ...\n", __FILE__, __LINE__); - - extra_error = g_strdup_printf("%s:%i: You might have to retrieve a new \"ticket-granting ticket\": kinit -V ...\n", __FILE__, __LINE__); - } - } - } - } - } - } - - - // Give hint about empty password only for authentication mechanisms - // other than EXTERNAL - if (passwd.bv_len == 0 && strcmp(tmp_authmech, "EXTERNAL")) { - if (ldap_error == NULL) { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" with an empty password, using \"%s\" as authentication mechanism. Maybe the LDAP server does not allow an anonymous bind.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech); - } else { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" with an empty password, using \"%s\" as authentication mechanism. Maybe the LDAP server does not allow an anonymous bind: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error); - } - } else { - if (ldap_error == NULL) { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism.", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech); - } else { - if (extra_error && extra_error[0]) { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism: \"%s\". %s", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error, extra_error); - } else { - osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: Unable to connect and sasl bind with \"%s\" as \"%s\" using \"%s\" as authentication mechanism: \"%s\"", __FILE__, __LINE__, sinkenv->url ? sinkenv->url : sinkenv->servername, sinkenv->authcid, tmp_authmech, ldap_error); - } - } - } + if (!osync_error_is_set(error)) + osync_error_set(error, OSYNC_ERROR_NO_CONNECTION, "%s:%i: ERROR: ldap_sasl_interactive_bind_s() has failed. ldap_errno = %i\n", __FILE__, __LINE__, ldap_errno); rv = FALSE; goto out1; - - } // if (ldap_errno != LDAP_SUCCESS) @@ -4619,7 +4749,7 @@ osync_trace(TRACE_INTERNAL, "%s(): OK. Value of keyattribute is identical to the identifier: \"%s\".", __func__, entry->id); identical = TRUE; } else { - osync_trace(TRACE_ERROR, "%s:%i: WARNING: Value of keyattribute (\"%s\"):\n\n\t\"%s\" \n\nconflicts with identifier:\n\n\t\"%s\".\n\nTrying to enforce correct one.", __FILE__, __LINE__, mod->mod_type, mod->mod_bvalues[0]->bv_val, entry->id); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: Value of keyattribute (\"%s\"):\n\n\t\"%s\" \n\nconflicts with identifier:\n\n\t\"%s\".\n\nTrying to enforce correct one: \"%s\".\n\n", __FILE__, __LINE__, mod->mod_type, mod->mod_bvalues[0]->bv_val, entry->id, entry->id); g_free(mod->mod_bvalues[0]->bv_val); mod->mod_bvalues[0]->bv_val = g_strdup(entry->id); mod->mod_bvalues[0]->bv_len = strlen(entry->id); Modified: plugins/ldap-sync/src/ldap_debug.c ============================================================================== --- plugins/ldap-sync/src/ldap_debug.c Thu Jan 14 21:57:04 2010 (r6009) +++ plugins/ldap-sync/src/ldap_debug.c Sun Jan 17 19:01:05 2010 (r6010) @@ -600,6 +600,13 @@ + + + + + + + #ifdef DEBUG_fastsync /** * @brief translate_changetype Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Thu Jan 14 21:57:04 2010 (r6009) +++ plugins/ldap-sync/src/ldap_plugin.h Sun Jan 17 19:01:05 2010 (r6010) @@ -530,6 +530,8 @@ osync_bool ldap_plugin_get_sinkenv(OSyncContext *ctx, OSyncObjTypeSink *sink, void *userdata, sink_environment **sinkenv, OSyncError **error); char *ldap_plugin_hash_append(OSyncContext *ctx, char *hash, const sink_environment *sinkenv, const ldap_entry *entry, OSyncError **error); osync_bool ldap_plugin_makebind(OSyncContext *ctx, sink_environment *sinkenv, OSyncError **error); +osync_bool ldap_plugin_report_sasl_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const struct berval passwd, char *tmp_authmech, char *tmp_authcid, OSyncError **error); +osync_bool ldap_plugin_report_simple_authentication_error(sink_environment *sinkenv, const char *file, const int line, const int ldap_errno, const char *binddn, const struct berval passwd, OSyncError **error); osync_bool ldap_plugin_rewrite_ldap_entry(ldap_entry *entry, GList *modifications, OSyncError **error); osync_bool ldap_plugin_set_ldap_protocol (OSyncContext *ctx, sink_environment *sinkenv, OSyncError **error); |
From: <svn...@op...> - 2010-01-14 20:59:08
|
Author: scriptor Date: Thu Jan 14 21:52:38 2010 New Revision: 6006 URL: http://www.opensync.org/changeset/6006 Log: Changed a comment. Modified: plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Wed Jan 13 13:08:22 2010 (r6005) +++ plugins/ldap-sync/src/ldap_plugin.h Thu Jan 14 21:52:38 2010 (r6006) @@ -420,7 +420,10 @@ char *bindpwd; ///< Bind password char *searchbase; ///< Base DN for any searches char *searchfilter; ///< Search filter - char *storebase; ///< Base DN where to store new contacts + char *storebase; ///< Base DN where to store new contacts/events/tasks/ + ///< notes. This can be left untouched, because in + ///< ldap_plugin_parse_config() it will be set to + ///< the searchbase, if not defined otherwise. char *keyattr; ///< Key attribute for each objtype: This one ///< defines "the id". Which one of all the attributes ///< counts as "the unique identifier". |
From: <svn...@op...> - 2010-01-14 20:59:08
|
Author: scriptor Date: Thu Jan 14 21:52:51 2010 New Revision: 6007 URL: http://www.opensync.org/changeset/6007 Log: Workaround for the way osync_xmlformat_sort() in: libopensync/opensync/xmlformat/opensync_xmlformat.c applies xmlAddChild(). xmlAddChild() frees the node, sometimes. Consequently a subsequent call to osync_xmlformat_is_sorted() segfaults, occasionally. Please note, this is NOT a bug fix. Not at all. Because it does NOT prevent the xmlformat struct from getting corrupted by libxml2. 277 cur = osync_xmlformat_get_first_field(xmlformat); 278 for(; cur != NULL; cur = osync_xmlfield_get_next(cur)) { 279 list[index] = cur; 280 index++; 281 xmlUnlinkNode(cur->node); 282 } 290 for(index = 0; index < xmlformat->child_count; index++) { 291 cur = (OSyncXMLField *)list[index]; 292 xmlAddChild(xmlDocGetRootElement(xmlformat->doc), cur->node); 293 cur is a pointer to a field in the original xmlformat rather than a copy. And cur->node gets free'd in some cases (not in all cases) by xmlAddChild(). Quoting from http://xmlsoft.org/html/libxml-tree.html#xmlAddChild "Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed). If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed." The proper solution would be making use of the return value of xmlAddChild(), I suppose. Or make use of xmlCopyNode(). Not tested, though. And in case of xmlCopyNode() I do not know how well it plays together with a subsequent xmlFreeNode(), when the node has already been freed'd by libxml2... Modified: plugins/ldap-sync/src/ldap_format.c Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Thu Jan 14 21:52:38 2010 (r6006) +++ plugins/ldap-sync/src/ldap_format.c Thu Jan 14 21:52:51 2010 (r6007) @@ -2444,13 +2444,56 @@ goto error; } - if (osync_xmlformat_is_sorted(xmlformat)) { - osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced IS sorted.\n", __FILE__, __LINE__); + + + /** + * The following call to osync_xmlformat_copy() is a workaround for + * the problem, that libxml2 may or may not free some cur->node + * pointers: + * + * Quoting from http://localhost/usr_share_doc/libxml2-devel-2.7.6/html/libxml-tree.html + * + * Function: xmlAddChild + * + * xmlNodePtr xmlAddChild (xmlNodePtr parent, xmlNodePtr cur) + * + * Add a new node to @parent, at the end of the child (or property) list + * merging adjacent TEXT nodes (in which case @cur is freed). + * + * If the new node is ATTRIBUTE, it is added into properties instead of + * children. + * + * If there is an attribute with equal name, it is first destroyed. + * + * See also osync_xmlformat_sort() in opensync_xmlformat.c + * around line 292. + * + * Small wonder, that a subsequent call to osync_xmlformat_is_sorted() + * segfaults: cur->node may have been freed by libxml2. + * Possibly, not necessarily. Resulting in a double-free. + * + */ + OSyncXMLFormat *xmlformat2 = NULL; + if (osync_xmlformat_copy(xmlformat, &xmlformat2, error)) { + if (xmlformat2) { + if (osync_xmlformat_is_sorted(xmlformat2)) { + osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced IS sorted.\n", __FILE__, __LINE__); + } else { + osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced is NOT sorted.\n", __FILE__, __LINE__); + } + + osync_xmlformat_unref(xmlformat2); + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: xmlformat2 = NULL. osync_xmlformat_is_sorted() cannot be called, therefore. Ignoring.", __FILE__, __LINE__); + } } else { - osync_trace(TRACE_INTERNAL, "%s:%i: xmlformat just produced is NOT sorted.\n", __FILE__, __LINE__); + if (!osync_error_is_set(error)) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_xmlformat_copy() has failed.", __FILE__, __LINE__); + } + + goto error; } - // Report the results to the calling function *output = (char *) xmlformat; *outpsize = osync_xmlformat_size(); // Returns the size of the OSyncXMLFormat struct. |
From: <svn...@op...> - 2010-01-14 20:57:13
|
Author: scriptor Date: Thu Jan 14 21:57:04 2010 New Revision: 6009 URL: http://www.opensync.org/changeset/6009 Log: 1. I have eliminated the different ldap-sync.conf* files in tests/. Instead, the ldap-sync.conf is now generated from tests/ldap-sync.conf.templ each time, with the variables being set in test.conf. Thus the configuration becomes easier, as it is now concentrated in tests/test.conf and tests/CMakeLists.txt. Different ldap-sync.conf files are right now necessary only in the check_plugin_auth script. So this file might be worth being checked in case of any problems. Besides, for debugging purposes the "debug" variable in tests/test.conf can be set to "yes". This saves an ldap-sync.conf_${test_name} in the build subdirectory, when the tests are run, so these files can be checked whether something is wrong, there. 2. I have added further tests regarding the files in tests/vcards, tests/vevents, tests/vtodos and tests/vnotes. Trying to write them into the LDAP tree reveals quite some issues, most of them located outside of the LDAP plugin. Among these problems is a) http://www.opensync.org/ticket/1176 element AlarmRepeat: Schemas validity error : Element 'AlarmRepeat': '' is not a valid value of the atomic type 'xs:integer'. ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. b) "company phoneöä" is invalid for the LDAP attribute "homePhone" ERROR: /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: LDAP ERROR: "Invalid syntax". homePhone: value #0 invalid per syntax /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: LDAP ERROR: "Invalid syntax". homePhone: value #0 invalid per syntax /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: This error occurred with id = evo2-umlaute.vcf, chtype = 1 dn: uid=evo2-umlaute.vcf,ou=addressbook,dc=example,dc=com cn: Titleö Firstä Middleü Lastß Suffixö givenName: Firstä homePhone: company phoneöä homePostalAddress: Multiline street multiline cityäüööüä mail: workemailö o: organization objectClass: inetOrgPerson sn: Titleö Firstä Middleü Lastß Suffixö uid: evo2-umlaute.vcf c) Several validation errors regarding object type "event": element event: Schemas validity error : Element 'event': Missing child element(s ). Expected is one of ( AlarmAudio, AlarmDisplay, AlarmEmail, AlarmProcedure, Attach, Attendee, CalendarScale, Categories, Class, Comment ). ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred, for example, with evolution2-1-hour-alarm2.vcf) element Timezone: Schemas validity error : Element 'Timezone': This element is not expected. Expected is one of ( Uid, Url, Version ). ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred, for example, with evolution2-todo-full1.vcf) element Attendee: Schemas validity error : Element 'Attendee', attribute 'Status': The attribute 'Status' is not allowed. element Content: Schemas validity error : Element 'Content': [facet 'enumeration'] The value 'NEEDS_ACTION' is not an element of the set {'NEEDS-ACTION', 'COMPLETED', 'IN-PROCESS', 'CANCELLED'}. element Content: Schemas validity error : Element 'Content': 'NEEDS_ACTION' is not a valid value of the atomic type 'TodoStatusValue'. ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred with kdepim-todoful1.vcs) d) Possible detector problem: Entity: line 1: parser error : Start tag expected, '<' not found BEGIN:VCALENDAR ^ ERROR: Could not parse XML. Well, a vevent is not an XML file. (occurred, for example, with evolution2-1-hour-alarm.vcf) e) ERROR: /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_connect.c:4622: WARNING: Value of keyattribute ("documentIdentifier"): "20050306T005538Z-4378-1000-1-28@azrael" conflicts with identifier: "evolution2-todo-full2.vcf". 3. New display utility tests/show_ldap_tree to make the debugging easier. 4. I have fixed several smaller bugs in the test scripts. And cleaned them up a bit. Added: plugins/ldap-sync/tests/check_common.inc - copied, changed from r6005, plugins/ldap-sync/tests/check_osynctool_common.inc Copied and modified: plugins/ldap-sync/tests/check_common.inc (from r6005, plugins/ldap-sync/tests/check_osynctool_common.inc) ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_common.inc Wed Jan 13 13:08:22 2010 (r6005, copy source) +++ plugins/ldap-sync/tests/check_common.inc Thu Jan 14 21:57:04 2010 (r6009) @@ -3,6 +3,9 @@ enable_tracing() { + local rv=0 + + test_name="$1" if test -z "$test_name"; then echo "${FUNCNAME}(): ERROR: \$test_name is empty. Exiting." @@ -69,6 +72,9 @@ enable_trace_subdir() { + local rv=0 + + test_name="$1" if test -z "$test_name"; then echo "${FUNCNAME}(): ERROR: \$test_name is empty. Exiting." @@ -307,7 +313,54 @@ +build_dn() +{ + short_name="$1" + + if test -z "$short_name"; then + echo -e "${FUNCNAME}(): ERROR: \$short_name is empty. Exiting." + exit 1 + fi + + dn_to_be_found="" + dn_to_be_found2="" + dn_to_be_found3="" + + if test "$short_name" == "contact1.xml"; then + dn_to_be_found="$CONTACT1_DN" + dn_to_be_found3="uid=${short_name},${SEARCHBASE_CONTACT}" + elif test "$short_name" == "contact2.xml"; then + dn_to_be_found="$CONTACT2_DN" + dn_to_be_found3="uid=${short_name},${SEARCHBASE_CONTACT}" + elif test "$short_name" == "event1.xml"; then + dn_to_be_found="$EVENT1_DN" + dn_to_be_found3="documentIdentifier=${short_name},${SEARCHBASE_EVENT}" + elif test "$short_name" == "todo1.xml"; then + dn_to_be_found="$TODO1_DN" + dn_to_be_found3="documentIdentifier=${short_name},${SEARCHBASE_TODO}" + elif test "$short_name" == "note1.xml"; then + dn_to_be_found="$NOTE1_DN" + dn_to_be_found3="documentIdentifier=${short_name},${SEARCHBASE_NOTE}" + elif test "$short_name" == "note2.xml"; then + dn_to_be_found="$NOTE2_DN" + dn_to_be_found3="documentIdentifier=${short_name},${SEARCHBASE_NOTE}" + elif test "$objecttype" == "contact"; then + dn_to_be_found="uid=${short_name},${SEARCHBASE_CONTACT}" + dn_to_be_found3="$dn_to_be_found" + elif test "$objecttype" == "event"; then + dn_to_be_found="documentIdentifier=${short_name},${SEARCHBASE_EVENT}" + dn_to_be_found3="$dn_to_be_found" + elif test "$objecttype" == "todo"; then + dn_to_be_found="documentIdentifier=${short_name},${SEARCHBASE_TODO}" + dn_to_be_found3="$dn_to_be_found" + elif test "$objecttype" == "note"; then + dn_to_be_found="documentIdentifier=${short_name},${SEARCHBASE_NOTE}" + dn_to_be_found3="$dn_to_be_found" + fi + + +} @@ -317,6 +370,10 @@ verify_file_add() { xmlfile="$1" + objecttype="$2" + local rv=0 + + if test -z "$xmlfile"; then echo -e "${FUNCNAME}(): ERROR: \$xmlfile is empty. Exiting." exit 1 @@ -330,6 +387,16 @@ echo -e "${FUNCNAME}(): ERROR: $xmlfile could be found, but was not readable. Exiting." fi + if test -z "$objecttype"; then + echo -e "${FUNCNAME}(): ERROR: \$objecttype is empty. Exiting." + exit 1 + fi + + if test "$objecttype" != "contact" -a "$objecttype" != "event" -a "$objecttype" != "todo" -a "$objecttype" != "note"; then + echo -e "${FUNCNAME}(): ERROR: Unknown \$objecttype: \"$objecttype\" . Exiting." + exit 1 + fi + short_name=$(basename $xmlfile) if test -z "$short_name"; then @@ -337,21 +404,7 @@ exit 1 fi - dn_to_be_found="" - dn_to_be_found2="" - if test "$short_name" == "contact1.xml"; then - dn_to_be_found="$CONTACT1_DN" - elif test "$short_name" == "contact2.xml"; then - dn_to_be_found="$CONTACT2_DN" - elif test "$short_name" == "event1.xml"; then - dn_to_be_found="$EVENT1_DN" - elif test "$short_name" == "todo1.xml"; then - dn_to_be_found="$TODO1_DN" - elif test "$short_name" == "note1.xml"; then - dn_to_be_found="$NOTE1_DN" - elif test "$short_name" == "note2.xml"; then - dn_to_be_found="$NOTE2_DN" - fi + eval build_dn "$short_name" if test -z "$dn_to_be_found"; then echo -e "${FUNCNAME}(): ERROR: \$dn_to_be_found could not be set. Exiting." @@ -377,14 +430,23 @@ cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found" output=`$cmd` - local rv=$? + rv=$? if test $rv -ne 0; then cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" output=`$cmd` rv=$? if test $rv -ne 0; then - echo -e "${FUNCNAME}(): ERROR: ldapsearch could not find \"$dn_to_be_found\" nor \"$dn_to_be_found2\". Synchronizing after the addition must have failed. Exiting." - exit 1 + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found3" + 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" + fi + else + echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" fi else echo -e "\n\n\nOK. Synchronizing after the addition was successful.\n\n\n" @@ -397,6 +459,9 @@ verify_file_delete() { + local rv=0 + + xmlfile="$1" if test -z "$xmlfile"; then echo -e "${FUNCNAME}(): ERROR: \$xmlfile is empty. Exiting." @@ -418,21 +483,7 @@ exit 1 fi - dn_to_be_found="" - dn_to_be_found2="" - if test "$short_name" == "contact1.xml"; then - dn_to_be_found="$CONTACT1_DN" - elif test "$short_name" == "contact2.xml"; then - dn_to_be_found="CONTACT2_DN" - elif test "$short_name" == "event1.xml"; then - dn_to_be_found="$EVENT1_DN" - elif test "$short_name" == "todo1.xml"; then - dn_to_be_found="$TODO1_DN" - elif test "$short_name" == "note1.xml"; then - dn_to_be_found="NOTE1_DN" - elif test "$short_name" == "note2.xml"; then - dn_to_be_found="NOTE2_DN" - fi + eval build_dn "$short_name" if test -z "$dn_to_be_found"; then echo -e "${FUNCNAME}(): ERROR: \$dn_to_be_found could not be set. Exiting." @@ -458,7 +509,7 @@ cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" output=`$cmd` - local rv=$? + 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 @@ -477,6 +528,7 @@ check_plugin_available() { + local rv=0 plugin="$1" if test -z "$plugin"; then @@ -501,18 +553,22 @@ $OSYNCTOOL --listplugins | grep -q "$plugin" - local rv=$? + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldap-sync was not included in pluginlist. Exiting." exit 1 fi + return $rv } check_ldap_formats() { + local rv=0 + + if test -z "$OSYNCTOOL"; then echo "${FUNCNAME}(): ERROR: \$OSYNCTOOL is empty. Exiting." exit 1; @@ -530,7 +586,7 @@ $OSYNCTOOL --listformats | grep -q "ldap-evolutionperson" - local rv=$? + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldap-evolutionperson was not included in formatlist. Exiting." exit 1 @@ -571,6 +627,9 @@ check_xmlformats() { + local rv=0 + + if test -z "$OSYNCTOOL"; then echo "${FUNCNAME}(): ERROR: \$OSYNCTOOL is empty. Exiting." exit 1; @@ -588,7 +647,7 @@ $OSYNCTOOL --listformats | grep -q "xmlformat-contact$" - local rv=$? + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: xmlformat-contact was not included in formatlist. Exiting." exit 1 @@ -641,6 +700,9 @@ check_file_directories() { + local rv=0 + + for f in "$CONTACT1_FILE" "$CONTACT2_FILE" "$EVENT1_FILE" "$TODO1_FILE" "$NOTE1_FILE" "$NOTE2_FILE"; do do_check_file_directories $f; rv=$?; @@ -657,6 +719,9 @@ configure_plugin() { + local rv=0 + + group="$1" if test -z "$group"; then echo "${FUNCNAME}(): ERROR: \$group is empty. Exiting."; @@ -669,19 +734,52 @@ exit 1; fi - member_config_file="$3" + BUILD_DIR="$3" + if test -z "$BUILD_DIR"; then + echo "$FILE:$LINENO: ERROR: \$BUILD_DIR is empty. Exiting."; + exit 1; + fi + + if test ! -d "$BUILD_DIR"; then + echo "$FILE:$LINENO: ERROR: \$BUILD_DIR = \"${BUILD_DIR}\" does not exist or is not a directory. Exiting."; + exit 1; + fi + + member_config_file="$4" if test -z "$member_config_file"; then echo "${FUNCNAME}(): ERROR: \$member_config_file is empty. Exiting."; exit 1; fi - if test ! -f "$SOURCE_DIR/$member_config_file"; then - echo "${FUNCNAME}(): ERROR: $SOURCE_DIR/$member_config_file does not exist. Exiting."; + if test -e "$SOURCE_DIR/$member_config_file"; then + config_file="$SOURCE_DIR/$member_config_file" + else + if test -e "$SOURCE_DIR/${member_config_file}.templ"; then + echo "${FUNCNAME}(): INFO: $SOURCE_DIR/${member_config_file}.templ could be found. Generating $BUILD_DIR/$member_config_file" + 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." + fi + + + if test -e "$BUILD_DIR/$member_config_file"; then + config_file="$BUILD_DIR/$member_config_file" + else + if test -e "$member_config_file"; then + config_file="$member_config_file" + fi + fi + fi + + + if test ! -e "$config_file"; then + echo "${FUNCNAME}(): ERROR: $config_file does not exist. Exiting."; exit 1; fi - if test ! -r "$SOURCE_DIR/$member_config_file"; then - echo "${FUNCNAME}(): ERROR: $SOURCE_DIR/$member_config_file does exist, but it is not readable. Exiting."; + if test ! -r "$config_file"; then + echo "${FUNCNAME}(): ERROR: $config_file does exist, but it is not readable. Exiting."; exit 1; fi @@ -720,7 +818,7 @@ export EDITOR="cat >" - $OSYNCTOOL --configdir "$TMPDIR" --configure "$group" "$memberid" < "$SOURCE_DIR/$member_config_file" + $OSYNCTOOL --configdir "$TMPDIR" --configure "$group" "$memberid" < "$config_file" local rv=$? @@ -734,6 +832,9 @@ setup_group() { + local rv=0 + + group="$1" if test -z "$group"; then echo "${FUNCNAME}(): ERROR: \$group is empty. Exiting."; @@ -741,6 +842,17 @@ fi + BUILD_DIR="$2" + if test -z "$BUILD_DIR"; then + echo "${FUNCNAME}(): ERROR: \$BUILD_DIR is empty. Exiting."; + exit 1; + fi + + if test ! -d "$BUILD_DIR"; then + echo "${FUNCNAME}(): ERROR: \$BUILD_DIR = \"${BUILD_DIR}\" does not exist or is not a directory. Exiting."; + exit 1; + fi + if test -z "$OSYNCTOOL"; then echo "${FUNCNAME}(): ERROR: \$OSYNCTOOL is empty. Exiting." exit 1; @@ -775,8 +887,8 @@ - configure_plugin "$group" "1" "file-sync.conf" - local rv=$? + configure_plugin "$group" "1" "${BUILD_DIR}" "file-sync.conf" + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: configure plugin \"$group\" \"1\" has failed. Exiting." @@ -788,7 +900,7 @@ - configure_plugin "$group" "2" "ldap-sync.conf" + configure_plugin "$group" "2" "${BUILD_DIR}" "ldap-sync.conf" rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: configure plugin \"$group\" \"1\" has failed. Exiting." @@ -849,6 +961,17 @@ prologue() { + BUILD_DIR="$1" + if test -z "$BUILD_DIR"; then + echo "${FUNCNAME}(): ERROR: \$BUILD_DIR is empty. Exiting."; + exit 1; + fi + + if test ! -d "$BUILD_DIR"; then + echo "${FUNCNAME}(): ERROR: \$BUILD_DIR = \"${BUILD_DIR}\" does not exist or is not a directory. Exiting."; + exit 1; + fi + if test -n "$OSYNC_TRACE"; then remember="$OSYNC_TRACE" unset OSYNC_TRACE @@ -863,7 +986,7 @@ check_ldap_formats; check_xmlformats; - setup_group "$GROUPNAME" + setup_group "$GROUPNAME" "$BUILD_DIR" if test -n "$remember"; then @@ -900,6 +1023,9 @@ run_ldapadd() { ldif="$1" + local rv=0 + + if test -z "$ldif"; then echo "${FUNCNAME}(): ERROR: \$ldif is empty. Exiting." exit 1; @@ -920,12 +1046,12 @@ LDAPADD=$(which ldapadd 2>/dev/null) if test ! -f "$LDAPADD"; then - echo "$FILE:$LINENO: ERROR: ldapadd could not be found. Exiting." + echo "${FUNCNAME}(): ERROR: ldapadd could not be found. Exiting." exit 1 fi if test ! -x "$LDAPADD"; then - echo "$FILE:$LINENO: ERROR: ldapadd could be found, but is not executable. Exiting." + echo "${FUNCNAME}(): ERROR: ldapadd could be found, but is not executable. Exiting." exit 1 fi @@ -958,7 +1084,7 @@ echo "Command: $LDAPADD $AUTH -a -f $ldif" $LDAPADD $AUTH -a -f $ldif - local rv=$? + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldapadd has failed. Exiting." exit $rv; @@ -971,6 +1097,7 @@ run_ldapmodify() { + local rv=0 entrymods="$1" if test -z "$entrymods"; then echo "${FUNCNAME}(): ERROR: \$entrymods is empty. Exiting." @@ -1017,7 +1144,7 @@ echo "Command: $LDAPMODIFY $AUTH -f $entrymods" $LDAPMODIFY $AUTH -f $entrymods - local rv=$? + rv=$? if test $rv -ne 0; then echo "${FUNCNAME}(): ERROR: ldapmodify has failed. Exiting." exit $rv; @@ -1030,6 +1157,7 @@ run_ldapdelete() { + local rv=0 ldif="$1" if test -z "$ldif"; then echo "${FUNCNAME}(): ERROR: \$ldif is empty. Exiting." @@ -1090,7 +1218,7 @@ echo "Command: $LDAPDELETE $AUTH -r $DN" $LDAPDELETE $AUTH -r $DN - local rv=$? + rv=$? if test $rv -ne 0; then $LDAPDELETE $AUTH -r ${DN/@/_} rv=$? @@ -1109,6 +1237,8 @@ { check_file_directories; + CONTACT_FILE="$1" + if test -z "$CONTACT1_FILE"; then echo "${FUNCNAME}(): ERROR: \$CONTACT1_FILE is empty. Ignoring." elif test -f "$CONTACT1_FILE"; then @@ -1121,39 +1251,81 @@ rm -f ${CONTACT2_FILE}* fi - # output=$(ls -al /tmp/file_contact) - # echo -e "$output\n" + if test -n "$CONTACT_FILE"; then + rm -f "${CONTACT_DIR}/$CONTACT_FILE" + fi + + for f in ${CONTACT_FILES}; do + rm -f "${CONTACT_DIR}/${f}" + done + + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + output=$(ls -al "${CONTACT_DIR}") + echo -e "$output\n" + fi } remove_event1_file() { + EVENT_FILE="$1" + if test -z "$EVENT1_FILE"; then echo "${FUNCNAME}(): ERROR: \$EVENT1_FILE is empty. Ignoring." elif test -f "$EVENT1_FILE"; then rm -f ${EVENT1_FILE}* fi - # output=$(ls -al /tmp/file_event) - # echo -e "$output\n" + + if test -n "$EVENT_FILE"; then + rm -f "${EVENT_DIR}/$EVENT_FILE" + fi + + + for f in ${EVENT_FILES}; do + rm -f "${EVENT_DIR}/${f}" + done + + + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + output=$(ls -al "${EVENT_DIR}") + echo -e "$output\n" + fi } remove_todo1_file() { + TODO_FILE="$1" + + if test -z "$TODO1_FILE"; then echo "${FUNCNAME}(): ERROR: \$TODO1_FILE is empty. Ignoring." elif test -f "$TODO1_FILE"; then rm -f ${TODO1_FILE}* fi - # output=$(ls -al /tmp/file_todo) - # echo -e "$output\n" + + if test -n "$TODO_FILE"; then + rm -f "${TODO_DIR}/$TODO_FILE" + fi + + for f in ${TODO_FILES}; do + rm -f "${TODO_DIR}/${f}" + done + + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + output=$(ls -al "${TODO_DIR}") + echo -e "$output\n" + fi } remove_note_files() { + NOTE_FILE="$1" + + if test -z "$NOTE1_FILE"; then echo "${FUNCNAME}(): ERROR: \$NOTE1_FILE is empty. Ignoring." elif test -f "$NOTE1_FILE"; then @@ -1166,14 +1338,30 @@ rm -f ${NOTE2_FILE}* fi - # output=$(ls -al /tmp/file_note) - # echo -e "$output\n" + + if test -n "$NOTE_FILE"; then + rm -f "${NOTE_DIR}/$NOTE_FILE" + fi + + + for f in ${NOTE_FILES}; do + p="${NOTE_DIR}/${f}" + rm -f + done + + + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + output=$(ls -al "${NOTE_DIR}") + echo -e "$output\n" + fi } remove_file_by_objtype() { objtype="$1" + xmlfile="$2" + if test -z "$objtype"; then echo "${FUNCNAME}(): ERROR: \$objtype is empty. Exiting."; @@ -1187,13 +1375,13 @@ if test "$objtype" == "contact"; then - remove_contact_files + remove_contact_files "$xmlfile" elif test "$objtype" == "event"; then - remove_event1_file + remove_event1_file "$xmlfile" elif test "$objtype" == "todo"; then - remove_todo1_file + remove_todo1_file "$xmlfile" elif test "$objtype" == "note"; then - remove_note_files + remove_note_files "$xmlfile" fi } @@ -1207,10 +1395,269 @@ remove_event1_file remove_todo1_file remove_note_files + + # Workaround for failing tests: + remove_event1_file "event1.xml" + remove_todo1_file "todo1.xml" } +do_clear_dn() +{ + local rv=0 + dn="$1" + if test -z "$dn"; then + echo "$FILE:$LINENO: ERROR: \$dn is empty. Exiting." + exit 1 + fi + + + LDAPSEARCH=$(which ldapsearch 2>/dev/null) + if test -z "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: \$LDAPSEARCH could not be found. Exiting." + exit 1 + fi + + if test ! -f "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could be found, but is not executable. Exiting." + exit 1 + fi + + + LDAPDELETE=$(which ldapdelete 2>/dev/null) + + if test ! -f "$LDAPDELETE"; then + echo "$FILE:$LINENO: ERROR: ldapdelete could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPDELETE"; then + echo "$FILE:$LINENO: ERROR: ldapdelete could be found, but is not executable. Exiting." + exit 1 + fi + + echo "${FUNCNAME}(): AUTH = \"$AUTH\"" + + $LDAPSEARCH $AUTH -LLL -s base -b "$dn" 2> /dev/null + rv=$? + if test $rv -eq 0; then + echo "$FILE:$LINENO: Found ${dn}. Trying to delete it." + $LDAPDELETE $AUTH -r "$dn" + rv2=$? + if test $rv2 -ne 0; then + echo "$FILE:$LINENO: ERROR: ldapdelete has failed with \$dn = \"$dn\". Exiting." + exit $rv2; + fi + else + if test $rv -ne 32; then + echo -e "\n\n$FILE:$LINENO: ERROR: ldapsearch has failed with \$dn = \"$dn\"\n\n" + fi + fi + +} + + + + +clear_dn() +{ + dn="$1" + if test -z "$dn"; then + echo "$FILE:$LINENO: ERROR: \$dn is empty. Exiting." + exit 1 + fi + + dn2="${dn/@/_}" + if test -z "$dn2"; then + echo "$FILE:$LINENO: ERROR: \$dn2 is empty. Exiting." + exit 1 + fi + + do_clear_dn "$dn" + + do_clear_dn "$dn2" +} + + + + +remove_ldif_by_objtype() +{ + objtype="$1" + short_name="$2" + local rv=0 + + + eval build_dn "$short_name" + if test -z "$dn_to_be_found"; then + echo -e "${FUNCNAME}(): ERROR: \$dn_to_be_found could not be set. Exiting." + exit 1 + fi + + dn_to_be_found2="${dn_to_be_found/@/_}" + + LDAPSEARCH=$(which ldapsearch 2>/dev/null) + if test -z "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: \$LDAPSEARCH could not be found. Exiting." + exit 1 + fi + + if test ! -f "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPSEARCH"; then + echo -e "${FUNCNAME}(): ERROR: ldapsearch could be found, but is not executable. Exiting." + exit 1 + fi + + + echo "AUTH = \"$AUTH\"" + + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found" + output=`$cmd` + rv=$? + if test $rv -ne 0; then + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found2" + output=`$cmd` + rv=$? + if test $rv -eq 0; then + clear_dn "$dn_to_be_found2" + else + cmd="$LDAPSEARCH $AUTH -LLL -s base -b $dn_to_be_found3" + output=`$cmd` + rv=$? + if test $rv -eq 0; then + clear_dn "$dn_to_be_found3" + fi + fi + else + clear_dn "$dn_to_be_found" + fi + +} + + + + +remove_ldifs() +{ + + if test -z "$AUTH"; then + echo "$FILE:$LINENO: ERROR: \$AUTH is empty. Exiting."; + exit 1 + fi + + + if test -z "$CONTACT1_DN"; then + echo "$FILE:$LINENO: ERROR: \$CONTACT1 is empty. Exiting."; + exit 1 + fi + + + if test -z "$CONTACT2_DN"; then + echo "$FILE:$LINENO: ERROR: \$CONTACT2 is empty. Exiting."; + exit 1 + fi + + + if test -z "$EVENT1_DN"; then + echo "$FILE:$LINENO: ERROR: \$EVENT1 is empty. Exiting."; + exit 1 + fi + + + if test -z "$TODO1_DN"; then + echo "$FILE:$LINENO: ERROR: \$TODO1 is empty. Exiting."; + exit 1 + fi + + + if test -z "$NOTE1_DN"; then + echo "$FILE:$LINENO: ERROR: \$NOTE1 is empty. Exiting."; + exit 1 + fi + + if test -z "$NOTE2_DN"; then + echo "$FILE:$LINENO: ERROR: \$NOTE1 is empty. Exiting."; + exit 1 + fi + + + LDAPSEARCH=$(which ldapsearch 2>/dev/null) + + if test ! -f "$LDAPSEARCH"; then + echo "$FILE:$LINENO: ERROR: ldapsearch could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPSEARCH"; then + echo "$FILE:$LINENO: ERROR: ldapsearch could be found, but is not executable. Exiting." + exit 1 + fi + + + LDAPDELETE=$(which ldapdelete 2>/dev/null) + + if test ! -f "$LDAPDELETE"; then + echo "$FILE:$LINENO: ERROR: ldapdelete could not be found. Exiting." + exit 1 + fi + + if test ! -x "$LDAPDELETE"; then + echo "$FILE:$LINENO: ERROR: ldapdelete could be found, but is not executable. Exiting." + exit 1 + fi + + + clear_dn "$CONTACT1_DN" + + clear_dn "$CONTACT2_DN" + + clear_dn "$EVENT1_DN" + + clear_dn "$TODO1_DN" + + clear_dn "$NOTE1_DN" + + clear_dn "$NOTE2_DN" + + + for f in ${CONTACT_FILES}; do + dn="uid=${f},${SEARCHBASE_CONTACT}" + clear_dn "$dn" + done + + for f in ${EVENT_FILES}; do + dn="documentIdentifier=${f},${SEARCHBASE_EVENT}" + clear_dn "$dn" + done + + for f in ${TODO_FILES}; do + dn="documentIdentifier=${f},${SEARCHBASE_TODO}" + clear_dn "$dn" + done + + for f in ${NOTE_FILES}; do + dn="documentIdentifier=${f},${SEARCHBASE_NOTE}" + clear_dn "$dn" + done + + + # Workaround for failing tests: + clear_dn "documentIdentifier=todo1.xml,ou=todo,dc=example,dc=com" +} + + + + add_file() { objtype="$1" @@ -1254,15 +1701,24 @@ elif test "$tmp" == "contact2.xml"; then cp -f "$xmlfile" $CONTACT2_FILE else - echo "$FUNCNAME(): ERROR: Cannot find out whether to take CONTACT1_FILE or CONTACT2_FILE. Exiting." - exit 1; + cp -f "$xmlfile" $CONTACT_DIR + fi + + if test $debug = "yes" -o "$debug" = "on" -o "$debug" = "true"; then + echo + echo + echo + ls -al $CONTACT_DIR + echo + echo + echo fi elif test "$objtype" == "event"; then - cp -f "$xmlfile" $EVENT1_FILE + cp -f "$xmlfile" $EVENT_DIR elif test "$objtype" == "todo"; then - cp -f "$xmlfile" $TODO1_FILE + cp -f "$xmlfile" $TODO_DIR elif test "$objtype" == "note"; then tmp=$(basename "$xmlfile") @@ -1272,8 +1728,7 @@ elif test "$tmp" == "note2.xml"; then cp -f "$xmlfile" $NOTE2_FILE else - echo "$FUNCNAME(): ERROR: Cannot find out whether to take NOTE1_FILE or NOTE2_FILE. Exiting." - exit 1; + cp -f "$xmlfile" $NOTE_DIR fi fi @@ -1702,6 +2157,7 @@ { group="$GROUPNAME" objtype="$1" + local rv=0 if test -z "$group"; then @@ -1754,8 +2210,9 @@ $VALGRIND $OSYNCTOOL --configdir "$TMPDIR" --sync "$group" --slow-sync "$objtype" --always-accept-forecast --conflict 2 + rv=$? - + return $rv } @@ -1810,3 +2267,60 @@ $VALGRIND $OSYNCTOOL --configdir "$TMPDIR" --sync "$group" --always-accept-forecast --conflict 2 } + + + +generate_conf() +{ + SOURCE_DIR="$1" + BUILD_DIR="$2" + PLUGINNAME="$3" + + if test -z "$SOURCE_DIR"; then + echo "${FUNCNAME}(): ERROR: \$SOURCE_DIR is empty. Exiting."; + exit 1; + fi + + if test -z "$BUILD_DIR"; then + echo "${FUNCNAME}(): ERROR: \$BUILD_DIR is empty. Exiting."; + exit 1; + fi + + if test -z "$PLUGINNAME"; then + echo "${FUNCNAME}(): ERROR: \$PLUGINNAME is empty. Exiting."; + exit 1; + fi + + + if test -e "$SOURCE_DIR/${PLUGINNAME}.conf"; then + CFG="$SOURCE_DIR/${PLUGINNAME}.conf" + else + if test -e "$3/${PLUGINNAME}.conf"; then + CFG="$3/${PLUGINNAME}.conf" + else + if test -e "$SOURCE_DIR/${PLUGINNAME}.conf.templ"; then + echo "${FUNCNAME}(): INFO: $SOURCE_DIR/${PLUGINNAME}.conf.templ could be found. Generating $BUILD_DIR/${PLUGINNAME}.conf" + templ=$(eval "$SOURCE_DIR/${PLUGINNAME}.conf.templ") + echo "${templ}" > "$BUILD_DIR/${PLUGINNAME}.conf" + CFG="$BUILD_DIR/${PLUGINNAME}.conf" + else + echo "${FUNCNAME}(): ERROR: $SOURCE_DIR/${PLUGINNAME}.conf.templ could NOT be found. Exiting." + exit 1 + fi + fi + fi + + + if test -z "$CFG"; then + echo "${FUNCNAME}(): ERROR: \$CFG is empty. Exiting."; + exit 1; + fi + + + if test ! -e "$CFG"; then + echo "${FUNCNAME}(): ERROR: \$CFG = \"$CFG\" does not exist. Exiting."; + exit 1; + fi + + +} |
From: <svn...@op...> - 2010-01-14 20:56:19
|
Author: scriptor Date: Thu Jan 14 21:56:02 2010 New Revision: 6008 URL: http://www.opensync.org/changeset/6008 Log: 1. I have eliminated the different ldap-sync.conf* files in tests/. Instead, the ldap-sync.conf is now generated from tests/ldap-sync.conf.templ each time, with the variables being set in test.conf. Thus the configuration becomes easier, as it is now concentrated in tests/test.conf and tests/CMakeLists.txt. Different ldap-sync.conf files are right now necessary only in the check_plugin_auth script. So this file might be worth being checked in case of any problems. Besides, for debugging purposes the "debug" variable in tests/test.conf can be set to "yes". This saves an ldap-sync.conf_${test_name} in the build subdirectory, when the tests are run, so these files can be checked whether something is wrong, there. 2. I have added further tests regarding the files in tests/vcards, tests/vevents, tests/vtodos and tests/vnotes. Trying to write them into the LDAP tree reveals quite some issues, most of them located outside of the LDAP plugin. Among these problems is a) http://www.opensync.org/ticket/1176 element AlarmRepeat: Schemas validity error : Element 'AlarmRepeat': '' is not a valid value of the atomic type 'xs:integer'. ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. b) "company phoneöä" is invalid for the LDAP attribute "homePhone" ERROR: /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: LDAP ERROR: "Invalid syntax". homePhone: value #0 invalid per syntax /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: LDAP ERROR: "Invalid syntax". homePhone: value #0 invalid per syntax /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_plugin.c:3143: This error occurred with id = evo2-umlaute.vcf, chtype = 1 dn: uid=evo2-umlaute.vcf,ou=addressbook,dc=example,dc=com cn: Titleö Firstä Middleü Lastß Suffixö givenName: Firstä homePhone: company phoneöä homePostalAddress: Multiline street multiline cityäüööüä mail: workemailö o: organization objectClass: inetOrgPerson sn: Titleö Firstä Middleü Lastß Suffixö uid: evo2-umlaute.vcf c) Several validation errors regarding object type "event": element event: Schemas validity error : Element 'event': Missing child element(s ). Expected is one of ( AlarmAudio, AlarmDisplay, AlarmEmail, AlarmProcedure, Attach, Attendee, CalendarScale, Categories, Class, Comment ). ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred, for example, with evolution2-1-hour-alarm2.vcf) element Timezone: Schemas validity error : Element 'Timezone': This element is not expected. Expected is one of ( Uid, Url, Version ). ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred, for example, with evolution2-todo-full1.vcf) element Attendee: Schemas validity error : Element 'Attendee', attribute 'Status': The attribute 'Status' is not allowed. element Content: Schemas validity error : Element 'Content': [facet 'enumeration'] The value 'NEEDS_ACTION' is not an element of the set {'NEEDS-ACTION', 'COMPLETED', 'IN-PROCESS', 'CANCELLED'}. element Content: Schemas validity error : Element 'Content': 'NEEDS_ACTION' is not a valid value of the atomic type 'TodoStatusValue'. ERROR: XMLFormat validation failed. EXIT_ERROR: osync_converter_invoke: XMLFormat validation failed. (occurred with kdepim-todoful1.vcs) d) Possible detector problem: Entity: line 1: parser error : Start tag expected, '<' not found BEGIN:VCALENDAR ^ ERROR: Could not parse XML. Well, a vevent is not an XML file. (occurred, for example, with evolution2-1-hour-alarm.vcf) e) ERROR: /home/a0037/dev/plugins/ldap-sync-jl/src/ldap_connect.c:4622: WARNING: Value of keyattribute ("documentIdentifier"): "20050306T005538Z-4378-1000-1-28@azrael" conflicts with identifier: "evolution2-todo-full2.vcf". 3. New display utility tests/show_ldap_tree to make the debugging easier. 4. I have fixed several smaller bugs in the test scripts. And cleaned them up a bit. Added: plugins/ldap-sync/tests/ldap-sync.conf.templ (contents, props changed) plugins/ldap-sync/tests/show_ldap_tree (contents, props changed) Deleted: plugins/ldap-sync/tests/check_osynctool_common.inc plugins/ldap-sync/tests/ldap-sync.conf plugins/ldap-sync/tests/ldap-sync.conf_cram_md5_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_cram_md5_slapd plugins/ldap-sync/tests/ldap-sync.conf_digest_md5_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_digest_md5_slapd plugins/ldap-sync/tests/ldap-sync.conf_external1_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_external1_slapd plugins/ldap-sync/tests/ldap-sync.conf_external2_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_external2_slapd plugins/ldap-sync/tests/ldap-sync.conf_gssapi_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_gssapi_slapd plugins/ldap-sync/tests/ldap-sync.conf_login_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_login_slapd plugins/ldap-sync/tests/ldap-sync.conf_ns-slapd_example plugins/ldap-sync/tests/ldap-sync.conf_ntlm_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_ntlm_slapd plugins/ldap-sync/tests/ldap-sync.conf_plain_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_plain_slapd plugins/ldap-sync/tests/ldap-sync.conf_simple_nsslapd plugins/ldap-sync/tests/ldap-sync.conf_simple_slapd plugins/ldap-sync/tests/ldap-sync.conf_slapd_example plugins/ldap-sync/tests/remove_ldifs Modified: plugins/ldap-sync/tests/CMakeLists.txt plugins/ldap-sync/tests/check_add_modify_delete_and_sync plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync 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_fastsync plugins/ldap-sync/tests/check_init 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_file_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_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_files_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_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/test.conf Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Thu Jan 14 21:52:51 2010 (r6007) +++ plugins/ldap-sync/tests/CMakeLists.txt Thu Jan 14 21:56:02 2010 (r6008) @@ -13,28 +13,6 @@ SET ( SCHEMADIR "${LDAP_PLUGIN_OPENSYNC_SCHEMASDIR}" CACHE STRING "Path where any *.xml files are located.") -# 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... -IF (RUN_LONG_TESTS) - SET ( TIMEOUT 3600 CACHE STRING "General timeout value." FORCE ) -ELSE(RUN_LONG_TESTS) - 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 ) -SET ( CMAKE_LONG_TEST_TIMEOUT ${TIMEOUT} CACHE STRING "Does not work, either." FORCE ) -SET ( DART_TESTING_TIMEOUT ${TIMEOUT} CACHE STRING "Is there really no other way to set a timeout to the tests run by ctest?" FORCE ) -SET ( CTEST_TIME_LIMIT ${TIMEOUT} CACHE STRING "Taken from ChangeLog.txt in cmake-2.6.2... No chance." FORCE ) - - - - - - MESSAGE(STATUS "checking for xmllint...") FIND_PROGRAM( XMLLINT_EXECUTABLE xmllint ) IF (XMLLINT_EXECUTABLE) @@ -410,9 +388,9 @@ ADD_TEST( mozldap_auth_ntlm_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_NTLM_SLAPD" ) - # ADD_TEST( mozldap_auth_login_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_LOGIN_SLAPD" ) + ADD_TEST( mozldap_auth_login_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_LOGIN_SLAPD" ) - # ADD_TEST( mozldap_auth_plain_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_PLAIN_SLAPD" ) + ADD_TEST( mozldap_auth_plain_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_PLAIN_SLAPD" ) ADD_TEST( mozldap_auth_gssapi_slapd ${TESTDIR}/check_mozldap_auth "AUTH_MOZLDAP_GSSAPI_SLAPD" ) @@ -540,6 +518,9 @@ # 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} ) + + ADD_TEST( check_init ${TESTDIR}/check_init "check_init" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) ADD_TEST( check_connect ${TESTDIR}/check_connect "check_connect" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) @@ -553,42 +534,42 @@ IF (RUN_AUTH_TESTS) - 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_simple_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} ) - 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" ) + ADD_TEST( plugin_auth_digest_md5_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_digest_md5_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_cram_md5_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_cram_md5_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_cram_md5_slapd" ) + ADD_TEST( plugin_auth_cram_md5_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_cram_md5_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_ntlm_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_ntlm_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_ntlm_slapd" ) + ADD_TEST( plugin_auth_ntlm_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_ntlm_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_login_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_login_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_login_slapd" ) + ADD_TEST( plugin_auth_login_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_login_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_plain_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_plain_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_plain_slapd" ) + ADD_TEST( plugin_auth_plain_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_plain_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_gssapi_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_gssapi_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_gssapi_slapd" ) + ADD_TEST( plugin_auth_gssapi_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_gssapi_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_external1_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_external1_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_external1_slapd" ) + ADD_TEST( plugin_auth_external1_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_external1_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_external2_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_external1_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_external2_slapd" ) + ADD_TEST( plugin_auth_external2_slapd ${TESTDIR}/check_plugin_auth "plugin_auth_external2_slapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_simple_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_simple_nsslapd" ) + ADD_TEST( plugin_auth_simple_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_digest_md5_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_digest_md5_nsslapd" ) + ADD_TEST( plugin_auth_digest_md5_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_digest_md5_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_cram_md5_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_cram_md5_nsslapd" ) + ADD_TEST( plugin_auth_cram_md5_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_cram_md5_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_ntlm_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_ntlm_nsslapd" ) + ADD_TEST( plugin_auth_ntlm_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_ntlm_nsslapd" ${CMAKE_BINARY_DIR} ) - # ADD_TEST( plugin_auth_login_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_login_nsslapd" ) + # ADD_TEST( plugin_auth_login_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_login_nsslapd" ${CMAKE_BINARY_DIR} ) - # ADD_TEST( plugin_auth_plain_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_plain_nsslapd" ) + # ADD_TEST( plugin_auth_plain_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_plain_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_gssapi_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_gssapi_nsslapd" ) + ADD_TEST( plugin_auth_gssapi_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_gssapi_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_external1_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_external1_nsslapd" ) + ADD_TEST( plugin_auth_external1_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_external1_nsslapd" ${CMAKE_BINARY_DIR} ) - ADD_TEST( plugin_auth_external2_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_simple_slapd" ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/tests/ldap-sync.conf_external2_nsslapd" ) + ADD_TEST( plugin_auth_external2_nsslapd ${TESTDIR}/check_plugin_auth "plugin_auth_external2_nsslapd" ${CMAKE_BINARY_DIR} ) ENDIF (RUN_AUTH_TESTS) @@ -603,44 +584,47 @@ IF (LDAPMODIFY_EXECUTABLE) IF (LDAPDELETE_EXECUTABLE) - ADD_TEST( add_mod_del_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( clean_up3 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + - ADD_TEST( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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_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( add_mod_del_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( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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_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( add_mod_del_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( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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( add_mod_del_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_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_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( add_mod_del_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_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( add_mod_del_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( 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( add_mod_del_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") + 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) @@ -655,18 +639,21 @@ IF (LDAPDELETE_EXECUTABLE) IF (VALGRIND_EXECUTABLE) - ADD_TEST( vg_add_mod_del_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( clean_up4 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + - ADD_TEST( vg_add_mod_del_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_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_add_mod_del_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_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_add_mod_del_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_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_add_mod_del_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( 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( vg_add_mod_del_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( 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") ENDIF (VALGRIND_EXECUTABLE) ENDIF (LDAPDELETE_EXECUTABLE) @@ -682,65 +669,182 @@ IF (LDAPMODIFY_EXECUTABLE) IF (LDAPDELETE_EXECUTABLE) - ADD_TEST( osynctool_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( clean_up5 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - #ADD_TEST( osynctool_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( osynctool_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_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( osynctool_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_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( osynctool_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( 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 "osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) - ADD_TEST( clean_up2 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + 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( osynctool_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( clean_up6 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( osynctool_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( osynctool_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_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( osynctool_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_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( osynctool_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_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( osynctool_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_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_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_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_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-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-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-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-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-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_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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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_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-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_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-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-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-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-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-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-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-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-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-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-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_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-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_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-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-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-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-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-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-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-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_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( clean_up3 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( otool_add_vnote1-same_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote1-same_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote1-same.vnt") - ADD_TEST( osynctool_add_mod_del_contact1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" "${TESTDIR}/contact1.xml_modified" ) + ADD_TEST( otool_add_vnote1-similar_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote1-similar_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote1-similar.vnt") - ADD_TEST( osynctool_add_mod_del_contact2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" "${TESTDIR}/contact2.xml_modified" ) + ADD_TEST( otool_add_vnote1_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote1_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote1.vnt") - ADD_TEST( osynctool_add_mod_del_event_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" "${TESTDIR}/event1.xml_modified" ) + ADD_TEST( otool_add_vnote2_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote2_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote2.vnt") - ADD_TEST( osynctool_add_mod_del_todo_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" "${TESTDIR}/todo1.xml_modified" ) + ADD_TEST( otool_add_vnote3_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote3_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote3.vnt") - ADD_TEST( osynctool_add_mod_del_note1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" "${TESTDIR}/note1.xml_modified" ) + ADD_TEST( otool_add_vnote-minimal_vnt ${TESTDIR}/check_osynctool_add_file_and_slowsync "osynctool_add_vnote-minimal_vnt" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/vnotes/vnote-minimal.vnt") - ADD_TEST( osynctool_add_mod_del_note2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" "${TESTDIR}/note2.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_all_four_xmlfiles ${TESTDIR}/check_osynctool_add_modify_delete_four_files_and_sync "osynctool_add_mod_del_all_four_xmlfiles" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${TESTDIR}/contact1.xml" "${TESTDIR}/event1.xml" "${TESTDIR}/todo1.xml" "${TESTDIR}/note1.xml" "${TESTDIR}/contact1.xml_modified" "${TESTDIR}/event1.xml_modified" "${TESTDIR}/todo1.xml_modified" "${TESTDIR}/note1.xml_modified" ) + ADD_TEST( clean_up7 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( clean_up4 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( otool_a_m_d_contact1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" "${TESTDIR}/contact1.xml_modified" ) + ADD_TEST( otool_a_m_d_contact2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" "${TESTDIR}/contact2.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_contact1_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_contact1_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods ) + ADD_TEST( otool_a_m_d_event_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" "${TESTDIR}/event1.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_contact2_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_contact2_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods ) + ADD_TEST( otool_a_m_d_todo_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" "${TESTDIR}/todo1.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_event_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_event_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods ) + ADD_TEST( otool_a_m_d_note1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" "${TESTDIR}/note1.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_todo_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_todo_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods ) + ADD_TEST( otool_a_m_d_note2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_sync "osynctool_add_mod_del_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" "${TESTDIR}/note2.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_note_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_note_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods ) + ADD_TEST( otool_a_m_d_all_four_xmlfiles ${TESTDIR}/check_osynctool_add_modify_delete_four_files_and_sync "osynctool_add_mod_del_all_four_xmlfiles" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${TESTDIR}/contact1.xml" "${TESTDIR}/event1.xml" "${TESTDIR}/todo1.xml" "${TESTDIR}/note1.xml" "${TESTDIR}/contact1.xml_modified" "${TESTDIR}/event1.xml_modified" "${TESTDIR}/todo1.xml_modified" "${TESTDIR}/note1.xml_modified" ) - ADD_TEST( osynctool_add_mod_del_all_four_ldifs_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_four_ldifs_and_sync "osynctool_add_mod_del_all_four_ldifs_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods ) + + ADD_TEST( clean_up8 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + + + ADD_TEST( otool_a_m_d_contact1_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_contact1_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods ) + + ADD_TEST( otool_a_m_d_contact2_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_contact2_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods ) + + ADD_TEST( otool_a_m_d_event_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_event_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods ) + + ADD_TEST( otool_a_m_d_todo_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_todo_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods ) + + ADD_TEST( otool_a_m_d_note_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_sync "osynctool_add_mod_del_note_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods ) + + ADD_TEST( otool_a_m_d_all_four_ldifs_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_four_ldifs_and_sync "osynctool_add_mod_del_all_four_ldifs_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods ) ENDIF (LDAPDELETE_EXECUTABLE) @@ -759,68 +863,182 @@ IF (VALGRIND_EXECUTABLE) - ADD_TEST( clean_up5 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( clean_up9 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( vg_osynctool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) + ADD_TEST( vg_otool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) - #ADD_TEST( vg_osynctool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) + #ADD_TEST( vg_otool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) - ADD_TEST( vg_osynctool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) + ADD_TEST( vg_otool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) - ADD_TEST( vg_osynctool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) + ADD_TEST( vg_otool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) - ADD_TEST( vg_osynctool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) + ADD_TEST( vg_otool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) - ADD_TEST( clean_up6 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( clean_up10 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( vg_osynctool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) + ADD_TEST( vg_otool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) - ADD_TEST( vg_osynctool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) + ADD_TEST( vg_otool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) - ADD_TEST( vg_osynctool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) + ADD_TEST( vg_otool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) - ADD_TEST( vg_osynctool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) + ADD_TEST( vg_otool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) - ADD_TEST( vg_osynctool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) + ADD_TEST( vg_otool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) - ADD_TEST( vg_osynctool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) + ADD_TEST( vg_otool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) - ADD_TEST( clean_up7 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + ADD_TEST( vg_otool_add_evo2-full1_vcf ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_evo2-full1_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full1.vcf") + + ADD_TEST( vg_otool_add_evo2-full2_vcf ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_evo2-full2_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-full2.vcf") + + ADD_TEST( vg_otool_add_evo2-multiline_vcf ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_evo2-multiline_vcf" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/vcards/evo2-multiline.vcf") + + ADD_TEST( vg_otool_add_evo2-photo_vcf ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_evo2-photo_vcf" ${CMAKE_B... [truncated message content] |
From: <svn...@op...> - 2010-01-13 12:08:33
|
Author: markellis Date: Wed Jan 13 13:08:22 2010 New Revision: 6005 URL: http://www.opensync.org/changeset/6005 Log: glib has deprecated individual includes, replaced with glib.h and check for GRegex by version Modified: trunk/ChangeLog trunk/config.h.cmake trunk/opensync/common/opensync_list.c trunk/opensync/version/opensync_version.c Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue Jan 12 18:31:53 2010 (r6004) +++ trunk/ChangeLog Wed Jan 13 13:08:22 2010 (r6005) @@ -1,3 +1,8 @@ +2010-01-13 Mark Ellis <ma...@mp...> + + * config.h.cmake,opensync/{common/opensync_list.c,version/opensync_version.c}: glib has + deprecated individual includes, replaced with glib.h and check for GRegex by version + 2010-01-10 Mark Ellis <ma...@mp...> * wrapper/opensync-{engine,format,group,merger,plugin,version}.i: modifications due to API Modified: trunk/config.h.cmake ============================================================================== --- trunk/config.h.cmake Tue Jan 12 18:31:53 2010 (r6004) +++ trunk/config.h.cmake Wed Jan 13 13:08:22 2010 (r6005) @@ -19,7 +19,6 @@ #cmakedefine OPENSYNC_TRACE #cmakedefine HAVE_FLOCK -#cmakedefine HAVE_GLIB_GREGEX_H #cmakedefine HAVE_SOLARIS #define OPENSYNC_TESTDATA "${CMAKE_CURRENT_SOURCE_DIR}/tests/data" Modified: trunk/opensync/common/opensync_list.c ============================================================================== --- trunk/opensync/common/opensync_list.c Tue Jan 12 18:31:53 2010 (r6004) +++ trunk/opensync/common/opensync_list.c Wed Jan 13 13:08:22 2010 (r6005) @@ -30,7 +30,7 @@ * MT safe */ -#include <glib/gmem.h> +#include <glib.h> #include "opensync_list.h" #include "opensync_internals.h" Modified: trunk/opensync/version/opensync_version.c ============================================================================== --- trunk/opensync/version/opensync_version.c Tue Jan 12 18:31:53 2010 (r6004) +++ trunk/opensync/version/opensync_version.c Wed Jan 13 13:08:22 2010 (r6005) @@ -38,7 +38,7 @@ return 1; /* Only newer versions of glib support regular expressions */ /* On Windows the glib regular expressions are required */ -#ifndef HAVE_GLIB_GREGEX_H +#if GLIB_MAJOR_VERSION < 3 && GLIB_MINOR_VERSION < 14 regex_t *preg = osync_try_malloc0(sizeof(regex_t), error); if(!preg) goto error; @@ -82,7 +82,7 @@ error: return -1; -#else /* HAVE_GLIB_GREGEX_H */ +#else /* GLIB_MAJOR_VERSION < 3 && GLIB_MINOR_VERSION < 14 */ return g_regex_match_simple(pattern, string, 0, 0); #endif } |
From: <svn...@op...> - 2010-01-12 17:32:25
|
Author: bricks Date: Tue Jan 12 18:31:53 2010 New Revision: 6004 URL: http://www.opensync.org/changeset/6004 Log: changed licence to lgpl 2.1 because sources also contain lgpl statements fixes #1200 Modified: plugins/file-sync/COPYING Modified: plugins/file-sync/COPYING ============================================================================== --- plugins/file-sync/COPYING Tue Jan 12 18:07:49 2010 (r6003) +++ plugins/file-sync/COPYING Tue Jan 12 18:31:53 2010 (r6004) @@ -1,221 +1,400 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. The precise terms and conditions for copying, distribution and -modification follow. +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. - GNU GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. -Activities other than copying, distribution and modification are not + Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - a) You must cause the modified files to carry prominent notices + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, +identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of +on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. +entire whole, and thus to each and every part regardless of who wrote +it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or -collective works based on the Program. +collective works based on the Library. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. - 5. You are not required to accept this License, since you have not + 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are +distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying -the Program or works based on it. +the Library or works based on it. - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to +You are not responsible for enforcing compliance by third parties with this License. - - 7. If, as a consequence of a court judgment or allegation of patent + + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other +apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is +integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that @@ -225,116 +404,107 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in + + 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - <one line to give the program's name and a brief idea of what it does.> + <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. +That's all there is to it! - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. |
From: <svn...@op...> - 2010-01-12 17:08:10
|
Author: bricks Date: Tue Jan 12 18:07:49 2010 New Revision: 6003 URL: http://www.opensync.org/changeset/6003 Log: added lgpl2.1 licence. fixes #1201 Added: format-plugins/xmlformat/trunk/src/COPYING Added: format-plugins/xmlformat/trunk/src/COPYING ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ format-plugins/xmlformat/trunk/src/COPYING Tue Jan 12 18:07:49 2010 (r6003) @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + |
From: <svn...@op...> - 2010-01-11 15:28:23
|
Author: dgollub Date: Mon Jan 11 16:28:13 2010 New Revision: 6002 URL: http://www.opensync.org/changeset/6002 Log: Make multisync_conflict_hybrid_choose more reliable by switching to a new conflict handler. Instead of taking the "first" modified entry we choose the modified entry of member 2. For this a new conflict resolution function got introduced in the testsuite. The memberid get passed via userdata pointer. The order of the mapping_engine list seems to be not sorted by memberid. TODO: How is this list of changes sorted? fixes #1124 Modified: trunk/tests/support.c trunk/tests/support.h trunk/tests/sync-tests/check_multisync.c Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Sun Jan 10 20:11:36 2010 (r6001) +++ trunk/tests/support.c Mon Jan 11 16:28:13 2010 (r6002) @@ -524,6 +524,24 @@ } } + +void conflict_handler_choose_member(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) +{ + OSyncChange *change = NULL; + OSyncError *error = NULL; + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); + + num_mapping_conflicts++; + fail_unless(num_engine_end_conflicts == 0, NULL); + + change = osync_mapping_engine_member_change(mapping, GPOINTER_TO_UINT(user_data)); + osync_assert(osync_engine_mapping_solve(engine, mapping, change, &error)); + osync_assert(error == NULL); + + osync_trace(TRACE_EXIT, "%s", __func__); +} + void conflict_handler_choose_first(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) { OSyncChange *change = NULL; Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Sun Jan 10 20:11:36 2010 (r6001) +++ trunk/tests/support.h Mon Jan 11 16:28:13 2010 (r6002) @@ -123,6 +123,7 @@ void mapping_status(OSyncEngineMappingUpdate *status, void *user_data); /* Conflict handlers */ +void conflict_handler_choose_member(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); void conflict_handler_choose_first(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); void conflict_handler_choose_deleted(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); void conflict_handler_choose_modified(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); Modified: trunk/tests/sync-tests/check_multisync.c ============================================================================== --- trunk/tests/sync-tests/check_multisync.c Sun Jan 10 20:11:36 2010 (r6001) +++ trunk/tests/sync-tests/check_multisync.c Mon Jan 11 16:28:13 2010 (r6002) @@ -1037,15 +1037,15 @@ /* Sync from data1/testdata to all * remove data1 and change data2 to newdata2 and data3 to newdata - * conflict_handler_choose_modified picks the first modified so should get newdata2 - * everywhere. + * conflict_handler_choose_member chooses the change of member2 (which owns data2/ directory). + * So newdata2 should get synced everywhere. */ START_TEST (multisync_conflict_hybrid_choose) { char *testbed = setup_testbed("multisync_conflict_changetype_choose"); OSyncError *error = NULL; OSyncEngine *engine = setup_engine(testbed); - osync_engine_set_conflict_callback(engine, conflict_handler_choose_modified, GINT_TO_POINTER(3)); + osync_engine_set_conflict_callback(engine, conflict_handler_choose_member, GINT_TO_POINTER(2)); fail_unless(osync_engine_initialize(engine, &error), NULL); fail_unless(error == NULL, NULL); |
From: <svn...@op...> - 2010-01-10 19:11:49
|
Author: dgollub Date: Sun Jan 10 20:11:36 2010 New Revision: 6001 URL: http://www.opensync.org/changeset/6001 Log: Move all doxygen anotation from C-files to their header files. This is now complete for the opensync/ directory. fixes #898 Added: trunk/opensync/debug/opensync_trace_private.h - copied, changed from r5993, trunk/opensync/debug/opensync_trace.h Modified: trunk/opensync/client/opensync_client_proxy.c trunk/opensync/client/opensync_client_proxy_private.h trunk/opensync/debug/opensync_trace.c trunk/opensync/format/opensync_time.c trunk/opensync/format/opensync_time_internals.h trunk/opensync/group/opensync_member.c trunk/opensync/group/opensync_member_private.h trunk/opensync/ipc/opensync_queue.c trunk/opensync/ipc/opensync_queue_private.h Modified: trunk/opensync/client/opensync_client_proxy.c ============================================================================== --- trunk/opensync/client/opensync_client_proxy.c Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/client/opensync_client_proxy.c Sun Jan 10 20:11:36 2010 (r6001) @@ -1243,18 +1243,6 @@ return FALSE; } -/** - * @brief Check if passed resource is valid. - * - * This check looks for: - * - are all format plugins in the format-sinks available - * - ... - * - * @param proxy Pointer to OSyncClientProxy - * @param resource Pointer to resource to check - * @param error The error which will hold the info of an invalid resource - * @return TRUE if valid, FALSE otherwise. - */ static osync_bool osync_client_proxy_check_resource(OSyncClientProxy *proxy, OSyncPluginResource *resource, OSyncError **error) { OSyncList *format_sinks = osync_plugin_resource_get_objformat_sinks(resource); Modified: trunk/opensync/client/opensync_client_proxy_private.h ============================================================================== --- trunk/opensync/client/opensync_client_proxy_private.h Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/client/opensync_client_proxy_private.h Sun Jan 10 20:11:36 2010 (r6001) @@ -81,4 +81,18 @@ void osync_client_proxy_set_error(OSyncClientProxy *proxy, OSyncError *error); +/** + * @brief Check if passed resource is valid. + * + * This check looks for: + * - are all format plugins in the format-sinks available + * - ... + * + * @param proxy Pointer to OSyncClientProxy + * @param resource Pointer to resource to check + * @param error The error which will hold the info of an invalid resource + * @return TRUE if valid, FALSE otherwise. + */ +static osync_bool osync_client_proxy_check_resource(OSyncClientProxy *proxy, OSyncPluginResource *resource, OSyncError **error); + #endif /*OSYNC_CLIENT_PROXY_PRIVATE_H_*/ Modified: trunk/opensync/debug/opensync_trace.c ============================================================================== --- trunk/opensync/debug/opensync_trace.c Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/debug/opensync_trace.c Sun Jan 10 20:11:36 2010 (r6001) @@ -23,6 +23,8 @@ #include "opensync.h" #include "opensync_internals.h" +#include "opensync_trace_private.h" + GPrivate* current_tabs = NULL; GPrivate* thread_id = NULL; GPrivate* trace_disabled = NULL; @@ -68,9 +70,6 @@ #ifdef OPENSYNC_TRACE -/*! @brief Initailize tracing - * - */ static void _osync_trace_init() { const char *noprivacy; Copied and modified: trunk/opensync/debug/opensync_trace_private.h (from r5993, trunk/opensync/debug/opensync_trace.h) ============================================================================== --- trunk/opensync/debug/opensync_trace.h Sun Jan 10 19:03:23 2010 (r5993, copy source) +++ trunk/opensync/debug/opensync_trace_private.h Sun Jan 10 20:11:36 2010 (r6001) @@ -1,6 +1,7 @@ /* * libopensync - A synchronization framework * Copyright (C) 2004-2005 Armin Bauer <arm...@op...> + * Copyright (C) 2010 Daniel Gollub <go...@b1...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,73 +19,24 @@ * */ -#ifndef _OPENSYNC_TRACE_H -#define _OPENSYNC_TRACE_H +#ifndef _OPENSYNC_TRACE_PRIVATE_H +#define _OPENSYNC_TRACE_PRIVATE_H /** * @defgroup OSyncDebug OpenSync Debug Module - * @ingroup OSyncPublic - * @defgroup OSyncDebugAPI OpenSync Debug + * @ingroup OSyncPrivate + * @defgroup OSyncDebugPrivateAPI OpenSync Debug * @ingroup OSyncDebug * @brief Functions for debugging */ /*@{*/ -/*! @brief The type of the trace +/*! @brief Initailize tracing * */ -typedef enum { - /** Used when entering a function. This will indent the callgraph */ - TRACE_ENTRY, - /** Used when exiting a function. This will unindent the callgraph */ - TRACE_EXIT, - /** Used for traces inside a function. Does not indent. */ - TRACE_INTERNAL, - /** Used for traces with sensitive content inside a function. Does not indent. */ - TRACE_SENSITIVE, - /** Used when exiting a function with a error. This will unindent the callgraph */ - TRACE_EXIT_ERROR, - /** Used to log a general error. This will not unindent the callgraph */ - TRACE_ERROR -} OSyncTraceType; - - -/*! @brief Reset the indentation of the trace function. - * - * Use this function after when process got forked. It's up to the forked - * process (child) to reset the indent. - * - */ -OSYNC_EXPORT void osync_trace_reset_indent(void); - -/*! @brief Used for tracing the application - * - * use this function to trace calls. The call graph will be saved into - * the file that is given in the OSYNC_TRACE environment variable - * - * @param type The type of the trace - * @param message The message to save - * - */ -OSYNC_EXPORT void osync_trace(OSyncTraceType type, const char *message, ...) GCC_FORMAT_CHECK(2, 3); - -/*! @brief Disable tracing - * - */ -OSYNC_EXPORT void osync_trace_disable(void); - -/*! @brief Enable tracing - * - */ -OSYNC_EXPORT void osync_trace_enable(void); - -/*! @brief Is tracing enabled? - * - * @returns TRUE if tracing is enabled, FALSE if disabled. - */ -OSYNC_EXPORT osync_bool osync_trace_is_enabled(void); +static void _osync_trace_init(); /*@} */ -#endif /* _OPENSYNC_TRACE_H */ +#endif /* _OPENSYNC_TRACE_PRIVATE_H */ Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/format/opensync_time.c Sun Jan 10 20:11:36 2010 (r6001) @@ -146,18 +146,6 @@ } #if 0 -/*! @brief Function sets the time of vtime timestamp to the given time parameter - * - * If vtime only stores date (without THHMMSS[Z]) parameter time will - * appended. The is_utc append a Z (Zulu) for UTC if not present. - * - * Mainly used for workarounds. - * - * @param vtime The original data-timestamp which gets modified - * @param time The time which should be set - * @param is_utc If the given time is UTC is_utc have to be TRUE - * @returns data-timestamp in UTC if is_utc TRUE - */ char *osync_time_set_vtime(const char *vtime, const char *time, osync_bool is_utc) { char *tmp = NULL; Modified: trunk/opensync/format/opensync_time_internals.h ============================================================================== --- trunk/opensync/format/opensync_time_internals.h Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/format/opensync_time_internals.h Sun Jan 10 20:11:36 2010 (r6001) @@ -31,6 +31,21 @@ OSYNC_TEST_EXPORT inline struct tm* localtime_r (const time_t *clock, struct tm *result); #endif /* _WIN32 */ +#if 0 +/*! @brief Function sets the time of vtime timestamp to the given time parameter + * + * If vtime only stores date (without THHMMSS[Z]) parameter time will + * appended. The is_utc append a Z (Zulu) for UTC if not present. + * + * Mainly used for workarounds. + * + * @param vtime The original data-timestamp which gets modified + * @param time The time which should be set + * @param is_utc If the given time is UTC is_utc have to be TRUE + * @returns data-timestamp in UTC if is_utc TRUE + */ +char *osync_time_set_vtime(const char *vtime, const char *time, osync_bool is_utc); +#endif /* 0 */ #endif /* _OPENSYNC_TIME_INTERNALS_H_ */ Modified: trunk/opensync/group/opensync_member.c ============================================================================== --- trunk/opensync/group/opensync_member.c Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/group/opensync_member.c Sun Jan 10 20:11:36 2010 (r6001) @@ -774,13 +774,6 @@ osync_objtype_sink_ref(sink); } -// FIXME this procedure does not seem to be referred to anywhere... -/** @brief Remove an OSyncObjTypeSink object to the member list of supported object types of this member - * - * @param member The member pointer - * @param sink The OSyncObjTypeSink object to add - * - */ void osync_member_remove_objtype_sink(OSyncMember *member, OSyncObjTypeSink *sink) { osync_assert(member); Modified: trunk/opensync/group/opensync_member_private.h ============================================================================== --- trunk/opensync/group/opensync_member_private.h Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/group/opensync_member_private.h Sun Jan 10 20:11:36 2010 (r6001) @@ -48,6 +48,15 @@ */ static OSyncObjTypeSink *osync_member_parse_objtype(xmlNode *cur, OSyncError **error); +// FIXME this procedure does not seem to be referred to anywhere... +/** @brief Remove an OSyncObjTypeSink object to the member list of supported object types of this member + * + * @param member The member pointer + * @param sink The OSyncObjTypeSink object to add + * + */ +void osync_member_remove_objtype_sink(OSyncMember *member, OSyncObjTypeSink *sink); + /*@}*/ #endif /* _OPENSYNC_MEMBER_PRIVATE_H_ */ Modified: trunk/opensync/ipc/opensync_queue.c ============================================================================== --- trunk/opensync/ipc/opensync_queue.c Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/ipc/opensync_queue.c Sun Jan 10 20:11:36 2010 (r6001) @@ -764,14 +764,6 @@ } -/** @brief Flush all message of the Queue - * - * Flush all message inside the Queue and dereference the messages. - * - * @param queue The queue to flush - * - */ - static void _osync_queue_flush_messages(GAsyncQueue *queue) { OSyncMessage *message; Modified: trunk/opensync/ipc/opensync_queue_private.h ============================================================================== --- trunk/opensync/ipc/opensync_queue_private.h Sun Jan 10 20:02:37 2010 (r6000) +++ trunk/opensync/ipc/opensync_queue_private.h Sun Jan 10 20:11:36 2010 (r6001) @@ -153,6 +153,15 @@ * */ static long long int opensync_queue_gen_id(const GTimeVal *tv); +/** @brief Flush all message of the Queue + * + * Flush all message inside the Queue and dereference the messages. + * + * @param queue The queue to flush + * + */ +static void _osync_queue_flush_messages(GAsyncQueue *queue); + /*@}*/ #endif /* _OPENSYNC_QUEUE_PRIVATE_H */ |
From: <svn...@op...> - 2010-01-10 19:02:47
|
Author: dgollub Date: Sun Jan 10 20:02:37 2010 New Revision: 6000 URL: http://www.opensync.org/changeset/6000 Log: Move doxygen anotation to header file refs #898 Modified: trunk/opensync/common/opensync_xml.c trunk/opensync/common/opensync_xml_internals.h Modified: trunk/opensync/common/opensync_xml.c ============================================================================== --- trunk/opensync/common/opensync_xml.c Sun Jan 10 19:56:22 2010 (r5999) +++ trunk/opensync/common/opensync_xml.c Sun Jan 10 20:02:37 2010 (r6000) @@ -421,11 +421,6 @@ return OSYNC_CONV_DATA_MISMATCH; } -/** - * @brief Dumps the XML tree to a string - * @param doc the XML doc value - * @return String of XML the tree (the caller is responsible for freeing) - */ char *osync_xml_write_to_string(xmlDoc *doc) { xmlChar *temp = NULL; @@ -474,11 +469,6 @@ return TRUE; } -/** - * @brief Help method which return the content of a xmlNode - * @param node The pointer to a xmlNode - * @return The value of the xmlNode or a empty string - */ xmlChar *osync_xml_node_get_content(xmlNodePtr node) { if(node->children && node->children->content) @@ -487,11 +477,6 @@ return (xmlChar *)""; } -/** - * @brief Help method which return the content of a xmlAttr - * @param node The pointer to a xmlAttr - * @return The value of the xmlAttr or a empty string - */ xmlChar *osync_xml_attr_get_content(xmlAttrPtr node) { if(node->children && node->children->content) @@ -500,18 +485,6 @@ return (xmlChar *)""; } -/*! @brief Opens a xml document - * - * Opens a xml document - * - * @param doc Pointer to a xmldoc - * @param cur The pointer to the first node - * @param path The path of the document - * @param topentry the name of the top node - * @param error Pointer to a error struct - * @returns TRUE if successful, FALSE otherwise - * - */ osync_bool osync_xml_open_file(xmlDocPtr *doc, xmlNodePtr *cur, const char *path, const char *topentry, OSyncError **error) { if (!g_file_test(path, G_FILE_TEST_EXISTS)) { Modified: trunk/opensync/common/opensync_xml_internals.h ============================================================================== --- trunk/opensync/common/opensync_xml_internals.h Sun Jan 10 19:56:22 2010 (r5999) +++ trunk/opensync/common/opensync_xml_internals.h Sun Jan 10 20:02:37 2010 (r6000) @@ -82,14 +82,43 @@ xmlXPathObject *osync_xml_get_nodeset(xmlDoc *doc, const char *expression); xmlXPathObject *osync_xml_get_unknown_nodes(xmlDoc *doc); OSyncConvCmpResult osync_xml_compare(xmlDoc *leftinpdoc, xmlDoc *rightinpdoc, OSyncXMLScore *scores, int default_score, int treshold); + +/** + * @brief Dumps the XML tree to a string + * @param doc the XML doc value + * @return String of XML the tree (the caller is responsible for freeing) + */ char *osync_xml_write_to_string(xmlDoc *doc); osync_bool osync_xml_copy(const char *input, unsigned int inpsize, char **output, unsigned int *outpsize, OSyncError **error); osync_bool osync_xml_validate_document(xmlDocPtr doc, char *schemafilepath); +/** + * @brief Help method which return the content of a xmlNode + * @param node The pointer to a xmlNode + * @return The value of the xmlNode or a empty string + */ xmlChar *osync_xml_node_get_content(xmlNodePtr node); + +/** + * @brief Help method which return the content of a xmlAttr + * @param node The pointer to a xmlAttr + * @return The value of the xmlAttr or a empty string + */ xmlChar *osync_xml_attr_get_content(xmlAttrPtr node); +/*! @brief Opens a xml document + * + * Opens a xml document + * + * @param doc Pointer to a xmldoc + * @param cur The pointer to the first node + * @param path The path of the document + * @param topentry the name of the top node + * @param error Pointer to a error struct + * @returns TRUE if successful, FALSE otherwise + * + */ osync_bool osync_xml_open_file(xmlDocPtr *doc, xmlNodePtr *cur, const char *path, const char *topentry, OSyncError **error); /*@}*/ |