From e22107cf0954f29215052becf848bc28b47ffbe0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 12 Apr 2012 20:49:04 -0300 Subject: Validate created date on long_rotation to avoid too many arguments at comparison (upstream #3868) --- handlers/rsync.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/handlers/rsync.in b/handlers/rsync.in index 68ab392..31449c2 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -421,6 +421,11 @@ function rotate_long { else created=0 fi + # Validate created date + if [ -z "$created" ] || echo $created | grep -v -q -e '^[0-9]*$'; then + warning "Invalid metatada $created. Skipping rotation." + break + fi cutoff_time=$(( now - (seconds*(i-1)) )) if [ ! $created -gt $cutoff_time ]; then next=$(( i + 1 )) @@ -539,6 +544,11 @@ function rotate_long_remote { else created=0 fi + # Validate created date + if [ -z "\$created" ] || echo \$created | grep -v -q -e '^[0-9]*$'; then + echo "Warning: Invalid metatada \$created. Skipping rotation." + break + fi cutoff_time=\$(( now - (seconds*(i-1)) )) if [ ! \$created -gt \$cutoff_time ]; then next=\$(( i + 1 )) -- cgit v1.2.3