changeset 19069:fcb3e4a2aa9a

- x509_nss copy op
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 03 Aug 2007 07:08:42 +0000
parents 9ac0fbb569a5
children 7ccb5ab3e07e
files libpurple/plugins/ssl/ssl-nss.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:02:10 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:08:42 2007 +0000
@@ -415,7 +415,21 @@
 static PurpleCertificate *
 x509_copy_certificate(PurpleCertificate *crt)
 {
-	return NULL;
+	CERTCertificate *crt_dat;
+	PurpleCertificate *newcrt;
+
+	g_return_val_if_fail(crt, NULL);
+	g_return_val_if_fail(crt->scheme == &x509_nss, NULL);
+
+	crt_dat = X509_NSS_DATA(crt);
+	g_return_val_if_fail(crt_dat, NULL);
+
+	/* Create the certificate copy */
+	newcrt = g_new0(PurpleCertificate, 1);
+	newcrt->scheme = &x509_nss;
+	newcrt->data = CERT_DupCertificate(crt_dat);
+	
+	return newcrt;
 }
 
 /** Frees a Certificate