NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/40324: The homeperm setting in /etc/usermgmt.conf is ignored by useradd



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 04 12:05:00 +0000 2009
>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) {



Home | Main Index | Thread Index | Old Index