mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-26 22:54:16 +01:00
Remove use of getnameinfo for new connections.
This commit is contained in:
parent
6d042c525a
commit
8e14aa4417
13
source/ftp.c
13
source/ftp.c
@ -11,7 +11,6 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <netdb.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -898,8 +897,6 @@ ftp_session_new(int listen_fd)
|
|||||||
ftp_session_t *session;
|
ftp_session_t *session;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
socklen_t addrlen = sizeof(addr);
|
socklen_t addrlen = sizeof(addr);
|
||||||
char host[NI_MAXHOST+1];
|
|
||||||
char serv[NI_MAXSERV+1];
|
|
||||||
|
|
||||||
/* accept connection */
|
/* accept connection */
|
||||||
new_fd = accept(listen_fd, (struct sockaddr*)&addr, &addrlen);
|
new_fd = accept(listen_fd, (struct sockaddr*)&addr, &addrlen);
|
||||||
@ -909,18 +906,8 @@ ftp_session_new(int listen_fd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(host, 0, sizeof(host));
|
|
||||||
memset(serv, 0, sizeof(serv));
|
|
||||||
|
|
||||||
/* reverse dns lookup */
|
|
||||||
rc = getnameinfo((struct sockaddr*)&addr, addrlen,
|
|
||||||
host, sizeof(host), serv, sizeof(serv), 0);
|
|
||||||
if(rc != 0)
|
|
||||||
console_print(CYAN "accepted connection from %s:%u\n" RESET,
|
console_print(CYAN "accepted connection from %s:%u\n" RESET,
|
||||||
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
else
|
|
||||||
console_print(CYAN "accepted connection from %s:%s\n" RESET,
|
|
||||||
host, serv);
|
|
||||||
|
|
||||||
/* allocate a new session */
|
/* allocate a new session */
|
||||||
session = (ftp_session_t*)calloc(1, sizeof(ftp_session_t));
|
session = (ftp_session_t*)calloc(1, sizeof(ftp_session_t));
|
||||||
|
Loading…
Reference in New Issue
Block a user