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