libpurple/certificate.c

branch
soc.2007.certmgr
changeset 19025
8b4c3e863a53
parent 19024
17f710a21bc1
child 19026
a814165b098f
equal deleted inserted replaced
19024:17f710a21bc1 19025:8b4c3e863a53
738 738
739 739
740 static PurpleCertificateVerifier x509_tls_cached; 740 static PurpleCertificateVerifier x509_tls_cached;
741 741
742 static void 742 static void
743 x509_tls_cached_unknown_peer_cb (PurpleCertificateVerificationRequest *vrq, gint id) 743 x509_tls_cached_user_auth_cb (PurpleCertificateVerificationRequest *vrq, gint id)
744 { 744 {
745 PurpleCertificatePool *tls_peers; 745 PurpleCertificatePool *tls_peers;
746 746
747 g_return_if_fail(vrq); 747 g_return_if_fail(vrq);
748 748
766 766
767 /* Finish off the request */ 767 /* Finish off the request */
768 purple_certificate_verify_destroy(vrq); 768 purple_certificate_verify_destroy(vrq);
769 } 769 }
770 770
771 /* Validates a certificate by asking the user */
771 static void 772 static void
772 x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq) 773 x509_tls_cached_user_auth(PurpleCertificateVerificationRequest *vrq)
773 { 774 {
774 gchar *sha_asc; 775 gchar *sha_asc;
775 GByteArray *sha_bin; 776 GByteArray *sha_bin;
776 gchar *cn; 777 gchar *cn;
777 const gchar *cn_match; 778 const gchar *cn_match;
817 1, /* Accept by default */ 818 1, /* Accept by default */
818 NULL, /* No account */ 819 NULL, /* No account */
819 NULL, /* No other user */ 820 NULL, /* No other user */
820 NULL, /* No associated conversation */ 821 NULL, /* No associated conversation */
821 vrq, 822 vrq,
822 x509_tls_cached_unknown_peer_cb, 823 x509_tls_cached_user_auth_cb,
823 x509_tls_cached_unknown_peer_cb ); 824 x509_tls_cached_user_auth_cb );
824 825
825 /* Cleanup */ 826 /* Cleanup */
826 g_free(primary); 827 g_free(primary);
827 g_free(secondary); 828 g_free(secondary);
828 g_free(sha_asc); 829 g_free(sha_asc);
836 837
837 (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data); 838 (vrq->cb)(PURPLE_CERTIFICATE_INVALID, vrq->cb_data);
838 /* Okay, we're done here */ 839 /* Okay, we're done here */
839 purple_certificate_verify_destroy(vrq); 840 purple_certificate_verify_destroy(vrq);
840 return; 841 return;
842 }
843
844 /* For when we've never communicated with this party before */
845 static void
846 x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq)
847 {
848 /* For now, just toss it to the user */
849 x509_tls_cached_user_auth(vrq);
841 } 850 }
842 851
843 static void 852 static void
844 x509_tls_cached_start_verify(PurpleCertificateVerificationRequest *vrq) 853 x509_tls_cached_start_verify(PurpleCertificateVerificationRequest *vrq)
845 { 854 {

mercurial