Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

user(8): Don't create default config file

3 views
Skip to first unread message

Matthew Martin

unread,
Oct 6, 2016, 11:37:22 PM10/6/16
to te...@openbsd.org
There doesn't seem to be any reason for user to write out a config file
with the defaults if none exists. I've never seen anything else in base
do this, so kill it.

- Matthew Martin


Index: user.c
===================================================================
RCS file: /cvs/src/usr.sbin/user/user.c,v
retrieving revision 1.112
diff -u -p -r1.112 user.c
--- user.c 10 Aug 2016 20:30:34 -0000 1.112
+++ user.c 7 Oct 2016 03:21:25 -0000
@@ -742,7 +742,6 @@ setdefaults(user_t *up)
static void
read_defaults(user_t *up)
{
- struct stat st;
size_t lineno;
size_t len;
FILE *fp;
@@ -761,13 +760,7 @@ read_defaults(user_t *up)
err(1, NULL);
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);
- }
- fp = fopen(CONFFILE, "r");
- }
- if (fp != NULL) {
+ if ((fp = fopen(CONFFILE, "r")) != NULL) {
while ((s = fparseln(fp, &len, &lineno, NULL, 0)) != NULL) {
if (strncmp(s, "group", 5) == 0) {
for (cp = s + 5 ; isspace((unsigned char)*cp); cp++) {

Matthew Martin

unread,
Oct 13, 2016, 11:28:47 PM10/13/16
to te...@openbsd.org
On Thu, Oct 06, 2016 at 10:36:48PM -0500, Matthew Martin wrote:
> There doesn't seem to be any reason for user to write out a config file
> with the defaults if none exists. I've never seen anything else in base
> do this, so kill it.

Ping. With man pages fixes this time.

- Matthew Martin


Index: user.c
===================================================================
RCS file: /cvs/src/usr.sbin/user/user.c,v
retrieving revision 1.112
diff -u -p -r1.112 user.c
--- user.c 10 Aug 2016 20:30:34 -0000 1.112
+++ user.c 14 Oct 2016 03:26:16 -0000
@@ -742,7 +742,6 @@ setdefaults(user_t *up)
static void
read_defaults(user_t *up)
{
- struct stat st;
size_t lineno;
size_t len;
FILE *fp;
@@ -761,13 +760,7 @@ read_defaults(user_t *up)
err(1, NULL);
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);
- }
- fp = fopen(CONFFILE, "r");
- }
- if (fp != NULL) {
+ if ((fp = fopen(CONFFILE, "r")) != NULL) {
while ((s = fparseln(fp, &len, &lineno, NULL, 0)) != NULL) {
if (strncmp(s, "group", 5) == 0) {
for (cp = s + 5 ; isspace((unsigned char)*cp); cp++) {
Index: useradd.8
===================================================================
RCS file: /cvs/src/usr.sbin/user/useradd.8,v
retrieving revision 1.34
diff -u -p -r1.34 useradd.8
--- useradd.8 14 Aug 2016 09:52:08 -0000 1.34
+++ useradd.8 14 Oct 2016 03:26:16 -0000
@@ -85,8 +85,7 @@ the range from which the UID will be all
and default login shell
can be provided in the
.Pa /etc/usermgmt.conf
-file, which, if running as root, is created using the built-in defaults if
-it does not exist.
+file.
.Pp
The first form of the command shown above (using the
.Fl D
Index: userdel.8
===================================================================
RCS file: /cvs/src/usr.sbin/user/userdel.8,v
retrieving revision 1.17
diff -u -p -r1.17 userdel.8
--- userdel.8 13 Mar 2015 19:58:41 -0000 1.17
+++ userdel.8 14 Oct 2016 03:26:16 -0000
@@ -53,8 +53,7 @@ removing that user's home directory and
.Pp
Default values are taken from the information provided in the
.Pa /etc/usermgmt.conf
-file, which, if running as root, is created using the built-in defaults if
-it does not exist.
+file.
.Pp
The first form of the command shown above (using the
.Fl D
Index: usermod.8
===================================================================
RCS file: /cvs/src/usr.sbin/user/usermod.8,v
retrieving revision 1.33
diff -u -p -r1.33 usermod.8
--- usermod.8 16 Aug 2016 11:33:07 -0000 1.33
+++ usermod.8 14 Oct 2016 03:26:16 -0000
@@ -60,8 +60,7 @@ utility modifies user login information
.Pp
Default values are taken from the information provided in the
.Pa /etc/usermgmt.conf
-file, which, if running as root, is created using the built-in defaults if
-it does not exist.
+file.
.Pp
After setting any defaults, and then reading values from
.Pa /etc/usermgmt.conf ,

0 new messages