Import of tac_plus.v8.tar.gz: 173206 bytes, md5:
[tac_plus.git] / tcpwrap.c
1 /* 
2    This function  use for check access control rules from hosts.deny and
3    hosts.access file. 
4    Writen by Devrim SERAL<devrim@gazi.edu.tr>. This file protected by 
5    GNU Copyright agreement. 
6 */
7 #ifdef TCPWRAPPER
8 #include <tcpd.h>
9 #include "tac_plus.h"
10
11 int allow_severity = LOG_INFO;
12 int deny_severity = LOG_WARNING;
13
14
15 int
16 check_from_wrap(datap)
17 struct identity *datap;
18 {
19     struct request_info req;
20
21     request_init(&req, RQ_DAEMON,TACNAME,RQ_CLIENT_ADDR,datap->NAS_name , NULL);
22     fromhost(&req); /* validate client host info */
23     if (!hosts_access(&req))
24       {
25         if (debug & DEBUG_AUTHEN_FLAG)
26                 report(LOG_DEBUG, "Access denied for NAS=%s",datap->NAS_name);
27         send_authen_error("You are not allowed to access here");
28         refuse(&req); /* If connection is not allowed, clean up and exit. */
29         return 0;
30       } 
31     
32     if (debug & DEBUG_AUTHEN_FLAG )
33                 report(LOG_DEBUG, "Access permited for NAS=%s",datap->NAS_name);
34 return 1;     
35
36 }
37 #endif /* TCPWRAPPER */