changeset 19014:bc4d0ebeabd3

- Add expiration/activation time display to tls_cached verifier
author William Ehlhardt <williamehlhardt@gmail.com>
date Thu, 12 Jul 2007 03:00:07 +0000
parents 5157ebe90b93
children 720c61141f4b
files libpurple/certificate.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Thu Jul 12 02:59:13 2007 +0000
+++ b/libpurple/certificate.c	Thu Jul 12 03:00:07 2007 +0000
@@ -524,6 +524,9 @@
 	GByteArray *sha_bin;
 	gchar *cn;
 	const gchar *cn_match;
+	time_t activation, expiration;
+	/* Length of these buffers is dictated by 'man ctime_r' */
+	gchar activ_str[26], expir_str[26];
 	gchar *primary, *secondary;
 	PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data;
 
@@ -542,10 +545,17 @@
 	} else {
 		cn_match = _("(DOES NOT MATCH)");
 	}
+
+	/* Get the certificate times */
+	/* TODO: Check the times against localtime */
+	/* TODO: errorcheck? */
+	g_assert(purple_certificate_get_times(crt, &activation, &expiration));
+	ctime_r(&activation, activ_str);
+	ctime_r(&expiration, expir_str);
 	
 	/* Make messages */
 	primary = g_strdup_printf(_("%s has presented the following certificate:"), vrq->subject_name);
-	secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc);
+	secondary = g_strdup_printf(_("Common name: %s %s\n\nFingerprint (SHA1): %s\n\nActivation date: %s\nExpiration date: %s\n"), cn, cn_match, sha_asc, activ_str, expir_str);
 	
 	/* Make a semi-pretty display */
 	purple_request_accept_cancel(