Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:pchenthill
evolution-data-server
fix-117813-ldap-crashers.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-117813-ldap-crashers.diff of Package evolution-data-server
Index: e-book-backend-ldap.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/ldap/e-book-backend-ldap.c,v retrieving revision 1.58 diff -u -p -r1.58 e-book-backend-ldap.c --- e-book-backend-ldap.c 18 Jul 2006 11:12:37 -0000 1.58 +++ addressbook/backends/ldap/e-book-backend-ldap.c 24 Aug 2006 11:12:16 -0000 @@ -516,13 +516,10 @@ check_schema_support (EBookBackendLDAP * LDAP *ldap; struct timeval timeout; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (!bl->priv->schema_dn) return; @@ -962,14 +959,11 @@ e_book_backend_ldap_reconnect (EBookBack g_get_current_time (&start); } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (enable_debug) printf ("e_book_backend_ldap_reconnect ... ldap handler is NULL\n"); return FALSE; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); /* we need to reconnect if we were previously connected */ if (bl->priv->connected && ldap_status == LDAP_SERVER_DOWN) { @@ -1064,8 +1058,9 @@ ldap_op_finished (LDAPOp *op) if (bl->priv->ldap) ldap_abandon (bl->priv->ldap, op->id); g_static_rec_mutex_unlock (&eds_ldap_handler_lock); - - op->dtor (op); + + if (op->dtor) + op->dtor (op); bl->priv->active_ops--; @@ -1405,18 +1400,14 @@ create_contact_handler (LDAPOp *op, LDAP int ldap_error; int response; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_create (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL); ldap_op_finished (op); - } - else { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); + return; } if (LDAP_RES_ADD != ldap_msgtype (res)) { @@ -1571,9 +1562,7 @@ e_book_backend_ldap_create_contact (EBoo ldap_mods = (LDAPMod**)mod_array->pdata; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); do { book_view_notify_status (book_view, _("Adding contact to LDAP server...")); @@ -1620,14 +1609,11 @@ remove_contact_handler (LDAPOp *op, LDAP int ldap_error; GList *ids = NULL; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_remove_contacts (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL); ldap_op_finished (op); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (LDAP_RES_DELETE != ldap_msgtype (res)) { g_warning ("incorrect msg type %d passed to remove_contact_handler", ldap_msgtype (res)); @@ -1691,14 +1677,11 @@ e_book_backend_ldap_remove_contacts (EBo g_free (remove_op); return; case GNOME_Evolution_Addressbook_MODE_REMOTE : - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_remove_contacts (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL); g_free (remove_op); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); book_view = find_book_view (bl); @@ -1766,10 +1749,8 @@ modify_contact_modify_handler (LDAPOp *o char *ldap_error_msg; int ldap_error; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_modify (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, @@ -1777,7 +1758,6 @@ modify_contact_modify_handler (LDAPOp *o ldap_op_finished (op); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (LDAP_RES_MODIFY != ldap_msgtype (res)) { g_warning ("incorrect msg type %d passed to modify_contact_handler", ldap_msgtype (res)); @@ -1819,16 +1799,13 @@ modify_contact_search_handler (LDAPOp *o LDAP *ldap; int msg_type; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_modify (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL); ldap_op_finished (op); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); /* if it's successful, we should get called with a RES_SEARCH_ENTRY and a RES_SEARCH_RESULT. if it's @@ -1836,9 +1813,7 @@ modify_contact_search_handler (LDAPOp *o msg_type = ldap_msgtype (res); if (msg_type == LDAP_RES_SEARCH_ENTRY) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); LDAPMessage *e = ldap_first_entry(ldap, res); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (!e) { g_warning ("uh, this shouldn't happen"); @@ -1850,10 +1825,8 @@ modify_contact_search_handler (LDAPOp *o return; } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); modify_op->current_contact = build_contact_from_entry (bl, e, &modify_op->existing_objectclasses); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } else if (msg_type == LDAP_RES_SEARCH_RESULT) { char *ldap_error_msg; @@ -2010,14 +1983,11 @@ e_book_backend_ldap_modify_contact (EBoo e_data_book_respond_modify(book, opid, GNOME_Evolution_Addressbook_RepositoryOffline, NULL); return; case GNOME_Evolution_Addressbook_MODE_REMOTE : - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_modify (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL); g_free (modify_op); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); book_view = find_book_view (bl); @@ -2025,9 +1995,7 @@ e_book_backend_ldap_modify_contact (EBoo modify_op->contact = e_contact_new_from_vcard (vcard); modify_op->id = e_contact_get_const (modify_op->contact, E_CONTACT_UID); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); do { book_view_notify_status (book_view, _("Modifying contact from LDAP server...")); @@ -2077,25 +2045,20 @@ get_contact_handler (LDAPOp *op, LDAPMes g_get_current_time (&start); } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_get_contact (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, ""); ldap_op_finished (op); if (enable_debug) printf ("get_contact_handler... ldap handler is NULL \n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); /* the msg_type will be either SEARCH_ENTRY (if we're successful) or SEARCH_RESULT (if we're not), so we finish the op after either */ msg_type = ldap_msgtype (res); if (msg_type == LDAP_RES_SEARCH_ENTRY) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); LDAPMessage *e = ldap_first_entry (bl->priv->ldap, res); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); EContact *contact; char *vcard; @@ -2110,9 +2073,7 @@ get_contact_handler (LDAPOp *op, LDAPMes return; } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); contact = build_contact_from_entry (bl, e, NULL); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30); e_data_book_respond_get_contact (op->book, @@ -2218,17 +2179,14 @@ e_book_backend_ldap_get_contact (EBookBa printf("e_book_backend_ldap_get_contact ... \n"); g_get_current_time (&start); } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_get_contact (book, opid, GNOME_Evolution_Addressbook_OtherError, ""); if (enable_debug) printf("e_book_backend_ldap_get_contact ... ldap handler is NULL\n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); get_contact_op = g_new0 (LDAPGetContactOp, 1); book_view = find_book_view (bl); @@ -2287,31 +2245,24 @@ contact_list_handler (LDAPOp *op, LDAPMe if (enable_debug) printf ("contact_list_handler ...\n"); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_get_contact_list (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL); ldap_op_finished (op); if (enable_debug) printf ("contact_list_handler ... ldap handler is NULL \n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); msg_type = ldap_msgtype (res); if (msg_type == LDAP_RES_SEARCH_ENTRY) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); e = ldap_first_entry (ldap, res); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); while (NULL != e) { EContact *contact; char *vcard; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); contact = build_contact_from_entry (bl, e, NULL); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30); @@ -2322,9 +2273,7 @@ contact_list_handler (LDAPOp *op, LDAPMe g_object_unref (contact); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); e = ldap_next_entry(ldap, e); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } } else if (msg_type == LDAP_RES_SEARCH_RESULT) { @@ -2441,17 +2390,14 @@ e_book_backend_ldap_get_contact_list (EB return; case GNOME_Evolution_Addressbook_MODE_REMOTE: - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL); if (enable_debug) printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); contact_list_op = g_new0 (LDAPGetContactListOp, 1); book_view = find_book_view (bl); @@ -3860,14 +3806,11 @@ poll_ldap (EBookBackendLDAP *bl) struct timeval timeout; const char *ldap_timeout_string; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); bl->priv->poll_timeout = -1; return FALSE; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (!bl->priv->active_ops) { g_warning ("poll_ldap being called for backend with no active operations"); @@ -3883,9 +3826,7 @@ poll_ldap (EBookBackendLDAP *bl) else timeout.tv_usec = LDAP_RESULT_TIMEOUT_MILLIS * 1000; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); rc = ldap_result (ldap, LDAP_RES_ANY, 0, &timeout, &res); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (rc != 0) {/* rc == 0 means timeout exceeded */ if (rc == -1) { EDataBookView *book_view = find_book_view (bl); @@ -3906,7 +3847,7 @@ poll_ldap (EBookBackendLDAP *bl) d(printf ("looked up msgid %d, got op %p\n", msgid, op)); - if (op) + if (op && op->handler) op->handler (op, res); else g_warning ("unknown operation, msgid = %d", msgid); @@ -3938,17 +3879,14 @@ ldap_search_handler (LDAPOp *op, LDAPMes if (enable_debug) g_get_current_time(&start); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_OtherError); ldap_op_finished (op); if (enable_debug) printf ("ldap_search_handler... ldap handler is NULL \n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); if (!search_op->notified_receiving_results) { search_op->notified_receiving_results = TRUE; @@ -3957,21 +3895,15 @@ ldap_search_handler (LDAPOp *op, LDAPMes msg_type = ldap_msgtype (res); if (msg_type == LDAP_RES_SEARCH_ENTRY) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); e = ldap_first_entry (ldap, res); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); while (NULL != e) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); EContact *contact = build_contact_from_entry (bl, e, NULL); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_view_notify_update (view, contact); g_object_unref (contact); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); e = ldap_next_entry(ldap, e); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } } else if (msg_type == LDAP_RES_SEARCH_RESULT) { @@ -4070,14 +4002,12 @@ e_book_backend_ldap_search (EBookBackend case GNOME_Evolution_Addressbook_MODE_REMOTE : ldap_query = e_book_backend_ldap_build_query (bl, e_data_book_view_get_card_query (view)); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (ldap_query != NULL && bl->priv->ldap) { LDAP *ldap; int ldap_err; int search_msgid; int view_limit; - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); view_limit = e_data_book_view_get_max_results (view); if (view_limit == -1 || view_limit > bl->priv->ldap_limit) view_limit = bl->priv->ldap_limit; @@ -4085,14 +4015,11 @@ e_book_backend_ldap_search (EBookBackend printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query, view_limit); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); do { book_view_notify_status (view, _("Searching...")); - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap_err = ldap_search_ext (ldap, bl->priv->ldap_rootdn, bl->priv->ldap_scope, ldap_query, @@ -4101,7 +4028,6 @@ e_book_backend_ldap_search (EBookBackend NULL, /* XXX */ NULL, /* XXX timeout */ view_limit, &search_msgid); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } while (e_book_backend_ldap_reconnect (bl, view, ldap_err)); g_free (ldap_query); @@ -4146,7 +4072,6 @@ e_book_backend_ldap_search (EBookBackend GNOME_Evolution_Addressbook_InvalidQuery); */ /* Ignore NULL query */ - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); e_data_book_view_notify_complete (view, GNOME_Evolution_Addressbook_Success); return; @@ -4211,16 +4136,13 @@ generate_cache_handler (LDAPOp *op, LDAP printf ("generate_cache_handler ... \n"); g_get_current_time (&start); } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap = bl->priv->ldap; if (!ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); ldap_op_finished (op); if (enable_debug) printf ("generate_cache_handler ... ldap handler is NULL \n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); book_view = find_book_view (bl); @@ -4231,9 +4153,7 @@ generate_cache_handler (LDAPOp *op, LDAP g_static_rec_mutex_unlock (&eds_ldap_handler_lock); while (e != NULL) { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); EContact *contact = build_contact_from_entry (bl, e, NULL); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); contact_list_op->contacts = g_list_prepend (contact_list_op->contacts, contact); @@ -4309,21 +4229,17 @@ generate_cache (EBookBackendLDAP *book_b priv = book_backend_ldap->priv; - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); g_free (contact_list_op); if (enable_debug) printf ("generating offline cache failed ... ldap handler is NULL\n"); return; } - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); ldap_query = e_book_backend_ldap_build_query (book_backend_ldap, "(beginswith \"file_as\" \"\")"); do { - g_static_rec_mutex_lock (&eds_ldap_handler_lock); ldap_error = ldap_search_ext (priv->ldap, priv->ldap_rootdn, priv->ldap_scope, @@ -4331,7 +4247,6 @@ generate_cache (EBookBackendLDAP *book_b NULL, 0, NULL, NULL, NULL, /* XXX timeout */ LDAP_NO_LIMIT, &contact_list_msgid); - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } while (e_book_backend_ldap_reconnect (book_backend_ldap, NULL, ldap_error)); g_free (ldap_query); @@ -4365,6 +4280,9 @@ e_book_backend_ldap_authenticate_user (E int status; char *dn = NULL; + if (enable_debug) + printf ("e_book_backend_ldap_authenticate_user ... \n"); + if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL) { e_book_backend_notify_writable (backend, FALSE); e_book_backend_notify_connection_status (backend, FALSE); @@ -4374,9 +4292,7 @@ e_book_backend_ldap_authenticate_user (E return; } - g_static_rec_mutex_lock (&eds_ldap_handler_lock); if (!bl->priv->connected || !bl->priv->ldap) { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); status = e_book_backend_ldap_connect (bl); if (status != GNOME_Evolution_Addressbook_Success) { @@ -4385,9 +4301,6 @@ e_book_backend_ldap_authenticate_user (E return ; } - } - else { - g_static_rec_mutex_unlock (&eds_ldap_handler_lock); } if (!g_ascii_strncasecmp (auth_method, LDAP_SIMPLE_PREFIX, strlen (LDAP_SIMPLE_PREFIX))) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor