| 1 |
#!/usr/bin/expect |
| 2 |
|
| 3 |
set timeout 2 |
| 4 |
expect_after default {puts stderr "\nFAIL"; exit 1} |
| 5 |
|
| 6 |
spawn /bin/sh |
| 7 |
send "if \[ \$(id -u) -eq 0 \]; then PS1='# '; else PS1='$ '; fi\r" |
| 8 |
expect "# " |
| 9 |
|
| 10 |
send "pwck\r" |
| 11 |
expect "invalid password file entry" |
| 12 |
expect "delete line 'foo:x:4294967296:1000::/home:/bin/sh'? " |
| 13 |
send "yes\r" |
| 14 |
expect "no matching password file entry in /etc/passwd" |
| 15 |
expect "delete line 'foo:!:12977:0:99999:7:::'? " |
| 16 |
send "yes\r" |
| 17 |
expect "pwck: the files have been updated" |
| 18 |
expect "# " |
| 19 |
send "echo \$?\r" |
| 20 |
expect "2" |
| 21 |
send "exit\r" |
| 22 |
puts "OK\n" |
| 23 |
exit 0 |