# HG changeset patch # User William Ehlhardt # Date 1189652989 0 # Node ID eda223b50bdc93140b7468d755a2eaae1a3392b3 # Parent 3023e0ba2fa686d6f5fc8b263c52fe85ee7a7f05 - Make ssl-nss unique_id and issuer_unique_id work diff -r 3023e0ba2fa6 -r eda223b50bdc libpurple/plugins/ssl/ssl-nss.c --- a/libpurple/plugins/ssl/ssl-nss.c Wed Sep 12 20:32:09 2007 +0000 +++ b/libpurple/plugins/ssl/ssl-nss.c Thu Sep 13 03:09:49 2007 +0000 @@ -509,7 +509,6 @@ g_free(crt); } -#if 0 /** Determines whether one certificate has been issued and signed by another * * @param crt Certificate to check the signature of @@ -519,12 +518,11 @@ * @TODO Modify this function to return a reason for invalidity? */ static gboolean -x509_certificate_signed_by(PurpleCertificate * crt, - PurpleCertificate * issuer) +x509_signed_by(PurpleCertificate * crt, + PurpleCertificate * issuer) { return FALSE; } -#endif static GByteArray * x509_sha1sum(PurpleCertificate *crt) @@ -564,6 +562,34 @@ } static gchar * +x509_dn (PurpleCertificate *crt) +{ + CERTCertificate *crt_dat; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme == &x509_nss, NULL); + + crt_dat = X509_NSS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + return g_strdup(crt_dat->subjectName); +} + +static gchar * +x509_issuer_dn (PurpleCertificate *crt) +{ + CERTCertificate *crt_dat; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme == &x509_nss, NULL); + + crt_dat = X509_NSS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + return g_strdup(crt_dat->subjectName); +} + +static gchar * x509_common_name (PurpleCertificate *crt) { CERTCertificate *crt_dat; @@ -659,10 +685,10 @@ x509_export_certificate, /* Certificate export function */ x509_copy_certificate, /* Copy */ x509_destroy_certificate, /* Destroy cert */ - NULL, /* Signed-by */ + x509_signed_by, /* Signed-by */ x509_sha1sum, /* SHA1 fingerprint */ - NULL, /* Unique ID */ - NULL, /* Issuer Unique ID */ + x509_dn, /* Unique ID */ + x509_issuer_dn, /* Issuer Unique ID */ x509_common_name, /* Subject name */ x509_check_name, /* Check subject name */ x509_times, /* Activation/Expiration time */