From a8aec94b90ee2c15bb69380ffb97b662c6d8b5bc Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 19 Mar 2016 08:41:51 +0100 Subject: Only accept numbers from .publish.ttl files --- publish-purge | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/publish-purge b/publish-purge index ea65755..0be0fd7 100755 --- a/publish-purge +++ b/publish-purge @@ -57,7 +57,14 @@ cleanit() d=$(readlink -f -- "$d") if [ -e "$d/.publish.ttl" ]; then - ttl="$(cat "$d/.publish.ttl")" + local newttl + newttl="$(cat "$d/.publish.ttl")" + if [ "$newttl" -eq "$newttl" ] 2>/dev/null; then + # if it is a number + ttl="$newttl" + else + [ "$optVerbose" -ge "1" ] && echo "Ignoring invalid TTL setting '$newttl' in $d" + fi fi if test_if_ancient "$d" "$ttl"; then -- cgit v1.2.3