summaryrefslogtreecommitdiff
path: root/pith/smime.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2013-10-06 23:58:51 -0600
committerEduardo Chappa <chappa@washington.edu>2013-10-06 23:58:51 -0600
commit30a979ab1460a57d466a6a5cc6adb96eac452ce4 (patch)
tree1aec0ebb21be40922bc5a708c7780fb0db602202 /pith/smime.c
parentc5bb25b1320af6cda4cc62ea9e15fbb03ee92026 (diff)
downloadalpine-30a979ab1460a57d466a6a5cc6adb96eac452ce4.tar.xz
* new version 2.11.8
* Fix in configure script for recognition of SSL files in Ubuntu 12.04 * Alpine does not attempt to automatically reopen a collection that was not opened due to cancellation by the user. Instead, the user must try to open it explicitly. * few improvements on new /tls1, /tls1_1, etc. options.
Diffstat (limited to 'pith/smime.c')
-rw-r--r--pith/smime.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/pith/smime.c b/pith/smime.c
index d212b233..532948bf 100644
--- a/pith/smime.c
+++ b/pith/smime.c
@@ -1166,8 +1166,12 @@ load_private_key(PERSONAL_CERT *pcert)
ps_global->smime->need_passphrase = 1;
if(ps_global->smime){
- if(ps_global->smime->passphrase_emailaddr)
- fs_give((void **) &ps_global->smime->passphrase_emailaddr);
+ if(ps_global->smime->passphrase_emailaddr){
+ int i;
+ for(i = 0; ps_global->smime->passphrase_emailaddr[i] != NULL; i++)
+ fs_give((void **)&ps_global->smime->passphrase_emailaddr[i]);
+ fs_give((void **) ps_global->smime->passphrase_emailaddr);
+ }
ps_global->smime->passphrase_emailaddr = get_x509_subject_email(pcert->cert);
}
@@ -1213,7 +1217,8 @@ match_personal_cert_to_email(ADDRESS *a)
{
PERSONAL_CERT *pcert = NULL;
char buf[MAXPATH];
- char *email;
+ char **email;
+ int i, done;
if(!a || !a->mailbox || !a->host)
return NULL;
@@ -1230,12 +1235,17 @@ match_personal_cert_to_email(ADDRESS *a)
email = get_x509_subject_email(pcert->cert);
- if(email && strucmp(email,buf)==0){
- fs_give((void**) &email);
- break;
+ done = 0;
+ if(email != NULL){
+ for(i = 0; email[i] && strucmp(email[i], buf) != 0; i++);
+ if(email[i] != NULL) done++;
+ for(i = 0; email[i] != NULL; i++)
+ fs_give((void **)&email[i]);
+ fs_give((void **)email);
}
- fs_give((void**) &email);
+ if(done > 0)
+ break;
}
}
@@ -1634,7 +1644,7 @@ do_signature_verify(PKCS7 *p7, BIO *in, BIO *out)
if(signers)
for(i=0; i<sk_X509_num(signers); i++){
- char *email;
+ char **email;
X509 *x = sk_X509_value(signers,i);
X509 *cert;
@@ -1644,13 +1654,16 @@ do_signature_verify(PKCS7 *p7, BIO *in, BIO *out)
email = get_x509_subject_email(x);
if(email){
- cert = get_cert_for(email);
- if(cert)
- X509_free(cert);
- else
- save_cert_for(email, x);
-
- fs_give((void**) &email);
+ int i;
+ for(i = 0; email[i] != NULL; i++){
+ cert = get_cert_for(email[i]);
+ if(cert)
+ X509_free(cert);
+ else
+ save_cert_for(email[i], x);
+ fs_give((void **) &email[i]);
+ }
+ fs_give((void **) email);
}
}
@@ -2338,8 +2351,12 @@ static void
free_smime_struct(SMIME_STUFF_S **smime)
{
if(smime && *smime){
- if((*smime)->passphrase_emailaddr)
- fs_give((void **) &(*smime)->passphrase_emailaddr);
+ if((*smime)->passphrase_emailaddr){
+ int i;
+ for(i = 0; (*smime)->passphrase_emailaddr[i] != NULL; i++)
+ fs_give((void **) &(*smime)->passphrase_emailaddr[i]);
+ fs_give((void **) (*smime)->passphrase_emailaddr);
+ }
if((*smime)->publicpath)
fs_give((void **) &(*smime)->publicpath);