summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-01-26 21:41:54 +0000
committerdim <dim@FreeBSD.org>2015-01-26 21:41:54 +0000
commita53e4d44d0463dae21283fdb3ca61a1e38df799f (patch)
tree6f5baa0292e962bb69dc0020ada66d60ea578642 /usr.sbin/pw
parentc9e57e45aceb65bdac0c758538375582075c8a97 (diff)
parent191df99881cad772b533cb8ad72897ab307efdb9 (diff)
downloadFreeBSD-src-a53e4d44d0463dae21283fdb3ca61a1e38df799f.zip
FreeBSD-src-a53e4d44d0463dae21283fdb3ca61a1e38df799f.tar.gz
Merge ^/head r277719 through 277776.
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/pw_group.c6
-rw-r--r--usr.sbin/pw/pw_user.c5
-rw-r--r--usr.sbin/pw/tests/Makefile4
-rwxr-xr-xusr.sbin/pw/tests/pw_groupshow.sh19
-rwxr-xr-xusr.sbin/pw/tests/pw_usershow.sh19
5 files changed, 3 insertions, 50 deletions
diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c
index 51166cd..b20ce88 100644
--- a/usr.sbin/pw/pw_group.c
+++ b/usr.sbin/pw/pw_group.c
@@ -68,11 +68,7 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
};
if (a_gid != NULL) {
- const char *teststr;
- teststr = a_gid->val;
- if (*teststr == '-')
- teststr++;
- if (strspn(teststr, "0123456789") != strlen(teststr))
+ if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val))
errx(EX_USAGE, "-g expects a number");
}
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index f146b46..483148a 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -322,10 +322,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
a_name = NULL;
}
} else {
- const char *teststr = a_uid->val;
- if (*teststr == '-')
- teststr++;
- if (strspn(teststr, "0123456789") != strlen(teststr))
+ if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val))
errx(EX_USAGE, "-u expects a number");
}
diff --git a/usr.sbin/pw/tests/Makefile b/usr.sbin/pw/tests/Makefile
index c609884..1283ff2 100644
--- a/usr.sbin/pw/tests/Makefile
+++ b/usr.sbin/pw/tests/Makefile
@@ -9,11 +9,9 @@ ATF_TESTS_SH= pw_etcdir \
pw_lock \
pw_groupdel \
pw_groupmod \
- pw_groupshow \
pw_useradd \
pw_userdel \
- pw_usermod \
- pw_usershow
+ pw_usermod
.for tp in ${ATF_TESTS_SH}
TEST_METADATA.${tp}+= required_user="root"
diff --git a/usr.sbin/pw/tests/pw_groupshow.sh b/usr.sbin/pw/tests/pw_groupshow.sh
deleted file mode 100755
index 2ba53d6..0000000
--- a/usr.sbin/pw/tests/pw_groupshow.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-# $FreeBSD$
-
-# Import helper functions
-. $(atf_get_srcdir)/helper_functions.shin
-
-
-# Test negative uid are still valid
-# PR: 196514
-atf_test_case show_group_with_negative_number
-show_group_with_negative_number_body() {
- populate_etc_skel
- atf_check -s exit:0 \
- -o inline:"wheel:*:0:root\n" \
- ${PW} groupshow -n wheel -g -1
-}
-
-atf_init_test_cases() {
- atf_add_test_case show_group_with_negative_number
-}
diff --git a/usr.sbin/pw/tests/pw_usershow.sh b/usr.sbin/pw/tests/pw_usershow.sh
deleted file mode 100755
index 4703644..0000000
--- a/usr.sbin/pw/tests/pw_usershow.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-# $FreeBSD$
-
-# Import helper functions
-. $(atf_get_srcdir)/helper_functions.shin
-
-
-# Test negative uid are still valid
-# PR: 196514
-atf_test_case show_user_with_negative_number
-show_user_with_negative_number_body() {
- populate_etc_skel
- atf_check -s exit:0 \
- -o inline:"root:*:0:0::0:0:Charlie &:/root:/bin/csh\n" \
- ${PW} usershow -n root -u -1
-}
-
-atf_init_test_cases() {
- atf_add_test_case show_user_with_negative_number
-}
OpenPOWER on IntegriCloud