summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-08-21 14:28:14 +0000
committerbapt <bapt@FreeBSD.org>2015-08-21 14:28:14 +0000
commit43164ff2ed6441746170b7dcdd5a37ebda9afa05 (patch)
tree886e8d0a56dd106da634e1d2ae398f8088c78d84 /usr.sbin/pw
parentb4161cb4156cc6edf94f67c41a1e429f442ee811 (diff)
downloadFreeBSD-src-43164ff2ed6441746170b7dcdd5a37ebda9afa05.zip
FreeBSD-src-43164ff2ed6441746170b7dcdd5a37ebda9afa05.tar.gz
Fix err pointer not initialized to NULL resulting
Reported by: "O. Hartmann" <ohartman@zedat.fu-berlin.de>
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/strtounum.c1
-rwxr-xr-xusr.sbin/pw/tests/pw_useradd.sh15
2 files changed, 16 insertions, 0 deletions
diff --git a/usr.sbin/pw/strtounum.c b/usr.sbin/pw/strtounum.c
index be57276..b2fefeb 100644
--- a/usr.sbin/pw/strtounum.c
+++ b/usr.sbin/pw/strtounum.c
@@ -41,6 +41,7 @@ strtounum(const char * __restrict np, uintmax_t minval, uintmax_t maxval,
char *endp;
uintmax_t ret;
+ *errpp = NULL;
if (minval > maxval) {
errno = EINVAL;
if (errpp != NULL)
diff --git a/usr.sbin/pw/tests/pw_useradd.sh b/usr.sbin/pw/tests/pw_useradd.sh
index 0c3a39e..cb62944 100755
--- a/usr.sbin/pw/tests/pw_useradd.sh
+++ b/usr.sbin/pw/tests/pw_useradd.sh
@@ -338,6 +338,20 @@ user_add_w_yes_body() {
grep "^foo" ${HOME}/master.passwd
}
+atf_test_case user_add_with_pw_conf
+user_add_with_pw_conf_body()
+{
+ populate_etc_skel
+ atf_check -s exit:0 \
+ ${PW} useradd -D -C ${HOME}/pw.conf \
+ -u 2000,32767 -i 2000,32767
+ atf_check -s exit:0 \
+ -o inline:"minuid = 2000\nmaxuid = 32767\nmingid = 2000\nmaxgid = 32767\n" \
+ grep "^m.*id =" ${HOME}/pw.conf
+ atf_check -s exit:0 \
+ ${PW} useradd foo -C ${HOME}/pw.conf
+}
+
atf_init_test_cases() {
atf_add_test_case user_add
atf_add_test_case user_add_noupdate
@@ -367,4 +381,5 @@ atf_init_test_cases() {
atf_add_test_case user_add_bad_shell
atf_add_test_case user_add_already_exists
atf_add_test_case user_add_w_yes
+ atf_add_test_case user_add_with_pw_conf
}
OpenPOWER on IntegriCloud