changeset 19047:3af5d9ed9ad3

- Write remove_cert function for tls_peers Pool
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 27 Jul 2007 07:23:58 +0000
parents 8599a27ad69c
children fd0b4b2f6cf0
files libpurple/certificate.c
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Fri Jul 27 07:01:21 2007 +0000
+++ b/libpurple/certificate.c	Fri Jul 27 07:23:58 2007 +0000
@@ -543,6 +543,37 @@
 	return ret;
 }
 
+static gboolean
+x509_tls_peers_remove_cert(const gchar *id)
+{
+	gboolean ret = FALSE;
+	gchar *keypath;
+
+	g_return_val_if_fail(id, FALSE);
+
+	/* Is the id even in the pool? */
+	if (!x509_tls_peers_cert_in_pool(id)) {
+		purple_debug_warning("certificate/tls_peers",
+				     "Id %s wasn't in the pool\n",
+				     id);
+		return FALSE;
+	}
+
+	/* OK, so work out the keypath and delete the thing */
+	keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id);	
+	if ( unlink(keypath) != 0 ) {
+		purple_debug_error("certificate/tls_peers",
+				   "Unlink of %s failed!\n",
+				   keypath);
+		ret = FALSE;
+	} else {
+		ret = TRUE;
+	}
+
+	g_free(keypath);
+	return ret;
+}
+
 static GList *
 x509_tls_peers_get_idlist(void)
 {