More fiddling with passive mode

This commit is contained in:
Andrew Pamment 2017-04-05 09:52:39 +10:00
parent 915b5e2be2
commit 263e916d15

View File

@ -395,13 +395,14 @@ void handle_PASV(struct ftpserver *cfg, struct ftpclient *client) {
if (listen(client->data_srv_socket, 1) < 0) { if (listen(client->data_srv_socket, 1) < 0) {
send_msg(client, "426 PASV failure\r\n"); send_msg(client, "426 PASV failure\r\n");
return;
} }
struct sockaddr_in6 file_addr; struct sockaddr_in6 file_addr;
socklen_t file_sock_len = sizeof(struct sockaddr_in6); socklen_t file_sock_len = sizeof(struct sockaddr_in6);
getsockname(client->data_srv_socket, (struct sockaddr*) &file_addr, &file_sock_len); getsockname(client->data_srv_socket, (struct sockaddr*) &file_addr, &file_sock_len);
fprintf(stderr, "%s\n", client->hostip); fprintf(stderr, "%s\n", &client->hostip[7]);
ipcpy = strdup(&client->hostip[7]); ipcpy = strdup(&client->hostip[7]);
ipptr = strtok(ipcpy, "."); ipptr = strtok(ipcpy, ".");