xref: /titanic_44/usr/src/lib/libwrap/refuse.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   * refuse() reports a refused connection, and takes the consequences: in
9*7c478bd9Sstevel@tonic-gate   * case of a datagram-oriented service, the unread datagram is taken from
10*7c478bd9Sstevel@tonic-gate   * the input queue (or inetd would see the same datagram again and again);
11*7c478bd9Sstevel@tonic-gate   * the program is terminated.
12*7c478bd9Sstevel@tonic-gate   *
13*7c478bd9Sstevel@tonic-gate   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
14*7c478bd9Sstevel@tonic-gate   */
15*7c478bd9Sstevel@tonic-gate 
16*7c478bd9Sstevel@tonic-gate #ifndef lint
17*7c478bd9Sstevel@tonic-gate static char sccsid[] = "@(#) refuse.c 1.5 94/12/28 17:42:39";
18*7c478bd9Sstevel@tonic-gate #endif
19*7c478bd9Sstevel@tonic-gate 
20*7c478bd9Sstevel@tonic-gate /* System libraries. */
21*7c478bd9Sstevel@tonic-gate 
22*7c478bd9Sstevel@tonic-gate #include <stdio.h>
23*7c478bd9Sstevel@tonic-gate #include <syslog.h>
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate /* Local stuff. */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #include "tcpd.h"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /* refuse - refuse request */
30*7c478bd9Sstevel@tonic-gate 
refuse(request)31*7c478bd9Sstevel@tonic-gate void    refuse(request)
32*7c478bd9Sstevel@tonic-gate struct request_info *request;
33*7c478bd9Sstevel@tonic-gate {
34*7c478bd9Sstevel@tonic-gate     syslog(deny_severity, "refused connect from %s", eval_client(request));
35*7c478bd9Sstevel@tonic-gate     clean_exit(request);
36*7c478bd9Sstevel@tonic-gate     /* NOTREACHED */
37*7c478bd9Sstevel@tonic-gate }
38*7c478bd9Sstevel@tonic-gate 
39