Mercurial > pidgin
comparison libpurple/plugins/ssl/ssl-gnutls.c @ 19008:7fd9bd55f8d0
- Add certificate_check_subject_name and associated machinery
- Update GnuTLS to support the above
- tls_cached verifier now uses check_subject_name instead of strcmp
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Mon, 09 Jul 2007 03:47:36 +0000 |
parents | 8228c5b1d181 |
children | 5157ebe90b93 |
comparison
equal
deleted
inserted
replaced
19007:8228c5b1d181 | 19008:7fd9bd55f8d0 |
---|---|
709 cn, &cn_size); | 709 cn, &cn_size); |
710 | 710 |
711 return cn; | 711 return cn; |
712 } | 712 } |
713 | 713 |
714 static gboolean | |
715 x509_check_name (PurpleCertificate *crt, const gchar *name) | |
716 { | |
717 gnutls_x509_crt_t crt_dat; | |
718 | |
719 g_return_val_if_fail(crt, FALSE); | |
720 g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); | |
721 g_return_val_if_fail(name, FALSE); | |
722 | |
723 crt_dat = *( (gnutls_x509_crt_t *) crt->data ); | |
724 | |
725 if (gnutls_x509_crt_check_hostname(crt_dat, name)) { | |
726 return TRUE; | |
727 } else { | |
728 return FALSE; | |
729 } | |
730 } | |
731 | |
714 /* X.509 certificate operations provided by this plugin */ | 732 /* X.509 certificate operations provided by this plugin */ |
715 /* TODO: Flesh this out! */ | 733 /* TODO: Flesh this out! */ |
716 static PurpleCertificateScheme x509_gnutls = { | 734 static PurpleCertificateScheme x509_gnutls = { |
717 "x509", /* Scheme name */ | 735 "x509", /* Scheme name */ |
718 N_("X.509 Certificates"), /* User-visible scheme name */ | 736 N_("X.509 Certificates"), /* User-visible scheme name */ |
721 x509_destroy_certificate, /* Destroy cert */ | 739 x509_destroy_certificate, /* Destroy cert */ |
722 x509_sha1sum, /* SHA1 fingerprint */ | 740 x509_sha1sum, /* SHA1 fingerprint */ |
723 NULL, /* Unique ID */ | 741 NULL, /* Unique ID */ |
724 NULL, /* Issuer Unique ID */ | 742 NULL, /* Issuer Unique ID */ |
725 x509_common_name, /* Subject name */ | 743 x509_common_name, /* Subject name */ |
744 x509_check_name, /* Check subject name */ | |
726 NULL, /* Activation time */ | 745 NULL, /* Activation time */ |
727 NULL /* Expiration time */ | 746 NULL /* Expiration time */ |
728 }; | 747 }; |
729 | 748 |
730 static PurpleSslOps ssl_ops = | 749 static PurpleSslOps ssl_ops = |