]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check for cert bundle existence before using it
authorVincent Petry <pvince81@owncloud.com>
Tue, 4 Nov 2014 15:44:42 +0000 (16:44 +0100)
committerVincent Petry <pvince81@owncloud.com>
Tue, 4 Nov 2014 15:44:42 +0000 (16:44 +0100)
apps/files_sharing/lib/external/storage.php

index 92d8f92b380100ce3ae52bf807b7a09153b83f35..2da0022028f176f8d72b6c78c7366328d47b585f 100644 (file)
@@ -198,12 +198,22 @@ class Storage extends DAV implements ISharedStorage {
 
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
-               curl_setopt($ch, CURLOPT_CAINFO, $this->certificateManager->getCertificateBundle());
+               $path = $this->certificateManager->getCertificateBundle();
+               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: