Date: Thu, 16 Sep 2004 11:31:18 GMT From: Peter Pentchev <roam@FreeBSD.org> To: andrew.hayden@gmail.com, roam@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: bin/71786: adduser breaks if /sbin/nologin is included in /etc/shells Message-ID: <200409161131.i8GBVID4001503@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
Synopsis: adduser breaks if /sbin/nologin is included in /etc/shells State-Changed-From-To: open->feedback State-Changed-By: roam State-Changed-When: Thu Sep 16 11:26:10 GMT 2004 State-Changed-Why: 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. Index: src/usr.sbin/adduser/adduser.sh =================================================================== RCS file: /home/ncvs/src/usr.sbin/adduser/adduser.sh,v retrieving revision 1.20 diff -u -r1.20 adduser.sh --- src/usr.sbin/adduser/adduser.sh 24 Jun 2003 15:20:43 -0000 1.20 +++ src/usr.sbin/adduser/adduser.sh 16 Sep 2004 11:24:30 -0000 @@ -123,6 +123,12 @@ _shell=$1 [ -z "$_shell" ] && return 1 + # /sbin/nologin is a special case + if [ "$_shell" = "${NOLOGIN}" ]; then + echo ${NOLOGIN_PATH} + return 0; + fi + cat ${ETCSHELLS} | while read _path _junk ; do case "$_path" in @@ -137,12 +143,6 @@ esac done - # /sbin/nologin is a special case - if [ "$_shell" = "${NOLOGIN}" ]; then - echo ${NOLOGIN_PATH} - return 0; - fi - return 1 } http://www.freebsd.org/cgi/query-pr.cgi?pr=71786
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409161131.i8GBVID4001503>