Add tests from the old svn tree

We're losing the svn history (which we could probably keep if we tried
hard enough) but don't consider that worthwhile.

Note these tests are destructive, so run them only in a throwaway
environment like a chroot, container, or vm.

The tests/run.all script should be the one which launches all the tests.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Serge Hallyn 2014-09-17 14:42:55 -05:00
parent 2cb54158b8
commit b999d48941
8970 changed files with 336314 additions and 0 deletions

21
tests/README Normal file
View File

@ -0,0 +1,21 @@
This testsuite is NOT SECURE: it will temporarily change your passwords file
with known passwords.
You should run it on a chroot, or on a secured dedicated system.
To test a Debian system:
$ mkdir sid-chroot
$ sudo debootstrap sid sid-chroot/ http://ftp.fr.debian.org/debian/
edit or copy a sources.list
$ sudo cp /etc/apt/sources.list sid-chroot/etc/apt/
edit or copy a resolv.conf
$ sudo cp /etc/resolv.conf sid-chroot/etc/
$ su - root -c "chroot sid-chroot/ /bin/bash"
# mount -t proc proc /proc
# mount -t devpts devpts /dev/pts
# aptitude update
# aptitude install expect
# cd /dev ; mknod --mode=666 /dev/ptmx c 5 2

61
tests/bug332198-test.exp Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/expect -f
# This is a script for repeatedly logging into the localhost
# using `rlogin` in order to apparently see a symptoms described
# in bug #332198.
# As described in the bug log, sometimes `rlogind` will fail to
# establish a connection, because it starts "login" process and
# the latter fails with "unable to determine TTY name, got /dev/pts/1"
# message.
#
# BUGS
#
# * the script rlogins to localhost
# * the script doesn't handle passwdord prompt, because it's intended
# to use .rhosts auth and expects shell prompt immediately after
# `rlogin`
# * the regexp for shell prompt is hardcoded
log_user 0
match_max 8192
while {1} {
set rlogin_spawn [spawn rlogin localhost]
if { $rlogin_spawn == 0 } { exit 1 }
expect {
-timeout 10 -re "^.*(Last login\[^\r\n\]*).*\n(\[^\r\n\]*\[#$\] )$" {
send_error "$expect_out(1,string)\n"
send_error "$expect_out(2,string)\n"
# send_error "$expect_out(0,string)\n"
}
timeout {
send_error "TIMEOUT/prompt\n"
send_error "$expect_out(buffer)\n"
send_error "RETRYING\n"
log_user 1
send "tty /\r"
expect -timeout 2 -re "^.*\r?\n(\[^\r\n\]*# )$" {}
send "tty /\r"
expect -timeout 2 -re "^.*\r?\n(\[^\r\n\]*# )$" {}
send_error "\n"
exit 2
}
}
send "tty\r"
expect {
-timeout 4 -re "tty\r?\n(\[^\r\n\]*)\r?\n(\[^\r\n\]*\[#$\] )$" {
send_error "$expect_out(2,string)$expect_out(1,string)\n"
# send_error "$expect_out(0,string)\n"
}
timeout { send_error "TIMEOUT/tty\n" ; exit 3 }
}
send "exit\r"
expect {
-timeout 2 eof {
# send_error "OK4: EOF\n"
}
timeout { send_error "TIMEOUT/eof\n" ; exit 4 }
}
wait
}
# vi: set sw=4:

