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