aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Dav.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-08-31 21:38:03 -0700
committerzotlabs <mike@macgirvin.com>2017-08-31 21:38:03 -0700
commitae8cdc3b42a01bfa6a8a7baf80bad2544c3821a7 (patch)
tree859652d073439cf21cdd01f70bb7dfb35c73ef85 /Zotlabs/Module/Dav.php
parentb413beeb365ea09ac79f57e68dbb6ac49b5ea056 (diff)
downloadvolse-hubzilla-ae8cdc3b42a01bfa6a8a7baf80bad2544c3821a7.tar.gz
volse-hubzilla-ae8cdc3b42a01bfa6a8a7baf80bad2544c3821a7.tar.bz2
volse-hubzilla-ae8cdc3b42a01bfa6a8a7baf80bad2544c3821a7.zip
some changes after testing server-to-server magic auth
Diffstat (limited to 'Zotlabs/Module/Dav.php')
-rw-r--r--Zotlabs/Module/Dav.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php
index 8c4512806..d506fe9f5 100644
--- a/Zotlabs/Module/Dav.php
+++ b/Zotlabs/Module/Dav.php
@@ -41,6 +41,11 @@ class Dav extends \Zotlabs\Web\Controller {
/* Signature authentication */
if(array_key_exists($head,$_SERVER) && substr(trim($_SERVER[$head]),0,9) === 'Signature') {
+ if($head !== 'HTTP_AUTHORIZATION') {
+ $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER[$head];
+ continue;
+ }
+
$sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]);
if($sigblock) {
$keyId = $sigblock['keyId'];
@@ -52,19 +57,17 @@ class Dav extends \Zotlabs\Web\Controller {
$c = channelx_by_hash($r[0]['hubloc_hash']);
if($c) {
$a = q("select * from account where account_id = %d limit 1",
- intval($c[0]['channel_account_id'])
+ intval($c['channel_account_id'])
);
if($a) {
- $record = [ 'channel' => $c[0], 'account' => $a[0] ];
- $channel_login = $c[0]['channel_id'];
+ $record = [ 'channel' => $c, 'account' => $a[0] ];
+ $channel_login = $c['channel_id'];
}
}
}
if(! $record)
continue;
- if($head !== 'HTTP_AUTHORIZATION') {
- $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER[$head];
- }
+
if($record) {
$verified = \Zotlabs\Web\HTTPSig::verify('',$record['channel']['channel_pubkey']);
if(! ($verified && $verified['header_signed'] && $verified['header_valid'])) {