mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-28 07:29:57 +00:00
Merge pull request #209 from rakslice/slirp_ftp_fix
fix for slirp ftp handling putting slirp placeholder address in PORT commands
This commit is contained in:
commit
79f2e7e8e4
@ -986,6 +986,7 @@ do_prompt:
|
||||
case EMU_FTP: /* ftp */
|
||||
*(m->m_data+m->m_len) = 0; /* NULL terminate for strstr */
|
||||
if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) {
|
||||
struct socket * control_so = so;
|
||||
/*
|
||||
* Need to emulate the PORT command
|
||||
*/
|
||||
@ -1004,8 +1005,20 @@ do_prompt:
|
||||
|
||||
n5 = (n6 >> 8) & 0xff;
|
||||
n6 &= 0xff;
|
||||
|
||||
laddr = ntohl(so->so_faddr.s_addr);
|
||||
|
||||
if (so->so_faddr.s_addr != alias_addr.s_addr) {
|
||||
laddr = ntohl(so->so_faddr.s_addr);
|
||||
} else {
|
||||
/* local side address of control conn */
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||
if (getsockname(control_so->s, &addr, &addrlen) == 0) {
|
||||
laddr = ntohl(addr.sin_addr.s_addr);
|
||||
} else {
|
||||
/* fall back to whatever we have for our address generally */
|
||||
laddr = ntohl(our_addr.s_addr);
|
||||
}
|
||||
}
|
||||
|
||||
n1 = ((laddr >> 24) & 0xff);
|
||||
n2 = ((laddr >> 16) & 0xff);
|
||||
|
Loading…
Reference in New Issue
Block a user