From: eyvind.ness@hrp.no (Eyvind Ness)
Newsgroups: comp.sys.ti.explorer
Subject: Unix Commands from Explorer via TCP/IP?
Date: 26 Aug 92 07:20:00 GMT
Reply-To: Eyvind.Ness@HRP.No
Distribution: inet
Organization: The Internet


  | Date: Tue, 25 August 92, 18:37 EDT
  | From: Mark H David
  |
  |    From: Eyvind Ness <harvard!hrp.no!eyvind.ness>
  |    Posted-Date: Tue, 25 Aug 92 20:09 GMT
  |    Received-Date: Tue, 25 Aug 92 22:09:18 met
  |    Date: Tue, 25 Aug 92 20:09 GMT
  |    Reply-To: harvard!HRP.No!Eyvind.Ness
  |    X-Mailer: GNU Emacs 18.58.20 with VM 5.21 (beta)
  | 
  |      | Date: Tue, 25 August 92, 15:33 EDT
  |      | From: Mark H David
  |      |
  |      | Thanks for the info.  -- mhd
  | 
  |    You're welcome. I just checked it out again, and it still seems OK:
  | 
  |        (load "lm:public;rsh")
  | 
  |        (ip:rsh "smart" "who" :lispm-user-id "eyvind" :unix-user-id "eyvind")
  |        Error in rsh:
  |        remshd: Login incorrect
  | 
  |        ;;; Fix ~/.rhosts on smart, the Unix host:
  |        ;;; smart(bash)$ echo "remulus eyvind" >>~/.rhosts
  |        ;;; smart(bash)$
  |        ;;; (My Explorer is called "remulus")
  | 
  |        (ip:rsh "smart" "who" :lispm-user-id "eyvind" :unix-user-id "eyvind")
  |        eyvind     console      Aug 24 18:40
  | 
  | Actually, this was fun at first.  However, this only works about 1/2
  | the time.  Almost as reliably, when you repeatedly evaluate a form
  | like the one above, it enters the debugger with
  | 
  | 	Error: End of file on #<IP:ASCII-TRANSLATING-CHARACTER-STREAM 534021>.
  | 	While in the function (:METHOD SYS::BASIC-BUFFERED-STREAM :TYI)
  | 	<- READ-CHAR <- RSH
  | 
  | Any ideas?

Think so.

I've noticed the behaviour you complain about - after trying ~5-6 times
I got the same error. I studied the protocol description in remshd(1m)
in HP-UX and rshd(8c) in SunOS. According to these manual pages there
seems to be a slight misktake in the definition of ip:rsh since it
doesn't conform to the 1st protocol requirement (listed below) that the
local port number should be in the range 512-1023.

So I changed the call to generate-port-number-in-range from:

(generate-port-number-in-range 256 1024)) to:

(generate-port-number-in-range 512 1023))

I haven't experienced any problems since then (I've just successfully
executed the call to IP:RSH shown above ~20 times).

I hope this helps.

Cheers,
Eyvind.

 -When you die, where will you go?  (in the ground is not a valid answer)
 -If I'm pure, I go to pure lisp storage. If I'm impure, I become garbage,
 get collected and blown away.


  Here's an excerpt of the SunOS man page for rsh(8c):

  RSHD(8C)              MAINTENANCE COMMANDS               RSHD(8C)

  NAME
       rshd, in.rshd - remote shell server

  SYNOPSIS
       /usr/etc/in.rshd host.port

  DESCRIPTION
       rshd is the server for  the  rcmd(3N)  routine  and,  conse-
       quently,  for  the  rsh(1C)  program.   The  server provides
       remote execution facilities  with  authentication  based  on
       privileged port numbers.

       rshd is invoked by inetd(8C) each time a  shell  service  is
       requested, and executes the following protocol:

       +    The server checks the client's  source  port.   If  the
	    port  is  not  in the range 512-1023, the server aborts
	    the connection.  The clients host address (in hex)  and
	    port  number  (in  decimal)  are the argument passed to
	    rshd.

       +    The server reads characters from the  socket  up  to  a
	    null (\0) byte.  The resultant string is interpreted as
	    an ASCII number, base 10.

       +    If the number received in step 1  is  non-zero,  it  is
	    interpreted as the port number of a secondary stream to
	    be used for the stderr.  A second  connection  is  then
	    created  to the specified port on the client's machine.
	    The source port of this second connection  is  also  in
	    the range 512-1023.

       +    The server checks the client's source address.  If  the
	    address   is  associated  with  a  host  for  which  no
	    corresponding entry exists in the host name  data  base
	    (see hosts(5)), the server aborts the connection.

       +    A null terminated user name of at most 16 characters is
	    retrieved  on  the  initial  socket.  This user name is
	    interpreted as a user identity to use on  the  server's
	    machine.

       +    A null terminated user name of at most 16 characters is
	    retrieved  on  the  initial  socket.  This user name is
	    interpreted  as  the  user  identity  on  the  client's
	    machine.

       +    A null terminated command to be passed to  a  shell  is
	    retrieved  on  the  initial  socket.  The length of the
	    command is limited by the upper bound on  the  size  of
	    the system's argument list.

  Sun Release 4.1   Last change: 9 September 1987                 1

  RSHD(8C)              MAINTENANCE COMMANDS               RSHD(8C)


+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 Eyvind Ness                    Internet Email: Eyvind.Ness@HRP.No
 Research Scientist             Phone: +47 9 183100
 Control Room Systems Division  Fax: +47 9 187109
 OECD Halden Reactor Project    Surface Mail: P.O. Box 173, N-1751 Halden
 Norway
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+


(forever (and Lisp Emacs))
Newsgroups: comp.sys.ti