Question about uid check in csh's source command

Barry Shein bzs at bu-cs.UUCP
Wed Jan 1 06:43:56 AEST 1986


>	I am trying to figure out a way to make csh read a system-wide
>.login file before reading $HOME/.login.  Looking at the source for csh
>(/usr/src/bin/csh/sh.c) it seems all you have to do is just add one line
>to the startup code.  Where it says:
>
>	if (loginsh) {
>		srccat(value("home"), "/.login");
>	}
>
>I guess I should just be able to add another call to srccat to read in
>/usr/lib/csh.login or something like that.  Reading a bit further into the
>code you find out that srccat won't source a file unless it has the same
>uid or gid as you do.  This I don't understand; why should it care?
>-- 
>Roy Smith <allegra!phri!roy>

I added exactly that as: (/usr/src/bin/csh/sh.c, same place as he mentions)

			/* BZS -
				srcunit/open does enuf
				access checking. Source
				a global .login file if it
				exists. Cannot use srccat
				et al cause they demand
				we be the owner.
			*/
		->	srcunit(dmove(open("/usr/lib/.login",0),-1),0,0) ;
			/* end BZS */
			srccat(value("home"), "/.login");

a while ago, so guess I ran into the same trubble (tho this works exactly
as you wish I believe.)

I assume the owner check is to prevent imposter .login scripts from
being eaten, reasonable I guess (tho if they managed to write into
your home directory...oh well, go figger.)

	-Barry Shein, Boston University



More information about the Comp.unix.wizards mailing list