changeset 19019:e179e7e6ded7

- Add GnuTLS X.509 cert copy operator
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 13 Jul 2007 08:42:59 +0000
parents d6f902265076
children d69355001a6e
files libpurple/plugins/ssl/ssl-gnutls.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Fri Jul 13 08:38:21 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Fri Jul 13 08:42:59 2007 +0000
@@ -581,6 +581,23 @@
 	return success;
 }
 
+static PurpleCertificate *
+x509_copy_certificate(PurpleCertificate *crt)
+{
+	x509_crtdata_t *crtdat;
+	PurpleCertificate *newcrt;
+
+	g_return_val_if_fail(crt, NULL);
+	g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL);
+
+	crtdat = (x509_crtdata_t *) crt->data;
+
+	newcrt = g_new0(PurpleCertificate, 1);
+	newcrt->scheme = &x509_gnutls;
+	newcrt->data = x509_crtdata_addref(crtdat);
+
+	return newcrt;
+}
 /** Frees a Certificate
  *
  *  Destroys a Certificate's internal data structures and frees the pointer
@@ -799,7 +816,7 @@
 	N_("X.509 Certificates"),        /* User-visible scheme name */
 	x509_import_from_file,           /* Certificate import function */
 	x509_export_certificate,         /* Certificate export function */
-	NULL,                            /* Copy */
+	x509_copy_certificate,           /* Copy */
 	x509_destroy_certificate,        /* Destroy cert */
 	x509_sha1sum,                    /* SHA1 fingerprint */
 	NULL,                            /* Unique ID */