summaryrefslogtreecommitdiff
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
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...
-rw-r--r--alpine/mailcmd.c4
-rw-r--r--alpine/mailcmd.h2
-rw-r--r--pith/options.h2
-rw-r--r--pith/smime.c12
4 files changed, 10 insertions, 10 deletions
diff --git a/alpine/mailcmd.c b/alpine/mailcmd.c
index 15be7840..a4fa5247 100644
--- a/alpine/mailcmd.c
+++ b/alpine/mailcmd.c
@@ -322,7 +322,7 @@ alpine_get_password(char *prompt, char *pass, size_t len)
0, len, prompt, NULL, NO_HELP, &flags);
}
-int smime_import_certificate(char *filename, char *full_filename, size_t len)
+int smime_import_certificate(char *filename, char *full_filename, char *what, size_t len)
{
int r = 1;
static HISTORY_S *history = NULL;
@@ -344,7 +344,7 @@ int smime_import_certificate(char *filename, char *full_filename, size_t len)
full_filename[0] = '\0';
r = get_export_filename(ps_global, filename, NULL, full_filename,
- len, "certificate", "IMPORT", eopts, NULL,
+ len, what, "IMPORT", eopts, NULL,
-FOOTER_ROWS(ps_global), GE_IS_IMPORT, &history);
return r;
diff --git a/alpine/mailcmd.h b/alpine/mailcmd.h
index f4fda9b2..f7c4891a 100644
--- a/alpine/mailcmd.h
+++ b/alpine/mailcmd.h
@@ -68,7 +68,7 @@ typedef enum {View, MsgIndx, ThrdIndx} CmdWhere;
int alpine_get_data_prompt(char *, char *, size_t);
int alpine_get_password(char *, char *, size_t);
int alpine_smime_confirm_save(char *);
-int smime_import_certificate(char *, char *, size_t);
+int smime_import_certificate(char *, char *, char *, size_t);
int process_cmd(struct pine *, MAILSTREAM *, MSGNO_S *, int, CmdWhere, int *);
char *pretty_command(UCS);
void bogus_command(UCS, char *);
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;