diff libpurple/certificate.c @ 18964:7b03727b10b4

- x509_singleuse uses the subject_name field...somewhat
author William Ehlhardt <williamehlhardt@gmail.com>
date Wed, 27 Jun 2007 04:14:16 +0000
parents fcd05c39803e
children 898e2bd70f23
line wrap: on
line diff
--- a/libpurple/certificate.c	Wed Jun 27 03:51:36 2007 +0000
+++ b/libpurple/certificate.c	Wed Jun 27 04:14:16 2007 +0000
@@ -190,6 +190,8 @@
 {
 	gchar *sha_asc;
 	GByteArray *sha_bin;
+	gchar *cn;
+	const gchar *cn_match;
 	gchar *primary, *secondary;
 	PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data;
 
@@ -199,9 +201,20 @@
 	sha_asc = purple_base16_encode_chunked(sha_bin->data,
 					       sha_bin->len);
 
+	/* Get the cert Common Name */
+	cn = purple_certificate_get_subject_name(crt);
+
+	/* Determine whether the name matches */
+	/* TODO: Worry about strcmp safety? */
+	if (!strcmp(cn, vrq->subject_name)) {
+		cn_match = _("");
+	} else {
+		cn_match = _("(DOES NOT MATCH)");
+	}
+	
 	/* Make messages */
 	primary = g_strdup_printf(_("%s has presented the following certificate for just-this-once use:"), vrq->subject_name);
-	secondary = g_strdup_printf(_("Fingerprint (SHA1): %s"), sha_asc);
+	secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc);
 	
 	/* Make a semi-pretty display */
 	purple_request_accept_cancel(