[net.bugs.4bsd] Short summary of the problem

norm@fluke.UUCP (Norm Seethoff) (10/25/85)

Index:	etc/rshd.c 4.2BSD [+FIX]

Description:
	rshd does not establish the same umask as login.  Files created
	via commands executed by rshd on behalf of a remote client have
	world write permission.

Repeat-By:
	execute:
		rsh remotesystem umask
	and find that the result is consistently returned as 0.
	or:
		rsh remotesystem touch /tmp/foo
	and find that the mode of /tmp/foo is -rw-rw-rw-

Fix:
	Add a umask call to rshd in the vicinity of line 270 as
	in the following code fragment:

		environ = envinit;
		strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
		strncat(shell, pwd->pw_shell, sizeof(shell)-7);
		strncat(username, pwd->pw_name, sizeof(username)-6);
		umask(022);     /* set same default umask as in login */


Norm Seethoff
John Fluke Mfg. Co., Inc.
{decvax!microso | uw-beaver | allegra | lbl-csam}!fluke!norm

ken@rochester.UUCP (and Vicki Herrieschopper) (10/28/85)

In article <2841@vax4.fluke.UUCP> norm@fluke.UUCP (Norm Seethoff) writes:
>	rshd does not establish the same umask as login.  Files created
>	via commands executed by rshd on behalf of a remote client have
>	world write permission.

On our system (4.2 BSD) I worked around the problem by putting the
umask statement in .cshrc instead of .login. You will need to do this
anyway if you want anything other than the default.

	Ken
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
USnail:	Dept. of Comp. Sci., U. of Rochester, NY 14627. Voice: Ken!

stephen@dcl-cs.UUCP (Stephen J. Muir) (10/30/85)

In article <12695@rochester.UUCP> ken@rochester.UUCP (and Vicki Herrieschopper) writes:
>In article <2841@vax4.fluke.UUCP> norm@fluke.UUCP (Norm Seethoff) writes:
>>	rshd does not establish the same umask as login.  Files created
>>	via commands executed by rshd on behalf of a remote client have
>>	world write permission.
>
>On our system (4.2 BSD) I worked around the problem by putting the
>umask statement in .cshrc instead of .login. You will need to do this
>anyway if you want anything other than the default.

Personally, I would rather change "/etc/init" to set the default umask to 022.
This is because "/etc/cron" also suffers from this problem.
-- 
UUCP:	...!seismo!mcvax!ukc!dcl-cs!stephen
DARPA:	stephen%lancs.comp@ucl-cs	| Post: University of Lancaster,
JANET:	stephen@uk.ac.lancs.comp	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4599		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR