summaryrefslogtreecommitdiff
path: root/pith/smime.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-09-18 22:17:44 -0600
committerEduardo Chappa <chappa@washington.edu>2015-09-18 22:17:44 -0600
commita5bec83c5704f49844a9232d16aab0b2b9bf633e (patch)
treedab972df7886336e6e9984e77308403c4155c468 /pith/smime.c
parent6bcba429b8feb23fa3de2ee8d77bfa80785676ed (diff)
downloadalpine-a5bec83c5704f49844a9232d16aab0b2b9bf633e.tar.xz
* SMIME: Crash if public certificates are located in an inaccessible
remote server and the private key is not available. * SMIME: Management of several alternate name (SAN) certificates is improved. When importing a SAN certificate, also import a certificate for the filename, besides for the e-mail addresses in the certificate. * When saving an attachment, the "^T" command leads to a screen where the "A" command can be used to add a file. A directory can be added by pressing "^X" after the "A" command. Added after a suggestion by Stefan Goessling.
Diffstat (limited to 'pith/smime.c')
-rw-r--r--pith/smime.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/pith/smime.c b/pith/smime.c
index c8c350be..01e0df09 100644
--- a/pith/smime.c
+++ b/pith/smime.c
@@ -211,10 +211,12 @@ setup_pwdcert(void **pwdcert)
EVP_PKEY *pkey = NULL;
X509 *pcert = NULL;
PERSONAL_CERT *pc, *pc2 = NULL;
+ static int was_here = 0;
- if(pwdcert == NULL)
+ if(pwdcert == NULL || was_here == 1)
return;
+ was_here++;
if(ps_global->pwdcertdir){
if(our_stat(ps_global->pwdcertdir, &sbuf) == 0
&& ((sbuf.st_mode & S_IFMT) == S_IFDIR)){
@@ -232,11 +234,15 @@ setup_pwdcert(void **pwdcert)
setup_dir++;
}
- if(setup_dir == 0)
+ if(setup_dir == 0){
+ was_here = 0;
return;
+ }
- if(load_key_and_cert(pathdir, pathdir, &keyfile, &certfile, &pkey, &pcert) < 0)
+ if(load_key_and_cert(pathdir, pathdir, &keyfile, &certfile, &pkey, &pcert) < 0){
+ was_here = 0;
return;
+ }
if(certfile && keyfile){
pc = (PERSONAL_CERT *) fs_get(sizeof(PERSONAL_CERT));
@@ -246,14 +252,17 @@ setup_pwdcert(void **pwdcert)
pc->cert = pcert;
*pwdcert = (void *) pc;
fs_give((void **)&certfile);
+ was_here = 0;
return;
}
/* if the user gave a pwdcertdir and there is nothing there, do not
* continue. Let the user initialize on their own this directory.
*/
- if(ps_global->pwdcertdir != NULL)
+ if(ps_global->pwdcertdir != NULL){
+ was_here = 0;
return;
+ }
/* look to see if there are any certificates lying around, first
* we try to load ps_global->smime to see if that has information
@@ -363,6 +372,7 @@ setup_pwdcert(void **pwdcert)
if(setup_dir){
*pwdcert = (void *) pc2;
+ was_here = 0;
return;
}
else if(pc2 != NULL)
@@ -415,6 +425,7 @@ setup_pwdcert(void **pwdcert)
pc->cert = pcert;
*pwdcert = (void *) pc;
fs_give((void **)&certfile);
+ was_here = 0;
return;
}
@@ -422,7 +433,7 @@ setup_pwdcert(void **pwdcert)
q_status_message(SM_ORDER, 2, 2,
_("No key/certificate pair found for password file encryption support"));
*/
-
+ was_here = 0;
if(we_inited)
smime_deinit();
}
@@ -685,8 +696,9 @@ import_certificate(WhichCerts ctype)
}
fs_give((void **)email);
}
- else
- save_cert_for(filename, cert, Public);
+ if(strcmp(filename + strlen(filename) - 4, ".crt") == 0)
+ filename[strlen(filename) - 4] = '\0';
+ save_cert_for(filename, cert, Public);
}
else /* if(SMHOLDERTYPE(ctype) == Container){ */
add_file_to_container(ctype, full_filename, NULL);