diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-10-09 11:41:15 +0200 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-10-09 11:41:15 +0200 |
commit | 2f93cce4dc3e659ce11ccae93fb256cec1258062 (patch) | |
tree | bb1b47441eb37e68042dab7a004e9db2b016b219 | |
parent | 7b060df85dd4ad3cc2236886fab2e7541ae58cb9 (diff) | |
download | scripts-2f93cce4dc3e659ce11ccae93fb256cec1258062.tar.gz |
tmp-upload: fix upload when open_basedir is set
-rwxr-xr-x | tmp-upload | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -11,9 +11,12 @@ if [ -n "$1" ]; then fi fi -out="$(mktemp /tmp/tmp-upload-php.XXXXXXXX)" +# Temporary directory for storing uploads and PHP script +tmpdir="$(mktemp -d)" + +out="$tmpdir/upload.php" cleanup() { - rm -v "$out" + rm -rvf "$tmpdir" } trap cleanup EXIT @@ -22,7 +25,8 @@ startline=$(grep -hn -F -m 1 "# stuff ""below" "$0" | cut -d: -f1) tail -n+$((startline+1)) "$0" > "$out" php -d post_max_size=128M -d upload_max_filesize=128M \ - -d open_basedir="$out:$(pwd)/" \ + -d upload_tmp_dir="$tmpdir/" \ + -d open_basedir="$tmpdir/:$(pwd)/" \ -S "$host:$port" "$out" exit # stuff below |