Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Aug 2015 14:28:15 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286993 - in head/usr.sbin/pw: . tests
Message-ID:  <201508211428.t7LESFPX005802@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Aug 21 14:28:14 2015
New Revision: 286993
URL: https://svnweb.freebsd.org/changeset/base/286993

Log:
  Fix err pointer not initialized to NULL resulting
  
  Reported by:	"O. Hartmann" <ohartman@zedat.fu-berlin.de>

Modified:
  head/usr.sbin/pw/strtounum.c
  head/usr.sbin/pw/tests/pw_useradd.sh

Modified: head/usr.sbin/pw/strtounum.c
==============================================================================
--- head/usr.sbin/pw/strtounum.c	Fri Aug 21 14:15:54 2015	(r286992)
+++ head/usr.sbin/pw/strtounum.c	Fri Aug 21 14:28:14 2015	(r286993)
@@ -41,6 +41,7 @@ strtounum(const char * __restrict np, ui
 	char *endp;
 	uintmax_t ret;
 
+	*errpp = NULL;
 	if (minval > maxval) {
 		errno = EINVAL;
 		if (errpp != NULL)

Modified: head/usr.sbin/pw/tests/pw_useradd.sh
==============================================================================
--- head/usr.sbin/pw/tests/pw_useradd.sh	Fri Aug 21 14:15:54 2015	(r286992)
+++ head/usr.sbin/pw/tests/pw_useradd.sh	Fri Aug 21 14:28:14 2015	(r286993)
@@ -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
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508211428.t7LESFPX005802>