summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjpierre%netscape.com <devnull@localhost>2002-06-27 00:18:35 +0000
committerjpierre%netscape.com <devnull@localhost>2002-06-27 00:18:35 +0000
commit56ec9908b85b97f5648f548ed0ff35bcfa40ab2a (patch)
tree779a7ec85d9cb3c68a098919d0523936c76d455a
parentd739d330a1c31b64d7bb69bd7629ea09a6fa6811 (diff)
downloadnss-hg-56ec9908b85b97f5648f548ed0ff35bcfa40ab2a.tar.gz
Fix for 154212 - make CERT_SaveSMimeProfile copy the cert to the database if it comes from an external source
-rw-r--r--security/nss/lib/certdb/stanpcertdb.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/security/nss/lib/certdb/stanpcertdb.c b/security/nss/lib/certdb/stanpcertdb.c
index 654da08dd..3f52f438e 100644
--- a/security/nss/lib/certdb/stanpcertdb.c
+++ b/security/nss/lib/certdb/stanpcertdb.c
@@ -747,7 +747,24 @@ CERT_SaveSMimeProfile(CERTCertificate *cert, SECItem *emailProfile,
NSSCryptoContext *cc;
nssSMIMEProfile *stanProfile = NULL;
PRBool freeOldProfile = PR_FALSE;
-
+ PK11SlotInfo* internalslot = PK11_GetInternalKeySlot();
+
+ if (cert && cert->slot != internalslot) {
+ /* this cert comes from an external source, we need to add it
+ to the cert db before creating an S/MIME profile */
+ rv = PK11_ImportCert(internalslot, cert,
+ CK_INVALID_HANDLE, NULL, PR_FALSE);
+
+ PK11_FreeSlot(internalslot);
+
+ if (rv != SECSuccess )
+ {
+ return SECFailure;
+ }
+ } else {
+ PK11_FreeSlot(internalslot);
+ }
+
emailAddr = cert->emailAddr;
if ( emailAddr == NULL ) {