[Pkg-owncloud-commits] [owncloud] 19/34: Check for cert bundle existence before using it

David Prévot taffit at moszumanska.debian.org
Fri Nov 7 11:44:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 3f35822e24597ae353a44a90662c86d423e8d531
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Nov 4 16:49:25 2014 +0100

    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 665978e..41a822f 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:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list