Make external shares work with imported self-signed certificates
This commit is contained in:
parent
ecdbf00628
commit
c2ebc192a6
2 changed files with 14 additions and 2 deletions
4
apps/files_sharing/lib/external/manager.php
vendored
4
apps/files_sharing/lib/external/manager.php
vendored
|
@ -113,9 +113,11 @@ class Manager {
|
||||||
* @return Mount
|
* @return Mount
|
||||||
*/
|
*/
|
||||||
protected function mountShare($data) {
|
protected function mountShare($data) {
|
||||||
|
$user = $this->userSession->getUser();
|
||||||
$data['manager'] = $this;
|
$data['manager'] = $this;
|
||||||
$mountPoint = '/' . $this->userSession->getUser()->getUID() . '/files' . $data['mountpoint'];
|
$mountPoint = '/' . $user->getUID() . '/files' . $data['mountpoint'];
|
||||||
$data['mountpoint'] = $mountPoint;
|
$data['mountpoint'] = $mountPoint;
|
||||||
|
$data['certificateManager'] = \OC::$server->getCertificateManager($user);
|
||||||
$mount = new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader);
|
$mount = new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader);
|
||||||
$this->mountManager->addMount($mount);
|
$this->mountManager->addMount($mount);
|
||||||
return $mount;
|
return $mount;
|
||||||
|
|
12
apps/files_sharing/lib/external/storage.php
vendored
12
apps/files_sharing/lib/external/storage.php
vendored
|
@ -37,6 +37,11 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
*/
|
*/
|
||||||
private $token;
|
private $token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \OCP\ICertificateManager
|
||||||
|
*/
|
||||||
|
private $certificateManager;
|
||||||
|
|
||||||
private $updateChecked = false;
|
private $updateChecked = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +51,7 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
|
|
||||||
public function __construct($options) {
|
public function __construct($options) {
|
||||||
$this->manager = $options['manager'];
|
$this->manager = $options['manager'];
|
||||||
|
$this->certificateManager = $options['certificateManager'];
|
||||||
$this->remote = $options['remote'];
|
$this->remote = $options['remote'];
|
||||||
$this->remoteUser = $options['owner'];
|
$this->remoteUser = $options['owner'];
|
||||||
list($protocol, $remote) = explode('://', $this->remote);
|
list($protocol, $remote) = explode('://', $this->remote);
|
||||||
|
@ -190,7 +196,11 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
http_build_query(array('password' => $password)));
|
http_build_query(array('password' => $password)));
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
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);
|
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
Loading…
Reference in a new issue