aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-08-29 16:46:38 +0800
committerChris Toshok <toshok@src.gnome.org>2002-08-29 16:46:38 +0800
commit9d673d87ab50a27f988d3916db0791a6db27402d (patch)
tree7123cc3d88e361e4c06e34e46cb316010d4fa764 /addressbook/backend
parentb882d7ff1ec8ae53bea7cc545e2d0f399f2c3486 (diff)
downloadgsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar.gz
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar.bz2
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar.lz
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar.xz
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.tar.zst
gsoc2013-evolution-9d673d87ab50a27f988d3916db0791a6db27402d.zip
return NULL if the list is empty. (pas_backend_ldap_connect): always try
2002-08-29 Chris Toshok <toshok@ximian.com> * backend/pas/pas-backend-ldap.c (category_ber): return NULL if the list is empty. (pas_backend_ldap_connect): always try to use ldapv3, not just when we want to use tls. svn path=/trunk/; revision=17916
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index dd2da25bc5..88d2ecd00c 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -613,16 +613,14 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
if (NULL != blpriv->ldap) {
int ldap_error;
- if (bl->priv->use_tls) {
- int protocol_version = LDAP_VERSION3;
- ldap_error = ldap_set_option (blpriv->ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
- if (LDAP_OPT_SUCCESS != ldap_error) {
- g_warning ("failed to set protocol version to LDAPv3");
- bl->priv->ldap_v3 = FALSE;
- }
- else
- bl->priv->ldap_v3 = TRUE;
+ int protocol_version = LDAP_VERSION3;
+ ldap_error = ldap_set_option (blpriv->ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
+ if (LDAP_OPT_SUCCESS != ldap_error) {
+ g_warning ("failed to set protocol version to LDAPv3");
+ bl->priv->ldap_v3 = FALSE;
}
+ else
+ bl->priv->ldap_v3 = TRUE;
if (bl->priv->ldap_port == LDAPS_PORT && bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
int tls_level = LDAP_OPT_X_TLS_HARD;
@@ -2254,17 +2252,20 @@ category_ber (ECardSimple *card)
"category_list", &categories,
NULL);
- result = g_new0 (struct berval*, e_list_length (categories) + 1);
+ if (e_list_length (categories) != 0) {
+ result = g_new0 (struct berval*, e_list_length (categories) + 1);
- for (iterator = e_list_get_iterator(categories), i = 0; e_iterator_is_valid (iterator); e_iterator_next (iterator), i++) {
- const char *category = e_iterator_get (iterator);
+ for (iterator = e_list_get_iterator(categories), i = 0; e_iterator_is_valid (iterator);
+ e_iterator_next (iterator), i++) {
+ const char *category = e_iterator_get (iterator);
- result[i] = g_new (struct berval, 1);
- result[i]->bv_val = g_strdup (category);
- result[i]->bv_len = strlen (category);
- }
+ result[i] = g_new (struct berval, 1);
+ result[i]->bv_val = g_strdup (category);
+ result[i]->bv_len = strlen (category);
+ }
- gtk_object_unref (GTK_OBJECT (iterator));
+ gtk_object_unref (GTK_OBJECT (iterator));
+ }
return result;
}