mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-23 04:33:24 +00:00
fix for slirp ftp proxying putting slirp placeholder host ip in PORT commands
This commit is contained in:
parent
03e1593387
commit
2148b0b636
@ -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
|
||||
*/
|
||||
@ -1005,7 +1006,19 @@ do_prompt:
|
||||
n5 = (n6 >> 8) & 0xff;
|
||||
n6 &= 0xff;
|
||||
|
||||
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