diff options
Diffstat (limited to 'src/inetd-bi.c')
-rw-r--r-- | src/inetd-bi.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/inetd-bi.c b/src/inetd-bi.c index 30423de..d002e4c 100644 --- a/src/inetd-bi.c +++ b/src/inetd-bi.c @@ -320,6 +320,9 @@ tcpmux (int fd, struct component const *comp) char service[MAX_SERV_LEN + 1]; size_t len; struct component *srv_comp; + union pies_sockaddr_storage sa; + socklen_t salen = sizeof (sa); + int rc; /* Read service name */ if ((len = fd_getline (fd, service, MAX_SERV_LEN)) < 0) @@ -344,10 +347,30 @@ tcpmux (int fd, struct component const *comp) return; } + rc = getpeername (fd, (struct sockaddr *) &sa, &salen); + if (rc) + logmsg (LOG_ERR, _("%s: cannot get peer name: %s"), + comp->tag, strerror (errno)); + + if (comp->acl) + { + if (rc) + { + fd_write (fd, "-Service not available\r\n"); + return; + } + + if (check_acl (comp->acl, (struct sockaddr *) &sa, salen)) + { + fd_write (fd, "-Service not available\r\n"); + return; + } + } + if (srv_comp->flags & CF_TCPMUXPLUS) fd_write (fd, "+Go\r\n"); - - progman_run_comp (srv_comp, fd); + + progman_run_comp (srv_comp, fd, &sa, salen); } |