Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Fix for Bug 880699
Browse files Browse the repository at this point in the history
restorer.php security patch
  • Loading branch information
jwhonce committed Dec 5, 2012
1 parent f5d91bb commit 32564a0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions node-util/www/html/restorer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php

list($blank, $uuid, $blank) = split("/", $_SERVER["PATH_INFO"]);
shell_exec("/usr/sbin/oo-restorer-wrapper.sh $uuid");

sleep(2);
$url=str_replace("/$uuid", "", $_SERVER["PATH_INFO"]);
header("Location: $url");

if (preg_match('/[0-9a-fA-F]{32}/', $uuid)) {
shell_exec("/usr/sbin/oo-restorer-wrapper.sh $uuid");
sleep(2);
$host = $_SERVER['HTTP_HOST'];
$proto = "http" . ( isset($_SERVER['HTTPS']) ? 's' : '' ) . '://';
$url=str_replace("/$uuid", "", $_SERVER["PATH_INFO"]);
header("Location: $proto$host$url");
} else {
// someone is trying to attack
error_log("Invalid uuid $uuid given to restorer.php");
header('HTTP/1.0 403 Forbidden');
}
?>

0 comments on commit 32564a0

Please sign in to comment.