changeset 19072:4bdf4ce3473b

- ssl-nss x509_nss check_name
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 03 Aug 2007 07:37:57 +0000
parents d224a1e4b919
children 2156321c5482
files libpurple/plugins/ssl/ssl-nss.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:26:32 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:37:57 2007 +0000
@@ -511,6 +511,26 @@
 static gboolean
 x509_check_name (PurpleCertificate *crt, const gchar *name)
 {
+	CERTCertificate *crt_dat;
+	SECStatus st;
+	
+	g_return_val_if_fail(crt, FALSE);
+	g_return_val_if_fail(crt->scheme == &x509_nss, FALSE);
+
+	crt_dat = X509_NSS_DATA(crt);
+	g_return_val_if_fail(crt_dat, FALSE);
+
+	st = CERT_VerifyCertName(crt_dat, name);
+
+	if (st == SECSuccess) {
+		return TRUE;
+	}
+	else if (st == SECFailure) {
+		return FALSE;
+	}
+	
+	/* If we get here...bad things! */
+	g_assert(FALSE);
 	return FALSE;
 }