aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-04-19 06:43:54 +0800
committerChris Toshok <toshok@src.gnome.org>2002-04-19 06:43:54 +0800
commit500a46c6b7aca3556b2f77e5448fe7cff83ecae1 (patch)
tree48168342b44a1c22ac6048a8491da1064a505b10 /addressbook
parent7397bc24b8b776af4c46d13d2ac77d0e063bc853 (diff)
downloadgsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar.gz
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar.bz2
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar.lz
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar.xz
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.tar.zst
gsoc2013-evolution-500a46c6b7aca3556b2f77e5448fe7cff83ecae1.zip
fill in source->ssl. (addressbook_source_dialog_set_source): set up
2002-04-18 Chris Toshok <toshok@ximian.com> * gui/component/ldap-config.c (addressbook_dialog_get_source): fill in source->ssl. (addressbook_source_dialog_set_source): set up auth/scope/ssl option menus properly. * gui/component/addressbook-storage.c (addressbook_storage_init_source_uri): always include the limit/ssl in the uri so we don't need to rely on defaults everywhere. (ldap_source_foreach): store the ssl option. * gui/component/addressbook-storage.h: reorder SSLType to match the UI. * backend/pas/pas-backend-ldap.c: (struct _PASBackendLDAPPrivate) add field for ldap_timeout. (pas_backend_ldap_connect): reorder things a bit - we need to start tls before the root dse query, if we can. (pas_backend_ldap_load_uri): track the way ssl parameters are given in the uri, and parse out the timeout. * gui/component/ldap-config.c (port_changed_func): use the symbolic SSL name instead of an integer constant. svn path=/trunk/; revision=16529
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog26
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c56
-rw-r--r--addressbook/gui/component/addressbook-storage.c12
-rw-r--r--addressbook/gui/component/addressbook-storage.h4
-rw-r--r--addressbook/gui/component/ldap-config.c23
5 files changed, 74 insertions, 47 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7b151d6ebc..de94b9208c 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,31 @@
2002-04-18 Chris Toshok <toshok@ximian.com>
+ * gui/component/ldap-config.c (addressbook_dialog_get_source):
+ fill in source->ssl.
+ (addressbook_source_dialog_set_source): set up auth/scope/ssl
+ option menus properly.
+
+ * gui/component/addressbook-storage.c
+ (addressbook_storage_init_source_uri): always include the
+ limit/ssl in the uri so we don't need to rely on defaults
+ everywhere.
+ (ldap_source_foreach): store the ssl option.
+
+ * gui/component/addressbook-storage.h: reorder SSLType to match
+ the UI.
+
+ * backend/pas/pas-backend-ldap.c: (struct _PASBackendLDAPPrivate)
+ add field for ldap_timeout.
+ (pas_backend_ldap_connect): reorder things a bit - we need to
+ start tls before the root dse query, if we can.
+ (pas_backend_ldap_load_uri): track the way ssl parameters are
+ given in the uri, and parse out the timeout.
+
+ * gui/component/ldap-config.c (port_changed_func): use the
+ symbolic SSL name instead of an integer constant.
+
+2002-04-18 Chris Toshok <toshok@ximian.com>
+
* backend/pas/pas-backend-ldap.c (get_ldap_library_info): fix
memory leaks.
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 9af0a8c1a4..ee41bfcb69 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -94,6 +94,7 @@ struct _PASBackendLDAPPrivate {
gchar *ldap_rootdn; /* the base dn of our searches */
int ldap_scope; /* the scope used for searches */
int ldap_limit; /* the search limit */
+ int ldap_timeout; /* the search timeout */
gboolean ldap_v3; /* TRUE if the server supports protocol
revision 3 (necessary for TLS) */
@@ -563,6 +564,24 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
if (NULL != blpriv->ldap) {
int ldap_error;
+
+ if (bl->priv->use_tls) {
+ ldap_error = ldap_start_tls_s (blpriv->ldap, NULL, NULL);
+ if (LDAP_SUCCESS != ldap_error) {
+ if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
+ g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
+ ldap_unbind (blpriv->ldap);
+ blpriv->ldap = NULL;
+ return GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable;
+ }
+ else {
+ g_message ("TLS not available (ldap_error 0x%02x)", ldap_error);
+ }
+ }
+ else
+ g_message ("TLS active");
+ }
+
query_ldap_root_dse (bl);
if (bl->priv->ldap_v3) {
@@ -574,33 +593,6 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
}
}
- if (bl->priv->use_tls) {
- if (bl->priv->ldap_v3 /* the server supports v3 */) {
- ldap_error = ldap_start_tls_s (blpriv->ldap, NULL, NULL);
- if (LDAP_SUCCESS != ldap_error) {
- if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable;
- }
- else {
- g_message ("TLS not available (ldap_error 0x%02x)", ldap_error);
- }
- }
- else
- g_message ("TLS active");
- }
- else {
- g_warning ("user wants to use TLS, but server doesn't support LDAPv3");
- if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable;
- }
- }
- }
-
blpriv->connected = TRUE;
/* check to see if evolutionPerson is supported, if we can (me
@@ -2983,6 +2975,7 @@ pas_backend_ldap_load_uri (PASBackend *backend,
char **attributes;
int i;
int limit = 100;
+ int timeout = 60; /* 1 minute */
g_assert (bl->priv->connected == FALSE);
@@ -3008,12 +3001,12 @@ pas_backend_ldap_load_uri (PASBackend *backend,
if (value)
limit = atoi(value);
}
- else if (key_length == strlen("use_tls") && !strncmp (attributes[i], "use_tls", key_length)) {
+ else if (key_length == strlen("ssl") && !strncmp (attributes[i], "ssl", key_length)) {
if (value) {
if (!strncmp (value, "always", 6)) {
bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_ALWAYS;
}
- else if (!strncmp (value, "when-possible", 3)) {
+ else if (!strncmp (value, "whenever_possible", 3)) {
bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
}
else {
@@ -3024,6 +3017,10 @@ pas_backend_ldap_load_uri (PASBackend *backend,
bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
}
}
+ else if (key_length == strlen("timeout") && !strncmp (attributes[i], "timeout", key_length)) {
+ if (value)
+ timeout = atoi (value);
+ }
}
ldap_error = ldap_url_parse ((char*)attributes[0], &lud);
@@ -3039,6 +3036,7 @@ pas_backend_ldap_load_uri (PASBackend *backend,
bl->priv->ldap_port = LDAP_PORT;
bl->priv->ldap_rootdn = g_strdup(lud->lud_dn);
bl->priv->ldap_limit = limit;
+ bl->priv->ldap_timeout = timeout;
bl->priv->ldap_scope = lud->lud_scope;
ldap_free_urldesc(lud);
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index 2b54c5019e..75a2e2614f 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -373,13 +373,13 @@ addressbook_storage_init_source_uri (AddressbookSource *source)
g_string_sprintfa (str, "%s:%s/%s?"/*trigraph prevention*/"?%s",
source->host, source->port, source->rootdn, ldap_unparse_scope (source->scope));
- if (source->limit != 100)
- g_string_sprintfa (str, ";limit=%d", source->limit);
+ g_string_sprintfa (str, ";limit=%d", source->limit);
- if (source->ssl != ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE)
- g_string_sprintfa (str, ";ssl=%s", ldap_unparse_ssl (source->ssl));
+ g_string_sprintfa (str, ";ssl=%s", ldap_unparse_ssl (source->ssl));
- /* XXX need to do timeout info */
+#if 0
+ g_string_sprintfa (str, ";timeout=%d", source->timeout);
+#endif
source->uri = str->str;
@@ -498,6 +498,8 @@ ldap_source_foreach(AddressbookSource *source, xmlNode *root)
(xmlChar *) ldap_unparse_scope(source->scope));
xmlNewChild (source_root, NULL, (xmlChar *) "authmethod",
(xmlChar *) ldap_unparse_auth(source->auth));
+ xmlNewChild (source_root, NULL, (xmlChar *) "ssl",
+ (xmlChar *) ldap_unparse_ssl(source->ssl));
if (source->limit != 100) {
char *string;
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index edaa5cfb83..541d8096f7 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -40,9 +40,9 @@ typedef enum {
} AddressbookLDAPScopeType;
typedef enum {
- ADDRESSBOOK_LDAP_SSL_NEVER,
+ ADDRESSBOOK_LDAP_SSL_ALWAYS,
ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE,
- ADDRESSBOOK_LDAP_SSL_ALWAYS
+ ADDRESSBOOK_LDAP_SSL_NEVER
} AddressbookLDAPSSLType;
typedef struct {
diff --git a/addressbook/gui/component/ldap-config.c b/addressbook/gui/component/ldap-config.c
index 59e924c5af..c4aa08e15e 100644
--- a/addressbook/gui/component/ldap-config.c
+++ b/addressbook/gui/component/ldap-config.c
@@ -123,7 +123,7 @@ typedef struct {
GtkSignalFunc connecting_modify_func;
GtkWidget *port_combo;
GtkWidget *ssl_optionmenu;
- int ssl; /* XXX this should be AddressbookLDAPSSLType */
+ AddressbookLDAPSSLType ssl;
/* searching page fields */
GtkSignalFunc searching_modify_func;
@@ -239,6 +239,7 @@ addressbook_dialog_get_source (AddressbookSourceDialog *dialog)
source->limit = atoi(e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->limit_spinbutton)));
source->scope = dialog->scope;
source->auth = dialog->auth;
+ source->ssl = dialog->ssl;
addressbook_storage_init_source_uri (source);
@@ -260,20 +261,20 @@ addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, Addressbo
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->limit_spinbutton), string);
g_free (string);
-#if 0
dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE;
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth);
if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth - 1);
- gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_notebook), dialog->auth - 1);
+ gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1);
+ gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1);
}
+ gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
- dialog->ldap_scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->ldap_scope);
+ dialog->scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
- gtk_widget_set_sensitive (dialog->auth_optionmenu, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
- gtk_widget_set_sensitive (dialog->auth_notebook, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
-#endif
+ dialog->ssl = source ? source->auth : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), dialog->ssl);
}
static void
@@ -467,7 +468,7 @@ port_changed_func (GtkWidget *item, AddressbookSourceDialog *dialog)
dialog->connecting_modify_func (item, dialog);
if (!strcmp (string, LDAPS_PORT_STRING)) {
- dialog->ssl = 0; /* XXX SSL_ALWAYS */
+ dialog->ssl = ADDRESSBOOK_LDAP_SSL_ALWAYS;
gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu),
dialog->ssl);