From 6502c169013854525b5103a668bc7d5644f2028d Mon Sep 17 00:00:00 2001 From: bju Date: Sat, 22 Apr 2017 15:56:41 +0200 Subject: Fix handling of multiple certificate files --- vdr-vdrmanager/vdrmanager.cpp | 2 +- vdr-vdrmanager/vdrmanagerthread.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/vdr-vdrmanager/vdrmanager.cpp b/vdr-vdrmanager/vdrmanager.cpp index d61f8a1..791d6a5 100644 --- a/vdr-vdrmanager/vdrmanager.cpp +++ b/vdr-vdrmanager/vdrmanager.cpp @@ -159,7 +159,7 @@ bool cVdrManager::ProcessArgs(int argc, char *argv[]) { certFile = keyFile = optarg; } else { certFile = strndup(optarg, sep - optarg); - keyFile = sep; + keyFile = sep+1; } } break; diff --git a/vdr-vdrmanager/vdrmanagerthread.cpp b/vdr-vdrmanager/vdrmanagerthread.cpp index b0c37ba..3eaae36 100644 --- a/vdr-vdrmanager/vdrmanagerthread.cpp +++ b/vdr-vdrmanager/vdrmanagerthread.cpp @@ -68,14 +68,19 @@ bool cVdrManagerThread::Init() #if VDRMANAGER_USE_SSL cVdrmanagerServerSocket * sslSock; - if (!access(certFile, R_OK) && !access(keyFile, R_OK)) { + bool certFileOk = !access(certFile, R_OK); + bool keyFileOk = !access(keyFile, R_OK); + if (certFileOk && keyFileOk) { sslSock = new cVdrmanagerServerSocket(); if (sslSock == NULL || !sslSock->Create(sslPort, password, forceCheckSvdrp, compressionMode, certFile, keyFile)) { return false; } } else { sslSock = NULL; - esyslog("[vdrmanager] SSL key files %s and %s can't be read. SSL disabled.", certFile, keyFile); + if (!certFileOk) + esyslog("[vdrmanager] SSL cert file %s can't be read (errno %d). SSL disabled.", certFile, errno); + if (!keyFileOk) + esyslog("[vdrmanager] SSL key file %s can't be read (errno %d). SSL disabled.", keyFile, errno); } // register server sockets -- cgit v1.2.3