summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alpine/adrbkcmd.c18
-rw-r--r--imap/src/c-client/oauth2_aux.c10
-rw-r--r--imap/src/osdep/nt/ssl_libressl.c2
-rw-r--r--imap/src/osdep/unix/ssl_unix.c2
-rw-r--r--pith/ldap.c23
-rw-r--r--pith/osdep/creatdir.c2
-rw-r--r--pith/pine.hlp13
-rw-r--r--pith/send.c4
-rwxr-xr-xweb/cgi/alpine/1.0/ldapentry.tcl18
-rw-r--r--web/src/alpined.d/alpined.c26
10 files changed, 86 insertions, 32 deletions
diff --git a/alpine/adrbkcmd.c b/alpine/adrbkcmd.c
index c3472acc..b511b88c 100644
--- a/alpine/adrbkcmd.c
+++ b/alpine/adrbkcmd.c
@@ -7310,7 +7310,23 @@ prep_ldap_for_viewing(struct pine *ps, LDAP_CHOOSE_S *winning_e, SourceType srct
}
}
else{
- snprintf(obuf, sizeof(obuf), "%s", vals[i]->bv_val);
+ int is_binary = 0;
+ char *tmp2;
+
+ for(tmp = strchr(a, ';'); tmp != NULL; tmp = tmp2){
+ tmp2 = strchr(++tmp, ';');
+ if(tmp2)
+ *tmp2 = '\0';
+ is_binary = !strucmp(tmp, "binary");
+ if(tmp2)
+ *tmp2 = ';';
+ if(is_binary)
+ break;
+ }
+
+ snprintf(obuf, sizeof(obuf), "%s", (is_binary &&
+ vals[i]->bv_val && vals[i]->bv_val[0] != '\0') ?
+ _("[ Binary Data ]") : vals[i]->bv_val);
obuf[sizeof(obuf)-1] = '\0';
if((tmp = fold(obuf, width, width,
diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c
index d2ad6ce6..a0828ba4 100644
--- a/imap/src/c-client/oauth2_aux.c
+++ b/imap/src/c-client/oauth2_aux.c
@@ -34,19 +34,19 @@ char *oauth2_generate_state(void)
rv[0] = '\0';
for(i = 0; i < 4; i++)
- sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256));
+ sprintf(rv + strlen(rv), "%02x", (unsigned int) (random() % 256));
sprintf(rv + strlen(rv), "%c", '-');
for(i = 0; i < 2; i++)
- sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256));
+ sprintf(rv + strlen(rv), "%02x", (unsigned int) (random() % 256));
sprintf(rv + strlen(rv), "%c", '-');
for(i = 0; i < 2; i++)
- sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256));
+ sprintf(rv + strlen(rv), "%02x", (unsigned int) (random() % 256));
sprintf(rv + strlen(rv), "%c", '-');
for(i = 0; i < 2; i++)
- sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256));
+ sprintf(rv + strlen(rv), "%02x", (unsigned int) (random() % 256));
sprintf(rv + strlen(rv), "%c", '-');
for(i = 0; i < 6; i++)
- sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256));
+ sprintf(rv + strlen(rv), "%02x", (unsigned int) (random() % 256));
rv[36] = '\0';
return cpystr(rv);
}
diff --git a/imap/src/osdep/nt/ssl_libressl.c b/imap/src/osdep/nt/ssl_libressl.c
index 04dfb36e..da466821 100644
--- a/imap/src/osdep/nt/ssl_libressl.c
+++ b/imap/src/osdep/nt/ssl_libressl.c
@@ -518,7 +518,7 @@ static char *ssl_validate_cert (X509 *cert,char *host)
ret = "No name in certificate";
else if ((s = strstr (cert->name,"/CN=")) != NIL) {
m++; /* count that we tried this method */
- if (t = strchr (s += 4,'/')) *t = '\0';
+ if ((t = strchr (s += 4,'/')) != NIL) *t = '\0';
/* host name matches pattern? */
ret = ssl_compare_hostnames (host,s) ? NIL :
"Server name does not match certificate";
diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c
index e9243769..601888ec 100644
--- a/imap/src/osdep/unix/ssl_unix.c
+++ b/imap/src/osdep/unix/ssl_unix.c
@@ -535,7 +535,7 @@ static char *ssl_validate_cert (X509 *cert,char *host)
ret = "No name in certificate";
else if ((s = strstr (cert->name,"/CN=")) != NIL) {
m++; /* count that we tried this method */
- if (t = strchr (s += 4,'/')) *t = '\0';
+ if ((t = strchr (s += 4,'/')) != NIL) *t = '\0';
/* host name matches pattern? */
ret = ssl_compare_hostnames (host,s) ? NIL :
"Server name does not match certificate";
diff --git a/pith/ldap.c b/pith/ldap.c
index c2f2a78c..6ec46c1c 100644
--- a/pith/ldap.c
+++ b/pith/ldap.c
@@ -1903,26 +1903,32 @@ static struct tl_table ldap_trans_table[]={
{"officePhone", N_("Office Telephone")},
{"facsimileTelephoneNumber", N_("FAX Telephone")},
{"mobile", N_("Mobile Telephone")},
+ {"voiceMailTelephoneNumber", N_("Voice Mail")},
{"pager", N_("Pager")},
{"roomNumber", N_("Room Number")},
{"uid", N_("User ID")},
+ {"userCertificate", N_("User Certificate")},
{NULL, NULL}
};
char *
ldap_translate(char *a, LDAP_SERV_S *info_used)
{
+ char *s, *ret_a = a;
int i;
+ if((s = strchr(a, ';')) != NULL)
+ *s = '\0';
+
if(info_used){
if(info_used->mailattr && strucmp(info_used->mailattr, a) == 0)
- return(_(ldap_trans_table[LDAP_MAIL_ATTR].translated));
+ ret_a = _(ldap_trans_table[LDAP_MAIL_ATTR].translated);
else if(info_used->snattr && strucmp(info_used->snattr, a) == 0)
- return(_(ldap_trans_table[LDAP_SN_ATTR].translated));
+ ret_a = _(ldap_trans_table[LDAP_SN_ATTR].translated);
else if(info_used->gnattr && strucmp(info_used->gnattr, a) == 0)
- return(_(ldap_trans_table[LDAP_GN_ATTR].translated));
+ ret_a = _(ldap_trans_table[LDAP_GN_ATTR].translated);
else if(info_used->cnattr && strucmp(info_used->cnattr, a) == 0)
- return(_(ldap_trans_table[LDAP_CN_ATTR].translated));
+ ret_a = _(ldap_trans_table[LDAP_CN_ATTR].translated);
}
for(i = 0; ldap_trans_table[i].ldap_ese; i++){
@@ -1937,10 +1943,13 @@ ldap_translate(char *a, LDAP_SERV_S *info_used)
}
if(strucmp(ldap_trans_table[i].ldap_ese, a) == 0)
- return(_(ldap_trans_table[i].translated));
+ ret_a = _(ldap_trans_table[i].translated);
}
-
- return(a);
+
+ if(s)
+ *s = ';';
+
+ return ret_a;
}
char **
diff --git a/pith/osdep/creatdir.c b/pith/osdep/creatdir.c
index 1c3a115e..ac97ac38 100644
--- a/pith/osdep/creatdir.c
+++ b/pith/osdep/creatdir.c
@@ -89,7 +89,7 @@ create_random_dir(char *dir, size_t len)
{ int i;
char *s = &dir[strlen(dir) - 6];
for(i = 0; i < 10; i++){
- sprintf(s, "%x%x%x", (unsigned int)(random() % 256), (unsigned int)(random() % 256),
+ sprintf(s, "%02x%02x%02x", (unsigned int)(random() % 256), (unsigned int)(random() % 256),
(unsigned int)(random() % 256));
if(our_mkdir(dir, 0700) == 0) return dir;
}
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 48db2823..85797ab8 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 608 2021-10-24 13:59:38
+Alpine Commit 609 2021-10-27 21:07:40
============= h_news =================
<HTML>
<HEAD>
@@ -198,6 +198,15 @@ new additions to Alpine, please check it periodically.
must contain a draft message. This joint collaboration with Thomas
Uhle modifies alpine to not to attempt to continue a draft message if
the draft folder is empty.
+
+<LI> Contributions by Thomas Uhle:
+<UL>
+ <LI> Add support to the LDAP attribute "userCertificate";
+ <LI> Move voiceMailTelephoneNumber from the TCL side to ldap_translate;
+ <LI> XOAUTH2 state generator changes format specifier from %x to %02x;
+ <LI> Web Alpine will not attempt to continue a postponed message if the
+ postponed-msgs folder is empty.
+</UL>
</UL>
<P>
@@ -15988,7 +15997,7 @@ If an address doesn't look like a fully-qualified address, it will be looked
up in your address books, and if it doesn't match a nickname there, then it
will be looked up on the LDAP servers that have this feature set.
The lookups will also be done when using the address completion feature
-(TAB command) in the composer if any of the serves have this feature set.
+(TAB command) in the composer if any of the servers have this feature set.
Also see the LDAP feature
<A HREF="h_config_ldap_opts_rhs">&quot;Lookup-Addrbook-Contents&quot;</A>
and the Setup/Config feature
diff --git a/pith/send.c b/pith/send.c
index e4948ab9..64783374 100644
--- a/pith/send.c
+++ b/pith/send.c
@@ -5605,10 +5605,10 @@ post_handoff(METAENV *header, struct mail_bodystruct *body, char *errbuf,
char *s;
char tmp[200];
- if(s = strstr(header->env->date," (")) /* fix the date format for news */
+ if((s = strstr(header->env->date," (")) != NULL) /* fix the date format for news */
*s = '\0';
- if(err = mta_parse_post(header, body, SENDNEWS, errbuf, errbuflen, bigresult_f, pipecb_f)){
+ if((err = mta_parse_post(header, body, SENDNEWS, errbuf, errbuflen, bigresult_f, pipecb_f))){
strncpy(tmp, err, sizeof(tmp)-1);
tmp[sizeof(tmp)-1] = '\0';
snprintf(err = errbuf, errbuflen, _("News not posted: \"%s\": %s"),
diff --git a/web/cgi/alpine/1.0/ldapentry.tcl b/web/cgi/alpine/1.0/ldapentry.tcl
index a483f165..a66d7deb 100755
--- a/web/cgi/alpine/1.0/ldapentry.tcl
+++ b/web/cgi/alpine/1.0/ldapentry.tcl
@@ -216,9 +216,6 @@ WPEval $ldap_vars {
name {
continue;
}
- voicemailtelephonenumber {
- set fieldname "Voice Mail"
- }
"email address" {
set do_email 1
set fieldname [lindex $item 0]
@@ -232,12 +229,15 @@ WPEval $ldap_vars {
}
}
- set itematt ""
+ set vals [list ""]
if {[llength $item] > 2} {
set itematt [lindex $item 2]
- }
- if {$itematt == "objectclass"} {
set vals [lindex $item 1]
+ } else {
+ set itematt [lindex $item 1]
+ }
+
+ if {[lsearch -exact $itematt "objectclass"] >= 0} {
continue
}
@@ -249,8 +249,6 @@ WPEval $ldap_vars {
set bgwhite 1
}
- set vals [lindex $item 1]
-
cgi_table_row bgcolor=$bgcolor {
cgi_table_data width=25% nowrap valign=top rowspan=[llength $vals] {
cgi_division "style=\"padding-top:2\"" {
@@ -276,6 +274,8 @@ WPEval $ldap_vars {
unset do_fax
} elseif {[info exists do_email]} {
cgi_puts [cgi_url [cgi_font size=-1 face=courier [lindex $vals 0]] compose.tcl?ldap=1&dir=${dir}&qn=${qn}&si=${si}&ni=${ni}&ei=0&cid=[WPCmd PEInfo key]&oncancel=addrbook]
+ } elseif {[lsearch -exact -nocase $itematt "binary"] >= 0} {
+ cgi_puts "[ Binary Data ]"
} else {
cgi_puts [lindex $vals 0]
}
@@ -291,6 +291,8 @@ WPEval $ldap_vars {
cgi_table_data height=20px {
if {[info exists do_email]} {
cgi_puts [cgi_url [cgi_font size=-1 face=courier $extra] compose.tcl?ldap=1&dir=${dir}&qn=${qn}&si=${si}&ni=${ni}&ei=[incr ei]&cid=[WPCmd PEInfo key]&oncancel=addrbook]
+ } elseif {[lsearch -exact -nocase $itematt "binary"] >= 0} {
+ cgi_puts "[ Binary Data ]"
} else {
cgi_puts $extra
}
diff --git a/web/src/alpined.d/alpined.c b/web/src/alpined.d/alpined.c
index ad05aa9a..4c6f1e56 100644
--- a/web/src/alpined.d/alpined.c
+++ b/web/src/alpined.d/alpined.c
@@ -12040,7 +12040,7 @@ PEPostponeCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONS
if(!strcmp(s1, "any")){
MAILSTREAM *stream;
- if(postponed_stream(&stream, wps_global->VAR_POSTPONED_FOLDER, "Postponed", 0) && stream){
+ if(postponed_stream(&stream, wps_global->VAR_POSTPONED_FOLDER, "Postponed", 1) && stream){
Tcl_SetResult(interp, "1", TCL_STATIC);
if(stream != wps_global->mail_stream)
@@ -12109,6 +12109,8 @@ PEPostponeCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONS
if(stream != wps_global->mail_stream)
pine_mail_close(stream);
}
+ else
+ Tcl_SetResult(interp, "", TCL_STATIC);
return(TCL_OK);
}
@@ -15217,7 +15219,7 @@ PELdapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST ob
if(!strcmp(s1, "ldapext")){
/*
* Returns a list of the form:
- * {"dn" {{attrib {val, ...}}, ...}}
+ * {"dn" {{attrib {val, ...} {opt, ...}}, ...}}
*/
char *whichrec = Tcl_GetStringFromObj(objv[3], NULL);
char *tmpstr, *tmp, *tmp2, *a;
@@ -15302,12 +15304,28 @@ PELdapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST ob
ldap_value_free_len(vals);
if(Tcl_ListObjAppendElement(interp, secObj, resObj) != TCL_OK)
return(TCL_ERROR);
+ resObj = Tcl_NewListObj(0, NULL);
}
- if(!strcmp(a,"objectclass")){
- if(Tcl_ListObjAppendElement(interp, secObj,
+ if(!strucmp(a, "objectclass")){
+ if(Tcl_ListObjAppendElement(interp, resObj,
Tcl_NewStringObj("objectclass", -1)) != TCL_OK)
return(TCL_ERROR);
}
+ for(tmp = strchr(a, ';'); tmp != NULL; tmp = tmp2){
+ int retval;
+
+ tmp2 = strchr(++tmp, ';');
+ if(tmp2)
+ *tmp2 = '\0';
+ retval = Tcl_ListObjAppendElement(interp, resObj,
+ Tcl_NewStringObj(tmp, -1));
+ if(tmp2)
+ *tmp2 = ';';
+ if(retval != TCL_OK)
+ return(TCL_ERROR);
+ }
+ if(Tcl_ListObjAppendElement(interp, secObj, resObj) != TCL_OK)
+ return(TCL_ERROR);
if(Tcl_ListObjAppendElement(interp, itemObj, secObj) != TCL_OK)
return(TCL_ERROR);
}