Subject: rdist and ssh
To: None <netbsd-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-users
Date: 07/06/2002 20:20:12
I seem to be the only one moaning about rdist and RCMD_CMD=/usr/bin/ssh not
working - are any of you using it?

Taking NetBSD-1.6B/i386 (cluster) and NetBSD-1.6C/i386 (quartz) boxen:

cluster% pwd
/home/prlw1/NetBSD/rdist
cluster% ls -R
a         distfile

./a:
this
cluster% cat distfile
/home/prlw1/NetBSD/rdist/a -> quartz.newn.cam.ac.uk
install /home/prlw1/NetBSD/rdist/b;
cluster% printenv | grep RCMD
cluster% rdist -f distfile
updating host quartz.newn.cam.ac.uk
installing: /home/prlw1/NetBSD/rdist/a
installing: /home/prlw1/NetBSD/rdist/a/this


i.e., no problem. However:

cluster% setenv RCMD_CMD /usr/bin/ssh
cluster% rdist -f distfile
updating host quartz.newn.cam.ac.uk
prlw1@quartz.newn.cam.ac.uk's password: 

and then it hangs in src/usr.bin/rdist/docmd.c:271:

    if (read(rem, cp, 1) != 1)      <============= here
        lostconn(0);
    if (*cp == 'V') {
...

(rem=4, a valid fd, and remerr=6)
It is waiting to read the version string. Meanwhile, quartz is stuck in
server.c:116:

    (void) snprintf(buf, sizeof(buf), "V%d\n", VERSION);
    if (write(rem, buf, strlen(buf)) < 0)
        error("server: could not write remote end: %s\n",
            strerror(errno));
 
    for (;;) {
        cp = cmdbuf;
        if (read(rem, cp, 1) <= 0)      <============= here
            return;

after having apparently written "V3" successfully.

How come there is a difference in behaviour between rsh and ssh at all?
In both cases it just is used to run rdist -Server on the remote machine
and seems to be successful in this.

Clues welcome!

Cheers,

Patrick