diff options
author | Josh Rickmar <jrick@devio.us> | 2012-05-07 15:19:45 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-05-11 15:31:44 -0400 |
commit | 503de15ac3fb268325e9a0ec2571b79e1f4da831 (patch) | |
tree | 768c319332f17821ab7ec062194301df31b6c184 /xxxterm.c | |
parent | 8a3a9a2ad2d50a4dc21a48f8a9366aa61c178ae4 (diff) | |
download | xombrero-503de15ac3fb268325e9a0ec2571b79e1f4da831.tar.gz |
Make most of the rest of the settings dynamic.
Diffstat (limited to 'xxxterm.c')
-rw-r--r-- | xxxterm.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/xxxterm.c b/xxxterm.c index d8d7fe8..5931aae 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -160,9 +160,6 @@ TAILQ_HEAD(command_list, command_entry); #define XT_SEARCH_NEXT (1) #define XT_SEARCH_PREV (2) -#define XT_STYLE_CURRENT_TAB (0) -#define XT_STYLE_GLOBAL (1) - #define XT_PASTE_CURRENT_TAB (0) #define XT_PASTE_NEW_TAB (1) @@ -461,6 +458,33 @@ get_current_tab(void) return (NULL); } +int +set_ssl_ca_file(char *file) +{ + struct stat sb; + + if (file == NULL || strlen(file) == 0) + return (-1); + if (stat(file, &sb)) { + warnx("no CA file: %s", file); + if (ssl_ca_file == file) { /* check and fix */ + g_free(ssl_ca_file); + ssl_ca_file = NULL; + } + return (-1); + } + if (ssl_ca_file != file) { /* set dynamically */ + if (ssl_ca_file) + g_free(ssl_ca_file); + ssl_ca_file = g_strdup(file); + } + g_object_set(session, + SOUP_SESSION_SSL_CA_FILE, ssl_ca_file, + SOUP_SESSION_SSL_STRICT, ssl_strict_certs, + (void *)NULL); + return (0); +} + void set_status(struct tab *t, gchar *s, int status) { @@ -7918,17 +7942,7 @@ main(int argc, char **argv) setup_cookies(); /* certs */ - if (ssl_ca_file) { - if (stat(ssl_ca_file, &sb)) { - warnx("no CA file: %s", ssl_ca_file); - g_free(ssl_ca_file); - ssl_ca_file = NULL; - } else - g_object_set(session, - SOUP_SESSION_SSL_CA_FILE, ssl_ca_file, - SOUP_SESSION_SSL_STRICT, ssl_strict_certs, - (void *)NULL); - } + set_ssl_ca_file(ssl_ca_file); /* guess_search regex */ if (url_regex == NULL) |