"referenced entity .* not found" message fixed to be fatal
[tac_plus.git] / tcpwrap.c
index ef3d3ad..744a1df 100644 (file)
--- a/tcpwrap.c
+++ b/tcpwrap.c
@@ -1,24 +1,44 @@
-/* 
+/*
    This function  use for check access control rules from hosts.deny and
-   hosts.access file. 
-   Writen by Devrim SERAL<devrim@gazi.edu.tr>. This file protected by 
-   GNU Copyright agreement. 
+   hosts.access file.
+   Writen by Devrim SERAL<devrim@gazi.edu.tr>. This file protected by
+   GNU Copyright agreement.
 */
+
+
+#include "tac_plus.h"
+
 #ifdef TCPWRAPPER
+
 #include <tcpd.h>
-#include "tac_plus.h"
 
-int allow_severity = LOG_INFO;
+#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_DAEMON,TACNAME,RQ_CLIENT_ADDR,datap->NAS_name , NULL);
+    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))
       {
@@ -27,11 +47,16 @@ struct identity *datap;
         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;     
+return 1;
 
 }
+
+#else /* TCPWRAPPER */
+
+TAC_SOURCEFILE_EMPTY
+
 #endif /* TCPWRAPPER */