2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1999-08-27 09:40:32 adam
8 * Renamed logf function to yaz_log. Removed VC++ project files.
10 * Revision 1.2 1999/04/20 09:56:48 adam
11 * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
12 * Modified all encoders/decoders to reflect this change.
14 * Revision 1.1 1999/04/16 14:45:55 adam
15 * Added interface for tcpd wrapper for access control.
26 int allow_severity = LOG_INFO;
27 int deny_severity = LOG_WARNING;
48 int check_ip_tcpd(void *cd, const char *addr, int len, int type)
50 const char *daemon_name = (const char *) cd;
54 if (daemon_name && *daemon_name)
57 struct request_info request_info;
60 char *host_name = 0, *host_addr = 0;
63 struct sockaddr_in *addr_in = (struct sockaddr_in *) addr;
65 if ((host = gethostbyaddr((char*)&addr_in->sin_addr,
66 sizeof(addr_in->sin_addr),
68 host_name = (char*) host->h_name;
69 host_addr = inet_ntoa(addr_in->sin_addr);
72 request_init(&request_info, RQ_DAEMON, daemon_name,
73 RQ_CLIENT_NAME, host_name,
74 RQ_CLIENT_SIN, addr_in,
75 RQ_CLIENT_ADDR, host_addr, 0);
77 request_init(&request_info, RQ_DAEMON, daemon_name,
78 RQ_CLIENT_SIN, addr_in,
79 RQ_CLIENT_ADDR, host_addr, 0);
80 i = hosts_access(&request_info);
83 yaz_log (LOG_DEBUG, "access denied from %s",
84 host_name ? host_name : host_addr);
87 yaz_log (LOG_DEBUG, "access granted from %s",
88 host_name ? host_name : host_addr);