17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
37c478bdstevel@tonic-gate * Use is subject to license terms.
47c478bdstevel@tonic-gate */
57c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
67c478bdstevel@tonic-gate
77c478bdstevel@tonic-gate /*
87c478bdstevel@tonic-gate  * hosts_ctl() combines common applications of the host access control
97c478bdstevel@tonic-gate  * library routines. It bundles its arguments then calls the hosts_access()
107c478bdstevel@tonic-gate  * access control checker. The host name and user name arguments should be
117c478bdstevel@tonic-gate  * empty strings, STRING_UNKNOWN or real data. If a match is found, the
127c478bdstevel@tonic-gate  * optional shell command is executed.
137c478bdstevel@tonic-gate  *
147c478bdstevel@tonic-gate  * Restriction: this interface does not pass enough information to support
157c478bdstevel@tonic-gate  * selective remote username lookups or selective hostname double checks.
167c478bdstevel@tonic-gate  *
177c478bdstevel@tonic-gate  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
187c478bdstevel@tonic-gate  */
197c478bdstevel@tonic-gate
207c478bdstevel@tonic-gate#ifndef lint
217c478bdstevel@tonic-gatestatic char sccsid[] = "@(#) hosts_ctl.c 1.4 94/12/28 17:42:27";
227c478bdstevel@tonic-gate#endif
237c478bdstevel@tonic-gate
247c478bdstevel@tonic-gate#include <stdio.h>
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate#include "tcpd.h"
277c478bdstevel@tonic-gate
287c478bdstevel@tonic-gate/* hosts_ctl - limited interface to the hosts_access() routine */
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gateint     hosts_ctl(daemon, name, addr, user)
317c478bdstevel@tonic-gatechar   *daemon;
327c478bdstevel@tonic-gatechar   *name;
337c478bdstevel@tonic-gatechar   *addr;
347c478bdstevel@tonic-gatechar   *user;
357c478bdstevel@tonic-gate{
367c478bdstevel@tonic-gate    struct request_info request;
377c478bdstevel@tonic-gate
387c478bdstevel@tonic-gate    return (hosts_access(request_init(&request,
397c478bdstevel@tonic-gate				      RQ_DAEMON, daemon,
407c478bdstevel@tonic-gate				      RQ_CLIENT_NAME, name,
417c478bdstevel@tonic-gate				      RQ_CLIENT_ADDR, addr,
427c478bdstevel@tonic-gate				      RQ_USER, user,
437c478bdstevel@tonic-gate				      0)));
447c478bdstevel@tonic-gate}
45