pkgsubmit.php: Ensure the session is linked to a valid user.

Prevent race conditions that may occur when either the session or the
user is deleted before we extract the actual user identifier.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2011-04-24 14:22:24 +02:00
parent 9ff30614b8
commit ed9c95623f

View file

@ -13,7 +13,14 @@ check_sid(); # see if they're still logged in
$cwd = getcwd(); $cwd = getcwd();
if ($_COOKIE["AURSID"]): if ($_COOKIE["AURSID"]) {
$uid = uid_from_sid($_COOKIE['AURSID']);
}
else {
$uid = NULL;
}
if ($uid):
# Track upload errors # Track upload errors
$error = ""; $error = "";
@ -51,8 +58,6 @@ if ($_COOKIE["AURSID"]):
fclose($fh); fclose($fh);
} }
$uid = uid_from_sid($_COOKIE['AURSID']);
if (!$error) { if (!$error) {
$tar = new Archive_Tar($_FILES['pfile']['tmp_name']); $tar = new Archive_Tar($_FILES['pfile']['tmp_name']);