summaryrefslogtreecommitdiff
path: root/src/settings.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-09-27 15:17:59 +0200
committerLars-Dominik Braun <lars@6xq.net>2011-11-09 20:10:16 +0100
commit3b149d10572392da66f57a7e2aaac53ba424e45c (patch)
tree9a3af96c399971862dffe62d763af55031210934 /src/settings.c
parent0cfe02843cb400b8bc8d28644df350b205e263c7 (diff)
downloadpianobar-3b149d10572392da66f57a7e2aaac53ba424e45c.tar.gz
pianobar-3b149d10572392da66f57a7e2aaac53ba424e45c.tar.bz2
pianobar-3b149d10572392da66f57a7e2aaac53ba424e45c.zip
Added TLS settings
Diffstat (limited to 'src/settings.c')
-rw-r--r--src/settings.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/settings.c b/src/settings.c
index 9867b47..04bfff0 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -93,6 +93,9 @@ void BarSettingsDestroy (BarSettings_t *settings) {
free (settings->npStationFormat);
free (settings->listSongFormat);
free (settings->fifo);
+#ifdef ENABLE_TLS
+ free (settings->tlsCaPath);
+#endif
for (size_t i = 0; i < MSG_COUNT; i++) {
free (settings->msgFormat[i].prefix);
free (settings->msgFormat[i].postfix);
@@ -131,6 +134,10 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->listSongFormat = strdup ("%i) %a - %t%r");
settings->fifo = malloc (PATH_MAX * sizeof (*settings->fifo));
BarGetXdgConfigDir (PACKAGE "/ctl", settings->fifo, PATH_MAX);
+#ifdef ENABLE_TLS
+ settings->tls = true;
+ settings->tlsCaPath = strdup ("/etc/ssl/certs/ca-certificates.crt");
+#endif
settings->msgFormat[MSG_NONE].prefix = NULL;
settings->msgFormat[MSG_NONE].postfix = NULL;
@@ -239,6 +246,17 @@ void BarSettingsRead (BarSettings_t *settings) {
} else if (streq ("fifo", key)) {
free (settings->fifo);
settings->fifo = strdup (val);
+#ifdef ENABLE_TLS
+ } else if (streq ("tls", key)) {
+ if (streq ("1", val)) {
+ settings->tls = true;
+ } else {
+ settings->tls = false;
+ }
+ } else if (streq ("tls_ca_path", key)) {
+ free (settings->tlsCaPath);
+ settings->tlsCaPath = strdup (val);
+#endif
} else if (strncmp (formatMsgPrefix, key,
strlen (formatMsgPrefix)) == 0) {
static const char *mapping[] = {"none", "info", "nowplaying",