[net.bugs.4bsd] Bug in 4.2BSD su

steve@miduet.mifnet.gec-mi-ate.co.uk (Steve Lademann) (04/24/86)

I posted this once, but I don't think it made it - Try again.

>You probably know all about this one, but here goes, anyway.
>
>There is a bug in VAX 4.2BSD su which occurs if you want to temporarily
>change to a different login using the following shell command:-
>
>		su fred
>
>If the new user doesn't have access to the current directory, su
>appears to exit silently without changing to the new user. If the shell
>prompts for the new and the old user are similar, it's extremely
>difficult to tell what has happened. The reason is that su does not
>check that the current directory is accessible prior to exec-ing the
>new shell, which, on on being exec-ed and finding that it can't read
>the directory, exits ever so quietly with a status of 1. (Or at least,
>csh does - I haven't tried sh.)
>
>The fix is to add a check just prior to shell execing to test
>accessibility of the current directory, having juggled the uid and gid
>set. If it isn't, the friendly thing to do is to shift to the new
>user's home directory. If you're unfriendly, snap his head off and exit.
>
>If this is of a problem to you, please mail me for a diff.
>
-----------------------------------------------------------------
|Steve Lademann		|Phone:	44 727 59292 x326		|
|Marconi Instruments Ltd|UUCP : ...mcvax!ukc!hrc63!miduet!steve	|
|St. Albans		|NRS  : steve@uk.co.gec-mi-ate.mifnet	|
|Herts.   UK		|					|
-----------------------------------------------------------------
|"The views expressed herein do not necessarily reflect"|	|
|"those of my employer, and may not even reflect my own"|	|
-----------------------------------------------------------------