commit f3dedc4f366bf947066f023c56a74e6c18dddf7b
parent aa04debaad78e420a81356959632876e85c4bee7
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sun, 1 Jul 2018 13:46:58 +0200
Refine permissions when creating dir/files.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/txthole b/src/txthole
@@ -29,11 +29,12 @@ run() {
}
main() {
- mkdir -p "$pastes"
+ mkdir -pm 0740 "$pastes"
rm -f "$fifo"
mkfifo "$fifo"
while : ; do
paste="$(mktemp -q "$pastes/txthole.XXXXX.paste")"
+ chmod g+r "$paste" # the webserver needs to read
cat "$fifo" |tee -a "$paste" | run "$paste" | nc -4Nl "$port" > "$fifo"
[ "$(wc -c "$paste" |cut -d' ' -f1)" -eq 0 ] && rm -f "$paste"
done