/* This function use for check access control rules from hosts.deny and hosts.access file. Writen by Devrim SERAL. This file protected by GNU Copyright agreement. */ #include "tac_plus.h" #ifdef TCPWRAPPER #include #include "tcpwrap.h" #include "report.h" #include "packet.h" #include "do_author.h" /* for "struct identity" */ #include "main.h" int allow_severity = LOG_INFO; /* *_severity accessed from libwrap */ int deny_severity = LOG_WARNING; /* Configurable: */ /* Define tac_plus name for hosts.* files */ #define TACNAME "tac_plus" int check_from_wrap TAC_ARGS((struct identity *datap)); int check_from_wrap(datap) struct identity *datap; { struct request_info req; request_init(&req, RQ_FILE,session.sock,RQ_DAEMON,TACNAME,RQ_CLIENT_ADDR,datap->NAS_name , NULL); fromhost(&req); /* validate client host info */ if (!hosts_access(&req)) { if (debug & DEBUG_AUTHEN_FLAG) report(LOG_DEBUG, "Access denied for NAS=%s",datap->NAS_name); send_authen_error("You are not allowed to access here"); refuse(&req); /* If connection is not allowed, clean up and exit. */ return 0; } if (debug & DEBUG_AUTHEN_FLAG ) report(LOG_DEBUG, "Access permited for NAS=%s",datap->NAS_name); return 1; } #else /* TCPWRAPPER */ TAC_SOURCEFILE_EMPTY #endif /* TCPWRAPPER */