From: <svn...@op...> - 2009-04-11 18:28:56
|
Author: scriptor Date: Sat Apr 11 20:28:51 2009 New Revision: 5576 URL: http://www.opensync.org/changeset/5576 Log: Added detector functions for the LDAP specific formats. It does not matter whether the input data is in form of a human readable XML document (that is a real string), or in form of a glist_container struct (used by the LDAP plugin). Even an OSyncXMLFormat could theoretically be analyzed, but currently it is commented out (depending of HANDLE_OSYNC_XMLFORMAT in ldap_plugin.h), because of bugs in libopensync: Whenever the detector functions face an OSyncXMLFormat, it seems to be an invalid struct which causes memory faults. This is probably linked to the issue, that I have faced for quite some time now: The libopensync framework calls the converter functions of the LDAP format plugin with wrong kinds of data. For example, for an "xmlformat-event" libopensync calls the converter function for converting from "ldap-event" to "xmlformat-event". Which is right the opposite and therefore wrong direction. If HANDLE_OSYNC_XMLFORMAT is defined, then this problem has a different face: A probably invalid OSyncXMLformat struct is passed, leading to SigSegV in osync_xmlformat_assemble(). For debugging purposes the registration of the detector functions can be commented out by undefining ENABLE_DETECTOR_FUNCTIONS in ldap_plugin.h. And CALL_ABORT will lead to an abort, whenever an OSyncXMLFormat() is provided to the detector functions. Also fixed some error messages in ldap_format.c. Modified: plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Sat Apr 11 20:28:25 2009 (r5575) +++ plugins/ldap-sync/src/ldap_plugin.h Sat Apr 11 20:28:51 2009 (r5576) @@ -104,8 +104,17 @@ ///< conditions in libopensync. So they are almost ///< scheduled for debugging. +#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 + ///< what kind of format is inside an + ///< OSyncXMLFormat in + ///< ldap_format_do_detect_plain_as_ldap_format(). + #define DEBUG_auth 1 #define DEBUG_configuration 1 +#define DEBUG_detection 1 #define DEBUG_ldapdata_from_server 1 #define DEBUG_convert_ldap2xmlinternal 1 #define DEBUG_do_apply_stylesheet 1 @@ -124,6 +133,7 @@ #undef DEBUG_auth #undef DEBUG_configuration +#undef DEBUG_detection #undef DEBUG_ldapdata_from_server #undef DEBUG_convert_ldap2xmlinternal #undef DEBUG_do_apply_stylesheet @@ -271,6 +281,14 @@ const char *magic; ///< Here is stored the name of the struct, in ///< order to make it recognizable when passed ///< as a char * pointer. + const char *format_name; ///< This is the name of the LDAP specific + ///< format, like "ldap-evolutionperson" or + ///< "ldap-note". This variable is necessary, + ///< because the detector functions do not + ///< have any other possibility to recognize + ///< the format: For the object types event, + ///< todo and note the LDAP objectClass is + ///< is always "document". GList *list; ///< This is the GList that holds various ///< ldap_entry structs. } glist_container; @@ -468,7 +486,7 @@ void ldap_plugin_free_env(plugin_environment *env); void ldap_plugin_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync_requested, void *userdata); osync_bool ldap_plugin_get_ldap_entries_from_change(OSyncContext *ctx, OSyncChange *change, sink_environment *sinkenv, GList **ldap_entries, OSyncError **error); -osync_bool ldap_plugin_get_glist(char *unknown, GList **list, OSyncError **error); +osync_bool ldap_plugin_get_glist(const char *unknown, GList **list, OSyncError **error); void *ldap_plugin_initialize(OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError **error); osync_bool ldap_plugin_initialize_anchor(sink_environment *sinkenv, OSyncError **error); int ldap_plugin_initialize_format(OSyncPluginInfo *info, sink_environment *sinkenv, OSyncPluginConfig *configdata, const char *objtype, const char *format, OSyncError **error); |