aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-09 13:01:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-09 13:01:08 +0000
commit9b2fbda53853ae651349f97bcf86c891cc137f92 (patch)
tree23dd0fe4e01328899ba94e348a206ecb13ca37ac /libbb
parent57a3b174989c7778fb255f716e090d5be807b9b7 (diff)
downloadbusybox-w32-9b2fbda53853ae651349f97bcf86c891cc137f92.tar.gz
busybox-w32-9b2fbda53853ae651349f97bcf86c891cc137f92.tar.bz2
busybox-w32-9b2fbda53853ae651349f97bcf86c891cc137f92.zip
ftpd: EPSV and SIZE support. Tested to work on IPv6 too.
libbb: str2sockaddr shuld accept [IPv6] addr without port - wget 'ftp://[::1]/file' needs that to work. function old new delta bind_for_passive_mode - 129 +129 get_nport - 30 +30 ftpd_main 1731 1760 +29 str2sockaddr 412 431 +19 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/0 up/down: 207/0) Total: 207 bytes text data bss dec hex filename 808568 476 7864 816908 c770c busybox_old 808804 476 7864 817144 c77f8 busybox_unstripped
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xconnect.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 975844500..f5d7983a4 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -167,7 +167,8 @@ USE_FEATURE_IPV6(sa_family_t af,)
167 /* Even uglier parsing of [xx]:nn */ 167 /* Even uglier parsing of [xx]:nn */
168 host++; 168 host++;
169 cp = strchr(host, ']'); 169 cp = strchr(host, ']');
170 if (!cp || cp[1] != ':') { /* Malformed: must have [xx]:nn */ 170 if (!cp || (cp[1] != ':' && cp[1] != '\0')) {
171 /* Malformed: must be [xx]:nn or [xx] */
171 bb_error_msg("bad address '%s'", org_host); 172 bb_error_msg("bad address '%s'", org_host);
172 if (ai_flags & DIE_ON_ERROR) 173 if (ai_flags & DIE_ON_ERROR)
173 xfunc_die(); 174 xfunc_die();
@@ -183,8 +184,11 @@ USE_FEATURE_IPV6(sa_family_t af,)
183 if (cp) { /* points to ":" or "]:" */ 184 if (cp) { /* points to ":" or "]:" */
184 int sz = cp - host + 1; 185 int sz = cp - host + 1;
185 host = safe_strncpy(alloca(sz), host, sz); 186 host = safe_strncpy(alloca(sz), host, sz);
186 if (ENABLE_FEATURE_IPV6 && *cp != ':') 187 if (ENABLE_FEATURE_IPV6 && *cp != ':') {
187 cp++; /* skip ']' */ 188 cp++; /* skip ']' */
189 if (*cp == '\0') /* [xx] without port */
190 goto skip;
191 }
188 cp++; /* skip ':' */ 192 cp++; /* skip ':' */
189 port = bb_strtou(cp, NULL, 10); 193 port = bb_strtou(cp, NULL, 10);
190 if (errno || (unsigned)port > 0xffff) { 194 if (errno || (unsigned)port > 0xffff) {
@@ -193,6 +197,7 @@ USE_FEATURE_IPV6(sa_family_t af,)
193 xfunc_die(); 197 xfunc_die();
194 return NULL; 198 return NULL;
195 } 199 }
200 skip: ;
196 } 201 }
197 202
198 memset(&hint, 0 , sizeof(hint)); 203 memset(&hint, 0 , sizeof(hint));