From 305f2fe00235b6945031286ec198edced967c332 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 26 Jul 2000 19:48:35 +0000 Subject: add support for user settable scope. (pas_backend_ldap_search): same. 2000-07-26 Chris Toshok * backend/pas/pas-backend-ldap.c (pas_backend_ldap_build_all_cards_list): add support for user settable scope. (pas_backend_ldap_search): same. (pas_backend_ldap_load_uri): same. svn path=/trunk/; revision=4360 --- addressbook/backend/pas/pas-backend-ldap.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 6282135fe0..f032ab08d4 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -36,6 +36,7 @@ struct _PASBackendLDAPPrivate { gchar *ldap_host; gchar *ldap_rootdn; int ldap_port; + int ldap_scope; GList *book_views; }; @@ -210,7 +211,7 @@ pas_backend_ldap_build_all_cards_list(PASBackend *backend, if ((ldap_error = ldap_search_s (ldap, bl->priv->ldap_rootdn, - LDAP_SCOPE_ONELEVEL, + bl->priv->ldap_scope, "(objectclass=*)", NULL, 0, &res)) == -1) { g_warning ("ldap error '%s' in " @@ -697,12 +698,17 @@ pas_backend_ldap_search (PASBackendLDAP *bl, PASBook *book, PASBackendLDAPBookView *view) { - char *ldap_query = pas_backend_ldap_build_query(view->search); + char *ldap_query; + + if (view->search_idle) + g_warning ("pas_backend_ldap_search called again with pending search on this view.\n"); + + ldap_query = pas_backend_ldap_build_query(view->search); if (ldap_query != NULL) { LDAP *ldap; - pas_backend_ldap_ensure_connected(bl); + /* pas_backend_ldap_ensure_connected(bl);*/ ldap = bl->priv->ldap; @@ -712,7 +718,7 @@ pas_backend_ldap_search (PASBackendLDAP *bl, if ((view->search_msgid = ldap_search (ldap, bl->priv->ldap_rootdn, - LDAP_SCOPE_ONELEVEL, + bl->priv->ldap_scope, ldap_query, NULL, 0)) == -1) { g_warning ("ldap error '%s' in pas_backend_ldap_search\n", ldap_err2string(ldap->ld_errno)); @@ -761,7 +767,7 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend, : Evolution_BookListener_CardNotFound /* XXX */), book_view); - view = g_new(PASBackendLDAPBookView, 1); + view = g_new0(PASBackendLDAPBookView, 1); view->book_view = book_view; view->search = g_strdup(req->search); view->blpriv = bl->priv; @@ -887,6 +893,7 @@ pas_backend_ldap_load_uri (PASBackend *backend, if (bl->priv->ldap_port == 0) bl->priv->ldap_port = 389; bl->priv->ldap_rootdn = g_strdup(lud->lud_dn); + bl->priv->ldap_scope = lud->lud_scope; ldap_free_urldesc(lud); -- cgit