[8018] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.2R: rcp (patch included)

daemon@ATHENA.MIT.EDU (ckclark@ATHENA.MIT.EDU)
Fri Aug 23 12:41:46 1991

From: ckclark@ATHENA.MIT.EDU
Date: Fri, 23 Aug 91 12:42:08 -0400
To: marc@ATHENA.MIT.EDU
Cc: bugs@ATHENA.MIT.EDU
In-Reply-To: Marc Horowitz's message of Thu, 22 Aug 91 20:31:35 EDT <9108230031.AA00457@w20-575-96.MIT.EDU>
Reply-To: ckclark@mit.edu

>>>>> On Thu, 22 Aug 91 20:31:35 EDT, Marc Horowitz <marc@ATHENA.MIT.EDU> said:

	Marc> What's wrong:
	Marc> 	Apparently, something in rcp passes the filename to a shell running
	Marc> not as a tty, so # chars are treated as comments.  For example:

	Marc> % rcp beeblebrox:/usr/tmp/#8888.@afs@athena.mit.edu@user@m@marc@Mail@draft# /tmp/draft
	Marc> rcp: /usr/tmp/: not a plain file
	Marc> Exit 1

rshd uses the following line to execute commands passed to it by rcp and
rsh clients:

 execl(pwd->pw_shell, cp, "-c", cmdbuf, 0);

Because of this, I think the bug you sent in is really a bug in the
shell you use.  Both the Athena tcsh and tcsh-6.00 have this problem,
but sh, zsh, and ksh will not, and will execute the command without
quoting.

It seems to me to make no sense whatsoever for a shell to consider '#'
as a comment charcter when to the shell passed via '-c'.

If you don't like that agrument, the following patch to rshd.c will fix
the problem without requiring shell repair, but it's a kludge, as it
depends on the shell behaving in an intelligent fashion when given the
-i flag.  I have tested the patch out on the VAX with remote shells of
sh, Athena csh, tcsh-6.00, zsh, bash, and ksh.

NOTE: With this patch, no quoting will be necessary, but sh will print a
'$' before executing anything, and bash will tell you if you have local
mail before it executes the command.  These effects do not seem to
influence the effectiveness of the command, however.  Athena's csh and
tcsh-6.00 will do nothing out of the ordinary.  A further kludge would
be to pass the -i to the shell only if it's name ends in "csh", but I
haven't included that here because it's of dubious value, since a
shell's path name could be anything and still be csh.

(Also, since rsh and rcp a both rshd clients, this will fix similar
problems which occur when trying to execute commands like:

rsh remotehost /bin/rm -f /usr/tmp/#foo#)


*** /source/athena/athena.lib/kerberos/appl/bsd/rshd.c  Tue Aug 13 14:56:02 1991
--- rshd.c      Fri Aug 23 12:04:18 1991
***************
*** 371,377 ****
                cp++;
        else
                cp = pwd->pw_shell;
!       execl(pwd->pw_shell, cp, "-c", cmdbuf, 0);
        perror(pwd->pw_shell);
        exit(1);
  }
--- 371,377 ----
                cp++;
        else
                cp = pwd->pw_shell;
!       execl(pwd->pw_shell, cp, "-ic", cmdbuf, 0);
        perror(pwd->pw_shell);
        exit(1);
  }



home help back first fref pref prev next nref lref last post