summaryrefslogtreecommitdiffstats
path: root/tests/tests/chage/02/run
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests/chage/02/run')
-rwxr-xr-xtests/tests/chage/02/run50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/tests/chage/02/run b/tests/tests/chage/02/run
new file mode 100755
index 0000000..a792f0c
--- /dev/null
+++ b/tests/tests/chage/02/run
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)
+
+# Rational:
+# Test chage with bogus inputs
+
+# no testsuite password
+# root password: rootF00barbaz
+# myuser password: myuserF00barbaz
+
+save()
+{
+ [ ! -d tmp ] && mkdir tmp
+ for i in passwd group shadow gshadow
+ do
+ [ -f /etc/$i ] && cp /etc/$i tmp/$i
+ [ -f /etc/$i- ] && cp /etc/$i- tmp/$i-
+ done
+
+ true
+}
+
+restore()
+{
+ for i in passwd group shadow gshadow
+ do
+ [ -f tmp/$i ] && cp tmp/$i /etc/$i && rm tmp/$i
+ [ -f tmp/$i- ] && cp tmp/$i- /etc/$i- && rm tmp/$i-
+ done
+ rm -f tmp/out
+ rmdir tmp
+}
+
+save
+
+# restore the files on exit
+trap 'if [ "$?" != "0" ]; then echo "FAIL"; fi; restore' 0
+
+for i in passwd group shadow gshadow
+do
+ cp data/$i /etc
+done
+
+echo "interactive test"
+./run.exp $(date "+%Y-%m-%d")
+
+echo "OK"