NetBSD Problem Report #22469

Received: (qmail 25296 invoked by uid 605); 13 Aug 2003 18:03:49 -0000
Message-Id: <200308131803.h7DI3fw12797@vm-netbsd-161.nominum.com>
Date: Wed, 13 Aug 2003 11:03:41 -0700 (PDT)
From: rpixley@vm-netbsd-161.nominum.com
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: rpixley@vm-netbsd-161.nominum.com
To: gnats-bugs@gnats.netbsd.org
Subject: user.c should use "pwd.h" include file for _PATH_USERMGMT_CONF
X-Send-Pr-Version: 3.95

>Number:         22469
>Category:       bin
>Synopsis:       user.c should use "pwd.h" include file for _PATH_USERMGMT_CONF
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    rpaulo
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 13 18:04:01 +0000 2003
>Closed-Date:    Mon Sep 19 00:46:10 +0000 2005
>Last-Modified:  Mon Sep 19 00:46:10 +0000 2005
>Originator:     
>Release:        NetBSD 1.6.1
>Organization:

>Environment:


System: NetBSD vm-netbsd-161.nominum.com 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr 8 12:05:52 UTC 2003 autobuild@tgm.daemon.org:/autobuild/netbsd-1-6/i386/OBJ/autobuild/netbsd-1-6/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

usr/src/usr.sbin/user/user.c includes this line:

#define CONFFILE	"/etc/usermgmt.conf"

while usr/src/include/pwd.h includes this one:

#define	_PATH_USERMGMT_CONF	"/etc/usermgmt.conf"

user.c should probably just refer to pwd.h.


>How-To-Repeat:

>Fix:
--- user.c.~1.51.2.4.~	Wed Dec 25 23:37:50 2002
+++ user.c	Wed Aug 13 11:02:44 2003
@@ -108,8 +108,6 @@
 	F_CLASS		= 0x1000
 };

-#define CONFFILE	"/etc/usermgmt.conf"
-
 #ifndef DEF_GROUP
 #define DEF_GROUP	"users"
 #endif
@@ -710,13 +708,13 @@
 	int	i;
 #endif

-	(void) snprintf(template, sizeof(template), "%s.XXXXXX", CONFFILE);
+	(void) snprintf(template, sizeof(template), "%s.XXXXXX", _PATH_USERMGMT_CONF);
 	if ((fd = mkstemp(template)) < 0) {
-		warnx("can't mkstemp `%s' for writing", CONFFILE);
+		warnx("can't mkstemp `%s' for writing", _PATH_USERMGMT_CONF);
 		return 0;
 	}
 	if ((fp = fdopen(fd, "w")) == NULL) {
-		warn("can't fdopen `%s' for writing", CONFFILE);
+		warn("can't fdopen `%s' for writing", _PATH_USERMGMT_CONF);
 		return 0;
 	}
 	ret = 1;
@@ -730,20 +728,20 @@
 	    fprintf(fp, "inactive\t%s\n", (up->u_inactive == NULL) ?  UNSET_INACTIVE : up->u_inactive) <= 0 ||
 	    fprintf(fp, "expire\t\t%s\n", (up->u_expire == NULL) ?  UNSET_EXPIRY : up->u_expire) <= 0 ||
 	    fprintf(fp, "preserve\t%s\n", (up->u_preserve == 0) ? "false" : "true") <= 0) {
-		warn("can't write to `%s'", CONFFILE);
+		warn("can't write to `%s'", _PATH_USERMGMT_CONF);
 		ret = 0;
 	}
 #ifdef EXTENSIONS
 	for (i = (up->u_defrc != up->u_rc) ? up->u_defrc : 0 ; i < up->u_rc ; i++) {
 		if (fprintf(fp, "range\t\t%d..%d\n", up->u_rv[i].r_from, up->u_rv[i].r_to) <= 0) {
-			warn("can't write to `%s'", CONFFILE);
+			warn("can't write to `%s'", _PATH_USERMGMT_CONF);
 			ret = 0;
 		}
 	}
 #endif
 	(void) fclose(fp);
 	if (ret) {
-		ret = ((rename(template, CONFFILE) == 0) && (chmod(CONFFILE, 0644) == 0));
+		ret = ((rename(template, _PATH_USERMGMT_CONF) == 0) && (chmod(_PATH_USERMGMT_CONF, 0644) == 0));
 	}
 	return ret;
 }
@@ -772,11 +770,11 @@
 	NEWARRAY(range_t, up->u_rv, up->u_rsize, exit(1));
 	up->u_inactive = DEF_INACTIVE;
 	up->u_expire = DEF_EXPIRE;
-	if ((fp = fopen(CONFFILE, "r")) == NULL) {
-		if (stat(CONFFILE, &st) < 0 && !setdefaults(up)) {
-			warn("can't create `%s' defaults file", CONFFILE);
+	if ((fp = fopen(_PATH_USERMGMT_CONF, "r")) == NULL) {
+		if (stat(_PATH_USERMGMT_CONF, &st) < 0 && !setdefaults(up)) {
+			warn("can't create `%s' defaults file", _PATH_USERMGMT_CONF);
 		}
-		fp = fopen(CONFFILE, "r");
+		fp = fopen(_PATH_USERMGMT_CONF, "r");
 	}
 	if (fp != NULL) {
 		while ((s = fparseln(fp, &len, &lineno, NULL, 0)) != NULL) {

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->bin-bug-people 
Responsible-Changed-By: fair 
Responsible-Changed-When: Sat Aug 16 05:27:39 UTC 2003 
Responsible-Changed-Why:  
slightly malformed PR manually reformatted. 
From: "Liam J. Foy" <liamfoy@sepulcrum.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/22469
Date: Sun, 18 Sep 2005 23:19:52 +0100

 	Can this patch please be committed. It looks good to me.

 Thanks,
 -- 
 		- Liam J. Foy
 		liamfoy@sepulcrum.org
 		http://www.bsd-systems.co.uk

Responsible-Changed-From-To: bin-bug-people->rpaulo
Responsible-Changed-By: rpaulo@netbsd.org
Responsible-Changed-When: Mon, 19 Sep 2005 00:32:11 +0000
Responsible-Changed-Why:
I'll take care of it.


From: Rui Paulo <rpaulo@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/22469 CVS commit: src/usr.sbin/user
Date: Mon, 19 Sep 2005 00:43:17 +0000 (UTC)

 Module Name:	src
 Committed By:	rpaulo
 Date:		Mon Sep 19 00:43:17 UTC 2005

 Modified Files:
 	src/usr.sbin/user: user.c

 Log Message:
 PR 22469: user.c should use "pwd.h" include file for
 _PATH_USERMGMT_CONF. By rpixley@vm-netbsd-161.nominum.com.


 To generate a diff of this commit:
 cvs rdiff -r1.93 -r1.94 src/usr.sbin/user/user.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: rpaulo@netbsd.org
State-Changed-When: Mon, 19 Sep 2005 00:46:10 +0000
State-Changed-Why:
fixed, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.