# HG changeset patch # User William Ehlhardt # Date 1186984017 0 # Node ID 919395a01483b5cb2cddffe368e9f65bc07a2430 # Parent fff2bc09ec1a1019c6c5c35c4bdf33775fe7901a - Implement x509_ca_get_cert diff -r fff2bc09ec1a -r 919395a01483 libpurple/certificate.c --- a/libpurple/certificate.c Mon Aug 13 05:42:57 2007 +0000 +++ b/libpurple/certificate.c Mon Aug 13 05:46:57 2007 +0000 @@ -761,21 +761,23 @@ static PurpleCertificate * x509_ca_get_cert(const gchar *id) { - PurpleCertificateScheme *x509; PurpleCertificate *crt = NULL; + x509_ca_element *el; g_return_val_if_fail(x509_ca_lazy_init(), NULL); g_return_val_if_fail(id, NULL); - /* Is it in the pool? */ - if ( !x509_ca_cert_in_pool(id) ) { - return NULL; + /* Search the memory-cached pool */ + el = x509_ca_locate_cert(x509_ca_certs, id); + + if (el != NULL) { + /* Make a copy of the memcached one for the function caller + to play with */ + crt = purple_certificate_copy(el->crt); + } else { + crt = NULL; } - /* Look up the X.509 scheme */ - x509 = purple_certificate_find_scheme("x509"); - g_return_val_if_fail(x509, NULL); - return crt; }