From ac38a766b176bfc926377d9cc5185ab4d2722857 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 14 Dec 2019 00:14:41 -0700 Subject: * When more than one server was given in the server-name configuration option of rldap servers, none of them worked. Reported by Robert Wolf. --- pith/ldap.c | 27 +++++++++++++++++++++++---- pith/pine.hlp | 5 ++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/pith/ldap.c b/pith/ldap.c index 3c1db40..6826b13 100644 --- a/pith/ldap.c +++ b/pith/ldap.c @@ -398,7 +398,7 @@ ldap_lookup(LDAP_SERV_S *info, char *string, CUSTOM_FILT_S *cust, { char ebuf[900]; char buf[900]; - char *serv, *base, *serv_errstr; + char *serv, *base, *serv_errstr, *s, *t; char *mailattr, *snattr, *gnattr, *cnattr; int we_cancel = 0, we_turned_on = 0; LDAP_SERV_RES_S *serv_res = NULL; @@ -526,9 +526,28 @@ ldap_lookup(LDAP_SERV_S *info, char *string, CUSTOM_FILT_S *cust, } #endif /* SMIME_SSLCERTS */ - snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s://%s:%d", - info->ldaps ? "ldaps" : "ldap", serv, info->port); - tmp_20k_buf[SIZEOF_20KBUF-1] = '\0'; + tmp_20k_buf[0] = '\0'; + s = serv; + do { + if ((t = strchr(s, ' ')) != NULL) *t = '\0'; + snprintf(tmp_20k_buf + strlen(tmp_20k_buf), + SIZEOF_20KBUF - strlen(tmp_20k_buf), "%s://%s", + info->ldaps ? "ldaps" : "ldap", s); + if (strchr(s, ':') == NULL){ + snprintf(tmp_20k_buf + strlen(tmp_20k_buf), + SIZEOF_20KBUF - strlen(tmp_20k_buf), + "%s%d", ":", info->port); + } + if(t != NULL){ + *t = ' '; + for( ; *t == ' '; t++); + snprintf(tmp_20k_buf + strlen(tmp_20k_buf), + SIZEOF_20KBUF - strlen(tmp_20k_buf), "%s", " "); + } + s = t; + } while (s != NULL); + + tmp_20k_buf[SIZEOF_20KBUF - 1] = '\0'; if(ldap_initialize(&ld, tmp_20k_buf) != LDAP_SUCCESS) #endif diff --git a/pith/pine.hlp b/pith/pine.hlp index 9a4ab92..4945e4b 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 378 2019-11-25 11:08:40 +Alpine Commit 379 2019-12-14 00:14:37 ============= h_news ================= @@ -353,6 +353,9 @@ Bugs that have been addressed include:
  • Alpine crashes when opening a remote imap folder and computing scores. Reported by Paul DeStefano. + +
  • When more than one server was given in the server-name configuration + option of rldap servers, none of them worked. Reported by Robert Wolf.

    -- cgit v1.2.3-54-g00ecf