tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* rmt & rcmd problems
@ 1995-10-24  4:05 nick
  0 siblings, 0 replies; only message in thread
From: nick @ 1995-10-24  4:05 UTC (permalink / raw)
  To: tru64-unix-managers


	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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-10-24  4:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-10-24  4:05 rmt & rcmd problems nick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox