diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-05-30 16:59:08 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2010-05-30 16:59:08 +0200 |
commit | 70f9089fcfb857da0864ec0701f2a886b5e1dbff (patch) | |
tree | 3a25fe86cf1d1da77781a320d20db7c079c1c5dd /paste/include/storage/StorageEngine.php | |
parent | 1727e589f05ee351fb45a4a94cd5eeba13b5ef7c (diff) | |
download | rafb-nopaste-70f9089fcfb857da0864ec0701f2a886b5e1dbff.tar.gz rafb-nopaste-70f9089fcfb857da0864ec0701f2a886b5e1dbff.tar.xz rafb-nopaste-70f9089fcfb857da0864ec0701f2a886b5e1dbff.zip |
fix bug allowing every one to delete the paste
with the mysql storage back end on every call the delete token
was regenerated so, that every one could delete the paste
Diffstat (limited to 'paste/include/storage/StorageEngine.php')
-rw-r--r-- | paste/include/storage/StorageEngine.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/paste/include/storage/StorageEngine.php b/paste/include/storage/StorageEngine.php index db6e34b..09e1676 100644 --- a/paste/include/storage/StorageEngine.php +++ b/paste/include/storage/StorageEngine.php @@ -38,11 +38,17 @@ abstract class StorageEngine abstract public function getContent($pid); abstract public function delContent($pid); - public function generateToken($name) + public function generateToken($name, $remote = '') { global $config; - $ipAddr = $_SERVER["REMOTE_ADDR"]; + if (! empty($remote)) { + $ipAddr = $remote; + } + else { + $ipAddr = $_SERVER["REMOTE_ADDR"]; + } + return sha1($name . $ipAddr . $config['token_salt']); } } |