summaryrefslogtreecommitdiff
path: root/pith
diff options
context:
space:
mode:
Diffstat (limited to 'pith')
-rw-r--r--pith/pine.hlp2
-rw-r--r--pith/smime.c16
2 files changed, 13 insertions, 5 deletions
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 0a8e2ef7..a4f67718 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 173 2016-10-05 01:10:48
+Alpine Commit 174 2016-10-05 19:05:20
============= h_news =================
<HTML>
<HEAD>
diff --git a/pith/smime.c b/pith/smime.c
index 9ee83340..d219ba03 100644
--- a/pith/smime.c
+++ b/pith/smime.c
@@ -203,9 +203,14 @@ load_key_and_cert(char *pathkeydir, char *pathcertdir, char **keyfile,
* Ok, that should do it.
*
* return values: 0 - everything is normal
- * 1 - User could not unlock key
+ * 1 - User could not unlock key or no key in directory.
* 2 - User cancelled to create self signed certificate
- * -1 - a not normal value.
+ * -1 - we do not know which directory to use
+ * -2 - "-pwdcertdir" was given by user, but directory does not exist
+ * -3 - "DF_PASSWORD_DIR" exists but it is not a directory!!??
+ * -4 - we tried to create DF_PASSWORD_DIR but failed.
+ * -5 - password directory exists, but it is empty
+ *
*/
int
setup_pwdcert(void **pwdcert)
@@ -233,19 +238,22 @@ setup_pwdcert(void **pwdcert)
strncpy(pathdir, ps_global->pwdcertdir, sizeof(pathdir));
pathdir[sizeof(pathdir)-1] = '\0';
}
+ else rv = -2;
} else {
smime_path(DF_PASSWORD_DIR, pathdir, sizeof(pathdir));
if(our_stat(pathdir, &sbuf) == 0){
if((sbuf.st_mode & S_IFMT) == S_IFDIR)
setup_dir++;
+ else rv = -3;
} else if(can_access(pathdir, ACCESS_EXISTS) != 0
&& our_mkpath(pathdir, 0700) == 0)
setup_dir++;
+ else rv = -4;
}
if(setup_dir == 0){
was_here = 0;
- return -1;
+ return rv;
}
if(load_key_and_cert(pathdir, pathdir, &keyfile, &certfile, &pkey, &pcert) < 0){
@@ -275,7 +283,7 @@ setup_pwdcert(void **pwdcert)
*/
if(setup_certdir){ /* if we are here, pwdcertdir failed */
was_here = 0;
- return -1;
+ return -5;
}
/* look to see if there are any certificates lying around, first