summaryrefslogtreecommitdiff
path: root/pith
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-02-28 21:44:28 -0700
committerEduardo Chappa <chappa@washington.edu>2016-02-28 21:44:28 -0700
commitf79d3985bcf67ed2c0893c4a41fa8b7b1736a02a (patch)
tree4a17106ee709e63139fbf74cf996a79914a6d741 /pith
parent27b0c30862b56feccb120c896e1354b501681e2a (diff)
downloadalpine-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')
-rw-r--r--pith/options.h2
-rw-r--r--pith/smime.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/pith/options.h b/pith/options.h
index 7ed5b650..9dfe58be 100644
--- a/pith/options.h
+++ b/pith/options.h
@@ -227,7 +227,7 @@ extern int (*pith_opt_smime_get_passphrase)(void);
/*
* Required call to interface for input of file to import.
*/
-extern int (*pith_smime_import_certificate)(char *, char *, size_t);
+extern int (*pith_smime_import_certificate)(char *, char *, char *, size_t);
/*
* Required call to ask user to enter a password, with a given char * prompt
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;