mFix ipv6

master^2
Alexey Khromov 5 months ago
parent 9aed37b92e
commit bba77edecd

@ -22,7 +22,12 @@
int answ_system(e_session type, char *connstr, int inetd) int answ_system(e_session type, char *connstr, int inetd)
{ {
TIO oldtio; TIO oldtio;
struct sockaddr_storage client; union {
struct sockaddr a;
struct sockaddr_in in;
struct sockaddr_in6 in6;
} client;
//struct sockaddr_storage client;
int clientlen = sizeof(client); int clientlen = sizeof(client);
char clienthost[NI_MAXHOST]; char clienthost[NI_MAXHOST];
char clientport[NI_MAXSERV]; char clientport[NI_MAXSERV];
@ -79,7 +84,9 @@ int answ_system(e_session type, char *connstr, int inetd)
state.connstr = (char*)xstrcpy(connstr); state.connstr = (char*)xstrcpy(connstr);
else else
{ {
clientres = getnameinfo( (struct sockaddr*)&client, clientlen, if(getpeername(0, &client.a, &clientlen))
log("sess_answ: can't detrmine socket client");
clientres = getnameinfo( &client.a, clientlen,
clienthost, sizeof(clienthost), clientport, clienthost, sizeof(clienthost), clientport,
sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV); sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
if ( clientres == 0 ) if ( clientres == 0 )

Loading…
Cancel
Save