diff options
Diffstat (limited to 'pith')
-rw-r--r-- | pith/imap.h | 2 | ||||
-rw-r--r-- | pith/smime.c | 6 | ||||
-rw-r--r-- | pith/smkeys.c | 8 | ||||
-rw-r--r-- | pith/state.c | 31 | ||||
-rw-r--r-- | pith/state.h | 6 |
5 files changed, 38 insertions, 15 deletions
diff --git a/pith/imap.h b/pith/imap.h index 1b30e456..b6460e50 100644 --- a/pith/imap.h +++ b/pith/imap.h @@ -131,7 +131,7 @@ void imap_flush_passwd_cache(int); void set_read_predicted(int); void mm_login_work (NETMBX *mb,char *user,char *pwd,long trial,char *usethisprompt, char *altuserforcache); -/* this is necessary to figure out the name of the password file of the application */ +/* this is necessary to figure out the name of the password file of the application. */ #ifdef PASSFILE char *passfile_name(char *, char *, size_t); #endif /* PASSFILE */ diff --git a/pith/smime.c b/pith/smime.c index ab3961cd..9629f743 100644 --- a/pith/smime.c +++ b/pith/smime.c @@ -631,6 +631,7 @@ import_certificate(WhichCerts ctype) * in the same private key, and if not, we ask the user for its location. If all * of this works, we import the key and public to the password directory. */ +#ifdef PASSFILE if(ctype == Password){ char PrivateKeyPath[MAXPATH+1], PublicCertPath[MAXPATH+1], s[MAXPATH+1]; char full_name_key[MAXPATH+1], full_name_cert[MAXPATH+1]; @@ -830,6 +831,7 @@ import_certificate(WhichCerts ctype) return rc; } +#endif /* PASSFILE */ smime_init(); ps_global->mangled_screen = 1; @@ -1288,7 +1290,7 @@ get_personal_certs(char *path) strncpy(buf2, d->d_name, sizeof(buf2)-1); buf2[sizeof(buf2)-1] = '\0'; /* chop off ".key" trailier */ - buf2[strlen(buf2)-4] = 0; + buf2[strlen(buf2)-4] = '\0'; /* Look for certificate */ cert = get_cert_for(buf2, Public, 1); @@ -1300,6 +1302,8 @@ get_personal_certs(char *path) pc = (PERSONAL_CERT *) fs_get(sizeof(*pc)); pc->cert = cert; pc->name = cpystr(buf2); + strncat(buf2, EXTCERT(Public), 4); + pc->cname = cpystr(buf2); /* Try to load the key with an empty password */ pc->key = load_key(pc, "", SM_NORMALCERT); diff --git a/pith/smkeys.c b/pith/smkeys.c index 415bc190..ce58ed41 100644 --- a/pith/smkeys.c +++ b/pith/smkeys.c @@ -1106,6 +1106,7 @@ mem_to_personal_certs(char *contents) pc = (PERSONAL_CERT *) fs_get(sizeof(*pc)); pc->cert = cert; pc->name = cpystr(name); + pc->cname = NULL; pc->keytext = keytext; /* a pointer into contents */ pc->key = load_key(pc, "", SM_NORMALCERT); @@ -1347,12 +1348,11 @@ void free_personal_certs(PERSONAL_CERT **pc) { if(pc && *pc){ - free_personal_certs(&(*pc)->next); if((*pc)->name) fs_give((void **) &(*pc)->name); - if((*pc)->name) - fs_give((void **) &(*pc)->name); + if((*pc)->cname) + fs_give((void **) &(*pc)->cname); if((*pc)->cert) X509_free((*pc)->cert); @@ -1360,6 +1360,8 @@ free_personal_certs(PERSONAL_CERT **pc) if((*pc)->key) EVP_PKEY_free((*pc)->key); + free_personal_certs(&(*pc)->next); + fs_give((void **) pc); } } diff --git a/pith/state.c b/pith/state.c index d4b8c092..6ac569c3 100644 --- a/pith/state.c +++ b/pith/state.c @@ -178,10 +178,10 @@ free_pine_struct(struct pine **pps) if((*pps)->posting_charmap) fs_give((void **)&(*pps)->posting_charmap); -#ifdef PASSFILE - if((*pps)->passfile) - fs_give((void **)&(*pps)->passfile); #ifdef SMIME + if((*pps)->pwdcertdir) + fs_give((void **)&(*pps)->pwdcertdir); + if((*pps)->pwdcert){ PERSONAL_CERT *pc; @@ -189,9 +189,28 @@ free_pine_struct(struct pine **pps) free_personal_certs(&pc); (*pps)->pwdcert = NULL; } - if((*pps)->pwdcertdir) - fs_give((void **)&(*pps)->pwdcertdir); -#endif /* SMIME inside PASSFILE */ + + if((*pps)->pwdcertlist){ + CertList *cert; + + cert = (CertList *) (*pps)->pwdcertlist; + free_certlist(&cert); + (*pps)->pwdcertlist = NULL; + } + + if((*pps)->backuppassword){ + CertList *cert; + + cert = (CertList *) (*pps)->backuppassword; + free_certlist(&cert); + (*pps)->backuppassword = NULL; + } +#endif /* SMIME */ + + +#ifdef PASSFILE + if((*pps)->passfile) + fs_give((void **)&(*pps)->passfile); #endif /* PASSFILE */ if((*pps)->hdr_colors) diff --git a/pith/state.h b/pith/state.h index 52628cf0..53db2bf9 100644 --- a/pith/state.h +++ b/pith/state.h @@ -353,15 +353,13 @@ struct pine { PRINT_S *print; #ifdef SMIME - char *smimedir; + char *smimedir; SMIME_STUFF_S *smime; -#ifdef PASSFILE char *pwdcertdir; /* path to location of certificates for password file */ - char *pwdcertcontent; /* No comment yet */ void *pwdcert; /* this is of type PERSONAL_CERT */ + char *pwdcertcontent; /* No comment yet */ void *backuppassword; /* this is of type CertList */ void *pwdcertlist; /* this is of type CertList */ -#endif /* PASSFILE inside SMIME */ #endif /* SMIME */ struct variable *vars; |