From 81c0fa31cf39a74a08c74dc01611cd2c9416b211 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 3 Mar 2014 23:27:29 +0100 Subject: [PATCH] Use 'tls-database' instead of deprecated 'ssl-ca-file'. --- src/main.h | 28 +++++++++++++++------------- src/setting.c | 19 ++++++++++++++----- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/main.h b/src/main.h index f39269c..4717989 100644 --- a/src/main.h +++ b/src/main.h @@ -287,19 +287,21 @@ typedef struct { } State; typedef struct { - time_t cookie_timeout; - int scrollstep; - char *home_page; - char *download_dir; - guint history_max; - char *editor_command; - guint timeoutlen; /* timeout for ambiguous mappings */ - gboolean strict_focus; - GHashTable *headers; /* holds user defined header appended to requests */ - char *nextpattern; /* regex patter nfor prev link matching */ - char *prevpattern; /* regex patter nfor next link matching */ - char *file; /* path to the custome config file */ - char *autocmd; /* command given by --cmd option */ + time_t cookie_timeout; + int scrollstep; + char *home_page; + char *download_dir; + guint history_max; + char *editor_command; + guint timeoutlen; /* timeout for ambiguous mappings */ + gboolean strict_focus; + GHashTable *headers; /* holds user defined header appended to requests */ + char *nextpattern; /* regex patter nfor prev link matching */ + char *prevpattern; /* regex patter nfor next link matching */ + char *file; /* path to the custome config file */ + char *autocmd; /* command given by --cmd option */ + char *cafile; /* path to the ca file */ + GTlsDatabase *tls_db; /* tls database */ } Config; typedef struct { diff --git a/src/setting.c b/src/setting.c index fc4a91a..8d267cf 100644 --- a/src/setting.c +++ b/src/setting.c @@ -626,13 +626,22 @@ static SettingStatus strict_focus(const Setting *s, const SettingType type) static SettingStatus ca_bundle(const Setting *s, const SettingType type) { - char *value; if (type == SETTING_GET) { - g_object_get(vb.session, "ssl-ca-file", &value, NULL); - print_value(s, value); - g_free(value); + print_value(s, vb.config.cafile); } else { - g_object_set(vb.session, "ssl-ca-file", s->arg.s, NULL); + GError *error = NULL; + vb.config.tls_db = g_tls_file_database_new(s->arg.s, &error); + if (error) { + g_warning("Could not load ssl database '%s': %s", s->arg.s, error->message); + g_error_free(error); + + return SETTING_ERROR; + } + + /* there is no function to get the file back from tls file database so + * it's saves as seperate configuration */ + OVERWRITE_STRING(vb.config.cafile, s->arg.s); + g_object_set(vb.session, "tls-database", vb.config.tls_db, NULL); } return SETTING_OK; -- 2.20.1