Mercurial > pidgin.yaz
changeset 18975:172b8d1dc2be
- CertificatePool member functions no longer accept a Pool instance, as Pools are expected to be singletons
- Add skeleton for x509 tls_peers CertificatePool
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Thu, 28 Jun 2007 23:47:07 +0000 |
parents | 6b7c234b4984 |
children | 22481079895a |
files | libpurple/certificate.c libpurple/certificate.h |
diffstat | 2 files changed, 57 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/certificate.c Thu Jun 28 23:33:53 2007 +0000 +++ b/libpurple/certificate.c Thu Jun 28 23:47:07 2007 +0000 @@ -253,6 +253,58 @@ }; + + +static PurpleCertificatePool x509_tls_peers; + +static gboolean +x509_tls_peers_init(void) +{ + /* TODO: Set up key cache here if it isn't already done */ + + return TRUE; +} + +static gboolean +x509_tls_peers_cert_in_pool(const gchar *id) +{ + g_return_val_if_fail(id, FALSE); + + /* TODO: Fill this out */ + return FALSE; +} + +static PurpleCertificate * +x509_tls_peers_get_cert(const gchar *id) +{ + g_return_val_if_fail(id, NULL); + + /* TODO: Fill this out */ + return NULL; +} + +static gboolean +x509_tls_peers_put_cert(PurpleCertificate *crt) +{ + g_return_val_if_fail(crt, FALSE); + + /* TODO: Fill this out */ + return FALSE; +} + +static PurpleCertificatePool x509_tls_peers = { + "x509", /* Scheme name */ + "tls_peers", /* Pool name */ + N_("SSL Peers Cache"), /* User-friendly name */ + NULL, /* Internal data */ + x509_tls_peers_init, /* init */ + NULL, /* uninit not required */ + x509_tls_peers_cert_in_pool, /* Certificate exists? */ + x509_tls_peers_get_cert, /* Cert retriever */ + x509_tls_peers_put_cert /* Cert writer */ +}; + + /****************************************************************************/ /* Subsystem */ /****************************************************************************/ @@ -261,6 +313,7 @@ { /* Register builtins */ purple_certificate_register_verifier(&x509_singleuse); + purple_certificate_register_pool(&x509_tls_peers); } void @@ -445,7 +498,7 @@ /* Initialize the pool if needed */ if (pool->init) { - success = pool->init(pool); + success = pool->init(); } else { success = TRUE; } @@ -482,7 +535,7 @@ /* Uninit the pool if needed */ if (pool->uninit) { - pool->uninit(pool); + pool->uninit(); } cert_pools = g_list_remove(cert_pools, pool);
--- a/libpurple/certificate.h Thu Jun 28 23:33:53 2007 +0000 +++ b/libpurple/certificate.h Thu Jun 28 23:47:07 2007 +0000 @@ -95,21 +95,16 @@ * * Upon calling purple_certificate_register_pool() , this function will * be called. May be NULL. - * @param pool Pool instance being registered. This will not be - * relevant for most applications. * @return TRUE if the initialization succeeded, otherwise FALSE */ - gboolean (* init)(PurpleCertificatePool *pool); + gboolean (* init)(void); /** * Uninit the Pool's internal state * * Will be called by purple_certificate_unregister_pool() . May be NULL - * - * @param pool Pool instance being unregistered. This will not be - * relevant for most applications. */ - void (* uninit)(PurpleCertificatePool *pool); + void (* uninit)(void); /** Check for presence of a certificate in the pool using unique ID */ gboolean (* cert_in_pool)(const gchar *id);