changeset 19081:bdd8911d5031

- Add debugging babble to check_signature_chain
author William Ehlhardt <williamehlhardt@gmail.com>
date Wed, 08 Aug 2007 04:38:26 +0000
parents 3bdede51c007
children ddb5ad55f2d2
files libpurple/certificate.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Tue Aug 07 23:26:54 2007 +0000
+++ b/libpurple/certificate.c	Wed Aug 08 04:38:26 2007 +0000
@@ -172,11 +172,20 @@
 {
 	GList *cur;
 	PurpleCertificate *crt, *issuer;
+	gchar *uid;
 
 	g_return_val_if_fail(chain, FALSE);
+
+	uid = purple_certificate_get_unique_id((PurpleCertificate *) chain->data);
+	purple_debug_info("certificate",
+			  "Checking signature chain for uid=%s\n",
+			  uid);
+	g_free(uid);
 	
 	/* If this is a single-certificate chain, say that it is valid */
 	if (chain->next == NULL) {
+		purple_debug_info("certificate",
+				  "...Singleton. We'll say it's valid.\n");
 		return TRUE;
 	}
 
@@ -189,15 +198,28 @@
 		
 		/* Check the signature for this link */
 		if (! purple_certificate_signed_by(crt, issuer) ) {
+			uid = purple_certificate_get_unique_id(issuer);
+			purple_debug_info("certificate",
+					  "...Bad or missing signature by %s\nChain is INVALID\n",
+					  uid);
+			g_free(uid);
+		
 			return FALSE;
 		}
 
+		uid = purple_certificate_get_unique_id(issuer);
+		purple_debug_info("certificate",
+				  "...Good signature by %s\n",
+				  uid);
+		g_free(uid);
+		
 		/* The issuer is now the next crt whose signature is to be
 		   checked */
 		crt = issuer;
 	}
 
 	/* If control reaches this point, the chain is valid */
+	purple_debug_info("certificate", "Chain is VALID\n");
 	return TRUE;
 }