From 3f35822e24597ae353a44a90662c86d423e8d531 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 4 Nov 2014 16:49:25 +0100 Subject: [PATCH] Check for cert bundle existence before using it --- apps/files_sharing/lib/external/storage.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php index 665978ea976..41a822fbb27 100644 --- a/apps/files_sharing/lib/external/storage.php +++ b/apps/files_sharing/lib/external/storage.php @@ -193,12 +193,21 @@ class Storage extends DAV implements ISharedStorage { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $path = \OC_User::getHome(\OC_User::getUser()) . '/files_external/rootcerts.crt'; - curl_setopt($ch, CURLOPT_CAINFO, $path); + if (is_readable($path)) { + curl_setopt($ch, CURLOPT_CAINFO, $path); + } $result = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $errorMessage = null; + if ($status === 0) { + $errorMessage = curl_error($ch); + } curl_close($ch); + if ($errorMessage) { + throw new \Exception($errorMessage); + } switch ($status) { case 401: -- 2.39.5