From e29923cf879be6e046865ccfe4c63c843b55e9b7 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 5 Jul 2015 10:11:35 +0000 Subject: Also validate hours via strptime_l(3) Simplify the code, by only using one parser, ensure the dates (hours and dates) are valid --- pw/tests/pw_useradd.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pw/tests') diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh index 93cde50..d059828 100755 --- a/pw/tests/pw_useradd.sh +++ b/pw/tests/pw_useradd.sh @@ -199,6 +199,12 @@ user_add_expiration_body() { ${PW} useradd foo -e 20-Foo-2043 atf_check -e inline:"pw: Invalid date\n" -s exit:1 \ ${PW} useradd foo -e 20-13-2043 + atf_check -s exit:0 ${PW} useradd foo -e "12:00 20-03-2043" + atf_check -s exit:0 ${PW} userdel foo + atf_check -e inline:"pw: Invalid date\n" -s exit:1 \ + ${PW} useradd foo -e "12 20-03-2043" + atf_check -s exit:0 ${PW} useradd foo -e "20-03-2043 12:00" + atf_check -s exit:0 ${PW} userdel foo } atf_init_test_cases() { -- cgit v1.2.3