/pidgin/main: 89bda8c0750d: Copy changes from datallah's 2948449...
Mark Doliner
mark at kingant.net
Tue Jul 8 02:45:24 EDT 2014
Changeset: 89bda8c0750d380f69aa838284ae04983fa02809
Author: Mark Doliner <mark at kingant.net>
Date: 2014-07-07 23:45 -0700
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/89bda8c0750d
Description:
Copy changes from datallah's 2948449ffd12 from the
release-2.x.y branch to default.
I dropped these changes when I merged that branch into default because
the code had moved and it didn't seem appropriate to re-do the change
in the merge commit.
The only remaining change from that commit is to add a "View Issuer
Certificate" button to the accept dialog. I think it's a good idea to
give users a way to view info about the cert chain, but I'm not going
to spend the time to figure out how to do it in default. If anyone else
wants to, feel free.
If anyone is keeping a list of starter tasks for aspiring patch writers,
this is a great one.
Also, why the hell is the x509_display_string() function in the
library-specific code? The function is duplicated and almost 100% identical
in ssl-gnutls.c and ssl-nss.c. Ugh.
Refs #7034
https://developer.pidgin.im/ticket/7034
diffstat:
libpurple/plugins/ssl/ssl-gnutls.c | 10 +++++++++-
libpurple/plugins/ssl/ssl-nss.c | 11 ++++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
diffs (106 lines):
diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c
--- a/libpurple/plugins/ssl/ssl-gnutls.c
+++ b/libpurple/plugins/ssl/ssl-gnutls.c
@@ -1232,9 +1232,10 @@ x509_display_string(PurpleCertificate *c
{
gchar *sha_asc;
GByteArray *sha_bin;
- gchar *cn;
+ gchar *cn, *issuer_id;
gint64 activation, expiration;
gchar *activ_str, *expir_str;
+ gboolean self_signed;
gchar *text;
#if GLIB_CHECK_VERSION(2,26,0)
GDateTime *act_dt, *exp_dt;
@@ -1249,6 +1250,8 @@ x509_display_string(PurpleCertificate *c
/* TODO: Will break on CA certs */
cn = x509_common_name(crt);
+ issuer_id = purple_certificate_get_issuer_unique_id(crt);
+
/* Get the certificate times */
/* TODO: Check the times against localtime */
/* TODO: errorcheck? */
@@ -1271,19 +1274,24 @@ x509_display_string(PurpleCertificate *c
expir_str = g_strdup(ctime(&expiration));
#endif
+ self_signed = purple_certificate_signed_by(crt, crt);
+
/* Make messages */
text = g_strdup_printf(
_("Common name: %s\n\n"
+ "Issued by: %s\n\n"
"Fingerprint (SHA1): %s\n\n"
"Activation date: %s\n"
"Expiration date: %s\n"),
cn ? cn : "(null)",
+ self_signed ? _("(self-signed)") : (issuer_id ? issuer_id : "(null)"),
sha_asc ? sha_asc : "(null)",
activ_str ? activ_str : "(null)",
expir_str ? expir_str : "(null)");
/* Cleanup */
g_free(cn);
+ g_free(issuer_id);
g_free(sha_asc);
g_free(activ_str);
g_free(expir_str);
diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c
--- a/libpurple/plugins/ssl/ssl-nss.c
+++ b/libpurple/plugins/ssl/ssl-nss.c
@@ -951,9 +951,10 @@ x509_display_string(PurpleCertificate *c
{
gchar *sha_asc;
GByteArray *sha_bin;
- gchar *cn;
+ gchar *cn, *issuer_id;
gint64 activation, expiration;
gchar *activ_str, *expir_str;
+ gboolean self_signed;
gchar *text;
#if GLIB_CHECK_VERSION(2,26,0)
GDateTime *act_dt, *exp_dt;
@@ -967,6 +968,8 @@ x509_display_string(PurpleCertificate *c
/* TODO: Will break on CA certs */
cn = x509_common_name(crt);
+ issuer_id = purple_certificate_get_issuer_unique_id(crt);
+
/* Get the certificate times */
/* TODO: Check the times against localtime */
/* TODO: errorcheck? */
@@ -975,6 +978,7 @@ x509_display_string(PurpleCertificate *c
"Failed to get certificate times!\n");
activation = expiration = 0;
}
+
#if GLIB_CHECK_VERSION(2,26,0)
act_dt = g_date_time_new_from_unix_local(activation);
activ_str = g_date_time_format(act_dt, "%c");
@@ -988,19 +992,24 @@ x509_display_string(PurpleCertificate *c
expir_str = g_strdup(ctime(&expiration));
#endif
+ self_signed = purple_certificate_signed_by(crt, crt);
+
/* Make messages */
text = g_strdup_printf(
_("Common name: %s\n\n"
+ "Issued by: %s\n\n"
"Fingerprint (SHA1): %s\n\n"
"Activation date: %s\n"
"Expiration date: %s\n"),
cn ? cn : "(null)",
+ self_signed ? _("(self-signed)") : (issuer_id ? issuer_id : "(null)"),
sha_asc ? sha_asc : "(null)",
activ_str ? activ_str : "(null)",
expir_str ? expir_str : "(null)");
/* Cleanup */
g_free(cn);
+ g_free(issuer_id);
g_free(sha_asc);
g_free(activ_str);
g_free(expir_str);
More information about the Commits
mailing list