Mercurial > pidgin
changeset 19000:986413850713
- More skeletonizing for tls_cached logic.
- Fixed memleak
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Sun, 08 Jul 2007 02:10:31 +0000 |
parents | 7fbd0a6ac8d6 |
children | b207701cb5a3 |
files | libpurple/certificate.c |
diffstat | 1 files changed, 27 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/certificate.c Sun Jul 08 02:01:57 2007 +0000 +++ b/libpurple/certificate.c Sun Jul 08 02:10:31 2007 +0000 @@ -433,6 +433,28 @@ static PurpleCertificateVerifier x509_tls_cached; static void +x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq) +{ + /* TODO: Prompt the user, etc. */ + + (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data); + /* Okay, we're done here */ + purple_certificate_verify_destroy(vrq); + return; +} + +static void +x509_tls_cached_peer_cert_changed(PurpleCertificateVerificationRequest *vrq) +{ + /* TODO: Prompt the user, etc. */ + + (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data); + /* Okay, we're done here */ + purple_certificate_verify_destroy(vrq); + return; +} + +static void x509_tls_cached_start_verify(PurpleCertificateVerificationRequest *vrq) { PurpleCertificate *peer_crt = (PurpleCertificate *) vrq->cert_chain->data; @@ -481,18 +503,13 @@ "Peer cert matched cached\n"); (vrq->cb)(PURPLE_CERTIFICATE_VALID, vrq->cb_data); - /* Okay, we're done here */ + /* vrq is now finished */ purple_certificate_verify_destroy(vrq); - return; } else { purple_debug_info("certificate/x509/tls_cached", "Peer cert did NOT match cached\n"); - /* TODO: Prompt the user, etc. */ - - (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data); - /* Okay, we're done here */ - purple_certificate_verify_destroy(vrq); - return; + /* vrq now becomes the problem of cert_changed */ + x509_tls_cached_peer_cert_changed(vrq); } purple_certificate_destroy(cached_crt); @@ -502,11 +519,8 @@ /* TODO: Prompt the user, etc. */ purple_debug_info("certificate/x509/tls_cached", "...Not in cache\n"); - - (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data); - /* Okay, we're done here */ - purple_certificate_verify_destroy(vrq); - return; + /* vrq now becomes the problem of unknown_peer */ + x509_tls_cached_unknown_peer(vrq); } }