aboutsummaryrefslogtreecommitdiffstats
path: root/mod/cloud.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-11 15:22:58 -0800
committerfriendica <info@friendica.com>2015-01-11 15:22:58 -0800
commit3f4f3e244a7095538c288e66a17195d1bcceb48c (patch)
tree4473c3fa039e37f816c87e709ada0e52fbb0f1e2 /mod/cloud.php
parent381f8a1b4275823712b3cb9f27c17d9b624d1e8e (diff)
downloadvolse-hubzilla-3f4f3e244a7095538c288e66a17195d1bcceb48c.tar.gz
volse-hubzilla-3f4f3e244a7095538c288e66a17195d1bcceb48c.tar.bz2
volse-hubzilla-3f4f3e244a7095538c288e66a17195d1bcceb48c.zip
that was not intended to be merged with master yet. Put it under a define
Diffstat (limited to 'mod/cloud.php')
-rw-r--r--mod/cloud.php38
1 files changed, 36 insertions, 2 deletions
diff --git a/mod/cloud.php b/mod/cloud.php
index 03676c599..abeae88eb 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -12,6 +12,29 @@ use RedMatrix\RedDAV;
// composer autoloader for SabreDAV
require_once('vendor/autoload.php');
+if(! defined('TRINIDAD')) {
+ // workaround for HTTP-auth in CGI mode
+ if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+ }
+
+ if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
+ $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+ }
+}
+
+
+
/**
* @brief Fires up the SabreDAV server.
*
@@ -107,8 +130,19 @@ function cloud_init(&$a) {
}
if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
- logger('mod_cloud: auth exception' . $e->getMessage());
- http_status_exit($e->getHTTPCode(), $e->getMessage());
+ if(defined('TRINIDAD')) {
+ logger('mod_cloud: auth exception' . $e->getMessage());
+ http_status_exit($e->getHTTPCode(), $e->getMessage());
+ }
+ else {
+ try {
+ $auth->Authenticate($server, t('RedMatrix channel'));
+ }
+ catch (Exception $e) {
+ logger('mod_cloud: auth exception' . $e->getMessage());
+ http_status_exit($e->getHTTPCode(), $e->getMessage());
+ }
+ }
}
require_once('include/RedDAV/RedBrowser.php');