aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-04-12 20:49:04 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-04-12 20:52:05 -0300
commite22107cf0954f29215052becf848bc28b47ffbe0 (patch)
tree92c85a48e6eb2a17dbcf251bd425a5c35ea6123f
parent29286c7c3edefc3d77ea529bbe325718cace64db (diff)
downloadbackupninja-e22107cf0954f29215052becf848bc28b47ffbe0.tar.gz
backupninja-e22107cf0954f29215052becf848bc28b47ffbe0.tar.bz2
Validate created date on long_rotation to avoid too many arguments at comparison (upstream #3868)
-rw-r--r--handlers/rsync.in10
1 files changed, 10 insertions, 0 deletions
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 ))