summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-07-24 22:13:59 -0600
committerEduardo Chappa <chappa@washington.edu>2015-07-24 22:13:59 -0600
commit9306e227fc7b1b096d4a58f8c06da66603a50a6a (patch)
tree0f4089b0487bb8d6514fcfb79fdd352ebcd527a9 /web
parent28063ac494a640111f4483e85f968ee45b4213de (diff)
downloadalpine-9306e227fc7b1b096d4a58f8c06da66603a50a6a.tar.xz
* new version 2.20.9.
* Add command line argument -smimedir, which allows to specify the default path for a directory that contains the public, private, and ca directories. This is useful in case a user has a backup of old certificates that cannot be installed in the ~/.alpine-smime dir. * Update to alpine man page to include documentation on missing command line options such as -nowrite_password_cache, -passfile, -pwdcertdir, and -smimedir. * Various changes in the code to quell some compiler issued warnings in Mac OSX. Reported by Joe St Sauver. This includes the removing deprecated ldap functions from the code and the test in the configure script. The switch to not deprecated functions is done by the use of the belvar structure, which is not completely appropriate for what we are doing, but it is sufficient for our needs. The berval structure is more appropriate for binary data, but it works well with string data, which is what we need. * Various changes in the code to quell some warnings issued by clang 3.5.
Diffstat (limited to 'web')
-rw-r--r--web/src/alpined.d/alpined.c43
-rw-r--r--web/src/alpined.d/ldap.c61
-rw-r--r--web/src/alpined.d/ldap.h5
3 files changed, 57 insertions, 52 deletions
diff --git a/web/src/alpined.d/alpined.c b/web/src/alpined.d/alpined.c
index f75f03da..6936de9d 100644
--- a/web/src/alpined.d/alpined.c
+++ b/web/src/alpined.d/alpined.c
@@ -450,7 +450,7 @@ char **sml_getmsgs(void);
void sml_seen(void);
#ifdef ENABLE_LDAP
int peLdapQueryResults(Tcl_Interp *);
-int peLdapStrlist(Tcl_Interp *, Tcl_Obj *, char **);
+int peLdapStrlist(Tcl_Interp *, Tcl_Obj *, struct berval **);
int init_ldap_pname(struct pine *);
#endif /* ENABLE_LDAP */
char *strqchr(char *, int, int *, int);
@@ -10815,7 +10815,7 @@ peLoadConfig(struct pine *pine_state)
peInitVars(pine_state);
- if(s = peAuthException())
+ if((s = peAuthException()) != NULL)
return(s);
else if(ps_global->c_client_error[0])
return(ps_global->c_client_error);
@@ -11763,7 +11763,7 @@ peDoPost(METAENV *metaenv, BODY *body, char *fcc, CONTEXT_S **fcc_cntxtp, char *
if((recipients = (metaenv->env->to || metaenv->env->cc || metaenv->env->bcc))
&& call_mailer(metaenv, body, NULL, 0, NULL, NULL) < 0){
- if(s = peAuthException()){
+ if((s = peAuthException()) != NULL){
strcpy(errp, s);
}
else if(ps_global->last_error[0]){
@@ -12396,7 +12396,7 @@ peMsgCollector(Tcl_Interp *interp,
priority = "Lowest";
if(priority){
- if(pf = set_priority_header(md.metaenv, priority))
+ if((pf = set_priority_header(md.metaenv, priority)) != NULL)
pf->text = &pf->textbuf;
}
}
@@ -15209,7 +15209,8 @@ PELdapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST ob
* {"dn" {{attrib {val, ...}}, ...}}
*/
char *whichrec = Tcl_GetStringFromObj(objv[3], NULL);
- char *tmpstr, *tmp, *tmp2, **vals, *a;
+ char *tmpstr, *tmp, *tmp2, *a;
+ struct berval **vals;
WPLDAPRES_S *curres;
LDAP_CHOOSE_S *winning_e = NULL;
LDAP_SERV_RES_S *trl;
@@ -15280,14 +15281,14 @@ PELdapCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST ob
winning_e->info_used), -1)) != TCL_OK)
return(TCL_ERROR);
resObj = Tcl_NewListObj(0, NULL);
- vals = ldap_get_values(winning_e->ld, winning_e->selected_entry, a);
+ vals = ldap_get_values_len(winning_e->ld, winning_e->selected_entry, a);
if(vals){
for(i = 0; vals[i]; i++){
if(Tcl_ListObjAppendElement(interp, resObj,
- Tcl_NewStringObj(vals[i], -1)) != TCL_OK)
+ Tcl_NewStringObj(vals[i]->bv_val, -1)) != TCL_OK)
return(TCL_ERROR);
}
- ldap_value_free(vals);
+ ldap_value_free_len(vals);
if(Tcl_ListObjAppendElement(interp, secObj, resObj) != TCL_OK)
return(TCL_ERROR);
}
@@ -15517,7 +15518,7 @@ peLdapQueryResults(Tcl_Interp *interp)
e != NULL;
e = ldap_next_entry(trl->ld, e)){
char *dn;
- char **cn, **org, **unit, **title, **mail, **sn;
+ struct berval **cn, **org, **unit, **title, **mail, **sn;
dn = NULL;
cn = org = title = unit = mail = sn = NULL;
@@ -15527,15 +15528,15 @@ peLdapQueryResults(Tcl_Interp *interp)
&mail, &sn);
if(cn){
if(Tcl_ListObjAppendElement(interp, itemObj,
- Tcl_NewStringObj(cn[0], -1)) != TCL_OK)
+ Tcl_NewStringObj(cn[0]->bv_val, -1)) != TCL_OK)
return(TCL_ERROR);
- ldap_value_free(cn);
+ ldap_value_free_len(cn);
}
else if(sn){
if(Tcl_ListObjAppendElement(interp, itemObj,
- Tcl_NewStringObj(sn[0], -1)) != TCL_OK)
+ Tcl_NewStringObj(sn[0]->bv_val, -1)) != TCL_OK)
return(TCL_ERROR);
- ldap_value_free(sn);
+ ldap_value_free_len(sn);
}
else{
dn = ldap_get_dn(trl->ld, e);
@@ -15563,13 +15564,13 @@ peLdapQueryResults(Tcl_Interp *interp)
if(Tcl_ListObjAppendElement(interp, resObj, itemObj) != TCL_OK)
return(TCL_ERROR);
if(title)
- ldap_value_free(title);
+ ldap_value_free_len(title);
if(unit)
- ldap_value_free(unit);
+ ldap_value_free_len(unit);
if(org)
- ldap_value_free(org);
+ ldap_value_free_len(org);
if(mail)
- ldap_value_free(mail);
+ ldap_value_free_len(mail);
}
}
if(Tcl_ListObjAppendElement(interp, secObj, resObj) != TCL_OK)
@@ -15582,16 +15583,16 @@ peLdapQueryResults(Tcl_Interp *interp)
}
int
-peLdapStrlist(Tcl_Interp *interp, Tcl_Obj *itemObj, char **strl)
+peLdapStrlist(Tcl_Interp *interp, Tcl_Obj *itemObj, struct berval **strl)
{
Tcl_Obj *strlObj;
int i;
strlObj = Tcl_NewListObj(0, NULL);
if(strl){
- for(i = 0; strl[i] && strl[i][0]; i++){
+ for(i = 0; ALPINE_LDAP_usable(strl, i); i++){
if(Tcl_ListObjAppendElement(interp, strlObj,
- Tcl_NewStringObj(strl[i], -1)) != TCL_OK)
+ Tcl_NewStringObj(strl[i]->bv_val, -1)) != TCL_OK)
return(TCL_ERROR);
}
}
@@ -16265,7 +16266,7 @@ peRssFetch(Tcl_Interp *interp, char *link)
so_puts(feed_so, p);
}
else{ /* in header, grok fields */
- if(q = strchr(p,':')){
+ if((q = strchr(p,':')) != NULL){
int l = q - p;
*q++ = '\0';
diff --git a/web/src/alpined.d/ldap.c b/web/src/alpined.d/ldap.c
index 3e6bf99f..4107b375 100644
--- a/web/src/alpined.d/ldap.c
+++ b/web/src/alpined.d/ldap.c
@@ -40,7 +40,8 @@ ldap_addr_select(ps, ac, result, style, wp_err, srchstr)
{
LDAP_SERV_RES_S *res_list, *tmp_rl;
LDAPMessage *e, *tmp_e;
- char **mail = NULL, *a;
+ struct berval **mail = NULL;
+ char *a;
int got_n_entries = 0, retval = -5;
BerElement *ber;
@@ -59,11 +60,11 @@ ldap_addr_select(ps, ac, result, style, wp_err, srchstr)
a != NULL;
a = ldap_next_attribute(tmp_rl->ld, tmp_e, ber)){
if(strcmp(a, tmp_rl->info_used->mailattr) == 0){
- mail = ldap_get_values(tmp_rl->ld, tmp_e, a);
+ mail = ldap_get_values_len(tmp_rl->ld, tmp_e, a);
break;
}
}
- if(mail && mail[0] && mail[0][0]){
+ if(ALPINE_LDAP_can_use(mail)){
retval = 0;
if(result){
(*result) =
@@ -91,7 +92,8 @@ peLdapPname(mailbox, host)
char *host;
{
char *retstr = NULL;
- char adrstr[1024], **cn;
+ char adrstr[1024];
+ struct berval **cn = NULL;
int ecnt;
CUSTOM_FILT_S *filter;
WP_ERR_S wp_err;
@@ -125,8 +127,8 @@ peLdapPname(mailbox, host)
peLdapEntryParse(trl, e, &cn, NULL, NULL, NULL,
NULL, NULL);
if(cn){
- retstr = cpystr(cn[0]);
- ldap_value_free(cn);
+ retstr = cpystr(cn[0]->bv_val);
+ ldap_value_free_len(cn);
}
}
}
@@ -138,14 +140,15 @@ peLdapEntryParse(trl, e, ret_cn, ret_org, ret_unit,
ret_title, ret_mail, ret_sn)
LDAP_SERV_RES_S *trl;
LDAPMessage *e;
- char ***ret_cn;
- char ***ret_org;
- char ***ret_unit;
- char ***ret_title;
- char ***ret_mail;
- char ***ret_sn;
+ struct berval ***ret_cn;
+ struct berval ***ret_org;
+ struct berval ***ret_unit;
+ struct berval ***ret_title;
+ struct berval ***ret_mail;
+ struct berval ***ret_sn;
{
- char *a, **cn, **org, **unit, **title, **mail, **sn;
+ char *a;
+ struct berval **cn, **org, **unit, **title, **mail, **sn;
BerElement *ber;
cn = org = title = unit = mail = sn = NULL;
@@ -156,28 +159,28 @@ peLdapEntryParse(trl, e, ret_cn, ret_org, ret_unit,
dprint((9, " %s", a));
if(strcmp(a, trl->info_used->cnattr) == 0){
if(!cn)
- cn = ldap_get_values(trl->ld, e, a);
+ cn = ldap_get_values_len(trl->ld, e, a);
- if(cn && !(cn[0] && cn[0][0])){
- ldap_value_free(cn);
+ if(cn && !ALPINE_LDAP_can_use(cn)){
+ ldap_value_free_len(cn);
cn = NULL;
}
}
else if(strcmp(a, trl->info_used->mailattr) == 0){
if(!mail)
- mail = ldap_get_values(trl->ld, e, a);
+ mail = ldap_get_values_len(trl->ld, e, a);
}
else if(strcmp(a, "o") == 0){
if(!org)
- org = ldap_get_values(trl->ld, e, a);
+ org = ldap_get_values_len(trl->ld, e, a);
}
else if(strcmp(a, "ou") == 0){
if(!unit)
- unit = ldap_get_values(trl->ld, e, a);
+ unit = ldap_get_values_len(trl->ld, e, a);
}
else if(strcmp(a, "title") == 0){
if(!title)
- title = ldap_get_values(trl->ld, e, a);
+ title = ldap_get_values_len(trl->ld, e, a);
}
our_ldap_memfree(a);
@@ -190,10 +193,10 @@ peLdapEntryParse(trl, e, ret_cn, ret_org, ret_unit,
if(strcmp(a, trl->info_used->snattr) == 0){
if(!sn)
- sn = ldap_get_values(trl->ld, e, a);
+ sn = ldap_get_values_len(trl->ld, e, a);
- if(sn && !(sn[0] && sn[0][0])){
- ldap_value_free(sn);
+ if(sn && !ALPINE_LDAP_can_use(sn)){
+ ldap_value_free_len(sn);
sn = NULL;
}
}
@@ -202,22 +205,22 @@ peLdapEntryParse(trl, e, ret_cn, ret_org, ret_unit,
}
if(ret_cn)
(*ret_cn) = cn;
- else if(cn) ldap_value_free(cn);
+ else if(cn) ldap_value_free_len(cn);
if(ret_org)
(*ret_org) = org;
- else if(org) ldap_value_free(org);
+ else if(org) ldap_value_free_len(org);
if(ret_unit)
(*ret_unit) = unit;
- else if(unit) ldap_value_free(unit);
+ else if(unit) ldap_value_free_len(unit);
if(ret_title)
(*ret_title) = title;
- else if(title) ldap_value_free(title);
+ else if(title) ldap_value_free_len(title);
if(ret_mail)
(*ret_mail) = mail;
- else if(mail) ldap_value_free(mail);
+ else if(mail) ldap_value_free_len(mail);
if(ret_sn)
(*ret_sn) = sn;
- else if(sn) ldap_value_free(sn);
+ else if(sn) ldap_value_free_len(sn);
return 0;
}
diff --git a/web/src/alpined.d/ldap.h b/web/src/alpined.d/ldap.h
index 2ada2908..6084c7c2 100644
--- a/web/src/alpined.d/ldap.h
+++ b/web/src/alpined.d/ldap.h
@@ -39,8 +39,9 @@ extern WPLDAP_S *wpldap_global;
char *peLdapPname(char *, char *);
int peLdapEntryParse(LDAP_SERV_RES_S *, LDAPMessage *,
- char ***, char ***, char ***, char ***,
- char ***, char ***);
+ struct berval ***, struct berval ***,
+ struct berval ***, struct berval ***,
+ struct berval ***, struct berval ***);
WPLDAPRES_S *free_wpldapres(WPLDAPRES_S *);
#endif /* ENABLE_LDAP */