summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_lock.sh
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-12-02 22:01:37 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-12-02 22:01:37 +0000
commit589645e2892df41b0acc5fed5073098a2bfab6a7 (patch)
tree752386c16efdcce96b5dcde97d0ba7681f1b3ca6 /pw/tests/pw_lock.sh
parent492360f4ac483b5d0bff8961d5c7713700b55ab1 (diff)
downloadpw-darwin-589645e2892df41b0acc5fed5073098a2bfab6a7.tar.gz
pw-darwin-589645e2892df41b0acc5fed5073098a2bfab6a7.tar.zst
pw-darwin-589645e2892df41b0acc5fed5073098a2bfab6a7.zip
Fix handling of numeric-only names with pw lock
Add a regression test about it PR: 204968 MFC after: 1 week
Diffstat (limited to 'pw/tests/pw_lock.sh')
-rwxr-xr-xpw/tests/pw_lock.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/pw/tests/pw_lock.sh b/pw/tests/pw_lock.sh
index 9f14e24..5ec1b09 100755
--- a/pw/tests/pw_lock.sh
+++ b/pw/tests/pw_lock.sh
@@ -16,7 +16,27 @@ user_locking_body() {
grep "^test:\*:1001:" $HOME/master.passwd
}
+atf_test_case numeric_locking cleanup
+numeric_locking_body() {
+ populate_etc_skel
+ ${PW} useradd test || atf_fail "Creating test user"
+ ${PW} lock 1001 || atf_fail "Locking the user"
+ atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \
+ grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd
+ ${PW} unlock 1001 || atf_fail "Unlocking the user"
+ atf_check -s exit:0 -o match:"^test:\*:1001:" \
+ grep "^test:\*:1001:" $HOME/master.passwd
+ # Now numeric names
+ ${PW} useradd -n 1001 || atf_fail "Creating test user"
+ ${PW} lock 1001 || atf_fail "Locking the user"
+ atf_check -s exit:0 -o match:"^1001:\*LOCKED\*\*:1002:" \
+ grep "^1001:\*LOCKED\*\*:1002:" $HOME/master.passwd
+ ${PW} unlock 1001 || atf_fail "Unlocking the user"
+ atf_check -s exit:0 -o match:"^1001:\*:1002:" \
+ grep "^1001:\*:1002:" $HOME/master.passwd
+}
atf_init_test_cases() {
atf_add_test_case user_locking
+ atf_add_test_case numeric_locking
}