Mercurial > pidgin.yaz
changeset 18991:7a144f2229c6
- Add tls_peers put_cert
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Sat, 07 Jul 2007 20:49:22 +0000 |
parents | 3f2944bdb404 |
children | 605e69fa7108 |
files | libpurple/certificate.c |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/certificate.c Fri Jul 06 00:31:24 2007 +0000 +++ b/libpurple/certificate.c Sat Jul 07 20:49:22 2007 +0000 @@ -363,10 +363,21 @@ static gboolean x509_tls_peers_put_cert(const gchar *id, PurpleCertificate *crt) { - g_return_val_if_fail(crt, FALSE); + gboolean ret = FALSE; + gchar *keypath; - /* TODO: Fill this out */ - return FALSE; + g_return_val_if_fail(crt, FALSE); + g_return_val_if_fail(crt->scheme, FALSE); + /* Make sure that this is some kind of X.509 certificate */ + /* This check may be excessively paranoid */ + g_return_val_if_fail(crt->scheme == purple_certificate_find_scheme(x509_tls_peers.scheme_name), FALSE); + + /* Work out the filename and export */ + keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id); + ret = purple_certificate_export(keypath, crt); + + g_free(keypath); + return ret; } static PurpleCertificatePool x509_tls_peers = {