]> gitweb.fluxo.info Git - backupninja.git/commitdiff
Validate created date on long_rotation to avoid too many arguments at comparison...
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 12 Apr 2012 23:49:04 +0000 (20:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 12 Apr 2012 23:52:05 +0000 (20:52 -0300)
handlers/rsync.in

index 68ab392d4c3197e78455d5f2d2713c982460ac05..31449c2c759a9fd78893cf3723030fa8ea3e1c00 100644 (file)
@@ -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 ))