Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/619/head
Maxence Lange 2019-07-05 00:15:41 -01:00
rodzic b3514342f7
commit 6f549f0b64
2 zmienionych plików z 13 dodań i 9 usunięć

Wyświetl plik

@ -191,6 +191,7 @@ class SignatureService {
* @throws ItemUnknownException
* @throws RequestResultNotJsonException
* @throws DateTimeException
* @throws UnauthorizedFediverseException
*/
public function checkRequest(IRequest $request, int &$time = 0): string {
try {
@ -310,6 +311,7 @@ class SignatureService {
* @throws RequestContentException
* @throws RequestResultSizeException
* @throws RequestResultNotJsonException
* @throws UnauthorizedFediverseException
*/
private function checkRequestSignature(IRequest $request): string {
$signatureHeader = $request->getHeader('Signature');
@ -351,10 +353,11 @@ class SignatureService {
} catch (Exception $e) {
}
$estimated = "(request-target): " . $target;
$estimated = '';
foreach ($keys as $key) {
if ($key === '(request-target)') {
$estimated .= "(request-target): " . $target;
continue;
}
@ -363,10 +366,10 @@ class SignatureService {
$value = $this->configService->getCloudAddress(true);
}
$estimated .= "\n" . $key . ': ' . $value;
$estimated .= $key . ': ' . $value . "\n";
}
return $estimated;
return trim($estimated, "\n");
}
@ -449,6 +452,9 @@ class SignatureService {
case 'rsa-sha512':
return 'sha512';
case 'rsa-sha256':
return 'sha256';
default:
return 'sha256';
}

Wyświetl plik

@ -46,14 +46,12 @@ if (!array_key_exists('resource', $_GET)) {
$subject = $_GET['resource'];
$urlGenerator = OC::$server->getURLGenerator();
list($type, $account) = explode(':', $subject, 2);
if ($type !== 'acct') {
echo 'no acct';
exit();
if (strpos($subject, 'acct:') === 0) {
list($type, $account) = explode(':', $subject, 2);
} else {
$account = $subject;
}
list($username, $instance) = explode('@', $account);
try {
$cacheActorService = OC::$server->query(CacheActorService::class);