2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1999-04-16 14:45:55 adam
8 * Added interface for tcpd wrapper for access control.
19 int allow_severity = LOG_INFO;
20 int deny_severity = LOG_WARNING;
41 int check_ip_tcpd(void *cd, const char *addr, int len, int type)
43 const char *daemon_name = cd;
47 if (daemon_name && *daemon_name)
50 struct request_info request_info;
53 char *host_name = 0, *host_addr = 0;
56 struct sockaddr_in *addr_in = (struct sockaddr_in *) addr;
58 if ((host = gethostbyaddr((char*)&addr_in->sin_addr,
59 sizeof(addr_in->sin_addr),
61 host_name = (char*) host->h_name;
62 host_addr = inet_ntoa(addr_in->sin_addr);
65 request_init(&request_info, RQ_DAEMON, daemon_name,
66 RQ_CLIENT_NAME, host_name,
67 RQ_CLIENT_SIN, addr_in,
68 RQ_CLIENT_ADDR, host_addr, 0);
70 request_init(&request_info, RQ_DAEMON, daemon_name,
71 RQ_CLIENT_SIN, addr_in,
72 RQ_CLIENT_ADDR, host_addr, 0);
73 i = hosts_access(&request_info);
76 logf (LOG_DEBUG, "access denied from %s",
77 host_name ? host_name : host_addr);
80 logf (LOG_DEBUG, "access granted from %s",
81 host_name ? host_name : host_addr);