From 87133aed50f1a4c18c232da1cae4ac6521f4692e Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Wed, 5 Apr 2017 09:22:52 +1000 Subject: [PATCH] possible fixes --- utils/magiftpd/magiftpd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/magiftpd/magiftpd.c b/utils/magiftpd/magiftpd.c index 1161fc4..e79e3ac 100644 --- a/utils/magiftpd/magiftpd.c +++ b/utils/magiftpd/magiftpd.c @@ -214,7 +214,8 @@ int open_tcp_connection(struct ftpserver *cfg, struct ftpclient *client) { fprintf(stderr, "Error in port command\n"); return 0; } - if (connect(client->data_socket, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) == -1) { + if (connect(client->data_socket, (struct sockaddr *) &servaddr, sizeof(servaddr)) == -1) { + perror("Connect"); fprintf(stderr, "Error connecting to client\n"); return 0; } @@ -337,13 +338,14 @@ void handle_EPSV(struct ftpserver *cfg, struct ftpclient *client) { server.sin6_port = htons(port); - if (bind(client->data_srv_socket, (struct sockaddr*) &server, sizeof(struct sockaddr)) < 0) { + if (bind(client->data_srv_socket, (struct sockaddr*) &server, sizeof(server)) < 0) { send_msg(client, "500 EPSV failure\r\n"); return; } if (listen(client->data_srv_socket, 1) < 0) { send_msg(client, "500 EPSV failure\r\n"); + return; } struct sockaddr_in6 file_addr;