Commit Graph

6 Commits

Author SHA1 Message Date
Jan-Philipp Litza afce06c3d3 gluon-cron: Fix endless loop parsing invalid lines
Using the line
```
* * * * echo "foobar"
```
(notice the missing fifth time field) in a crontab causes gluon-cron
to enter an endless loop while parsing it, thus it won't even execute
the other, valid crontabs.

This is caused by the loop in [line 138] where `begin - min`
substracts the unsigned `min` from the signed `begin`. If now `begin`
is invalid, `strict_atoi` returns -1 and the loop starts at
`(-1)-1=MAX_INT` and runs while `i <= MAX_INT` which is always true.

The real culprit lies in [line 134] where exactly this case
`begin < min` is checked - but because of the signedness, this check doesn't
work as expected either.

The easiest solution is to make `min` a signed integer instead of an unsigned
one, as we do not require it to be very large and only pass the constants 0 or
1 to it.

To avoid other similar problems, this patch makes the input variable `n` a
signed integer as well.
2014-08-27 10:20:04 +02:00
Matthias Schiffer d204b0e24f Remove initscript enable/disable hacks
Better configure these properly.
2014-01-13 18:29:00 +01:00
Matthias Schiffer 1be0a7667f Make package version depend on the site config version where necessary 2014-01-04 09:19:13 +01:00
Matthias Schiffer 0a9b811477 gluon-cron: always enable cron when it is installed 2013-10-02 20:33:32 +02:00
Matthias Schiffer 639e300a93 gluon-crond: fix matches == 6 case 2013-09-29 22:18:24 +02:00
Matthias Schiffer b1c14b2b97 Add gluon-cron package 2013-09-29 21:55:57 +02:00