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