[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rsh



On Wed, Aug 04, 1999 at 08:37:03AM +0200, Assar Westerlund wrote:
> Brian A May <bmay@dgs.monash.edu.au> writes:
> > I have fixed all my rsh problems to date with the following patch.
> > Well... it would appear that the problems have gone, but I am still not
> > entirely sure my fixes are the best solution.
> 
> Patch applied.  Thanks.

I just noticed - it doesn't work for encrypted data (ie if rsh -x is used).
:-(

Hence my reason for saying earlier that it was broken under Ultrix, when
it doesn't work on Linux either. The client side is being shutdown,
but the server is not responding. Here is the strace:

select(7, [0 3 6], NULL, NULL, NULL)    = 1 (in [0])
read(0, "hi\n", 16384)                  = 3
write(3, "\0\0\0\3", 4)                 = 4
write(3, "\3319\270q#\345\352\363\367\237\247"..., 32) = 32
select(7, [0 3 6], NULL, NULL, NULL)    = 1 (in [0])
read(0, "", 16384)                      = 0
close(0)                                = 0
shutdown(3, 1 /* send */)               = 0
select(7, [3 6], NULL, NULL, NULL)      = 1 (in [3])
read(3, "\0\0\0\3", 4)                  = 4
read(3, "\2751\354~\247k_Q\f\217Y?\26M\317"..., 32) = 32
write(1, "hi\n", 3hi
)                     = 3
select(7, [3 6], NULL, NULL, NULL

This is how it looks without encryption:

select(7, [0 3 6], NULL, NULL, NULL)    = 1 (in [0])
read(0, "hi\n", 16384)                  = 3
write(3, "hi\n", 3)                     = 3
select(7, [0 3 6], NULL, NULL, NULL)    = 1 (in [0])
read(0, "", 16384)                      = 0
close(0)                                = 0
shutdown(3, 1 /* send */)               = 0
select(7, [3 6], NULL, NULL, NULL)      = 1 (in [3])
read(3, "hi\n", 16384)                  = 3
write(1, "hi\n", 3hi
)                     = 3
select(7, [3 6], NULL, NULL, NULL)      = 1 (in [6])
read(6, "", 16384)                      = 0
close(6)                                = 0
select(7, [3], NULL, NULL, NULL)        = 1 (in [3])
read(3, "", 16384)                      = 0
close(3)                                = 0
close(3)                                = -1 EBADF (Bad file number)
close(0)                                = -1 EBADF (Bad file number)
close(1)                                = 0
close(2)                                = 0
close(4)                                = 0
SYS_310(0x1, 0xfffffffffffff137, 0)     = 0
exit(0)                                 = ?
_exit returned!
) = ? (in [3])

(ignore the bottom bit - strace is a little bit broken.)

> > For instance, shutdown should not be called (I think) if there is
> > any data still being sent, and I don't know if this is a problem or
> > not.
> 
> I don't think that's a problem.  TCP should still buffer and send the
> data even if you have done a shutdown() on one direction.

It may not be a problem, but this is what the glibc documentation says:

    `1'
          Stop trying to transmit data from this socket.  Discard any
          data waiting to be sent.  Stop looking for acknowledgement of
          data already sent; don't retransmit it if it is lost.

-- 
Brian May <bmay@csse.monash.edu.au>

PGP signature