summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/external/storage.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-14 14:24:56 +0200
committerRobin Appelman <icewind@owncloud.com>2014-08-31 10:45:11 +0200
commitc2ebc192a6a6c7cb9cff958e412e0cc4aff15ead (patch)
treee95a69c9287d4fc6721e26e7c484d669ec157b2b /apps/files_sharing/lib/external/storage.php
parentecdbf006284fa4907b54f58ac6ba59f54b9738a5 (diff)
downloadnextcloud-server-c2ebc192a6a6c7cb9cff958e412e0cc4aff15ead.tar.gz
nextcloud-server-c2ebc192a6a6c7cb9cff958e412e0cc4aff15ead.zip
Make external shares work with imported self-signed certificates
Diffstat (limited to 'apps/files_sharing/lib/external/storage.php')
-rw-r--r--apps/files_sharing/lib/external/storage.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 855be2872b5..b3a8bdcc964 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -37,6 +37,11 @@ class Storage extends DAV implements ISharedStorage {
*/
private $token;
+ /**
+ * @var \OCP\ICertificateManager
+ */
+ private $certificateManager;
+
private $updateChecked = false;
/**
@@ -46,6 +51,7 @@ class Storage extends DAV implements ISharedStorage {
public function __construct($options) {
$this->manager = $options['manager'];
+ $this->certificateManager = $options['certificateManager'];
$this->remote = $options['remote'];
$this->remoteUser = $options['owner'];
list($protocol, $remote) = explode('://', $this->remote);
@@ -190,7 +196,11 @@ class Storage extends DAV implements ISharedStorage {
http_build_query(array('password' => $password)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $result = curl_exec($ch);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+ curl_setopt($ch, CURLOPT_CAINFO, $this->certificateManager->getCertificateBundle());
+
+ $result = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);