83
tests/bug334803-test.exp Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/expect --
# This is a script for switching to another user and then
# suspending (`suspend -f`) and resuming (`fg`) his shell
package require cmdline
set opts {
{s.arg "sudo su -" "user switching method"}
{u.arg "" "username to switch to"}
}
set usage ": \[options]\noptions:"
array set conf [::cmdline::getoptions argv $opts $usage]
log_user 1
match_max 8192
expect_after {
timeout { send_error "TIMEOUT\n" ; exit 1 }
eof { send_error "EXITED\n" ; exit 2 }
}
set timeout 2
# user switching command, by default `sudo su -`
set swcmd $conf(s)
# ending of typicall shell prompt (zsh/sh):
set shpmt "(%|#|\\$) \\Z"
catch {set shpmt $env(EXPECT_PROMPT)}
# initial username:
set user0 [exec id -un]
# user we switch to (with $swcmd), by default initial user
if {$conf(u) != ""} {set swuser $conf(u)} else {set swuser $user0}
# 1. start shell
spawn bash
expect -re "$shpmt" {}
# 2. sudo-ing swuser's shell:
send "$swcmd $swuser\r"
expect {
-re "$swuser.*$shpmt" {}
-re "assword: ?\\Z" {
stty -echo
expect_user -timeout -1 -re "(.*)\n" {set swpwd $expect_out(1,string)}
stty echo
send "$swpwd\r"
expect -re "$swuser.*$shpmt" {}
}
}
# 3. getting pid and ppid of swuser's shell (needed for 5b):
send "echo \$\$:\$PPID\r"
expect -re "(?n)^(\[\[:digit:\]\]*):(\[\[:digit:\]\]*)\r?\n(.*)$shpmt" {}
set swpid $expect_out(1,string)
set swppid $expect_out(2,string)
#send_error "$user0:$swpid:$swppid\n"
# 4. suspending swuser's shell (trying to return to parent shell):
send "suspend -f\r"
expect {
-re "$shpmt" {
# 5a. got to parent shell -- resuming swuser's shell by `fg`:
send "fg\r"
set hung no
}
timeout {
# 5b. `suspend -f` has hung -- resuming swuser's shell by SIGCONT:
send_error "kill $swppid\n"
send_error [exec kill -CONT $swppid]
set hung yes
}
}
expect -re "$shpmt" {}
# 6. exiting [both] shells
#set swstat [wait -nowait]
#send_error [pid]:[exp_pid]:$swstat\n
send "exit\rexit\r"
expect eof {}
#send_error [wait -nowait]\n
#exec kill -KILL -[exp_pid]
if {$hung} {send_error "BUGGY\n" ; exit 3 }
# vi:set sw=4:

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 28, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 1
Maximum number of days between password change : 99996
Number of days of warning before password expires : 5

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : Jan 01, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : Jan 02, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 26, 2005
Password expires : Aug 09, 2005
Password inactive : Sep 13, 2005
Account expires : Jul 27, 2012
Minimum number of days between password change : 13
Maximum number of days between password change : 14
Number of days of warning before password expires : 9

View File

@ -0,0 +1 @@
chage: user 'myuser8' does not exist in /etc/passwd

42
tests/chage/01/data/group Normal file
View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

16
tests/chage/01/data/usage Normal file
View File

@ -0,0 +1,16 @@
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

206
tests/chage/01/run Executable file
View File

