summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 10:10:00 +0200
committerSimon Rettberg2017-04-21 10:10:00 +0200
commitdb44704ce902c6b4dc967ef811de9d07a42397b1 (patch)
tree62e2b79c26d426dc3243cba92a76930001bfe3a4
parent[locatrioninfo] Add translation hook for coursebackends (diff)
downloadslx-admin-db44704ce902c6b4dc967ef811de9d07a42397b1.tar.gz
slx-admin-db44704ce902c6b4dc967ef811de9d07a42397b1.tar.xz
slx-admin-db44704ce902c6b4dc967ef811de9d07a42397b1.zip
[locationinfo] Properly support certificate and hostname verification
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php13
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php4
2 files changed, 11 insertions, 6 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
index 2f60249e..88e50df4 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
@@ -4,6 +4,8 @@ class CourseBackend_Davinci extends CourseBackend
{
private $location;
+ private $verifyHostname = true;
+ private $verifyCert = true;
public function setCredentialsInternal($data)
{
@@ -13,7 +15,8 @@ class CourseBackend_Davinci extends CourseBackend
}
$location = preg_replace('#/+(davinciis\.dll)?\W*$#i', '', $data['baseUrl']);
$this->location = $location . "/DAVINCIIS.dll?";
- //Davinci doesn't have credentials
+ $this->verifyHostname = $data['verifyHostname'];
+ $this->verifyCert = $data['verifyCert'];
return true;
}
@@ -33,7 +36,9 @@ class CourseBackend_Davinci extends CourseBackend
public function getCredentialDefinitions()
{
return [
- new BackendProperty('baseUrl', 'string')
+ new BackendProperty('baseUrl', 'string'),
+ new BackendProperty('verifyCert', 'bool', true),
+ new BackendProperty('verifyHostname', 'bool', true)
];
}
@@ -66,8 +71,8 @@ class CourseBackend_Davinci extends CourseBackend
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_SSL_VERIFYHOST => false,
- CURLOPT_SSL_VERIFYPEER => false,
+ CURLOPT_SSL_VERIFYHOST => $this->verifyHostname ? 2 : 0,
+ CURLOPT_SSL_VERIFYPEER => $this->verifyCert ? 1 : 0,
CURLOPT_URL => $url,
);
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
index cc1d243a..0a222b6f 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
@@ -182,8 +182,8 @@ class CourseBackend_HisInOne extends CourseBackend
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_SSL_VERIFYHOST => $this->verifyHostname,
- CURLOPT_SSL_VERIFYPEER => $this->verifyCert,
+ CURLOPT_SSL_VERIFYHOST => $this->verifyHostname ? 2 : 0,
+ CURLOPT_SSL_VERIFYPEER => $this->verifyCert ? 1 : 0,
CURLOPT_URL => $this->location,
CURLOPT_POSTFIELDS => $request,
CURLOPT_HTTPHEADER => $header,