From: Daniel Carl Date: Tue, 20 May 2014 20:44:50 +0000 (+0200) Subject: Added path expansion for ca-bundle setting. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=a3f91cbc80616229f3f36e4238fe70b0c0418bf9;p=vimb.git Added path expansion for ca-bundle setting. The setting ca-bundle can use $ENV, ${ENV} ~user and ~/ for the file path. --- diff --git a/doc/vimb.1 b/doc/vimb.1 index ff850fd..2a50f22 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -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. diff --git a/src/setting.c b/src/setting.c index 5bb6ce0..682d9e4 100644 --- a/src/setting.c +++ b/src/setting.c @@ -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); }