@ -0,0 +1,206 @@
#!/bin/sh
set -e
cd $(dirname $0)
# Rational:
# Test chage options
# no testsuite password
# root password: rootF00barbaz
# myuser password: myuserF00barbaz
save()
{
[ ! -d tmp ] && mkdir tmp
for i in passwd group shadow gshadow
do
[ -f /etc/$i ] && cp /etc/$i tmp/$i
[ -f /etc/$i- ] && cp /etc/$i- tmp/$i-
done
true
}
restore()
{
for i in passwd group shadow gshadow
do
[ -f tmp/$i ] && cp tmp/$i /etc/$i && rm tmp/$i
[ -f tmp/$i- ] && cp tmp/$i- /etc/$i- && rm tmp/$i-
done
rm -f tmp/out
rmdir tmp
}
save
# restore the files on exit
trap 'if [ "$?" != "0" ]; then echo "FAIL"; fi; restore' 0
for i in passwd group shadow gshadow
do
cp data/$i /etc
done
echo -n "testing option -l"
chage -l myuser1 > tmp/out
diff -au data/chage1 tmp/out
echo -n .
chage -l myuser2 > tmp/out
diff -au data/chage2 tmp/out
echo -n .
chage -l myuser3 > tmp/out
diff -au data/chage3 tmp/out
echo -n .
chage -l myuser4 > tmp/out
diff -au data/chage4 tmp/out
echo -n .
chage -l myuser5 > tmp/out
diff -au data/chage5 tmp/out
echo -n .
chage -l myuser6 > tmp/out
diff -au data/chage6 tmp/out
echo -n .
chage --list myuser7 > tmp/out
diff -au data/chage7 tmp/out
echo -n .
msg=$(chage -l myuser8 2> tmp/out) || err=$?
[ "$err" = "1" ] && [ "$msg" = "" ] || exit 1
diff -au data/chage8 tmp/out
echo .
echo "testing option -d"
chage -d 2001-10-02 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:11597:0:99999:7:1::' ] || exit 1
echo "testing option -d -1"
chage -d -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.::0:99999:7:1::' ] || exit 1
echo "testing option -d 0"
chage -d 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:0:0:99999:7:1::' ] || exit 1
echo "testing option --lastday"
chage --lastday 2011-11-02 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:1::' ] || exit 1
echo "testing option -E"
chage -E 2010-10-02 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:1:14884:' ] || exit 1
echo "testing option -E -1"
chage -E -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:1::' ] || exit 1
echo "testing option -E 0"
chage -E 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:1:0:' ] || exit 1
echo "testing option --expiredate"
chage --expiredate 2020-02-02 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:1:18294:' ] || exit 1
echo "testing option -I"
# NOTE: I could pass a date to -I
chage -I 42 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:42:18294:' ] || exit 1
echo "testing option -I -1"
# NOTE: this behavior is not documented
chage -I -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7::18294:' ] || exit 1
echo "testing option -I 0"
# NOTE: We should check that this is the expected behavior
chage -I 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:0:18294:' ] || exit 1
echo "testing option --inactive"
chage --inactive 12 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:12:18294:' ] || exit 1
echo "testing option -m"
chage -m 24 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:24:99999:7:12:18294:' ] || exit 1
echo "testing option -m -1"
# NOTE: this behavior is not documented
chage -m -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280::99999:7:12:18294:' ] || exit 1
echo "testing option -m 0"
chage -m 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:0:99999:7:12:18294:' ] || exit 1
echo "testing option --mindays"
chage --min 1 myuser7
# NOTE: that shouldn't have work
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:99999:7:12:18294:' ] || exit 1
echo "testing option -M"
chage -M 25 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:25:7:12:18294:' ] || exit 1
echo "testing option -M -1"
# NOTE: this behavior is not documented
chage -M -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1::7:12:18294:' ] || exit 1
echo "testing option -M 0"
chage -M 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:0:7:12:18294:' ] || exit 1
echo "testing option --maxdays"
chage --max 2 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:2:7:12:18294:' ] || exit 1
echo "testing option -W"
chage -W 26 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:2:26:12:18294:' ] || exit 1
echo "testing option -W -1"
# NOTE: this behavior is not documented
chage -W -1 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:2::12:18294:' ] || exit 1
echo "testing option -W 0"
chage -W 0 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:2:0:12:18294:' ] || exit 1
echo "testing option --warndays"
chage --warndays 3 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:15280:1:2:3:12:18294:' ] || exit 1
echo "testing with all options"
chage -d 2030-03-02 -E 1979-11-24 -I 10 -m 11 -M 12 --warndays 4 myuser7
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:21975:11:12:4:10:3614:' ] || exit 1
echo "interractive test"
./run1.exp
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12990:13:14:9:35:15548:' ] || exit 1
echo "interractive test (default)"
./run2.exp
ent=$(getent shadow myuser7)
[ "$ent" = 'myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12990:13:14:9:35:15548:' ] || exit 1
chage -l myuser7 > tmp/out
diff -au data/chage7b tmp/out
echo "usage"
chage -h > tmp/out || {
if [ "$?" != "2" ]; then false; fi
}
diff -au data/usage tmp/out
echo "OK"

31
tests/chage/01/run1.exp Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/expect
set timeout 5
# I've not been able to put the opening bracket in the regular expressions
# If anyone knows...
spawn /usr/bin/chage myuser7
expect -re "Minimum Password Age .11\]: "
send "13\r"
expect -re "Maximum Password Age .12\]: "
send "14\r"
expect -re "Last Password Change \[(]YYYY-MM-DD\[)] .2030-03-02\]: "
send "2005-07-26\r"
expect -re "Password Expiration Warning .4\]: "
send "9\r"
expect -re "Password Inactive .10\]: "
send "35\r"
expect -re "Account Expiration Date \[(]YYYY-MM-DD\[)] .1979-11-24\]: "
send "2012-07-27\r"
expect {
eof {
} default {
puts "\nFAIL"
exit 1
}
}
puts "\nPASS"
exit 0

31
tests/chage/01/run2.exp Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/expect
set timeout 5
# I've not been able to put the opening bracket in the regular expressions
# If anyone knows...
spawn /usr/bin/chage myuser7
expect -re "Minimum Password Age .13\]: "
send "\r"
expect -re "Maximum Password Age .14\]: "
send "\r"
expect -re "Last Password Change \[(]YYYY-MM-DD\[)] .2005-07-26\]: "
send "\r"
expect -re "Password Expiration Warning .9\]: "
send "\r"
expect -re "Password Inactive .35\]: "
send "\r"
expect -re "Account Expiration Date \[(]YYYY-MM-DD\[)] .2012-07-27\]: "
send "\r"
expect {
eof {
} default {
puts "\nFAIL"
exit 1
}
}
puts "\nPASS"
exit 0

42
tests/chage/02/data/group Normal file
View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,20 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,20 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::

