From: <svn...@op...> - 2009-04-02 19:20:02
|
Author: scriptor Date: Thu Apr 2 21:19:57 2009 New Revision: 5517 URL: http://www.opensync.org/changeset/5517 Log: Added error message. Changed a comment and a string. Modified: plugins/ldap-sync/src/ldap_connect.c Modified: plugins/ldap-sync/src/ldap_connect.c ============================================================================== --- plugins/ldap-sync/src/ldap_connect.c Thu Apr 2 21:19:40 2009 (r5516) +++ plugins/ldap-sync/src/ldap_connect.c Thu Apr 2 21:19:57 2009 (r5517) @@ -2217,12 +2217,30 @@ if (ldap_get_option(sinkenv->ld, LDAP_OPT_RESULT_CODE, &result_code) != LDAP_OPT_SUCCESS) { - + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_get_option() has failed. result_code could not be filled in. \n", __FILE__, __LINE__); goto error; } else { - goto ok1; + if (result_code == LDAP_SUCCESS) { + osync_trace(TRACE_INTERNAL, "%s:%i: uid = NULL, but LDAP_SUCCESS. This is ok.", __FILE__, __LINE__); + goto ok1; + } + + if (result_code == LDAP_NO_SUCH_OBJECT) { + osync_trace(TRACE_INTERNAL, "%s:%i: uid = NULL: LDAP_NO_SUCH_OBJECT: This is ok here.", __FILE__, __LINE__); + goto ok1; + } else { + char *ldap_error = ldap_plugin_report_ldap_error(sinkenv, __FILE__, __LINE__, result_code); + + if (ldap_error == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_first_entry() has failed.", __FILE__, __LINE__); + } else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_first_entry() has failed: \"%s\"", __FILE__, __LINE__, ldap_error); + } + + goto error; + } } } @@ -2292,7 +2310,6 @@ osync_context_report_osyncwarning(ctx, *error); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); - osync_error_unref(error); return FALSE; } @@ -3774,7 +3791,7 @@ * the LDAP entry accordingly. * * @param entry The LDAP entry to be checked. - * @param attribute The LDAP attribute which is required to be present. + * @param ldap_attribute The LDAP attribute which is required to be present. * @param value The value of the required LDAP attribute. * * @param error The libopensync error pointer. @@ -4036,7 +4053,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\" conflicts with identifier \"%s\". Trying to enforce correct one.", __FILE__, __LINE__, 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.", __FILE__, __LINE__, mod->mod_type, mod->mod_bvalues[0]->bv_val, 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); |