summaryrefslogtreecommitdiff
path: root/pith/imap.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2019-05-07 20:47:41 -0600
committerEduardo Chappa <chappa@washington.edu>2019-05-07 20:47:41 -0600
commitfd6775283db831681f9a04b23bdb29d1e4f5f11e (patch)
tree3b39d446c139d0b51fdf0be54706331c6bbe46f2 /pith/imap.c
parent6413ad3c988016cfee16aaf4b5d3e05d71c983d9 (diff)
downloadalpine-fd6775283db831681f9a04b23bdb29d1e4f5f11e.tar.xz
* Few improvements in the password management code.
Diffstat (limited to 'pith/imap.c')
-rw-r--r--pith/imap.c11
1 files changed, 4 insertions, 7 deletions
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);