50
tests/chage/02/run Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
set -e
cd $(dirname $0)
# Rational:
# Test chage with bogus inputs
# no testsuite password
# root password: rootF00barbaz
# myuser password: myuserF00barbaz
save()
{
[ ! -d tmp ] && mkdir tmp
for i in passwd group shadow gshadow
do
[ -f /etc/$i ] && cp /etc/$i tmp/$i
[ -f /etc/$i- ] && cp /etc/$i- tmp/$i-
done
true
}
restore()
{
for i in passwd group shadow gshadow
do
[ -f tmp/$i ] && cp tmp/$i /etc/$i && rm tmp/$i
[ -f tmp/$i- ] && cp tmp/$i- /etc/$i- && rm tmp/$i-
done
rm -f tmp/out
rmdir tmp
}
save
# restore the files on exit
trap 'if [ "$?" != "0" ]; then echo "FAIL"; fi; restore' 0
for i in passwd group shadow gshadow
do
cp data/$i /etc
done
echo "interractive test"
./run.exp $(date "+%Y-%m-%d")
echo "OK"

83
tests/chage/02/run.exp Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/expect
set timeout 5
proc expect_error {} {
expect {
"chage: error changing fields" {
expect {
eof {
} default {
puts "\nFAIL"
exit 1
}
}
} default {
puts "\nFAIL"
exit 1
}
}
}
# I've not been able to put the opening bracket in the regular expressions
# If anyone knows...
spawn /usr/bin/chage myuser
expect -re "Minimum Password Age .0\]: "
send -- "-2\r"
expect_error
spawn /usr/bin/chage myuser
expect -re "Minimum Password Age .0\]: "
send "foo\r"
expect_error
# chage accepts to be given only spaces
#spawn /usr/bin/chage myuser
#expect -re "Minimum Password Age .0\]: "
#send -- " \r"
#expect_error
#
#chage may not parse all the arguments.
#This may be a problem is a date is provided instead of just a number
#spawn /usr/bin/chage myuser
#expect -re "Minimum Password Age .0\]: "
#send -- "1 2\r"
#expect_error
spawn /usr/bin/chage myuser
expect -re "Minimum Password Age .0\]: "
send "11\r"
expect -re "Maximum Password Age .99999\]: "
send -- "-2\r"
expect_error
spawn /usr/bin/chage myuser
expect -re "Minimum Password Age .0\]: "
send "\r"
expect -re "Maximum Password Age .99999\]: "
send "foo\r"
expect_error
# chage should verify the range of the arguments
#spawn /usr/bin/chage myuser
#expect -re "Minimum Password Age .0\]: "
#send "\r"
#expect -re "Maximum Password Age .99999\]: "
#send "100000\r"
#expect_error
#spawn /usr/bin/chage myuser
#expect -re "Minimum Password Age .0\]: "
#send "\r"
#expect -re "Maximum Password Age .99999\]: "
#send "\r"
#expect -re "Last Password Change \[(]YYYY-MM-DD\[)] .2005-07-25]: "
#send "12\n"
#expect_error
puts "\nPASS"
exit 0

View File

@ -0,0 +1,48 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage can display its usage message"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Get chage usage (chage -h)..."
chage -h >tmp/usage.out
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,16 @@
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when an invalid option is used"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Use chage with an invalid option (chage -Z bin)..."
chage -Z bin 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,17 @@
chage: invalid option -- 'Z'
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when 2 users are provided"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Use chage with 2 users (chage -I 12 bin nobody)..."
chage -I 12 bin nobody 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,16 @@
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when no users are provided"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Use chage without an user (chage -I 12)..."
chage -I 12 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,16 @@
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,57 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when -l is used with another option"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
for opt in "-m 12" "-M 12" "-d 2011-09-11" "-W 12" "-I 12" "-E 2011-09-11"
do
echo -n "Use chage with -l and $opt (chage -l $opt bin)..."
chage -l $opt bin 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
done
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,17 @@
chage: do not include "l" with other flags
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,59 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when -l is used with another option"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
for opt in "-d 2011-09" "-E 2011-09-09-11"
do
echo -n "Use chage with an invalid date (chage $opt bin)..."
chage $opt bin 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
d=$(echo $opt | cut -d' ' -f2)
sed -e "s/'$d'/'DATE'/" -i tmp/usage.out
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
done
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,17 @@
chage: invalid date 'DATE'
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,59 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when -l is used with another option"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
for opt in "-I -12" "-m -12" "-M -12" "-W -12" "-I a" "-m 12.5" "-M 12a" "-W a12"
do
echo -n "Use chage with an invalid date (chage $opt bin)..."
chage $opt bin 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "2"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
v=$(echo $opt | cut -d' ' -f2)
sed -e "s/'$v'/'VAL'/" -i tmp/usage.out
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
done
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1,17 @@
chage: invalid numeric argument 'VAL'
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS

