diff options
author | Denis Vlasenko | 2007-01-11 16:50:23 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-11 16:50:23 +0000 |
commit | 8e9ccba371480fb1fb3da9235fabdbb7861523c3 (patch) | |
tree | 369636a4a765a571e1c6a6ecf2a52ca0131cc90e /networking/ftpgetput.c | |
parent | 085231fbbad159d2275cbd5ecdcf4732512bb80f (diff) | |
download | busybox-8e9ccba371480fb1fb3da9235fabdbb7861523c3.zip busybox-8e9ccba371480fb1fb3da9235fabdbb7861523c3.tar.gz |
ipv6-ization efforts continue. Few bugs are found,
unknown number likely introduced...
Diffstat (limited to 'networking/ftpgetput.c')
-rw-r--r-- | networking/ftpgetput.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 9e64ff9..9086cb1 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -19,7 +19,7 @@ typedef struct ftp_host_info_s { char *user; char *password; - struct sockaddr_in *s_in; + struct len_and_sockaddr *lsa; } ftp_host_info_t; static char verbose_flag; @@ -88,8 +88,8 @@ static int xconnect_ftpdata(ftp_host_info_t *server, char *buf) *buf_ptr = '\0'; port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; - server->s_in->sin_port = htons(port_num); - return xconnect_tcp_v4(server->s_in); + set_port(server->lsa, htons(port_num)); + return xconnect_stream(server->lsa); } static FILE *ftp_login(ftp_host_info_t *server) @@ -98,9 +98,9 @@ static FILE *ftp_login(ftp_host_info_t *server) char buf[512]; /* Connect to the command socket */ - control_stream = fdopen(xconnect_tcp_v4(server->s_in), "r+"); + control_stream = fdopen(xconnect_stream(server->lsa), "r+"); if (control_stream == NULL) { - /* Extremely unlikely */ + /* fdopen failed - extremely unlikely */ bb_perror_nomsg_and_die(); } @@ -304,7 +304,6 @@ int ftpgetput_main(int argc, char **argv) const char *port = "ftp"; /* socket to ftp server */ FILE *control_stream; - struct sockaddr_in s_in; /* continue previous transfer (-c) */ ftp_host_info_t *server; @@ -347,12 +346,10 @@ int ftpgetput_main(int argc, char **argv) /* We want to do exactly _one_ DNS lookup, since some * sites (i.e. ftp.us.debian.org) use round-robin DNS * and we want to connect to only one IP... */ - server->s_in = &s_in; - bb_lookup_host(&s_in, argv[0]); - s_in.sin_port = bb_lookup_port(port, "tcp", 21); + server->lsa = host2sockaddr(argv[0], bb_lookup_port(port, "tcp", 21)); if (verbose_flag) { - printf("Connecting to %s[%s]:%d\n", - argv[0], inet_ntoa(s_in.sin_addr), ntohs(s_in.sin_port)); + printf("Connecting to %s [%s]\n", argv[0], + xmalloc_sockaddr2dotted(&server->lsa->sa, server->lsa->len)); } /* Connect/Setup/Configure the FTP session */ |