diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-06-15 20:01:43 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-06-15 20:01:43 +0200 |
commit | 61dbc218e747f1b550a2615ffe3065024db29239 (patch) | |
tree | cd46a89a6e5346e7e100e132bff057d4b69b1f5c /src | |
parent | 4458cbab76fd98989fa2d4260dd20bbbd66297a4 (diff) | |
download | pianobar-61dbc218e747f1b550a2615ffe3065024db29239.tar.gz pianobar-61dbc218e747f1b550a2615ffe3065024db29239.tar.bz2 pianobar-61dbc218e747f1b550a2615ffe3065024db29239.zip |
Replace setting tls_fingerprint with ca_bundle
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.c | 16 | ||||
-rw-r--r-- | src/settings.h | 3 | ||||
-rw-r--r-- | src/ui.c | 3 |
3 files changed, 7 insertions, 15 deletions
diff --git a/src/settings.c b/src/settings.c index 6ee9df2..37928a9 100644 --- a/src/settings.c +++ b/src/settings.c @@ -177,9 +177,6 @@ void BarSettingsRead (BarSettings_t *settings) { settings->outkey = strdup ("6#26FRL$ZWD"); settings->fifo = BarGetXdgConfigDir (PACKAGE "/ctl"); assert (settings->fifo != NULL); - memcpy (settings->tlsFingerprint, "\x2D\x0A\xFD\xAF\xA1\x6F\x4B\x5C\x0A" - "\x43\xF3\xCB\x1D\x47\x52\xF9\x53\x55\x07\xC0", - sizeof (settings->tlsFingerprint)); settings->msgFormat[MSG_NONE].prefix = NULL; settings->msgFormat[MSG_NONE].postfix = NULL; @@ -253,6 +250,9 @@ void BarSettingsRead (BarSettings_t *settings) { } else if (streq ("decrypt_password", key)) { free (settings->inkey); settings->inkey = strdup (val); + } else if (streq ("ca_bundle", key)) { + free (settings->caBundle); + settings->caBundle = strdup (val); } else if (memcmp ("act_", key, 4) == 0) { size_t i; /* keyboard shortcuts */ @@ -323,16 +323,6 @@ void BarSettingsRead (BarSettings_t *settings) { settings->fifo = BarSettingsExpandTilde (val, userhome); } else if (streq ("autoselect", key)) { settings->autoselect = atoi (val); - } else if (streq ("tls_fingerprint", key)) { - /* expects 40 byte hex-encoded sha1 */ - if (strlen (val) == 40) { - for (size_t i = 0; i < 20; i++) { - char hex[3]; - memcpy (hex, &val[i*2], 2); - hex[2] = '\0'; - settings->tlsFingerprint[i] = strtol (hex, NULL, 16); - } - } } else if (strncmp (formatMsgPrefix, key, strlen (formatMsgPrefix)) == 0) { static const char *mapping[] = {"none", "info", "nowplaying", diff --git a/src/settings.h b/src/settings.h index ae22111..0ce5611 100644 --- a/src/settings.h +++ b/src/settings.h @@ -101,8 +101,7 @@ typedef struct { char *npStationFormat; char *listSongFormat; char *fifo; - char *rpcHost, *rpcTlsPort, *partnerUser, *partnerPassword, *device, *inkey, *outkey; - char tlsFingerprint[20]; + char *rpcHost, *rpcTlsPort, *partnerUser, *partnerPassword, *device, *inkey, *outkey, *caBundle; char keys[BAR_KS_COUNT]; BarMsgFormatStr_t msgFormat[MSG_COUNT]; } BarSettings_t; @@ -186,6 +186,9 @@ static CURLcode BarPianoHttpRequest (CURL * const http, setAndCheck (CURLOPT_WRITEDATA, &buffer); setAndCheck (CURLOPT_POST, 1); setAndCheck (CURLOPT_TIMEOUT, 30); + if (settings->caBundle != NULL) { + setAndCheck (CURLOPT_CAINFO, settings->caBundle); + } /* set up proxy (control proxy for non-us citizen or global proxy for poor * firewalled fellows) */ |