rmt & rcmd problems

From: Frank <nick_at_alldata.com>
Date: Tue, 24 Oct 1995 12:05:50 +0800

        We have written our own nifty network backup utility that uses
    rmt and rcmd to perform un-attended backups of filesystems scattered
    about the net. This has worked great for six years on our network of
    Suns, but I can't get rmt and rcmd to work on our 2100 running 3.0.
        Establishing the socket-pair works just fine:

int rmt_begin(host)
 char *host;
{
    struct servent *sp = NULL;
    struct passwd *pwd = NULL;
    auto char *p_host = host;
 
    if ((sp = getservbyname("shell", "tcp")) == NULL)
        return (FAILURE);

    if ((pwd = getpwuid(getuid())) == NULL)
        return (FAILURE);

#ifdef __osf__
    return (rcmd(&p_host, sp->s_port, pwd->pw_name, pwd->pw_name, "/usr/sbin/rmt", 0));
#else
    return (rcmd(&p_host, sp->s_port, pwd->pw_name, pwd->pw_name, "/etc/rmt", 0));
#endif
}


    but any subsequent operation fails with the return message "not a tty",
    (and the same thing happens when rcmd is used later in the program):


int rmt_open(des, dev, mode)
 int des;
 char *dev;
 int mode;
{
    char buf[256];
 
#ifdef __osf__
    sprintf(buf, "O %s %d", dev, mode);
#else
    sprintf(buf, "O%s\n%d\n", dev, mode);
#endif
    return (rmt_call(des, dev, buf));
}

int rmt_call(des, cmd, buf)
 int des;
 char *cmd;
 char *buf;
{
    if (write(des, buf, strlen(buf)) != strlen(buf))
        return (FAILURE);
    return (rmt_reply(des, cmd));
}

int rmt_reply(des, cmd)
 int des;
 char *cmd;
{
    auto char code[1024];
    auto char emsg[BUFSIZ];

    if (rmt_gets(des, code, sizeof (code)) == FAILURE)
    {
        fprintf(stderr, "ERROR rmt protocol: code = \"%s\"?\n", code);
        return (FAILURE);
    }

    if (*code == 'E' || *code == 'F')
    {
        errno = atoi(code + 1);
        rmt_gets(des, emsg, sizeof (emsg));
        return (FAILURE);
    }

    if (*code != 'A')
    {
        fprintf(stderr, "ERROR rmt protocol: code = \"%s\"?\n", code);
        return (FAILURE);
    }

    return (atoi(code + 1));
}

    Any ideas?
    Thanks!

    Frank.
Received on Tue Oct 24 1995 - 21:35:17 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT