Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zftp does not work



I do not when it happened; I guess I have not tried zftp for a long time.

bor@itsrm2% zftp open localhost
zftp open: address length mismatch
zftp open: connect failed: invalid argument

in tcp.c (zsh_getipnodebyname):

        if(zsh_inet_pton(af, name, nbuf) == 1) {
                zsh_inet_ntop(af, nbuf, pbuf, sizeof(pbuf));
                ahe.h_name = pbuf;
                ahe.h_aliases = addrlist+1;
                ahe.h_addrtype = af;
                ahe.h_length = (af == AF_INET) ? 4 : 16;
                ahe.h_addr_list = addrlist;
                return &ahe;
        }
        he = zsh_gethostbyname2(name, af);

zsh_inet_pton here finally does
  return (dst->s_addr = inet_addr(src)) != INADDR_NONE;

i.e. it returns 1 and h_length is set to 4; and later in zftp.c:

            salen = sizeof(struct sockaddr_in);
...
            if(salen != zhostp->h_length)
                zwarnnam(name, "address length mismatch", NULL, 0);

But struct sockaddr_in is

struct sockaddr_in {
        sa_family_t     sin_family;
        ushort_t        sin_port;
        struct  in_addr sin_addr;
        char    sin_zero[8];
};

and in no case can be 4.

-andrej



Messages sorted by: Reverse Date, Date, Thread, Author