OSDN Git Service

Ver1.5.28 Changed to deny duplicated open, added udp send and ohters.
[opengate/opengate.git] / opengate / opengatesrv / main.c
index fe4e077..0fb41dc 100644 (file)
@@ -77,6 +77,12 @@ int  main(int argc, char **argv)
   /* drop root privilege */
   seteuid(getuid());
 
+  /* if this is executed in shell with '-v' option, show make dir */  
+  if(argc>1 && strcmp(argv[1],"-v")==0){
+    printf("makedir: %s\n", MAKEDIR);
+    exit(0);
+  }
+
   /* get time at the cgi starting (in msec) */
   gettimeofday(&timeBeginCgi, NULL) ;
 
@@ -128,6 +134,9 @@ int  main(int argc, char **argv)
   /* setup pointer to ExtraSet in config file */
   SetupConfExtra(useridshort, extraId);
 
+  /* setup static variable value for SqLite3_busy_timeout from conf */
+  SetupSqliteBusyTimeoutValue();
+
   /* get address of client from getenv. it might be IPv4 or IPv6. */
   GetClientAddr(clientAddr6);
 
@@ -191,7 +200,10 @@ int  main(int argc, char **argv)
 
   /* open firewall for the client */
   if(OpenClientGate(clientAddr4,macAddr4,clientAddr6,macAddr6,
-                   userid,userProperty,ipStatus)==FALSE) return 0;
+                   userid,userProperty,ipStatus)==FALSE){
+    PutClientMsg("Error: Close this browser and retry");    
+    return 0;
+  }
   timeIn=time(NULL);
 
   /* set (ruleNumber,userid,clientAddr) in process title */
@@ -268,7 +280,6 @@ int  main(int argc, char **argv)
   return 0;
 }
 
-
 /*******************************************/
 /* calc connection duration and put it out */
 /*******************************************/
@@ -390,12 +401,15 @@ void logConnectMode()
     time3usec += 1000000; time3sec--;
   }
 
-  if(debug>0) err_msg("INFO: user=%s watchmode=%s procsec=%ld.%06ld,%ld.%06ld,%ld.%06ld ipversion=%d useragent=%s",
+  if(debug>0) err_msg("INFO: user=%s watchmode=%s procsec=%ld.%06ld,%ld.%06ld,%ld.%06ld ipversion=%d ipaddr=%s,%s macaddr=%s ipfwrule=%s,%s useragent=%s",
                      userid, mode[conMode], 
                      time1sec,time1usec,
                      time2sec,time2usec,
                      time3sec,time3usec,
-                     ipStatus, getenv("HTTP_USER_AGENT"));
+                     ipStatus,
+                     clientAddr4,clientAddr6,macAddr4,
+                     ruleNumber4, ruleNumber6,
+                     getenv("HTTP_USER_AGENT"));
 }