Deleted Added
sdiff udiff text old ( 44744 ) new ( 56977 )
full compact
1 /*
2 * tcpdmatch - explain what tcpd would do in a specific case
3 *
4 * usage: tcpdmatch [-d] [-i inet_conf] daemon[@host] [user@]host
5 *
6 * -d: use the access control tables in the current directory.
7 *
8 * -i: location of inetd.conf file.
9 *
10 * All errors are reported to the standard error stream, including the errors
11 * that would normally be reported via the syslog daemon.
12 *
13 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
14 */
15
16#ifndef lint
17static char sccsid[] = "@(#) tcpdmatch.c 1.5 96/02/11 17:01:36";
18#endif
19
20/* System libraries. */
21

--- 41 unchanged lines hidden (view full) ---

63 char *server;
64 char *addr;
65 char *user;
66 char *daemon;
67 struct request_info request;
68 int ch;
69 char *inetcf = 0;
70 int count;
71 struct sockaddr_in server_sin;
72 struct sockaddr_in client_sin;
73 struct stat st;
74
75 /*
76 * Show what rule actually matched.
77 */
78 hosts_access_verbose = 2;
79
80 /*

--- 87 unchanged lines hidden (view full) ---

168 * most one address. eval_hostname() warns the user about name server
169 * problems, while using the request.server structure as a cache for host
170 * address and name conversion results.
171 */
172 if (NOT_INADDR(server) == 0 || HOSTNAME_KNOWN(server)) {
173 if ((hp = find_inet_addr(server)) == 0)
174 exit(1);
175 memset((char *) &server_sin, 0, sizeof(server_sin));
176 server_sin.sin_family = AF_INET;
177 request_set(&request, RQ_SERVER_SIN, &server_sin, 0);
178
179 for (count = 0; (addr = hp->h_addr_list[count]) != 0; count++) {
180 memcpy((char *) &server_sin.sin_addr, addr,
181 sizeof(server_sin.sin_addr));
182
183 /*
184 * Force evaluation of server host name and address. Host name
185 * conflicts will be reported while eval_hostname() does its job.
186 */
187 request_set(&request, RQ_SERVER_NAME, "", RQ_SERVER_ADDR, "", 0);
188 if (STR_EQ(eval_hostname(request.server), unknown))
189 tcpd_warn("host address %s->name lookup failed",

--- 35 unchanged lines hidden (view full) ---

225 * in real life the client address is available (at least with IP). Let
226 * eval_hostname() figure out if this host is properly registered, while
227 * using the request.client structure as a cache for host name and
228 * address conversion results.
229 */
230 if ((hp = find_inet_addr(client)) == 0)
231 exit(1);
232 memset((char *) &client_sin, 0, sizeof(client_sin));
233 client_sin.sin_family = AF_INET;
234 request_set(&request, RQ_CLIENT_SIN, &client_sin, 0);
235
236 for (count = 0; (addr = hp->h_addr_list[count]) != 0; count++) {
237 memcpy((char *) &client_sin.sin_addr, addr,
238 sizeof(client_sin.sin_addr));
239
240 /*
241 * Force evaluation of client host name and address. Host name
242 * conflicts will be reported while eval_hostname() does its job.
243 */
244 request_set(&request, RQ_CLIENT_NAME, "", RQ_CLIENT_ADDR, "", 0);
245 if (STR_EQ(eval_hostname(request.client), unknown))
246 tcpd_warn("host address %s->name lookup failed",

--- 82 unchanged lines hidden ---