Skip to content

Commit

Permalink
Allow access if getsockname() or getifaddrs() fails
Browse files Browse the repository at this point in the history
For some address families, non AF_INET* sockets, the syscall getsockname()
may fail, tihs is OK.  We only care to block access from internets, so we
now allow such connections.

Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Sep 6, 2021
1 parent 8c211ea commit b3f5e66
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions accept-guard.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ static int iface_allowed(int sd, int ifindex)
int port = 0;
int i;

/* If incoming interface cannot be identified, deny access. */
/*
* If incoming interface cannot be identified, allow access.
* Possibly an AF_UNIX socket or other local access.
*/
if (identify_inbound(sd, ifindex, ifname, sizeof(ifname), &port))
return 0;
return 1;

for (i = 0; i < MAX_IFACES; i++) {
/* If reached last item => deny access */
Expand Down

0 comments on commit b3f5e66

Please sign in to comment.