Path: utzoo!attcan!lsuc!sickkids!mark From: mark@sickkids.UUCP (Mark Bartelt) Newsgroups: comp.bugs.4bsd Subject: Bug in chsh / passwd -s Message-ID: <130@sickkids.UUCP> Date: 9 Dec 88 18:04:32 GMT Reply-To: mark@sickkids.UUCP (Mark Bartelt) Organization: Hospital for Sick Children, Toronto Lines: 23 A bug in passwd.c has the effect of making it possible to change one's login shell from /bin/sh to /bin/csh, but not vice-versa. (Unless one swaps the order of /bin/sh and /bin/csh in /etc/shells, in which case one has the reverse problem!) In getloginshell(), there are two loops which call getusershell(): for (valid = getusershell(); valid; valid = getusershell()) { The first loop is used to confirm that the user who is invoking chsh (or its equivalent, passwd -s) has an (old) login shell listed in /etc/shells; the second is used to verify that the new shell chosen is valid. The bug and fix are obvious; change the second loop to begin: for (setusershell(), valid=getusershell(); valid; valid=getusershell()) { Well, maybe not; setusershell() doesn't work as distributed with 4.3bsd. One can either fix *that* bug first, or use endusershell() in place of setusershell() above. Mark Bartelt UUCP: {utzoo,decvax}!sickkids!mark Hospital for Sick Children, Toronto BITNET: mark@sickkids.utoronto 416/598-6442 INTERNET: mark@sickkids.toronto.edu