Date: Thu, 16 Sep 2004 11:50:24 GMT From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/71786: adduser breaks if /sbin/nologin is included in /etc/shells Message-ID: <200409161150.i8GBoOLu001922@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/71786; it has been noted by GNATS. From: Peter Pentchev <roam@ringlet.net> To: bug-followup@FreeBSD.org Cc: andrew.hayden@gmail.com Subject: Re: bin/71786: adduser breaks if /sbin/nologin is included in /etc/shells Date: Thu, 16 Sep 2004 14:45:32 +0300 On Thu, Sep 16, 2004 at 11:31:18AM +0000, Peter Pentchev wrote: [snip] > It seems that there is indeed a problem in adduser's handling of the > nologin shell. In the fullpath_from_shell() function, the 'return' > within the while/case/if will only return from the new shell instance > created due to the "cat ${ETCSHELLS}" pipe, and will *not* stop the > shell from executing the nologin special case test. Thus, > fullpath_from_shell() will output *two* lines containing nologin, and > those two lines will be what is added to the end of master.passwd's new > user line. > > Can you try the following patch? Basically, in the > fullpath_from_shell() function, move the nologin special case test > before the cat | while loop. FWIW, for 6.x-CURRENT and 5.3-BETA this patch would assume the following shape. Source committers, please treat this as a request for pre-commit review - I could commit this if no one has any objections: Index: src/usr.sbin/adduser/adduser.sh =================================================================== RCS file: /home/ncvs/src/usr.sbin/adduser/adduser.sh,v retrieving revision 1.24 diff -u -r1.24 adduser.sh --- src/usr.sbin/adduser/adduser.sh 28 Aug 2004 14:32:10 -0000 1.24 +++ src/usr.sbin/adduser/adduser.sh 16 Sep 2004 11:43:23 -0000 @@ -126,6 +126,13 @@ _shell=$1 [ -z "$_shell" ] && return 1 + # /usr/sbin/nologin is a special case + if [ "$_shell" = "${NOLOGIN}" -o \ + "$_shell" = "${NOLOGIN_PATH}" ]; then + echo ${NOLOGIN_PATH} + return 0; + fi + cat ${ETCSHELLS} | while read _path _junk ; do case "$_path" in @@ -141,13 +148,6 @@ esac done - # /usr/sbin/nologin is a special case - if [ "$_shell" = "${NOLOGIN}" -o \ - "$_shell" = "${NOLOGIN_PATH}" ]; then - echo ${NOLOGIN_PATH} - return 0; - fi - return 1 } G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence was in the past tense.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409161150.i8GBoOLu001922>