Date: Fri, 23 May 1997 15:20:39 +1000 (EST) From: iaint@css.tuu.utas.edu.au To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/3666: /usr/sbin/pw has error reading skeleton directories Message-ID: <199705230520.PAA26341@css.tuu.utas.edu.au> Resent-Message-ID: <199705230530.WAA02019@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 3666
>Category: bin
>Synopsis: /usr/sbin/pw has error reading skeleton directories
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu May 22 22:30:01 PDT 1997
>Last-Modified:
>Originator: Iain Templeton
>Organization:
UgH!
>Release: FreeBSD 2.2.1-RELEASE i386
>Environment:
Standard 2.2.1 release
>Description:
/usr/sbin/pw has trouble during useradd when trying to use the -k
(skeleton directory) option. It claims that the directory specified
does not exist. However that was not the case. Using directories which
I knew existed (such as /root), it still failed.
>How-To-Repeat:
pw useradd -n test -c 'Test User' -g test -m -k /usr/share/skel
Or just use any variant of useradd with -k
>Fix:
On line 232 of the file /usr/src/usr.sbin/pw/pw_user.c there is a test
on whether a stat()'ed file is a directory (S_ISDIR()). The logical
sense of this should be the other way around, as it will cause an error
if the directory does exist. The following context diff has what I
did to change the problem.
Note: Some of the lines appear to wrap on a narrow display.
*** pw_user.c.orig Fri May 23 14:46:08 1997
--- pw_user.c Fri May 23 14:47:39 1997
***************
*** 229,235 ****
cnf->groups[i++] = NULL;
}
if ((arg = getarg(args, 'k')) != NULL) {
! if (stat(cnf->dotdir = arg->val, &st) == -1 || S_ISDIR(st.st_mode))
cmderr(EX_OSFILE, "skeleton `%s' is not a directory or does not exist\n", cnf->dotdir);
}
if ((arg = getarg(args, 's')) != NULL)
--- 229,235 ----
cnf->groups[i++] = NULL;
}
if ((arg = getarg(args, 'k')) != NULL) {
! if (stat(cnf->dotdir = arg->val, &st) == -1 || !S_ISDIR(st.st_mode))
cmderr(EX_OSFILE, "skeleton `%s' is not a directory or does not exist\n", cnf->dotdir);
}
if ((arg = getarg(args, 's')) != NULL)
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705230520.PAA26341>
