Skip to content

Commit

Permalink
pass a IPv6 capable sized struct to accept - broken on x64_win32
Browse files Browse the repository at this point in the history
  • Loading branch information
NixM0nk3y committed Jul 1, 2019
1 parent cf7b2b1 commit bb4d21f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/lib/bnet_server_tcp.cc
Expand Up @@ -154,7 +154,7 @@ void BnetThreadServerTcp(
{
int newsockfd, status;
socklen_t clilen;
struct sockaddr cli_addr; /* client's address */
struct sockaddr_storage cli_addr; /* client's address */
int tlog;
int value;
#ifdef HAVE_LIBWRAP
Expand Down Expand Up @@ -357,7 +357,7 @@ void BnetThreadServerTcp(
*/
do {
clilen = sizeof(cli_addr);
newsockfd = accept(fd_ptr->fd, &cli_addr, &clilen);
newsockfd = accept(fd_ptr->fd, reinterpret_cast<sockaddr*>(&cli_addr), &clilen);
} while (newsockfd < 0 && errno == EINTR);
if (newsockfd < 0) { continue; }
#ifdef HAVE_LIBWRAP
Expand All @@ -368,8 +368,8 @@ void BnetThreadServerTcp(
V(mutex);
Jmsg2(NULL, M_SECURITY, 0,
_("Connection from %s:%d refused by hosts.access\n"),
SockaddrToAscii(&cli_addr, buf, sizeof(buf)),
SockaddrGetPort(&cli_addr));
SockaddrToAscii(reinterpret_cast<sockaddr*>(&cli_addr), buf, sizeof(buf)),
SockaddrGetPort(reinterpret_cast<sockaddr*>(&cli_addr)));
close(newsockfd);
continue;
}
Expand All @@ -390,7 +390,7 @@ void BnetThreadServerTcp(
* See who client is. i.e. who connected to us.
*/
P(mutex);
SockaddrToAscii(&cli_addr, buf, sizeof(buf));
SockaddrToAscii(reinterpret_cast<sockaddr*>(&cli_addr), buf, sizeof(buf));
V(mutex);

BareosSocket* bs;
Expand Down

0 comments on commit bb4d21f

Please sign in to comment.