diff options
Diffstat (limited to 'net/libfetch/files/ftp.c')
-rw-r--r-- | net/libfetch/files/ftp.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/net/libfetch/files/ftp.c b/net/libfetch/files/ftp.c index b60618edb86..33d1b644cc8 100644 --- a/net/libfetch/files/ftp.c +++ b/net/libfetch/files/ftp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftp.c,v 1.37 2011/01/23 18:37:31 agc Exp $ */ +/* $NetBSD: ftp.c,v 1.38 2011/08/21 16:28:27 joerg Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav * Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org> @@ -852,7 +852,6 @@ retry_mode: int arg; #endif int d; - char *ap; char hname[INET6_ADDRSTRLEN]; switch (u.ss.ss_family) { @@ -895,7 +894,6 @@ retry_mode: (p >> 8) & 0xff, p & 0xff); break; case AF_INET6: -#define UC(b) (((int)b)&0xff) e = -1; u.sin6.sin6_scope_id = 0; if (getnameinfo(&u.sa, l, @@ -907,17 +905,21 @@ retry_mode: goto ouch; } if (e != FTP_OK) { - ap = (char *)&u.sin6.sin6_addr; + unsigned char *ap = (void *)&u.sin6.sin6_addr.s6_addr; + uint16_t port = ntohs(u.sin6.sin6_port); e = ftp_cmd(conn, - "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n", + "LPRT %d,%d,%u,%u,%u,%u,%u,%u,%u,%u," + "%u,%u,%u,%u,%u,%u,%u,%u,%d,%d,%d\r\n", 6, 16, - UC(ap[0]), UC(ap[1]), UC(ap[2]), UC(ap[3]), - UC(ap[4]), UC(ap[5]), UC(ap[6]), UC(ap[7]), - UC(ap[8]), UC(ap[9]), UC(ap[10]), UC(ap[11]), - UC(ap[12]), UC(ap[13]), UC(ap[14]), UC(ap[15]), - 2, - (ntohs(u.sin6.sin6_port) >> 8) & 0xff, - ntohs(u.sin6.sin6_port) & 0xff); + (unsigned)ap[0], (unsigned)ap[1], + (unsigned)ap[2], (unsigned)ap[3], + (unsigned)ap[4], (unsigned)ap[5], + (unsigned)ap[6], (unsigned)ap[7], + (unsigned)ap[8], (unsigned)ap[9], + (unsigned)ap[10], (unsigned)ap[11], + (unsigned)ap[12], (unsigned)ap[13], + (unsigned)ap[14], (unsigned)ap[15], + 2, port >> 8, port & 0xff); } break; default: |