aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas/pas-backend-ldap.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2001-01-05 10:22:47 +0800
committerChris Toshok <toshok@src.gnome.org>2001-01-05 10:22:47 +0800
commit5dca3046d3ad660485cc68e3c9f4ef3f98a5922d (patch)
tree1aaa131bc0b4a9ea283c8a41235d559162522ee1 /addressbook/backend/pas/pas-backend-ldap.c
parentd760764af84a693d3fb580c8b402b2347a61bba8 (diff)
downloadgsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar.gz
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar.bz2
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar.lz
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar.xz
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.tar.zst
gsoc2013-evolution-5dca3046d3ad660485cc68e3c9f4ef3f98a5922d.zip
new function. (impl_BookListener_respond_authentication_result): new
2001-01-04 Chris Toshok <toshok@helixcode.com> * backend/ebook/e-book-listener.c (e_book_listener_queue_authentication_response): new function. (impl_BookListener_respond_authentication_result): new function. (e_book_listener_get_epv): fill in epv->notifyAuthenticationResult. * backend/ebook/e-book-listener.h: add AuthenticationResponse to EBookListenerOperation. * backend/ebook/e-book.c (e_book_authenticate_user): new function. * backend/ebook/e-book.h: add prototype for e_book_authenticate_user. * backend/idl/addressbook.idl (GNOME:Evolution:Addressbook:Book): add authenticateUser method. (GNOME:Evolution:Addressbook:BookListener): add AuthenticationFailed and AuthenticationRequired to CallStatus. also add notifyAuthenticationResult method. * backend/pas/pas-backend-file.c (pas_backend_file_process_authenticate_user): dummy authenticate_user function that always succeeds. (pas_backend_file_process_client_requests): respond to the AuthenticateUser request. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_build_query): gtk_object_unref(sexp) => s_exp_unref(sexp). (pas_backend_ldap_process_authenticate_user): fill in to use ldap_simple_bind_s. (pas_backend_ldap_process_client_requests): respond to the AuthenticateUser request. * backend/pas/pas-book.c (pas_book_queue_authenticate_user): new function. (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): new function. (pas_book_respond_authenticate_user): new function. (pas_book_get_epv): fill in epv->authenticateUser. * backend/pas/pas-book.h: add AuthenticateUser operation type, and add user/passwd to the PASRequest struct. * gui/component/addressbook-storage.c (addressbook_storage_get_source_by_uri): new function. should use a hashtable, perhaps, but the lists will generally be small anyway. * gui/component/addressbook-storage.h: add prototype for addressbook_storage_get_source_by_uri. * gui/component/addressbook-config.c (addressbook_source_dialog_set_source): fill in the binddn if the auth page is shown. * gui/component/addressbook.c (book_open_cb): shoe-horn authentication in here. if the source was configured to use authentication, authenticate the user after opening the ebook. also, be paranoid and clear out the password after authenticating. (book_auth_cb): callback for auth. set the "book" arg on the view->view here. (passwd_cb): set the view's passwd that'll be used in book_open_cb. (addressbook_view_free): g_free view->passwd. svn path=/trunk/; revision=7265
Diffstat (limited to 'addressbook/backend/pas/pas-backend-ldap.c')
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 4d86538a6e..1aa49cd17b 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -210,18 +210,18 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
{
PASBackendLDAPPrivate *blpriv = bl->priv;
-#ifdef DEBUG
- {
- extern int ldap_debug;
- ldap_debug = LDAP_DEBUG_ANY;
- }
-#endif
-
/* close connection first if it's open first */
if (blpriv->ldap)
ldap_unbind (blpriv->ldap);
blpriv->ldap = ldap_open (blpriv->ldap_host, blpriv->ldap_port);
+#ifdef DEBUG
+ {
+ int debug_level = ~0;
+ ldap_set_option (blpriv->ldap, LDAP_OPT_DEBUG_LEVEL, &debug_level);
+ }
+#endif
+
if (NULL != blpriv->ldap) {
ldap_simple_bind_s(blpriv->ldap,
NULL /*binddn*/, NULL /*passwd*/);
@@ -1249,7 +1249,7 @@ pas_backend_ldap_build_query (gchar *query)
r = e_sexp_eval(sexp);
- gtk_object_unref(GTK_OBJECT(sexp));
+ e_sexp_unref (sexp);
e_sexp_result_free(r);
if (list->next) {
@@ -1550,6 +1550,20 @@ pas_backend_ldap_process_check_connection (PASBackend *backend,
pas_book_report_connection (book, bl->priv->connected);
}
+static void
+pas_backend_ldap_process_authenticate_user (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+{
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ int ldap_error = ldap_simple_bind_s(bl->priv->ldap,
+ req->user,
+ req->passwd);
+
+ pas_book_respond_authenticate_user (book,
+ ldap_error_to_response (ldap_error));
+}
+
static gboolean
pas_backend_ldap_can_write (PASBook *book)
{
@@ -1603,6 +1617,10 @@ pas_backend_ldap_process_client_requests (PASBook *book)
case GetChanges:
/* FIXME: Code this. */
break;
+
+ case AuthenticateUser:
+ pas_backend_ldap_process_authenticate_user (backend, book, req);
+ break;
}
g_free (req);