summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alpine/imap.c30
-rw-r--r--pith/imap.c11
-rw-r--r--pith/pine.hlp2
3 files changed, 16 insertions, 27 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index c6da3e61..f4bf3965 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -856,11 +856,6 @@ mm_login_work(NETMBX *mb, char *user, char **pwd, long int trial,
altuserforcache ? altuserforcache : ""));
q_line = -(ps_global->ttyo ? ps_global->ttyo->footer_rows : 3);
- if(pwd && *pwd){
- char *s = *pwd;
- fs_give((void **) &s);
- *pwd = NULL;
- }
save_in_init = ps_global->in_init_seq;
ps_global->in_init_seq = 0;
ps_global->no_newmail_check_from_optionally_enter = 1;
@@ -2851,9 +2846,10 @@ read_passfile(pinerc, l)
char tmp[MAILTMPLEN], *ui[5];
int i, j, n, rv = 0;
size_t len;
+ char *tmptext = NULL;
#ifdef SMIME
char tmp2[MAILTMPLEN];
- char *tmptext, *text = NULL, *text2 = NULL;
+ char *text = NULL, *text2 = NULL;
int encrypted = 0;
#endif /* SMIME */
FILE *fp;
@@ -2971,12 +2967,13 @@ read_passfile(pinerc, l)
return using_passfile;
}
- tmptext = fs_get(len + 1);
+ if(len > 0){
+ tmptext = fs_get(len + 1);
#ifdef SMIME
- for(n = 0; len > 0 && (encrypted ? line_get(tmptext, len + 1, &text2)
- : (fgets(tmptext, len+1, fp) != NULL)); n++){
+ for(n = 0; encrypted ? line_get(tmptext, len + 1, &text2)
+ : (fgets(tmptext, len+1, fp) != NULL); n++){
#else /* SMIME */
- for(n = 0; fgets(tmptext, len+1, fp); n++){
+ for(n = 0; fgets(tmptext, len+1, fp); n++){
#endif /* SMIME */
/*** do any necessary DEcryption here ***/
xlate_key = n;
@@ -3014,6 +3011,7 @@ read_passfile(pinerc, l)
imap_set_passwd(l, ui[0], ui[1], hostlist, flags & 0x01, 0, 0);
}
+ }
}
if (tmptext) fs_give((void **) &tmptext);
@@ -3202,15 +3200,9 @@ write_passfile(pinerc, l)
tmp[i] = xlate_in(tmp[i]);
#ifdef SMIME
- if(len == 0){
- len = strlen(tmp) + 1;
- text = fs_get(len*sizeof(char));
- *text = '\0';
- }
- if(strlen(text) + strlen(tmp) > len){
- len = strlen(text) + strlen(tmp) + 1;
- fs_resize((void **)&text, len*sizeof(char));
- }
+ fs_resize((void **)&text, (len + strlen(tmp) + 1)*sizeof(char));
+ text[len] = '\0';
+ len += strlen(tmp) + 1;
strncat(text, tmp, strlen(tmp));
#else /* SMIME */
fputs(tmp, fp);
diff --git a/pith/imap.c b/pith/imap.c
index f9e5162f..42513123 100644
--- a/pith/imap.c
+++ b/pith/imap.c
@@ -4,7 +4,7 @@ static char rcsid[] = "$Id: imap.c 1142 2008-08-13 17:22:21Z hubert@u.washington
/*
* ========================================================================
- * Copyright 2013-2018 Eduardo Chappa
+ * Copyright 2013-2019 Eduardo Chappa
* Copyright 2006-2008 University of Washington
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1007,10 +1007,8 @@ imap_get_passwd_auth(MMLOGIN_S *m_list, char **passwd, char *user, STRLIST_S *ho
&& l->user[len] == PWDAUTHSEP))
&& !strcmp(user, l->user + len + offset)
&& l->altflag == altflag){
- if(passwd){
- fs_resize((void **) passwd, strlen(l->passwd + len + offset) + 1);
- strcpy(*passwd, l->passwd + len + offset);
- }
+ if(passwd)
+ *passwd = cpystr(l->passwd + len + offset);
dprint((9, "imap_get_passwd: match\n"));
dprint((10, "imap_get_passwd: trying passwd=\"%s\"\n",
passwd && *passwd ? *passwd : "?"));
@@ -1062,8 +1060,7 @@ imap_set_passwd_auth(MMLOGIN_S **l, char *passwd, char *user, STRLIST_S *hostlis
}
len = strlen(passwd);
- if(!(*l)->passwd || strlen((*l)->passwd) < len + authlen + offset)
- (*l)->passwd = ps_get(len + authlen + offset + 1);
+ (*l)->passwd = ps_get(len + authlen + offset + 1);
if(authtype)
sprintf((*l)->passwd, "%s%c%s", authtype, PWDAUTHSEP, passwd);
diff --git a/pith/pine.hlp b/pith/pine.hlp
index a9699582..4cf8c611 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 337 2019-05-05 11:58:07
+Alpine Commit 338 2019-05-07 20:47:22
============= h_news =================
<HTML>
<HEAD>