summaryrefslogtreecommitdiff
path: root/alpine/imap.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2022-05-30 15:31:53 -0600
committerEduardo Chappa <chappa@washington.edu>2022-05-30 15:31:53 -0600
commit6b87c9de3ab319846baa303544084a76254d55f5 (patch)
tree248714e2faaa82b2b7b040ec0388be620cf20f93 /alpine/imap.c
parent8d79159bae5cd24020ca37de062575c5fd6682f4 (diff)
downloadalpine-6b87c9de3ab319846baa303544084a76254d55f5.tar.xz
* All unix (non mac) versions of Alpine will have a default password file which
will be created by default when Alpine is compiled with encryption. The default name will be .alpine.pwd, but it can be overriden with the --with-passfile option or by a default set by a linux distribution.
Diffstat (limited to 'alpine/imap.c')
-rw-r--r--alpine/imap.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index 460908ba..34905c79 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -3591,7 +3591,7 @@ read_passfile(pinerc, l)
#else /* PASSFILE */
char tmp[MAILTMPLEN], *ui[5];
- int i, j, n, rv = 0;
+ int i, j, n, rv = 0, error = 0;
size_t len = 0;
char *tmptext = NULL;
struct stat sbuf;
@@ -3607,11 +3607,28 @@ read_passfile(pinerc, l)
dprint((9, "read_passfile\n"));
- /* if there's no password to read, bag it!! */
+ /* if there's no password to read, create it if we can encrypt it,
+ * or else let the user create it and bail out of here.
+ */
+ tmp[0] = '\0';
if(!passfile_name(pinerc, tmp, sizeof(tmp)) || !(fp = our_fopen(tmp, "rb"))){
+#ifdef SMIME
+ i = our_creat(tmp, 0600);
+ if(i >= 0){
+ close(i);
+ if(!(fp = our_fopen(tmp, "rb")))
+ error++;
+ }
+ else error++;
+#else
+ error++;
+#endif
+ };
+
+ if(error){
using_passfile = 0;
return(using_passfile);
- };
+ }
#ifndef SMIME
if(our_stat(tmp, &sbuf) == 0)