NetBSD Problem Report #40324

From www@NetBSD.org  Sun Jan  4 12:01:25 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id B8C6063BD15
	for <gnats-bugs@gnats.netbsd.org>; Sun,  4 Jan 2009 12:01:25 +0000 (UTC)
Message-Id: <20090104120125.6A13163BA1C@narn.NetBSD.org>
Date: Sun,  4 Jan 2009 12:01:25 +0000 (UTC)
From: guyyur@gmail.com
Reply-To: guyyur@gmail.com
To: gnats-bugs@NetBSD.org
Subject: The homeperm setting in /etc/usermgmt.conf is ignored by useradd
X-Send-Pr-Version: www-1.0

>Number:         40324
>Category:       bin
>Synopsis:       The homeperm setting in /etc/usermgmt.conf is ignored by useradd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 04 12:05:00 +0000 2009
>Closed-Date:    Sun Jun 10 07:56:37 +0000 2018
>Last-Modified:  Thu Jun 14 19:55:00 +0000 2018
>Originator:     Guy Yur
>Release:        4.0.1
>Organization:
>Environment:
NetBSD vm-nbsd1 4.0.1 NetBSD 4.0.1 (GENERIC) #0: Tue Oct  7 22:58:48 PDT 2008  builds@wb30:/home/builds/ab/netbsd-4-0-1-RELEASE/i386/200810080053Z-obj/home/builds/ab/netbsd-4-0-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
>Description:
The homeperm setting in /etc/usermgmt.conf is ignored by useradd.

The code that reads the settings from /etc/usermgmt.conf sets a default value for up->u_homeperm after the value was read from the file,
overwriting the read value.

>How-To-Repeat:
1. set homeperm to a value other than 0755 in /etc/usrmgmt.conf
   0700 for example.
2. create account with the -m flag to create the home directory
   and without the -M flag.
   useradd -m test1
3. The home directory is created with 0755 mode and not the mode
   specified in /etc/usrmgmt.conf.

>Fix:
in file
  src/usr.sbin/user/user.c

in function
  read_defaults(user_t *up)

move the line
  up->u_homeperm = DEF_HOMEPERM;

before the code that reads _PATH_USERMGMT_CONF.

for example, after
  up->u_expire = DEF_EXPIRE;
and before
  if ((fp = fopen(_PATH_USERMGMT_CONF, "r")) == NULL) {

>Release-Note:

>Audit-Trail:
From: Staffan =?iso-8859-1?Q?Thom=E9n?= <duck@shangtai.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/40324
Date: Thu, 26 Apr 2012 16:20:38 +0300

 Bumping this because someone who asked about this on IRC don't seem to have
 done it themselves. Still extant on 5.1, perhaps it would be a good idea to
 implement the above fix.

 -- 
 Staffan Thomén - ADB3 455F 10D5 86D1 78D6  048D 11BB D66E 7C7E 2EF8

From: "Zafer Aydogan" <zafer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40324 CVS commit: src/usr.sbin/user
Date: Sun, 10 Jun 2018 07:52:05 +0000

 Module Name:	src
 Committed By:	zafer
 Date:		Sun Jun 10 07:52:05 UTC 2018

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

 Log Message:
 Set default homeperm values before writing usermgmt.conf file and honor values in it instead of ignoring it.
 Fixes PR bin/40324 by Guy Yur


 To generate a diff of this commit:
 cvs rdiff -u -r1.131 -r1.132 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: zafer@NetBSD.org
State-Changed-When: Sun, 10 Jun 2018 07:56:37 +0000
State-Changed-Why:
Fixed. Thank you for your Problem Report Guy Yur.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40324 CVS commit: [netbsd-8] src/usr.sbin/user
Date: Thu, 14 Jun 2018 19:54:41 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Jun 14 19:54:41 UTC 2018

 Modified Files:
 	src/usr.sbin/user [netbsd-8]: user.c

 Log Message:
 Pull up following revision(s) (requested by zafer in ticket #877):

 	usr.sbin/user/user.c: revision 1.132

 Set default homeperm values before writing usermgmt.conf file and
 honor values in it instead of ignoring it.

 Fixes PR bin/40324 by Guy Yur


 To generate a diff of this commit:
 cvs rdiff -u -r1.131 -r1.131.22.1 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.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.