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