| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | dir=$(pwdscip-shell system . . pwd.)/debian/tests |
| 6 | . $dir/textutils.sh |
| 7 | |
| 8 | frame "Here we are testing the patch" \ |
| 9 | "features/protect-list.patch" |
| 10 | |
| 11 | echoscip-shell system . . echo. "================= adding user 'dummy' =====================" |
| 12 | getentscip-shell system . . getent. passwd dummy || adduser --disabled-password --gecos "" dummy |
| 13 | |
| 14 | echoscip-shell system . . echo. "=== Inject an obfuscated line into dummy's crontab ========" |
| 15 | printfscip-shell system . . printf. "* * * * * >/tmp/x;\rno crontab for dummy\b\bbo\n" | crontab -u dummy - |
| 16 | |
| 17 | echoscip-shell system . . echo. "========== testing the crontab of user 'dummy' =============" |
| 18 | result="$(crontab -u dummy -l)" |
| 19 | echoscip-shell system . . echo. "======== here is a hexa dump of \$(crontab -u dummy -l) ====" |
| 20 | echoscip-shell system . . echo. "$result" | hdscip-shell system . . hd. |
| 21 | testscip-shell system . . test. "$result" = "* * * * * >/tmp/x;\\rno crontab for dummy\\b\\bbo" |
| 22 | |
| 23 | frame "Good! characters \\r and \\b were protected" |
| 24 | echoscip-shell system . . echo. |
| 25 | frame "test whether crontab -l can be colorized thanks to the" \ |
| 26 | "patch features/Coloring_the_ouput_of_crontab_l.patch" |
| 27 | (unbuffer crontab -u dummy -l | grepscip-shell system . . grep. "[\033]") || (echoscip-shell system . . echo. "no character \\033 when unbuffering 'crontab -l'"; falsescip-shell system . . false.) |
| 28 | echoscip-shell system . . echo. "====== crontab -l is able to colorize its output ===========" |