xref: /freebsd/contrib/tcp_wrappers/hosts_ctl.c (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1  /*
2   * hosts_ctl() combines common applications of the host access control
3   * library routines. It bundles its arguments then calls the hosts_access()
4   * access control checker. The host name and user name arguments should be
5   * empty strings, STRING_UNKNOWN or real data. If a match is found, the
6   * optional shell command is executed.
7   *
8   * Restriction: this interface does not pass enough information to support
9   * selective remote username lookups or selective hostname double checks.
10   *
11   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
12   */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#) hosts_ctl.c 1.4 94/12/28 17:42:27";
16 #endif
17 
18 #include <stdio.h>
19 
20 #include "tcpd.h"
21 
22 /* hosts_ctl - limited interface to the hosts_access() routine */
23 
24 int     hosts_ctl(daemon, name, addr, user)
25 char   *daemon;
26 char   *name;
27 char   *addr;
28 char   *user;
29 {
30     struct request_info request;
31 
32     return (hosts_access(request_init(&request,
33 				      RQ_DAEMON, daemon,
34 				      RQ_CLIENT_NAME, name,
35 				      RQ_CLIENT_ADDR, addr,
36 				      RQ_USER, user,
37 				      0)));
38 }
39