Use 'tls-database' instead of deprecated 'ssl-ca-file'.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 3 Mar 2014 22:27:29 +0000 (23:27 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 3 Mar 2014 22:27:29 +0000 (23:27 +0100)
src/main.h
src/setting.c

index f39269c..4717989 100644 (file)
@@ -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 {
index fc4a91a..8d267cf 100644 (file)
@@ -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;