diff options
author | Eduardo Chappa <chappa@washington.edu> | 2016-02-28 21:44:28 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2016-02-28 21:44:28 -0700 |
commit | f79d3985bcf67ed2c0893c4a41fa8b7b1736a02a (patch) | |
tree | 4a17106ee709e63139fbf74cf996a79914a6d741 /pith/smime.c | |
parent | 27b0c30862b56feccb120c896e1354b501681e2a (diff) | |
download | alpine-f79d3985bcf67ed2c0893c4a41fa8b7b1736a02a.tar.xz |
* Adjust the "import certificate" prompt to make it clear that the
user is sometimes asked to import a certificate and sometimes a key.
* Fix a case of memory freed twice introduced in commit 4bf825141c...
Diffstat (limited to 'pith/smime.c')
-rw-r--r-- | pith/smime.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pith/smime.c b/pith/smime.c index da3cd253..ab3961cd 100644 --- a/pith/smime.c +++ b/pith/smime.c @@ -84,7 +84,7 @@ void smime_remove_folding_space(char **mimetext, unsigned long *mimelen, int smime_validate_extra_test(char *mimetext, unsigned long mimelen, char *bodytext, unsigned long bodylen, PKCS7 *p7, int nflag); int (*pith_opt_smime_get_passphrase)(void); -int (*pith_smime_import_certificate)(char *, char *, size_t); +int (*pith_smime_import_certificate)(char *, char *, char *, size_t); int (*pith_smime_enter_password)(char *prompt, char *, size_t); int (*pith_smime_confirm_save)(char *email); @@ -610,6 +610,7 @@ import_certificate(WhichCerts ctype) { int r = 1, rc; char filename[MAXPATH+1], full_filename[MAXPATH+1], buf[MAXPATH+1]; + char *what; if(pith_smime_import_certificate == NULL){ q_status_message(SM_ORDER, 0, 2, @@ -617,7 +618,8 @@ import_certificate(WhichCerts ctype) return 0; } - r = (*pith_smime_import_certificate)(filename, full_filename, sizeof(filename) - 20); + what = ctype == Public || ctype == CACert ? "certificate" : "key"; + r = (*pith_smime_import_certificate)(filename, full_filename, what, sizeof(filename) - 20); if(r < 0) return 0; @@ -702,7 +704,7 @@ import_certificate(WhichCerts ctype) int done = 0; /* attempt #3, ask the user */ do { - r = (*pith_smime_import_certificate)(filename, use_this_file, sizeof(filename) - 20); + r = (*pith_smime_import_certificate)(filename, use_this_file, "certificate", sizeof(filename) - 20); if(r < 0){ if(ins != NULL) BIO_free(ins); if(cert != NULL) X509_free(cert); @@ -1138,10 +1140,8 @@ certlist_from_personal_certs(PERSONAL_CERT *pc) if(pc == NULL) return NULL; - if((x = get_cert_for(pc->name, Public, 1)) != NULL){ + if((x = get_cert_for(pc->name, Public, 1)) != NULL) cl = smime_X509_to_cert_info(x, pc->name); - X509_free(x); - } cl->next = certlist_from_personal_certs(pc->next); return cl; |