mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-04 20:15:09 +01:00
Remove use of getnameinfo for new connections.
This commit is contained in:
parent
6d042c525a
commit
8e14aa4417
17
source/ftp.c
17
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));
|
console_print(CYAN "accepted connection from %s:%u\n" RESET,
|
||||||
memset(serv, 0, sizeof(serv));
|
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||||
|
|
||||||
/* 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,
|
|
||||||
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