mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-01-14 17:37:27 +01:00
Don't fall back to 0.0.0.0
This allows the client side to determine whether to fall back and gives the user a better chance of seeing that it isn't listening where they told it to.
This commit is contained in:
parent
2492316f55
commit
4d37ec6646
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* @file tcp_server.c
|
||||
* @brief
|
||||
* @brief
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include "tcp.h"
|
||||
@ -306,24 +306,10 @@ DWORD request_net_tcp_server_channel_open(Remote * remote, Packet * packet)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
dwResult = WSAGetLastError();
|
||||
if (dwResult != WSAEADDRNOTAVAIL)
|
||||
#else
|
||||
dwResult = errno;
|
||||
if (dwResult != EADDRNOTAVAIL)
|
||||
#endif
|
||||
{
|
||||
BREAK_ON_WSAERROR("[TCP-SERVER] request_net_tcp_server_channel_open. bind failed");
|
||||
}
|
||||
|
||||
dprintf("[TCP-SERVER] Failed to bind to %s, trying 0.0.0.0 ...", lhost);
|
||||
|
||||
// try again, but this time bind to any/all interfaces.
|
||||
lhost = "0.0.0.0";
|
||||
saddr.sin_addr.s_addr = inet_addr(lhost);
|
||||
if (bind(ctx->fd, (SOCKADDR *)&saddr, sizeof(SOCKADDR_IN)) == SOCKET_ERROR)
|
||||
{
|
||||
BREAK_ON_WSAERROR("[TCP-SERVER] request_net_tcp_server_channel_open. bind failed");
|
||||
}
|
||||
BREAK_ON_WSAERROR("[TCP-SERVER] request_net_tcp_server_channel_open. bind failed");
|
||||
dwResult = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user