View File

@ -0,0 +1,51 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage displays its usage message when -l is used with another option"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
for user in $(ls data/)
do
echo -n "Get $user aging info (chage -l $user)..."
chage -l $user >tmp/$user
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/$user
echo "======================================================================="
echo -n "Compare with expected output..."
diff -au data/$user tmp/$user
echo "OK"
rm -f tmp/$user
done
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,32 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash
myuser8:x:424249:424242::/home:/bin/bash
myuser9:x:424250:424242::/home:/bin/bash
myuser10:x:424251:424242::/home:/bin/bash
myuser11:x:424252:424242::/home:/bin/bash
myuser12:x:424253:424242::/home:/bin/bash
myuser13:x:424254:424242::/home:/bin/bash

View File

@ -0,0 +1,30 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:9999:7:1::
myuser8:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.::0:9999:7:1::
myuser9:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:0:0:9999:7:1::
myuser10:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0::7:1::
#myuser11:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:9999:7:1::

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : never
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : -1
Maximum number of days between password change : -1
Number of days of warning before password expires : -1

View File

@ -0,0 +1,7 @@
Last password change : Jul 28, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 1
Maximum number of days between password change : 99996
Number of days of warning before password expires : 5

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : Jan 01, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : Jan 02, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : Jul 27, 2005
Password expires : Dec 11, 2032
Password inactive : Dec 12, 2032
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 9999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : never
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 9999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,7 @@
Last password change : password must be changed
Password expires : password must be changed
Password inactive : password must be changed
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 9999
Number of days of warning before password expires : 7

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage warns in case of invalid user"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Use chage with an invalid user (chage -I 12 foo)..."
chage -I 12 foo 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "1"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -0,0 +1,42 @@
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
myuser:x:424242:

View File

@ -0,0 +1,42 @@
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
crontab:x::
Debian-exim:x::
myuser:x::

View File

@ -0,0 +1,26 @@
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
Debian-exim:x:102:102::/var/spool/exim4:/bin/false
myuser1:x:424242:424242::/home:/bin/bash
myuser2:x:424243:424242::/home:/bin/bash
myuser3:x:424244:424242::/home:/bin/bash
myuser4:x:424245:424242::/home:/bin/bash
myuser5:x:424246:424242::/home:/bin/bash
myuser6:x:424247:424242::/home:/bin/bash
myuser7:x:424248:424242::/home:/bin/bash

View File

@ -0,0 +1,26 @@
root:$1$NBLBLIXb$WUgojj1bNuxWEADQGt1m9.:12991:0:99999:7:::
daemon:*:12977:0:99999:7:::
bin:*:12977:0:99999:7:::
sys:*:12977:0:99999:7:::
sync:*:12977:0:99999:7:::
games:*:12977:0:99999:7:::
man:*:12977:0:99999:7:::
lp:*:12977:0:99999:7:::
mail:*:12977:0:99999:7:::
news:*:12977:0:99999:7:::
uucp:*:12977:0:99999:7:::
proxy:*:12977:0:99999:7:::
www-data:*:12977:0:99999:7:::
backup:*:12977:0:99999:7:::
list:*:12977:0:99999:7:::
irc:*:12977:0:99999:7:::
gnats:*:12977:0:99999:7:::
nobody:*:12977:0:99999:7:::
Debian-exim:!:12977:0:99999:7:::
myuser1:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:::
myuser2:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12992:1:99996:5:::
myuser3:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::0:
myuser4:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7::1:
myuser5:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:0::
myuser6:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::
myuser7:$1$yQnIAZWV$gDAMB2IkqaONgrQiRdo4y.:12991:0:99999:7:1::

View File

@ -0,0 +1 @@
chage: user 'foo' does not exist in /etc/passwd

View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "chage warns in case of invalid user"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo -n "Use chage with an invalid user (chage -l foo)..."
chage -l foo 2>tmp/usage.out && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "1"
echo "OK"
echo "chage reported:"
echo "======================================================================="
cat tmp/usage.out
echo "======================================================================="
echo -n "Check the usage message..."
diff -au data/usage.out tmp/usage.out
echo "usage message OK."
rm -f tmp/usage.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
echo "OK"
echo -n "Check the group file..."
../../common/compare_file.pl config/etc/group /etc/group
echo "OK"
echo -n "Check the shadow file..."
../../common/compare_file.pl config/etc/shadow /etc/shadow
echo "OK"
echo -n "Check the gshadow file..."
../../common/compare_file.pl config/etc/gshadow /etc/gshadow
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

Some files were not shown because too many files have changed in this diff Show More