Added path expansion for ca-bundle setting.
authorDaniel Carl <danielcarl@gmx.de>
Tue, 20 May 2014 20:44:50 +0000 (22:44 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 20 May 2014 20:50:38 +0000 (22:50 +0200)
The setting ca-bundle can use $ENV, ${ENV} ~user and ~/ for the file path.

doc/vimb.1
src/setting.c

index ff850fd..2a50f22 100644 (file)
@@ -679,7 +679,8 @@ reflective XSS attacks on vulnerable web sites.
 .SS Vimb-Settings
 .TP
 .B ca-bundle (string)
-The path to the crt file for the certificate validation.
+The path to the crt file for the certificate validation. The given path is
+expanded with standard file expansion.
 .TP
 .B completion-bg-active (color)
 Background color for selected completion item.
index 5bb6ce0..682d9e4 100644 (file)
@@ -638,11 +638,15 @@ static SettingStatus strict_focus(const Setting *s, const SettingType type)
 
 static SettingStatus ca_bundle(const Setting *s, const SettingType type)
 {
+    char *expanded;
+    GError *error = NULL;
     if (type == SETTING_GET) {
         print_value(s, vb.config.cafile);
     } else {
-        GError *error = NULL;
-        vb.config.tls_db = g_tls_file_database_new(s->arg.s, &error);
+        /* expand the given file and set it to the file database */
+        expanded         = util_expand(s->arg.s);
+        vb.config.tls_db = g_tls_file_database_new(expanded, &error);
+        g_free(expanded);
         if (error) {
             g_warning("Could not load ssl database '%s': %s", s->arg.s, error->message);
             g_error_free(error);
@@ -651,7 +655,7 @@ static SettingStatus ca_bundle(const Setting *s, const SettingType type)
         }
 
         /* there is no function to get the file back from tls file database so
-         * it's saves as seperate configuration */
+         * it's saved as seperate configuration */
         OVERWRITE_STRING(vb.config.cafile, s->arg.s);
         g_object_set(vb.session, "tls-database", vb.config.tls_db, NULL);
     }