]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
add tests
authorSerge Hallyn <serge@hallyn.com>
Sun, 22 Aug 2021 22:13:59 +0000 (17:13 -0500)
committerSerge Hallyn <serge@hallyn.com>
Mon, 23 Aug 2021 01:15:25 +0000 (20:15 -0500)
Create a container in which to run tests.

Run the 'usage' test since that's all that will work so far.

Also remove two defines from src/bin/passwd.rs which were
breaking build.

ubuntu-dev-tools is probably overkill in the container.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
173 files changed:
rust-test/common/compare_file.pl [new file with mode: 0755]
rust-test/common/config.sh [new file with mode: 0644]
rust-test/common/config_chroot-i386.list [new file with mode: 0644]
rust-test/common/config_chroot-powerpc.list [new file with mode: 0644]
rust-test/common/fopen_failure.c [new file with mode: 0644]
rust-test/common/link_failure.c [new file with mode: 0644]
rust-test/common/log.sh [new file with mode: 0644]
rust-test/common/open_RDONLY_failure.c [new file with mode: 0644]
rust-test/common/open_RDWR_failure.c [new file with mode: 0644]
rust-test/common/rename_failure.c [new file with mode: 0644]
rust-test/common/rmdir_failure.c [new file with mode: 0644]
rust-test/common/test_run [new file with mode: 0644]
rust-test/common/time_0.c [new file with mode: 0644]
rust-test/common/time_past.c [new file with mode: 0644]
rust-test/common/unlink_failure.c [new file with mode: 0644]
rust-test/common/unlinkat_failure.c [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/group [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/data/passwd.out [new file with mode: 0644]
rust-test/passwd/01_passwd_-S_root_locked_account/passwd.test [new file with mode: 0755]
rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/group [new file with mode: 0644]
rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/02_passwd_-S_root_valid_account/data/passwd.out [new file with mode: 0644]
rust-test/passwd/02_passwd_-S_root_valid_account/passwd.test [new file with mode: 0755]
rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/group [new file with mode: 0644]
rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/03_passwd_-S_root_empty_password/data/passwd.out [new file with mode: 0644]
rust-test/passwd/03_passwd_-S_root_empty_password/passwd.test [new file with mode: 0755]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/group [new file with mode: 0644]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/data/passwd.out [new file with mode: 0644]
rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/passwd.test [new file with mode: 0755]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/group [new file with mode: 0644]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/data/passwd.out [new file with mode: 0644]
rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/passwd.test [new file with mode: 0755]
rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/group [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/data/passwd.out [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/data/shadow [new file with mode: 0644]
rust-test/passwd/06_passwd_-l_root_lock_account/passwd.test [new file with mode: 0755]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/group [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd.out [new file with mode: 0644]
rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/passwd.test [new file with mode: 0755]
rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/group [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/data/passwd.out [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/data/shadow [new file with mode: 0644]
rust-test/passwd/08_passwd_-u_root_unlock_account/passwd.test [new file with mode: 0755]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/group [new file with mode: 0644]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/data/passwd.err [new file with mode: 0644]
rust-test/passwd/09_passwd_-u_root_unlock_to_empty/passwd.test [new file with mode: 0755]
rust-test/passwd/10_passwd_-d_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/data/shadow [new file with mode: 0644]
rust-test/passwd/10_passwd_-d_root/passwd.test [new file with mode: 0755]
rust-test/passwd/11_passwd_--mindays_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/data/shadow [new file with mode: 0644]
rust-test/passwd/11_passwd_--mindays_root/passwd.test [new file with mode: 0755]
rust-test/passwd/12_passwd_--maxdays_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/data/shadow [new file with mode: 0644]
rust-test/passwd/12_passwd_--maxdays_root/passwd.test [new file with mode: 0755]
rust-test/passwd/13_passwd_--warndays_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/data/shadow [new file with mode: 0644]
rust-test/passwd/13_passwd_--warndays_root/passwd.test [new file with mode: 0755]
rust-test/passwd/14_passwd_--inactive_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/data/shadow [new file with mode: 0644]
rust-test/passwd/14_passwd_--inactive_root/passwd.test [new file with mode: 0755]
rust-test/passwd/15_passwd_--expire_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/data/shadow [new file with mode: 0644]
rust-test/passwd/15_passwd_--expire_root/passwd.test [new file with mode: 0755]
rust-test/passwd/16_passwd_-S-a_root/config/etc/group [new file with mode: 0644]
rust-test/passwd/16_passwd_-S-a_root/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/16_passwd_-S-a_root/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/16_passwd_-S-a_root/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/16_passwd_-S-a_root/data/passwd.out [new file with mode: 0644]
rust-test/passwd/16_passwd_-S-a_root/passwd.test [new file with mode: 0755]
rust-test/passwd/17_passwd_root_change_password/config/etc/group [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/config/etc/pam.d/common-password [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/data/shadow [new file with mode: 0644]
rust-test/passwd/17_passwd_root_change_password/passwd.exp [new file with mode: 0755]
rust-test/passwd/17_passwd_root_change_password/passwd.test [new file with mode: 0755]
rust-test/passwd/18_passwd_root_change_password_user/config/etc/group [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/config/etc/pam.d/common-password [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/data/shadow [new file with mode: 0644]
rust-test/passwd/18_passwd_root_change_password_user/passwd.exp [new file with mode: 0755]
rust-test/passwd/18_passwd_root_change_password_user/passwd.test [new file with mode: 0755]
rust-test/passwd/19_passwd_user_change_password/config/etc/group [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/config/etc/pam.d/common-password [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/data/shadow [new file with mode: 0644]
rust-test/passwd/19_passwd_user_change_password/passwd.exp [new file with mode: 0755]
rust-test/passwd/19_passwd_user_change_password/passwd.test [new file with mode: 0755]
rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/group [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/pam.d/common-password [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/data/shadow [new file with mode: 0644]
rust-test/passwd/20_passwd_user_change_password_same_user/passwd.exp [new file with mode: 0755]
rust-test/passwd/20_passwd_user_change_password_same_user/passwd.test [new file with mode: 0755]
rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/group [new file with mode: 0644]
rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/21_passwd_user_change_password_other_user/data/passwd.err [new file with mode: 0644]
rust-test/passwd/21_passwd_user_change_password_other_user/passwd.test [new file with mode: 0755]
rust-test/passwd/22_passwd_usage/config.txt [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/config/etc/group [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/config/etc/gshadow [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/config/etc/passwd [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/config/etc/shadow [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/data/usage.out [new file with mode: 0644]
rust-test/passwd/22_passwd_usage/passwd.test [new file with mode: 0755]
rust-test/passwd/22_passwd_usage/passwd.test.log [new file with mode: 0644]
rust-test/run_all [new file with mode: 0755]
rust-test/setup-for-tests.sh [new file with mode: 0755]
rust-test/teardown-for-tests.sh [new file with mode: 0644]
rust-test/testrun.sh [new file with mode: 0755]
rust-test/testsuite.log [new file with mode: 0644]
src/bin/passwd.rs

diff --git a/rust-test/common/compare_file.pl b/rust-test/common/compare_file.pl
new file mode 100755 (executable)
index 0000000..eb498d3
--- /dev/null
@@ -0,0 +1,116 @@
+#!/usr/bin/perl
+
+open (TEMPLATE, $ARGV[0]) or die "Cannot open '".$ARGV[0]."': $!";
+my $template = join "", <TEMPLATE>;
+open (FILE, $ARGV[1]) or die "Cannot open '".$ARGV[1]."': $!";
+my $file = join "", <FILE>;
+
+my $today = int(time()/(24*3600));
+$template =~ s/\@TODAY\@/$today/g;
+
+my $tmp = $template;
+while ($tmp =~ m/^(.*?)([^\n]*):\@PASS_DES ([^:]*)\@:(.*)$/s) {
+       my $user = $2;
+       my $pass = $3;
+       $tmp = $4;
+       if ($file =~ m/^$user:/m) {
+               $file =~ s/^$user:([^:]*):(.*)$/$user:\@PASS_DES $pass\@:$2/m;
+               my $cryptpass = $1;
+               # Check the password
+               my $checkpass = qx|/usr/bin/openssl passwd -crypt -salt '$cryptpass' $pass 2>tmp/openssl.err|;
+               chomp $checkpass;
+
+               system "cat tmp/openssl.err"
+                       if ($checkpass ne $cryptpass);
+               system "rm -f tmp/openssl.err";
+               die "Wrong password for $user: '$cryptpass'. Expected password: '$checkpass'\n"
+                       if ($checkpass ne $cryptpass);
+       } else {
+               die "No user '$user' in ".$ARGV[1].".\n";
+       }
+}
+
+$tmp = $template;
+while ($tmp =~ m/^(.*?)([^\n]*):\@PASS_MD5 ([^:]*)\@:(.*)$/s) {
+       my $user = $2;
+       my $pass = $3;
+       $tmp = $4;
+       if ($file =~ m/^$user:/m) {
+               $file =~ s/^$user:([^:]*):(.*)$/$user:\@PASS_MD5 $pass\@:$2/m;
+               my $cryptpass = $1;
+               # Check the password
+               my $salt = $cryptpass;
+               $salt =~ s/^\$1\$//;
+               $salt =~ s/\$.*$//;
+               my $checkpass = qx|/usr/bin/openssl passwd -1 -salt '$salt' '$pass'|;
+               chomp $checkpass;
+
+               die "Wrong password for $user: '$cryptpass'. Expected password: '$checkpass'\n"
+                       if ($checkpass ne $cryptpass);
+       } else {
+               die "No user '$user' in ".$ARGV[1].".\n";
+       }
+}
+
+$tmp = $template;
+while ($tmp =~ m/^(.*?)([^\n]*):\@PASS_SHA256 ([^:]*)\@:(.*)$/s) {
+       my $user = $2;
+       my $pass = $3;
+       $tmp = $4;
+       if ($file =~ m/^$user:/m) {
+               $file =~ s/^$user:([^:]*):(.*)$/$user:\@PASS_SHA256 $pass\@:$2/m;
+               my $cryptpass = $1;
+               # Check the password
+               my $salt = $cryptpass;
+               $salt =~ s/^\$5\$//;
+               my $rounds = "";
+               if ($salt =~ s/^rounds=([0-9]*)\$//) {
+                       $rounds = "-R $1";
+               }
+
+               $salt =~ s/\$.*$//;
+               my $checkpass = qx!echo '$pass' | /usr/bin/mkpasswd -m sha-256 --salt '$salt' $rounds --stdin!;
+               chomp $checkpass;
+
+               die "Wrong password for $user: '$cryptpass'. Expected password: '$checkpass'\n"
+                       if ($checkpass ne $cryptpass);
+       } else {
+               die "No user '$user' in ".$ARGV[1].".\n";
+       }
+}
+
+$tmp = $template;
+while ($tmp =~ m/^(.*?)([^\n]*):\@PASS_SHA512 ([^:]*)\@:(.*)$/s) {
+       my $user = $2;
+       my $pass = $3;
+       $tmp = $4;
+       if ($file =~ m/^$user:/m) {
+               $file =~ s/^$user:([^:]*):(.*)$/$user:\@PASS_SHA512 $pass\@:$2/m;
+               my $cryptpass = $1;
+               # Check the password
+               my $salt = $cryptpass;
+               $salt =~ s/^\$6\$//;
+               my $rounds = "";
+               if ($salt =~ s/^rounds=([0-9]*)\$//) {
+                       $rounds = "-R $1";
+               }
+
+               $salt =~ s/\$.*$//;
+               my $checkpass = qx!echo '$pass' | /usr/bin/mkpasswd -m sha-512 --salt '$salt' $rounds --stdin!;
+               chomp $checkpass;
+
+               die "Wrong password for $user: '$cryptpass'. Expected password: '$checkpass'\n"
+                       if ($checkpass ne $cryptpass);
+       } else {
+               die "No user '$user' in ".$ARGV[1].".\n";
+       }
+}
+
+
+exit 0 if ($file =~ m/^\Q$template\E$/s);
+
+print "Files differ.\n";
+
+system "diff", "-au", $ARGV[0], $ARGV[1];
+
+exit 1
diff --git a/rust-test/common/config.sh b/rust-test/common/config.sh
new file mode 100644 (file)
index 0000000..cd44261
--- /dev/null
@@ -0,0 +1,123 @@
+# Generic functions to save, change, and restore configuration files
+
+set -e
+
+build_path=$(git rev-parse --show-toplevel)
+
+CONTAINER_GIT_TOP_REL="home/ubuntu/shadow"
+CONTAINER_GIT_TOP="/${CONTAINER_GIT_TOP_REL}"
+
+# Save the configuration files in tmp.
+save_config ()
+{
+       [ ! -d tmp ] && mkdir tmp
+       find config -depth -type f -print | sed -e 's/config\///' |
+       while read file
+       do
+               mkdir -p "tmp/$(dirname "$file")"
+               [ -f "/$file" ] && cp -dp "/$file" "tmp/$file" || true
+       done
+}
+
+# Copy the config files from config to the system
+change_config ()
+{
+       find config -depth -type f -print | sed -e 's/config\///' |
+       while read file
+       do
+               cp -f "config/$file" "/$file"
+       done
+}
+
+# Restored the config files in the system.
+# The config files must be saved before with save_config ().
+restore_config ()
+{
+       find config -depth -type f -print | sed -e 's/config\///' |
+       while read file
+       do
+               if [ -f "tmp/$file" ]; then
+                       cp -dp "tmp/$file" "/$file"
+                       rm "tmp/$file"
+               else
+                       rm -f "/$file"
+               fi
+               d="$(dirname "tmp/$file")"
+               while [ -n "$d" ] && [ "$d" != "." ]
+               do
+                       rmdir "$d" 2>/dev/null || true
+                       d="$(dirname "$d")"
+               done
+       done
+
+       rmdir tmp 2>/dev/null || true
+}
+
+prepare_chroot ()
+{
+       mkdir tmp/root
+       cp -rfdp config_chroot/* tmp/root/
+
+       lists=/root/tests/common/config_chroot.list
+       [ -f config_chroot.list ] && lists="$lists config_chroot.list"
+       cat $lists | grep -v "#" | while read f
+       do
+               # Create parent directory if needed
+               d=$(dirname tmp/root/$f)
+               [ -d $d ] || mkdir -p $d
+               # Create hard link
+               ln $f tmp/root/$f
+       done
+
+       # Copy existing gcda
+       mkdir -p tmp/root$build_path/lib
+       mkdir -p tmp/root$build_path/libmisc
+       mkdir -p tmp/root$build_path/src
+       find "$build_path" -name "*.gcda" | while read f
+       do
+               ln $f tmp/root/$f
+       done
+}
+
+clean_chroot ()
+{
+       # Remove copied files
+       lists=/root/tests/common/config_chroot.list
+       [ -f config_chroot.list ] && lists="$lists config_chroot.list"
+       cat $lists | grep -v "#" | while read f
+       do
+               rm -f tmp/root/$f
+               # Remove parent directory if empty
+               d=$(dirname tmp/root/$f)
+               rmdir -p --ignore-fail-on-non-empty $d
+       done
+
+       find "$build_path" -name "*.gcda" | while read f
+       do
+               rm -f tmp/root/$f
+       done
+       find tmp/root -name "*.gcda" | while read f
+       do
+               g=${f#tmp/root}
+               mv "$f" "$g"
+       done
+       rmdir tmp/root$build_path/lib
+       rmdir tmp/root$build_path/libmisc
+       rmdir tmp/root$build_path/src
+       rmdir tmp/root$build_path
+       rmdir tmp/root/root/build
+       rmdir tmp/root/root
+
+       find config_chroot -type f | while read f
+       do
+               f=${f#config_chroot/}
+               rm -f tmp/root/$f
+       done
+
+       find config_chroot -depth -type d | while read d
+       do
+               d=${d#config_chroot}
+               [ -d "tmp/root$d" ] && rmdir tmp/root$d
+       done
+}
+
diff --git a/rust-test/common/config_chroot-i386.list b/rust-test/common/config_chroot-i386.list
new file mode 100644 (file)
index 0000000..ba7bf8a
--- /dev/null
@@ -0,0 +1,25 @@
+/lib/i386-linux-gnu/ld-2.13.so
+/lib/i386-linux-gnu/ld-linux.so.2
+/lib/ld-linux.so.2
+/lib/i386-linux-gnu/libcrypt-2.13.so
+/lib/i386-linux-gnu/libcrypt.so.1
+/lib/i386-linux-gnu/libc-2.13.so
+/lib/i386-linux-gnu/libc.so.6
+/lib/i386-linux-gnu/libdl-2.13.so
+/lib/i386-linux-gnu/libdl.so.2
+/lib/i386-linux-gnu/libnsl-2.13.so
+/lib/i386-linux-gnu/libnsl.so.1
+/lib/i386-linux-gnu/libnss_compat-2.13.so
+/lib/i386-linux-gnu/libnss_compat.so.2
+/lib/i386-linux-gnu/libpamc.so.0
+/lib/i386-linux-gnu/libpamc.so.0.82.1
+/lib/i386-linux-gnu/libpam_misc.so.0
+/lib/i386-linux-gnu/libpam_misc.so.0.82.0
+/lib/i386-linux-gnu/libpam.so.0
+/lib/i386-linux-gnu/libpam.so.0.83.0
+/lib/i386-linux-gnu/libselinux.so.1
+/lib/i386-linux-gnu/security/pam_deny.so
+/lib/i386-linux-gnu/security/pam_permit.so
+/lib/i386-linux-gnu/security/pam_rootok.so
+/lib/i386-linux-gnu/security/pam_shells.so
+/lib/i386-linux-gnu/security/pam_unix.so
diff --git a/rust-test/common/config_chroot-powerpc.list b/rust-test/common/config_chroot-powerpc.list
new file mode 100644 (file)
index 0000000..e6c344e
--- /dev/null
@@ -0,0 +1,25 @@
+/lib/powerpc-linux-gnu/ld-2.13.so
+/lib/powerpc-linux-gnu/ld.so.1
+/lib/ld.so.1
+/lib/powerpc-linux-gnu/libcrypt-2.13.so
+/lib/powerpc-linux-gnu/libcrypt.so.1
+/lib/powerpc-linux-gnu/libc-2.13.so
+/lib/powerpc-linux-gnu/libc.so.6
+/lib/powerpc-linux-gnu/libdl-2.13.so
+/lib/powerpc-linux-gnu/libdl.so.2
+/lib/powerpc-linux-gnu/libnsl-2.13.so
+/lib/powerpc-linux-gnu/libnsl.so.1
+/lib/powerpc-linux-gnu/libnss_compat-2.13.so
+/lib/powerpc-linux-gnu/libnss_compat.so.2
+/lib/powerpc-linux-gnu/libpamc.so.0
+/lib/powerpc-linux-gnu/libpamc.so.0.82.1
+/lib/powerpc-linux-gnu/libpam_misc.so.0
+/lib/powerpc-linux-gnu/libpam_misc.so.0.82.0
+/lib/powerpc-linux-gnu/libpam.so.0
+/lib/powerpc-linux-gnu/libpam.so.0.83.0
+/lib/powerpc-linux-gnu/libselinux.so.1
+/lib/powerpc-linux-gnu/security/pam_deny.so
+/lib/powerpc-linux-gnu/security/pam_permit.so
+/lib/powerpc-linux-gnu/security/pam_rootok.so
+/lib/powerpc-linux-gnu/security/pam_shells.so
+/lib/powerpc-linux-gnu/security/pam_unix.so
diff --git a/rust-test/common/fopen_failure.c b/rust-test/common/fopen_failure.c
new file mode 100644 (file)
index 0000000..750cd66
--- /dev/null
@@ -0,0 +1,46 @@
+/* 
+ * gcc fopen_failure.c -o fopen_failure.so -shared -ldl 
+ * LD_PRELOAD=./fopen_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef FILE * (*fopen_type) (const char *path, const char *mode);
+static fopen_type next_fopen;
+
+static const char *failure_path = NULL;
+
+FILE *fopen64 (const char *path, const char *mode)
+{
+printf ("fopen64(%s, %s)\n", path, mode);
+       if (NULL == next_fopen)
+       {
+               next_fopen = dlsym (RTLD_NEXT, "fopen64");
+               assert (NULL != next_fopen);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != path)
+           && (NULL != failure_path)
+           && (strcmp (path, failure_path) == 0))
+       {
+               fprintf (stderr, "fopen64 FAILURE %s %s ...\n", path, mode);
+               errno = EIO;
+               return NULL;
+       }
+
+       return next_fopen (path, mode);
+}
+
diff --git a/rust-test/common/link_failure.c b/rust-test/common/link_failure.c
new file mode 100644 (file)
index 0000000..8cf460a
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * gcc link_failure.c -o link_failure.so -shared -ldl 
+ * LD_PRELOAD=./link_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+typedef int (*link_type) (const char *oldpath, const char *newpath);
+static link_type next_link;
+
+static const char *failure_path = NULL;
+
+int link (const char *oldpath, const char *newpath)
+{
+       if (NULL == next_link)
+       {
+               next_link = dlsym (RTLD_NEXT, "link");
+               assert (NULL != next_link);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != newpath)
+           && (NULL != failure_path)
+           && (strcmp (newpath, failure_path) == 0))
+       {
+               fprintf (stderr, "link FAILURE %s %s\n", oldpath, newpath);
+               errno = EIO;
+               return -1;
+       }
+
+       return next_link (oldpath, newpath);
+}
+
diff --git a/rust-test/common/log.sh b/rust-test/common/log.sh
new file mode 100644 (file)
index 0000000..4887970
--- /dev/null
@@ -0,0 +1,46 @@
+# Helpers to log messages / status
+
+log_start ()
+{
+       test="$1"
+       rationale="$2"
+       cat << EOF
+
+###############################################################################
+#
+# Test: $test
+#
+###############################################################################
+#
+# Rationale: $rationale
+#
+###############################################################################
+EOF
+}
+
+log_end ()
+{
+       test="$1"
+       cat << EOF
+###############################################################################
+#
+# End of test $test
+#
+###############################################################################
+
+EOF
+}
+
+log_status ()
+{
+       test="$1"
+       status="$2"
+       cat << EOF
+###############################################################################
+#
+# Status of test $test: $status
+#
+###############################################################################
+EOF
+}
+
diff --git a/rust-test/common/open_RDONLY_failure.c b/rust-test/common/open_RDONLY_failure.c
new file mode 100644 (file)
index 0000000..e14859f
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * gcc open_RDONLY_failure.c -o open_RDONLY_failure.so -shared -ldl 
+ * LD_PRELOAD=./open_RDONLY_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef int (*open_type) (const char *pathname, int flag, ...);
+static open_type next_open64;
+
+static const char *failure_path = NULL;
+
+int open64 (const char *pathname, int flag, ...)
+{
+       if (NULL == next_open64)
+       {
+               next_open64 = dlsym (RTLD_NEXT, "open64");
+               assert (NULL != next_open64);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != pathname)
+           && ((flag & O_ACCMODE) == O_RDONLY)
+           && (NULL != failure_path)
+           && (strcmp (pathname, failure_path) == 0))
+       {
+               fprintf (stderr, "open FAILURE %s %x ...\n", pathname, flag&O_ACCMODE);
+               errno = EIO;
+               return -1;
+       }
+
+       return next_open64 (pathname, flag);
+}
+
diff --git a/rust-test/common/open_RDWR_failure.c b/rust-test/common/open_RDWR_failure.c
new file mode 100644 (file)
index 0000000..5bf1069
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * gcc open_RDWR_failure.c -o open_RDWR_failure.so -shared -ldl 
+ * LD_PRELOAD=./open_RDWR_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef int (*open_type) (const char *pathname, int flag, ...);
+static open_type next_open64;
+
+static const char *failure_path = NULL;
+
+int open64 (const char *pathname, int flag, ...)
+{
+       if (NULL == next_open64)
+       {
+               next_open64 = dlsym (RTLD_NEXT, "open64");
+               assert (NULL != next_open64);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != pathname)
+           && ((flag & O_ACCMODE) == O_RDWR)
+           && (NULL != failure_path)
+           && (strcmp (pathname, failure_path) == 0))
+       {
+               fprintf (stderr, "open FAILURE %s %x ...\n", pathname, flag&O_ACCMODE);
+               errno = EIO;
+               return -1;
+       }
+
+       return next_open64 (pathname, flag);
+}
+
diff --git a/rust-test/common/rename_failure.c b/rust-test/common/rename_failure.c
new file mode 100644 (file)
index 0000000..dd02fe5
--- /dev/null
@@ -0,0 +1,50 @@
+/* 
+ * gcc rename_failure.c -o rename_failure.so -shared -ldl 
+ * LD_PRELOAD=./rename_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef int (*rename_type) (const char *old, const char *new);
+static rename_type next_rename;
+
+static const char *failure_path = NULL;
+
+int rename (const char *old, const char *new)
+{
+       if (NULL == next_rename)
+       {
+               next_rename = dlsym (RTLD_NEXT, "rename");
+               assert (NULL != next_rename);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != new)
+           && (NULL != failure_path)
+           && (strcmp (new, failure_path) == 0))
+       {
+               fprintf (stderr, "rename FAILURE %s %s\n", old, new);
+               errno = EIO;
+               return -1;
+       }
+
+       return next_rename (old, new);
+}
+
diff --git a/rust-test/common/rmdir_failure.c b/rust-test/common/rmdir_failure.c
new file mode 100644 (file)
index 0000000..9d775b1
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * gcc rmdir_failure.c -o rmdir_failure.so -shared -ldl 
+ * LD_PRELOAD=./rmdir_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+typedef int (*rmdir_type) (const char *path);
+static rmdir_type next_rmdir;
+
+static const char *failure_path = NULL;
+
+int rmdir (const char *path)
+{
+       if (NULL == next_rmdir)
+       {
+               next_rmdir = dlsym (RTLD_NEXT, "rmdir");
+               assert (NULL != next_rmdir);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != path)
+           && (NULL != failure_path)
+           && (strcmp (path, failure_path) == 0))
+       {
+               fprintf (stderr, "rmdir FAILURE %s\n", path);
+               errno = EBUSY;
+               return -1;
+       }
+
+       return next_rmdir (path);
+}
+
diff --git a/rust-test/common/test_run b/rust-test/common/test_run
new file mode 100644 (file)
index 0000000..b34f7c4
--- /dev/null
@@ -0,0 +1,40 @@
+run_test()
+{
+    ret=0
+       [ -f RUN_TEST.STOP ] && exit 1
+
+       if $1 > $1.log
+       then
+               echo -n "+"
+       else
+               ret=1
+               echo -n "-"
+       fi
+       cat $1.log >> testsuite.log
+       [ -f /etc/passwd.lock ] && echo $1 /etc/passwd.lock || true
+       [ -f /etc/group.lock ] && echo $1 /etc/group.lock || true
+       [ -f /etc/shadow.lock ] && echo $1 /etc/shadow.lock || true
+       [ -f /etc/gshadow.lock ] && echo $1 /etc/gshadow.lock || true
+       if [ "$(stat -c"%G" /etc/shadow)" != "shadow" ]
+       then
+               echo $1
+               ls -l /etc/shadow
+               chgrp shadow /etc/shadow
+       fi
+       if [ -d /nonexistent ]
+       then
+               echo $1 /nonexistent
+               rmdir /nonexistent
+       fi
+    return $ret
+}
+
+record_test_result()
+{
+    if [ $1 -eq 0 ]; then
+        succeeded=$((succeedd + 1))
+    else
+        failed=$((failed + 1))
+        failed_tests="${failed_tests} $2"
+    fi
+}
diff --git a/rust-test/common/time_0.c b/rust-test/common/time_0.c
new file mode 100644 (file)
index 0000000..6937361
--- /dev/null
@@ -0,0 +1,16 @@
+/* 
+ * gcc time_0.c -o time_0.so -shared
+ * LD_PRELOAD=./time_0.so ./test
+ */
+
+#include <stdio.h>
+#include <time.h>
+
+
+time_t time (time_t *t)
+{
+       fprintf (stderr, "time 0\n");
+
+       return (time_t)0;
+}
+
diff --git a/rust-test/common/time_past.c b/rust-test/common/time_past.c
new file mode 100644 (file)
index 0000000..d0eb741
--- /dev/null
@@ -0,0 +1,52 @@
+/* 
+ * gcc time_past.c -o time_past.so -shared -ldl 
+ * LD_PRELOAD=./time_past.so PAST_DAYS=2 ./test
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+typedef time_t (*time_type) (time_t *t);
+static time_type next_time;
+
+static int time_past = 0;
+static char *past = NULL;
+
+time_t time (time_t *t)
+{
+       time_t res;
+
+       if (NULL == next_time)
+       {
+               next_time = dlsym (RTLD_NEXT, "time");
+               assert (NULL != next_time);
+       }
+       if (NULL == past) {
+               const char *past = getenv ("PAST_DAYS");
+               if (NULL == past) {
+                       fputs ("No PAST_DAYS defined\n", stderr);
+               }
+               time_past = atoi (past);
+       }
+
+       res = next_time (t);
+       res -= 24*60*60*time_past;
+
+       if (NULL != t) {
+               *t = res;
+       }
+
+       return res;
+}
+
diff --git a/rust-test/common/unlink_failure.c b/rust-test/common/unlink_failure.c
new file mode 100644 (file)
index 0000000..2281c8a
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * gcc unlink_failure.c -o unlink_failure.so -shared -ldl 
+ * LD_PRELOAD=./unlink_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+typedef int (*unlink_type) (const char *path);
+static unlink_type next_unlink;
+
+static const char *failure_path = NULL;
+
+int unlink (const char *path)
+{
+       if (NULL == next_unlink)
+       {
+               next_unlink = dlsym (RTLD_NEXT, "unlink");
+               assert (NULL != next_unlink);
+       }
+       if (NULL == failure_path) {
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+       }
+
+       if (   (NULL != path)
+           && (NULL != failure_path)
+           && (strcmp (path, failure_path) == 0))
+       {
+               fprintf (stderr, "unlink FAILURE %s\n", path);
+               errno = EBUSY;
+               return -1;
+       }
+
+       return next_unlink (path);
+}
+
diff --git a/rust-test/common/unlinkat_failure.c b/rust-test/common/unlinkat_failure.c
new file mode 100644 (file)
index 0000000..5b8bf95
--- /dev/null
@@ -0,0 +1,62 @@
+/* 
+ * gcc unlinkat_failure.c -o unlinkat_failure.so -shared -ldl 
+ * LD_PRELOAD=./unlinkat_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+typedef int (*unlinkat_type) (int dirfd, const char *pathname, int flags);
+static unlinkat_type next_unlinkat;
+
+static const char *failure_path = NULL;
+static dev_t failure_dev = -1;
+static ino_t failure_ino = -1;
+
+int unlinkat (int dirfd, const char *pathname, int flags)
+{
+       if (NULL == next_unlinkat)
+       {
+               next_unlinkat = dlsym (RTLD_NEXT, "unlinkat");
+               assert (NULL != next_unlinkat);
+       }
+       if (NULL == failure_path) {
+               struct stat sb;
+               failure_path = getenv ("FAILURE_PATH");
+               if (NULL == failure_path) {
+                       fputs ("No FAILURE_PATH defined\n", stderr);
+               }
+               if (lstat (failure_path, &sb) != 0) {
+                       fputs ("Can't lstat FAILURE_PATH\n", stderr);
+               }
+               failure_dev = sb.st_dev;
+               failure_ino = sb.st_ino;
+       }
+
+       if (   (NULL != pathname)
+           && (NULL != failure_path)) {
+               struct stat sb;
+               if (   (fstatat (dirfd, pathname, &sb, flags) == 0)
+                   && (sb.st_dev == failure_dev)
+                   && (sb.st_ino == failure_ino)) {
+                       fprintf (stderr, "unlinkat FAILURE %s\n", failure_path);
+                       errno = EBUSY;
+                       return -1;
+               }
+       }
+
+       return next_unlinkat (dirfd, pathname, flags);
+}
+
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/group b/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/gshadow b/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/passwd b/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/shadow b/rust-test/passwd/01_passwd_-S_root_locked_account/config/etc/shadow
new file mode 100644 (file)
index 0000000..3112803
--- /dev/null
@@ -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:::
+foo:!:12978:0:99999:7:::
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/data/passwd.out b/rust-test/passwd/01_passwd_-S_root_locked_account/data/passwd.out
new file mode 100644 (file)
index 0000000..86a73e1
--- /dev/null
@@ -0,0 +1 @@
+foo L 07/14/2005 0 99999 7 -1
diff --git a/rust-test/passwd/01_passwd_-S_root_locked_account/passwd.test b/rust-test/passwd/01_passwd_-S_root_locked_account/passwd.test
new file mode 100755 (executable)
index 0000000..0641638
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Request password information for user foo (passwd -S foo)..."
+passwd -S foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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
+
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/group b/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/gshadow b/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/passwd b/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/shadow b/rust-test/passwd/02_passwd_-S_root_valid_account/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/data/passwd.out b/rust-test/passwd/02_passwd_-S_root_valid_account/data/passwd.out
new file mode 100644 (file)
index 0000000..55af5a7
--- /dev/null
@@ -0,0 +1 @@
+foo P 07/13/2005 0 99999 7 -1
diff --git a/rust-test/passwd/02_passwd_-S_root_valid_account/passwd.test b/rust-test/passwd/02_passwd_-S_root_valid_account/passwd.test
new file mode 100755 (executable)
index 0000000..0641638
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Request password information for user foo (passwd -S foo)..."
+passwd -S foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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
+
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/group b/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/gshadow b/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/passwd b/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/shadow b/rust-test/passwd/03_passwd_-S_root_empty_password/config/etc/shadow
new file mode 100644 (file)
index 0000000..9b3b67f
--- /dev/null
@@ -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:::
+foo::12988:0:99998:8:::
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/data/passwd.out b/rust-test/passwd/03_passwd_-S_root_empty_password/data/passwd.out
new file mode 100644 (file)
index 0000000..c64fb61
--- /dev/null
@@ -0,0 +1 @@
+foo NP 07/24/2005 0 99998 8 -1
diff --git a/rust-test/passwd/03_passwd_-S_root_empty_password/passwd.test b/rust-test/passwd/03_passwd_-S_root_empty_password/passwd.test
new file mode 100755 (executable)
index 0000000..0641638
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Request password information for user foo (passwd -S foo)..."
+passwd -S foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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
+
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/group b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/gshadow b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/passwd b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/shadow b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/data/passwd.out b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/data/passwd.out
new file mode 100644 (file)
index 0000000..e86159d
--- /dev/null
@@ -0,0 +1 @@
+foo P
diff --git a/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/passwd.test b/rust-test/passwd/04_passwd_-S_root_valid_account_no_shadow_file/passwd.test
new file mode 100755 (executable)
index 0000000..e084d34
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Remove /etc/shadow..."
+rm -f /etc/shadow
+echo "OK"
+
+echo -n "Request password information for user foo (passwd -S foo)..."
+passwd -S foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 that /etc/shadow does not exist..."
+test ! -f /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
+
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/group b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/gshadow b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/passwd b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/passwd
new file mode 100644 (file)
index 0000000..dfb11c8
--- /dev/null
@@ -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
+foo:!:1000:1000:::/bin/false
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/shadow b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/config/etc/shadow
new file mode 100644 (file)
index 0000000..5f50d18
--- /dev/null
@@ -0,0 +1,19 @@
+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:::
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/data/passwd.out b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/data/passwd.out
new file mode 100644 (file)
index 0000000..9ba8956
--- /dev/null
@@ -0,0 +1 @@
+foo L
diff --git a/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/passwd.test b/rust-test/passwd/05_passwd_-S_root_valid_account_no_shadow_entry/passwd.test
new file mode 100755 (executable)
index 0000000..0641638
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Request password information for user foo (passwd -S foo)..."
+passwd -S foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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
+
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/group b/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/gshadow b/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/passwd b/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/shadow b/rust-test/passwd/06_passwd_-l_root_lock_account/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/data/passwd.out b/rust-test/passwd/06_passwd_-l_root_lock_account/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/data/shadow b/rust-test/passwd/06_passwd_-l_root_lock_account/data/shadow
new file mode 100644 (file)
index 0000000..79c859a
--- /dev/null
@@ -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:::
+foo:!$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/06_passwd_-l_root_lock_account/passwd.test b/rust-test/passwd/06_passwd_-l_root_lock_account/passwd.test
new file mode 100755 (executable)
index 0000000..3fabb12
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can lock a password with passwd -l"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Lock foo's password (passwd -l foo)..."
+passwd -l foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/group b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/gshadow b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/passwd b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/passwd
new file mode 100644 (file)
index 0000000..440df65
--- /dev/null
@@ -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
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:1000:1000:::/bin/false
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/shadow b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/config/etc/shadow
new file mode 100644 (file)
index 0000000..5f50d18
--- /dev/null
@@ -0,0 +1,19 @@
+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:::
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd
new file mode 100644 (file)
index 0000000..3ca4f73
--- /dev/null
@@ -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
+foo:!$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:1000:1000:::/bin/false
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd.out b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/passwd.test b/rust-test/passwd/07_passwd_-l_root_lock_account_no_shadow_entry/passwd.test
new file mode 100755 (executable)
index 0000000..099c380
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can lock a password in /etc/passwd"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Lock foo's password (passwd -l foo)..."
+passwd -l foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.out
+
+echo -n "Check the passwd file..."
+../../common/compare_file.pl data/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
+
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/group b/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/gshadow b/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/passwd b/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/shadow b/rust-test/passwd/08_passwd_-u_root_unlock_account/config/etc/shadow
new file mode 100644 (file)
index 0000000..79c859a
--- /dev/null
@@ -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:::
+foo:!$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/data/passwd.out b/rust-test/passwd/08_passwd_-u_root_unlock_account/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/data/shadow b/rust-test/passwd/08_passwd_-u_root_unlock_account/data/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/08_passwd_-u_root_unlock_account/passwd.test b/rust-test/passwd/08_passwd_-u_root_unlock_account/passwd.test
new file mode 100755 (executable)
index 0000000..b5ac0d8
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can unlock a password with passwd -u"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "unlock foo's password (passwd -u foo)..."
+passwd -u foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/group b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/gshadow b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/passwd b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/shadow b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/config/etc/shadow
new file mode 100644 (file)
index 0000000..2baad3b
--- /dev/null
@@ -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:::
+foo:!:12977:0:99999:7:::
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/data/passwd.err b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/data/passwd.err
new file mode 100644 (file)
index 0000000..2987d41
--- /dev/null
@@ -0,0 +1,2 @@
+passwd: unlocking the password would result in a passwordless account.
+You should set a password with usermod -p to unlock the password of this account.
diff --git a/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/passwd.test b/rust-test/passwd/09_passwd_-u_root_unlock_to_empty/passwd.test
new file mode 100755 (executable)
index 0000000..b4d62f7
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd -u cannot create a passwordless account"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Unlock foo's password (passwd -u foo)..."
+passwd -u foo 2> tmp/passwd.err && exit 1 || {
+        status=$?
+}
+echo "OK"
+
+echo -n "Check returned status ($status)..."
+test "$status" = "3"
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.err
+echo "======================================================================="
+echo -n "Check the error message..."
+diff -au data/passwd.err tmp/passwd.err
+echo "error message OK."
+rm -f tmp/passwd.err
+
+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
+
diff --git a/rust-test/passwd/10_passwd_-d_root/config/etc/group b/rust-test/passwd/10_passwd_-d_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/10_passwd_-d_root/config/etc/gshadow b/rust-test/passwd/10_passwd_-d_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/10_passwd_-d_root/config/etc/passwd b/rust-test/passwd/10_passwd_-d_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/10_passwd_-d_root/config/etc/shadow b/rust-test/passwd/10_passwd_-d_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..79c859a
--- /dev/null
@@ -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:::
+foo:!$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/10_passwd_-d_root/data/passwd.out b/rust-test/passwd/10_passwd_-d_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/10_passwd_-d_root/data/shadow b/rust-test/passwd/10_passwd_-d_root/data/shadow
new file mode 100644 (file)
index 0000000..85ef660
--- /dev/null
@@ -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:::
+foo::12977:0:99999:7:::
diff --git a/rust-test/passwd/10_passwd_-d_root/passwd.test b/rust-test/passwd/10_passwd_-d_root/passwd.test
new file mode 100755 (executable)
index 0000000..e1ac5f2
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can delete a password with passwd -d"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Delete foo's password (passwd -d foo)..."
+passwd -d foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/11_passwd_--mindays_root/config/etc/group b/rust-test/passwd/11_passwd_--mindays_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/11_passwd_--mindays_root/config/etc/gshadow b/rust-test/passwd/11_passwd_--mindays_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/11_passwd_--mindays_root/config/etc/passwd b/rust-test/passwd/11_passwd_--mindays_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/11_passwd_--mindays_root/config/etc/shadow b/rust-test/passwd/11_passwd_--mindays_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/11_passwd_--mindays_root/data/passwd.out b/rust-test/passwd/11_passwd_--mindays_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/11_passwd_--mindays_root/data/shadow b/rust-test/passwd/11_passwd_--mindays_root/data/shadow
new file mode 100644 (file)
index 0000000..f424ad6
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:10:99999:7:::
diff --git a/rust-test/passwd/11_passwd_--mindays_root/passwd.test b/rust-test/passwd/11_passwd_--mindays_root/passwd.test
new file mode 100755 (executable)
index 0000000..409396f
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can use passwd --mindays"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Change the min number of days for foo's password (passwd --mindays 10 foo)..."
+passwd --mindays 10 foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/config/etc/group b/rust-test/passwd/12_passwd_--maxdays_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/config/etc/gshadow b/rust-test/passwd/12_passwd_--maxdays_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/config/etc/passwd b/rust-test/passwd/12_passwd_--maxdays_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/config/etc/shadow b/rust-test/passwd/12_passwd_--maxdays_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/data/passwd.out b/rust-test/passwd/12_passwd_--maxdays_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/data/shadow b/rust-test/passwd/12_passwd_--maxdays_root/data/shadow
new file mode 100644 (file)
index 0000000..82f40b6
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:10:7:::
diff --git a/rust-test/passwd/12_passwd_--maxdays_root/passwd.test b/rust-test/passwd/12_passwd_--maxdays_root/passwd.test
new file mode 100755 (executable)
index 0000000..a895e3e
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can use passwd --maxdays"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Change the max number of days for foo's password (passwd --maxdays 10 foo)..."
+passwd --maxdays 10 foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/13_passwd_--warndays_root/config/etc/group b/rust-test/passwd/13_passwd_--warndays_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/13_passwd_--warndays_root/config/etc/gshadow b/rust-test/passwd/13_passwd_--warndays_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/13_passwd_--warndays_root/config/etc/passwd b/rust-test/passwd/13_passwd_--warndays_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/13_passwd_--warndays_root/config/etc/shadow b/rust-test/passwd/13_passwd_--warndays_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/13_passwd_--warndays_root/data/passwd.out b/rust-test/passwd/13_passwd_--warndays_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/13_passwd_--warndays_root/data/shadow b/rust-test/passwd/13_passwd_--warndays_root/data/shadow
new file mode 100644 (file)
index 0000000..a62edfa
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:10:::
diff --git a/rust-test/passwd/13_passwd_--warndays_root/passwd.test b/rust-test/passwd/13_passwd_--warndays_root/passwd.test
new file mode 100755 (executable)
index 0000000..18a8b87
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can use passwd --warndays"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Change the number of warning days for foo's password (passwd --warndays 10 foo)..."
+passwd --warndays 10 foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/14_passwd_--inactive_root/config/etc/group b/rust-test/passwd/14_passwd_--inactive_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/14_passwd_--inactive_root/config/etc/gshadow b/rust-test/passwd/14_passwd_--inactive_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/14_passwd_--inactive_root/config/etc/passwd b/rust-test/passwd/14_passwd_--inactive_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/14_passwd_--inactive_root/config/etc/shadow b/rust-test/passwd/14_passwd_--inactive_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/14_passwd_--inactive_root/data/passwd.out b/rust-test/passwd/14_passwd_--inactive_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/14_passwd_--inactive_root/data/shadow b/rust-test/passwd/14_passwd_--inactive_root/data/shadow
new file mode 100644 (file)
index 0000000..52dc304
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:10::
diff --git a/rust-test/passwd/14_passwd_--inactive_root/passwd.test b/rust-test/passwd/14_passwd_--inactive_root/passwd.test
new file mode 100755 (executable)
index 0000000..52dbab0
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can use passwd --inactive"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Change the number of inactive days for foo's password (passwd --inactive 10 foo)..."
+passwd --inactive 10 foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/15_passwd_--expire_root/config/etc/group b/rust-test/passwd/15_passwd_--expire_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/15_passwd_--expire_root/config/etc/gshadow b/rust-test/passwd/15_passwd_--expire_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/15_passwd_--expire_root/config/etc/passwd b/rust-test/passwd/15_passwd_--expire_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/15_passwd_--expire_root/config/etc/shadow b/rust-test/passwd/15_passwd_--expire_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/15_passwd_--expire_root/data/passwd.out b/rust-test/passwd/15_passwd_--expire_root/data/passwd.out
new file mode 100644 (file)
index 0000000..55ce2cc
--- /dev/null
@@ -0,0 +1 @@
+passwd: password expiry information changed.
diff --git a/rust-test/passwd/15_passwd_--expire_root/data/shadow b/rust-test/passwd/15_passwd_--expire_root/data/shadow
new file mode 100644 (file)
index 0000000..4cd6096
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:0:0:99999:7:::
diff --git a/rust-test/passwd/15_passwd_--expire_root/passwd.test b/rust-test/passwd/15_passwd_--expire_root/passwd.test
new file mode 100755 (executable)
index 0000000..f2ab71d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can use passwd --expire"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+echo -n "Set foo's password as expired (passwd --expire foo)..."
+passwd --expire foo > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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 data/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
+
diff --git a/rust-test/passwd/16_passwd_-S-a_root/config/etc/group b/rust-test/passwd/16_passwd_-S-a_root/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/16_passwd_-S-a_root/config/etc/gshadow b/rust-test/passwd/16_passwd_-S-a_root/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/16_passwd_-S-a_root/config/etc/passwd b/rust-test/passwd/16_passwd_-S-a_root/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/16_passwd_-S-a_root/config/etc/shadow b/rust-test/passwd/16_passwd_-S-a_root/config/etc/shadow
new file mode 100644 (file)
index 0000000..3112803
--- /dev/null
@@ -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:::
+foo:!:12978:0:99999:7:::
diff --git a/rust-test/passwd/16_passwd_-S-a_root/data/passwd.out b/rust-test/passwd/16_passwd_-S-a_root/data/passwd.out
new file mode 100644 (file)
index 0000000..5a1b479
--- /dev/null
@@ -0,0 +1,20 @@
+root P 07/27/2005 0 99999 7 -1
+daemon L 07/13/2005 0 99999 7 -1
+bin L 07/13/2005 0 99999 7 -1
+sys L 07/13/2005 0 99999 7 -1
+sync L 07/13/2005 0 99999 7 -1
+games L 07/13/2005 0 99999 7 -1
+man L 07/13/2005 0 99999 7 -1
+lp L 07/13/2005 0 99999 7 -1
+mail L 07/13/2005 0 99999 7 -1
+news L 07/13/2005 0 99999 7 -1
+uucp L 07/13/2005 0 99999 7 -1
+proxy L 07/13/2005 0 99999 7 -1
+www-data L 07/13/2005 0 99999 7 -1
+backup L 07/13/2005 0 99999 7 -1
+list L 07/13/2005 0 99999 7 -1
+irc L 07/13/2005 0 99999 7 -1
+gnats L 07/13/2005 0 99999 7 -1
+nobody L 07/13/2005 0 99999 7 -1
+Debian-exim L 07/13/2005 0 99999 7 -1
+foo L 07/14/2005 0 99999 7 -1
diff --git a/rust-test/passwd/16_passwd_-S-a_root/passwd.test b/rust-test/passwd/16_passwd_-S-a_root/passwd.test
new file mode 100755 (executable)
index 0000000..1b64c53
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd can report the status of an account to root"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+echo -n "passwd -S -a..."
+passwd -S -a > tmp/passwd.out
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.out
+echo "======================================================================="
+echo -n "Check the message..."
+diff -au data/passwd.out tmp/passwd.out
+echo "message OK."
+rm -f tmp/passwd.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
+
diff --git a/rust-test/passwd/17_passwd_root_change_password/config/etc/group b/rust-test/passwd/17_passwd_root_change_password/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/17_passwd_root_change_password/config/etc/gshadow b/rust-test/passwd/17_passwd_root_change_password/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/17_passwd_root_change_password/config/etc/pam.d/common-password b/rust-test/passwd/17_passwd_root_change_password/config/etc/pam.d/common-password
new file mode 100644 (file)
index 0000000..38bce56
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# /etc/pam.d/common-password - password-related modules common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of modules that define the services to be
+# used to change user passwords.  The default is pam_unix.
+
+# Explanation of pam_unix options:
+#
+# The "sha512" option enables salted SHA512 passwords.  Without this option,
+# the default is Unix crypt.  Prior releases used the option "md5".
+#
+# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
+# login.defs.
+#
+# See the pam_unix manpage for other options.
+
+# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
+# To take advantage of this, it is recommended that you configure any
+# local modules either before or after the default block, and use
+# pam-auth-update to manage selection of other modules.  See
+# pam-auth-update(8) for details.
+
+# here are the per-package modules (the "Primary" block)
+password       [success=1 default=ignore]      pam_unix.so obscure md5
+# here's the fallback if no module succeeds
+password       requisite                       pam_deny.so
+# prime the stack with a positive return value if there isn't one already;
+# this avoids us returning an error just because nothing sets a success code
+# since the modules above will each just jump around
+password       required                        pam_permit.so
+# and here are more per-package modules (the "Additional" block)
+# end of pam-auth-update config
diff --git a/rust-test/passwd/17_passwd_root_change_password/config/etc/passwd b/rust-test/passwd/17_passwd_root_change_password/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/17_passwd_root_change_password/config/etc/shadow b/rust-test/passwd/17_passwd_root_change_password/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/17_passwd_root_change_password/data/shadow b/rust-test/passwd/17_passwd_root_change_password/data/shadow
new file mode 100644 (file)
index 0000000..6731888
--- /dev/null
@@ -0,0 +1,20 @@
+root:@PASS_MD5 rootpassword@:@TODAY@: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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/17_passwd_root_change_password/passwd.exp b/rust-test/passwd/17_passwd_root_change_password/passwd.exp
new file mode 100755 (executable)
index 0000000..2696ffb
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/expect
+
+set timeout 2
+expect_after default {puts "\nFAIL"; exit 1}
+
+spawn /bin/sh
+send "if \[ \$(id -u) -eq 0 \]; then PS1='# '; else PS1='$ '; fi\r"
+expect "# "
+
+send "passwd\r"
+expect "Enter new UNIX password: "
+send "rootpassword\r"
+expect "Retype new UNIX password: "
+send "rootpassword\r"
+expect "passwd: password updated successfully"
+expect "# "
+send "echo \$?\r"
+expect "0"
+expect "# "
+send "exit\r"
+puts "OK\n"
+exit 0
diff --git a/rust-test/passwd/17_passwd_root_change_password/passwd.test b/rust-test/passwd/17_passwd_root_change_password/passwd.test
new file mode 100755 (executable)
index 0000000..e181273
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can change her password"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+./passwd.exp
+
+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 data/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
+
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/config/etc/group b/rust-test/passwd/18_passwd_root_change_password_user/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/config/etc/gshadow b/rust-test/passwd/18_passwd_root_change_password_user/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/config/etc/pam.d/common-password b/rust-test/passwd/18_passwd_root_change_password_user/config/etc/pam.d/common-password
new file mode 100644 (file)
index 0000000..442182a
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# /etc/pam.d/common-password - password-related modules common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of modules that define the services to be
+# used to change user passwords.  The default is pam_unix.
+
+# Explanation of pam_unix options:
+#
+# The "sha512" option enables salted SHA512 passwords.  Without this option,
+# the default is Unix crypt.  Prior releases used the option "md5".
+#
+# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
+# login.defs.
+#
+# See the pam_unix manpage for other options.
+
+# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
+# To take advantage of this, it is recommended that you configure any
+# local modules either before or after the default block, and use
+# pam-auth-update to manage selection of other modules.  See
+# pam-auth-update(8) for details.
+
+# here are the per-package modules (the "Primary" block)
+password       [success=1 default=ignore]      pam_unix.so obscure
+# here's the fallback if no module succeeds
+password       requisite                       pam_deny.so
+# prime the stack with a positive return value if there isn't one already;
+# this avoids us returning an error just because nothing sets a success code
+# since the modules above will each just jump around
+password       required                        pam_permit.so
+# and here are more per-package modules (the "Additional" block)
+# end of pam-auth-update config
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/config/etc/passwd b/rust-test/passwd/18_passwd_root_change_password_user/config/etc/passwd
new file mode 100644 (file)
index 0000000..dc7bf84
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/false
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/config/etc/shadow b/rust-test/passwd/18_passwd_root_change_password_user/config/etc/shadow
new file mode 100644 (file)
index 0000000..dced560
--- /dev/null
@@ -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:::
+foo:$1$qFkVP1JD$QKhVFDs906AgiPjnyRPPk0:12977:0:99999:7:::
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/data/shadow b/rust-test/passwd/18_passwd_root_change_password_user/data/shadow
new file mode 100644 (file)
index 0000000..30ac54d
--- /dev/null
@@ -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:::
+foo:@PASS_DES foopassword@:@TODAY@:0:99999:7:::
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/passwd.exp b/rust-test/passwd/18_passwd_root_change_password_user/passwd.exp
new file mode 100755 (executable)
index 0000000..5150c6a
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/expect
+
+set timeout 2
+expect_after default {puts "\nFAIL"; exit 1}
+
+spawn /bin/sh
+send "if \[ \$(id -u) -eq 0 \]; then PS1='# '; else PS1='$ '; fi\r"
+expect "# "
+
+send "passwd foo\r"
+expect "Enter new UNIX password: "
+send "foopassword\r"
+expect "Retype new UNIX password: "
+send "foopassword\r"
+expect "passwd: password updated successfully"
+expect "# "
+send "echo \$?\r"
+expect "0"
+expect "# "
+send "exit\r"
+puts "OK\n"
+exit 0
diff --git a/rust-test/passwd/18_passwd_root_change_password_user/passwd.test b/rust-test/passwd/18_passwd_root_change_password_user/passwd.test
new file mode 100755 (executable)
index 0000000..e181273
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can change her password"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+./passwd.exp
+
+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 data/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
+
diff --git a/rust-test/passwd/19_passwd_user_change_password/config/etc/group b/rust-test/passwd/19_passwd_user_change_password/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/19_passwd_user_change_password/config/etc/gshadow b/rust-test/passwd/19_passwd_user_change_password/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/19_passwd_user_change_password/config/etc/pam.d/common-password b/rust-test/passwd/19_passwd_user_change_password/config/etc/pam.d/common-password
new file mode 100644 (file)
index 0000000..a0d4283
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# /etc/pam.d/common-password - password-related modules common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of modules that define the services to be
+# used to change user passwords.  The default is pam_unix.
+
+# Explanation of pam_unix options:
+#
+# The "sha512" option enables salted SHA512 passwords.  Without this option,
+# the default is Unix crypt.  Prior releases used the option "md5".
+#
+# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
+# login.defs.
+#
+# See the pam_unix manpage for other options.
+
+# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
+# To take advantage of this, it is recommended that you configure any
+# local modules either before or after the default block, and use
+# pam-auth-update to manage selection of other modules.  See
+# pam-auth-update(8) for details.
+
+# here are the per-package modules (the "Primary" block)
+password       [success=1 default=ignore]      pam_unix.so obscure sha256
+# here's the fallback if no module succeeds
+password       requisite                       pam_deny.so
+# prime the stack with a positive return value if there isn't one already;
+# this avoids us returning an error just because nothing sets a success code
+# since the modules above will each just jump around
+password       required                        pam_permit.so
+# and here are more per-package modules (the "Additional" block)
+# end of pam-auth-update config
diff --git a/rust-test/passwd/19_passwd_user_change_password/config/etc/passwd b/rust-test/passwd/19_passwd_user_change_password/config/etc/passwd
new file mode 100644 (file)
index 0000000..82223ff
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/bash
diff --git a/rust-test/passwd/19_passwd_user_change_password/config/etc/shadow b/rust-test/passwd/19_passwd_user_change_password/config/etc/shadow
new file mode 100644 (file)
index 0000000..18a7168
--- /dev/null
@@ -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:::
+foo:$1$hU4j2cnt$tRiti0uCvqiQN9u6iMHBq.:12977:0:99999:7:::
diff --git a/rust-test/passwd/19_passwd_user_change_password/data/shadow b/rust-test/passwd/19_passwd_user_change_password/data/shadow
new file mode 100644 (file)
index 0000000..a638637
--- /dev/null
@@ -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:::
+foo:@PASS_SHA256 password-foo@:@TODAY@:0:99999:7:::
diff --git a/rust-test/passwd/19_passwd_user_change_password/passwd.exp b/rust-test/passwd/19_passwd_user_change_password/passwd.exp
new file mode 100755 (executable)
index 0000000..6a3f1b6
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/expect
+
+set timeout 2
+expect_after default {puts "\nFAIL"; exit 1}
+
+spawn /bin/sh
+send "if \[ \$(id -u) -eq 0 \]; then PS1='# '; else PS1='$ '; fi\r"
+expect "# "
+send "su -l foo\r"
+expect "$ "
+send "id\r"
+expect "uid=1000(foo) gid=1000(foo) groups=1000(foo)"
+
+send "passwd\r"
+expect "Changing password for foo."
+expect "(current) UNIX password: "
+send "foopassword\r"
+expect "Enter new UNIX password: "
+send "password-foo\r"
+expect "Retype new UNIX password: "
+send "password-foo\r"
+expect "passwd: password updated successfully"
+expect "$ "
+send "echo \$?\r"
+expect "0"
+expect "$ "
+send "exit\r"
+expect "# "
+send "exit\r"
+puts "OK\n"
+exit 0
diff --git a/rust-test/passwd/19_passwd_user_change_password/passwd.test b/rust-test/passwd/19_passwd_user_change_password/passwd.test
new file mode 100755 (executable)
index 0000000..e181273
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can change her password"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+./passwd.exp
+
+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 data/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
+
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/group b/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/group
new file mode 100644 (file)
index 0000000..fecba0c
--- /dev/null
@@ -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:
+foo:x:1000:
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/gshadow b/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/gshadow
new file mode 100644 (file)
index 0000000..5042e58
--- /dev/null
@@ -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::
+foo:*::
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/pam.d/common-password b/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/pam.d/common-password
new file mode 100644 (file)
index 0000000..cb8c7b7
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# /etc/pam.d/common-password - password-related modules common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of modules that define the services to be
+# used to change user passwords.  The default is pam_unix.
+
+# Explanation of pam_unix options:
+#
+# The "sha512" option enables salted SHA512 passwords.  Without this option,
+# the default is Unix crypt.  Prior releases used the option "md5".
+#
+# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
+# login.defs.
+#
+# See the pam_unix manpage for other options.
+
+# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
+# To take advantage of this, it is recommended that you configure any
+# local modules either before or after the default block, and use
+# pam-auth-update to manage selection of other modules.  See
+# pam-auth-update(8) for details.
+
+# here are the per-package modules (the "Primary" block)
+password       [success=1 default=ignore]      pam_unix.so obscure sha512
+# here's the fallback if no module succeeds
+password       requisite                       pam_deny.so
+# prime the stack with a positive return value if there isn't one already;
+# this avoids us returning an error just because nothing sets a success code
+# since the modules above will each just jump around
+password       required                        pam_permit.so
+# and here are more per-package modules (the "Additional" block)
+# end of pam-auth-update config
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/passwd b/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/passwd
new file mode 100644 (file)
index 0000000..82223ff
--- /dev/null
@@ -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
+foo:x:1000:1000:::/bin/bash
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/shadow b/rust-test/passwd/20_passwd_user_change_password_same_user/config/etc/shadow
new file mode 100644 (file)
index 0000000..18a7168
--- /dev/null
@@ -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:::
+foo:$1$hU4j2cnt$tRiti0uCvqiQN9u6iMHBq.:12977:0:99999:7:::
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/data/shadow b/rust-test/passwd/20_passwd_user_change_password_same_user/data/shadow
new file mode 100644 (file)
index 0000000..542ae82
--- /dev/null
@@ -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:::
+foo:@PASS_SHA512 password-foo@:@TODAY@:0:99999:7:::
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/passwd.exp b/rust-test/passwd/20_passwd_user_change_password_same_user/passwd.exp
new file mode 100755 (executable)
index 0000000..70d4b80
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/expect
+
+set timeout 2
+expect_after default {puts "\nFAIL"; exit 1}
+
+spawn /bin/sh
+send "if \[ \$(id -u) -eq 0 \]; then PS1='# '; else PS1='$ '; fi\r"
+expect "# "
+send "su -l foo\r"
+expect "$ "
+send "id\r"
+expect "uid=1000(foo) gid=1000(foo) groups=1000(foo)"
+
+send "passwd foo\r"
+expect "Changing password for foo."
+expect "(current) UNIX password: "
+send "foopassword\r"
+expect "Enter new UNIX password: "
+send "password-foo\r"
+expect "Retype new UNIX password: "
+send "password-foo\r"
+expect "passwd: password updated successfully"
+expect "$ "
+send "echo \$?\r"
+expect "0"
+expect "$ "
+send "exit\r"
+expect "# "
+send "exit\r"
+puts "OK\n"
+exit 0
diff --git a/rust-test/passwd/20_passwd_user_change_password_same_user/passwd.test b/rust-test/passwd/20_passwd_user_change_password_same_user/passwd.test
new file mode 100755 (executable)
index 0000000..e181273
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can change her password"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+./passwd.exp
+
+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 data/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
+
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/group b/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/group
new file mode 100644 (file)
index 0000000..fb4f67e
--- /dev/null
@@ -0,0 +1,43 @@
+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:
+foo:x:1000:
+foo1:x:1001:
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/gshadow b/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/gshadow
new file mode 100644 (file)
index 0000000..3e73b5a
--- /dev/null
@@ -0,0 +1,43 @@
+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::
+foo:*::
+foo1:*::
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/passwd b/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/passwd
new file mode 100644 (file)
index 0000000..54cce8e
--- /dev/null
@@ -0,0 +1,21 @@
+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
+foo:x:1000:1000:::/bin/bash
+foo1:x:1001:1001:::/bin/bash
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/shadow b/rust-test/passwd/21_passwd_user_change_password_other_user/config/etc/shadow
new file mode 100644 (file)
index 0000000..4f88f0c
--- /dev/null
@@ -0,0 +1,21 @@
+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:::
+foo:$1$hU4j2cnt$tRiti0uCvqiQN9u6iMHBq.:12977:0:99999:7:::
+foo1:$1$hU4j2cnt$tRiti0uCvqiQN9u6iMHBq.:12977:0:99999:7:::
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/data/passwd.err b/rust-test/passwd/21_passwd_user_change_password_other_user/data/passwd.err
new file mode 100644 (file)
index 0000000..5b45f51
--- /dev/null
@@ -0,0 +1 @@
+passwd: You may not view or modify password information for foo1.
diff --git a/rust-test/passwd/21_passwd_user_change_password_other_user/passwd.test b/rust-test/passwd/21_passwd_user_change_password_other_user/passwd.test
new file mode 100755 (executable)
index 0000000..bcb0a10
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "root can change her password"
+
+save_config
+
+# restore the files on exit
+trap 'log_status "$0" "FAILURE"; restore_config' 0
+
+change_config
+
+su -l foo -c "passwd foo1" 2>tmp/passwd.err && exit 1 || {
+       status=$?
+}
+echo "OK"
+
+echo -n "Check returned status ($status)..."
+test "$status" = "1"
+echo "OK"
+
+echo "passwd reported:"
+echo "======================================================================="
+cat tmp/passwd.err
+echo "======================================================================="
+echo -n "Check that there were a failure message..."
+diff -au data/passwd.err tmp/passwd.err
+echo "error message OK."
+rm -f tmp/passwd.err
+
+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
+
diff --git a/rust-test/passwd/22_passwd_usage/config.txt b/rust-test/passwd/22_passwd_usage/config.txt
new file mode 100644 (file)
index 0000000..31f5635
--- /dev/null
@@ -0,0 +1,10 @@
+# no testsuite password
+# root password: rootF00barbaz
+# myuser password: myuserF00barbaz
+
+user foo, in group users (only in /etc/group)
+user foo, in group tty (only in /etc/gshadow)
+user foo, in group floppy
+user foo, admin of group disk
+user foo, admin and member of group fax
+user foo, admin and member of group cdrom (only in /etc/gshadow)
diff --git a/rust-test/passwd/22_passwd_usage/config/etc/group b/rust-test/passwd/22_passwd_usage/config/etc/group
new file mode 100644 (file)
index 0000000..1012390
--- /dev/null
@@ -0,0 +1,41 @@
+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:
diff --git a/rust-test/passwd/22_passwd_usage/config/etc/gshadow b/rust-test/passwd/22_passwd_usage/config/etc/gshadow
new file mode 100644 (file)
index 0000000..ae42486
--- /dev/null
@@ -0,0 +1,41 @@
+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::
diff --git a/rust-test/passwd/22_passwd_usage/config/etc/passwd b/rust-test/passwd/22_passwd_usage/config/etc/passwd
new file mode 100644 (file)
index 0000000..43fc135
--- /dev/null
@@ -0,0 +1,19 @@
+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
diff --git a/rust-test/passwd/22_passwd_usage/config/etc/shadow b/rust-test/passwd/22_passwd_usage/config/etc/shadow
new file mode 100644 (file)
index 0000000..5f50d18
--- /dev/null
@@ -0,0 +1,19 @@
+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:::
diff --git a/rust-test/passwd/22_passwd_usage/data/usage.out b/rust-test/passwd/22_passwd_usage/data/usage.out
new file mode 100644 (file)
index 0000000..21552fe
--- /dev/null
@@ -0,0 +1,22 @@
+Usage: passwd [options] [LOGIN]
+
+Options:
+  -a, --all                     report password status on all accounts
+  -d, --delete                  delete the password for the named account
+  -e, --expire                  force expire the password for the named account
+  -h, --help                    display this help message and exit
+  -k, --keep-tokens             change password only if expired
+  -i, --inactive INACTIVE       set password inactive after expiration
+                                to INACTIVE
+  -l, --lock                    lock the password of the named account
+  -n, --mindays MIN_DAYS        set minimum number of days before password
+                                change to MIN_DAYS
+  -q, --quiet                   quiet mode
+  -r, --repository REPOSITORY   change password in REPOSITORY repository
+  -R, --root CHROOT_DIR         directory to chroot into
+  -S, --status                  report password status on the named account
+  -u, --unlock                  unlock the password of the named account
+  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
+  -x, --maxdays MAX_DAYS        set maximum number of days before password
+                                change to MAX_DAYS
+
diff --git a/rust-test/passwd/22_passwd_usage/passwd.test b/rust-test/passwd/22_passwd_usage/passwd.test
new file mode 100755 (executable)
index 0000000..077ec90
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+. ../../common/config.sh
+. ../../common/log.sh
+
+log_start "$0" "passwd 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 passwd usage (passwd -h)..."
+passwd -h >tmp/usage.out
+
+echo "passwd 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
+
diff --git a/rust-test/passwd/22_passwd_usage/passwd.test.log b/rust-test/passwd/22_passwd_usage/passwd.test.log
new file mode 100644 (file)
index 0000000..4e45d6d
--- /dev/null
@@ -0,0 +1,45 @@
+
+###############################################################################
+#
+# Test: ./passwd/22_passwd_usage/passwd.test
+#
+###############################################################################
+#
+# Rationale: passwd can display its usage message
+#
+###############################################################################
+Get passwd usage (passwd -h)...passwd reported:
+=======================================================================
+Usage: passwd [options] [LOGIN]
+
+Options:
+  -a, --all                     report password status on all accounts
+  -d, --delete                  delete the password for the named account
+  -e, --expire                  force expire the password for the named account
+  -h, --help                    display this help message and exit
+  -k, --keep-tokens             change password only if expired
+  -i, --inactive INACTIVE       set password inactive after expiration
+                                to INACTIVE
+  -l, --lock                    lock the password of the named account
+  -n, --mindays MIN_DAYS        set minimum number of days before password
+                                change to MIN_DAYS
+  -q, --quiet                   quiet mode
+  -r, --repository REPOSITORY   change password in REPOSITORY repository
+  -R, --root CHROOT_DIR         directory to chroot into
+  -S, --status                  report password status on the named account
+  -u, --unlock                  unlock the password of the named account
+  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
+  -x, --maxdays MAX_DAYS        set maximum number of days before password
+                                change to MAX_DAYS
+
+=======================================================================
+Check the usage message...usage message OK.
+Check the passwd file...OK
+Check the group file...OK
+Check the shadow file...OK
+Check the gshadow file...OK
+###############################################################################
+#
+# Status of test ./passwd/22_passwd_usage/passwd.test: SUCCESS
+#
+###############################################################################
diff --git a/rust-test/run_all b/rust-test/run_all
new file mode 100755 (executable)
index 0000000..a5b863f
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+
+export LC_ALL=C
+unset LANG
+unset LANGUAGE
+. common/config.sh
+. common/test_run
+
+s=$(lxc-info -qsHn shadow-test)
+if [ $? -ne 0 ] || [ "$s" != "RUNNING" ]; then
+    echo "please run setup-for-tests.sh"
+    exit 1
+fi
+
+USE_PAM="yes"
+FAILURE_TESTS="yes"
+
+succeeded=0
+failed=0
+failed_tests=""
+
+echo "+: test passed"
+echo "-: test failed"
+
+# Empty the complete log.
+> testsuite.log
+
+lxc-attach -n shadow-test -- sh -c "cd $CONTAINER_GIT_TOP/rust-test; ./testrun.sh ./passwd/22_passwd_usage/passwd.test"
+record_test_result $? ./passwd/22_passwd_usage/passwd.test
+
+echo
+echo "$succeeded test(s) passed"
+echo "$failed test(s) failed"
+echo "log written in 'testsuite.log'"
+if [ "$failed" != "0" ]
+then
+       echo "the following tests failed:"
+       echo $failed_tests
+fi
+
diff --git a/rust-test/setup-for-tests.sh b/rust-test/setup-for-tests.sh
new file mode 100755 (executable)
index 0000000..ba6a0ae
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+. common/config.sh
+set +e
+set -x
+
+create_container()
+{
+    lxcdefault=$(mktemp)
+    gittop=$(git rev-parse --show-toplevel)
+    # if I were feeling more ambitious i'd check the range...
+    subuid=grep "^$(whoami):" /etc/subuid | cut -d : -f 2`
+    subgid=grep "^$(whoami):" /etc/subuid | cut -d : -f 2`
+    cat > $lxcdefault << EOF
+lxc.include = /etc/lxc/default.conf
+lxc.idmap = u 0 $(id -u) 1
+lxc.idmap = g 0 $(id -g) 1
+lxc.idmap = u 1 ${subuid} 65535
+lxc.idmap = g 1 ${subgid} 65535
+lxc.mount.entry = ${gittop} ${CONTAINER_GIT_TOP_REL} none bind,create=dir 0 0
+EOF
+    echo "Creating container with the following defaults:"
+    cat $lxcdefault
+    lxc-create -t download -f $lxcdefault -n shadow-test -- -d ubuntu -r bionic -a amd64
+    rm -f $lxcdefault
+    if [ $? -ne ] ; then
+        echo "Failed creating test container"
+        exit 1
+    fi
+    lxc-attach -n shadow-test -- apt-get update
+    lxc-attach -n shadow-test -- apt-get -y install git ubuntu-dev-tools
+}
+
+s=$(lxc-info -qsHn shadow-test)
+if [ $? -ne 0 ]; then
+    echo "Creating"
+    create_container
+    s=$(lxc-info -qsHn shadow-test)
+    if [ $? -ne 0 ]; then
+        echo "Error"
+        exit 1
+    fi
+fi
+if [ $s = "STOPPED" ]; then
+    lxc-start -n shadow-test
+    lxc-wait -n shadow-test -s RUNNING
+fi
+
+echo "shadow-test is running"
diff --git a/rust-test/teardown-for-tests.sh b/rust-test/teardown-for-tests.sh
new file mode 100644 (file)
index 0000000..b97c2e3
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+lxc-stop -n shadow-test
+echo "Test container shut down"
diff --git a/rust-test/testrun.sh b/rust-test/testrun.sh
new file mode 100755 (executable)
index 0000000..b24fa28
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. common/test_run
+
+run_test $*
diff --git a/rust-test/testsuite.log b/rust-test/testsuite.log
new file mode 100644 (file)
index 0000000..4e45d6d
--- /dev/null
@@ -0,0 +1,45 @@
+
+###############################################################################
+#
+# Test: ./passwd/22_passwd_usage/passwd.test
+#
+###############################################################################
+#
+# Rationale: passwd can display its usage message
+#
+###############################################################################
+Get passwd usage (passwd -h)...passwd reported:
+=======================================================================
+Usage: passwd [options] [LOGIN]
+
+Options:
+  -a, --all                     report password status on all accounts
+  -d, --delete                  delete the password for the named account
+  -e, --expire                  force expire the password for the named account
+  -h, --help                    display this help message and exit
+  -k, --keep-tokens             change password only if expired
+  -i, --inactive INACTIVE       set password inactive after expiration
+                                to INACTIVE
+  -l, --lock                    lock the password of the named account
+  -n, --mindays MIN_DAYS        set minimum number of days before password
+                                change to MIN_DAYS
+  -q, --quiet                   quiet mode
+  -r, --repository REPOSITORY   change password in REPOSITORY repository
+  -R, --root CHROOT_DIR         directory to chroot into
+  -S, --status                  report password status on the named account
+  -u, --unlock                  unlock the password of the named account
+  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
+  -x, --maxdays MAX_DAYS        set maximum number of days before password
+                                change to MAX_DAYS
+
+=======================================================================
+Check the usage message...usage message OK.
+Check the passwd file...OK
+Check the group file...OK
+Check the shadow file...OK
+Check the gshadow file...OK
+###############################################################################
+#
+# Status of test ./passwd/22_passwd_usage/passwd.test: SUCCESS
+#
+###############################################################################
index c5276bba64d92c21545c7ec78aed6d896b874033..f0d710590a856cf9d6dc2d15f7139cbe42930432 100644 (file)
@@ -15,8 +15,6 @@ const E_SUCCESS: i32 = 0; /* success */
 const E_NOPERM: i32 = 1; /* permission denied */
 const E_USAGE: i32 = 2; /* invalid combination of options */
 const E_FAILURE: i32 = 3; /* unexpected failure, nothing done */
-const E_MISSING: i32 = 4; /* unexpected failure, passwd file missing */
-const E_PWDBUSY: i32 = 5; /* passwd file busy, try again later */
 const E_BAD_ARG: i32 = 6; /* invalid argument to option */
 
 #[derive(Clap, Debug)]