IPv6 fixes for incoming inetd calls, minors from lint
This commit is contained in:
parent
3526bc5ece
commit
9aed37b92e
@ -54,7 +54,6 @@ static int tcpip_connect2(struct addrinfo *ai)
|
|||||||
if ( fd == -1 )
|
if ( fd == -1 )
|
||||||
{
|
{
|
||||||
DEB((D_INFO, "tcpip_connect2: socket error"));
|
DEB((D_INFO, "tcpip_connect2: socket error"));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
|
||||||
|
@ -118,6 +118,9 @@ int tio_get(int fd, TIO *tio)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
return tcgetattr(fd, tio);
|
return tcgetattr(fd, tio);
|
||||||
|
#else
|
||||||
|
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||||
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +130,9 @@ int tio_set(int fd, TIO *tio)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS_H
|
#ifdef HAVE_TERMIOS_H
|
||||||
return tcsetattr(fd, TCSANOW, tio);
|
return tcsetattr(fd, TCSANOW, tio);
|
||||||
|
#else
|
||||||
|
DEB(("io_unix_tio: TERMIOS not supported!"));
|
||||||
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,7 +788,7 @@ case BPMSG_FILE: /* File information */
|
|||||||
DEB((D_24554, "no, skipping; TODO: accept it"));
|
DEB((D_24554, "no, skipping; TODO: accept it"));
|
||||||
if( bstate->extracmd[0] != -1 ) return 0;
|
if( bstate->extracmd[0] != -1 ) return 0;
|
||||||
bstate->extracmd[0] = BPMSG_SKIP;
|
bstate->extracmd[0] = BPMSG_SKIP;
|
||||||
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm);
|
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
|
||||||
bstate->extraislast = false;
|
bstate->extraislast = false;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,11 @@
|
|||||||
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_in client;
|
struct sockaddr_storage client;
|
||||||
int clientlen = sizeof(client);
|
int clientlen = sizeof(client);
|
||||||
|
char clienthost[NI_MAXHOST];
|
||||||
|
char clientport[NI_MAXSERV];
|
||||||
|
int clientres = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -74,18 +77,18 @@ int answ_system(e_session type, char *connstr, int inetd)
|
|||||||
log("Answering TCPIP call...");
|
log("Answering TCPIP call...");
|
||||||
if( connstr && *connstr )
|
if( connstr && *connstr )
|
||||||
state.connstr = (char*)xstrcpy(connstr);
|
state.connstr = (char*)xstrcpy(connstr);
|
||||||
else if( getpeername(0, (struct sockaddr*)&client, &clientlen) == -1 )
|
|
||||||
logerr("can't get client address");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef IPV6
|
clientres = getnameinfo( (struct sockaddr*)&client, clientlen,
|
||||||
>char addr_str[INET6_ADDRSTRLEN+1];
|
clienthost, sizeof(clienthost), clientport,
|
||||||
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
|
sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
|
||||||
state.peerport = (long)ntohs(client.sin6_port);
|
if ( clientres == 0 )
|
||||||
#else
|
{
|
||||||
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
|
state.peername = (char*)xstrcpy(clienthost);
|
||||||
state.peerport = (long)ntohs(client.sin_port);
|
state.peerport = (long)atol(clientport);
|
||||||
#endif
|
}
|
||||||
|
else
|
||||||
|
log("sess_answ: can't get client address: ", gai_strerror(clientres));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ void *xrealloc(void *buf, size_t size)
|
|||||||
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
|
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
|
||||||
{
|
{
|
||||||
log("failed to reallocate %ld bytes -> abort", size);
|
log("failed to reallocate %ld bytes -> abort", size);
|
||||||
|
if( buf ) free(buf);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user