OSDN Git Service

modified comments
[opengatem/opengatem.git] / mngsrc / opengatemchk.c
index e48d336..517ca32 100644 (file)
@@ -1,6 +1,16 @@
 /**************************************************
 OpengateM - MAC address authentication system 
+
  module for mac address checking cgi main
+ use for the registration of the device without Web.
+ (Web device can be registered by owner oneself (opengatemown.c))
+ CGI gets addresses from arp/ndp, and show the list on web page.
+ Administrator select a candidate address from the list.
+ The gate from/to the address is opened for a while and closed.
+ Try the network access from the bring-in device at open time.
+ If the access is passed, go to the registration(opengatemreg.c).
+ Else select other address for candidate.
 
 Copyright (C) 2011 Opengate Project Team
 Written by Yoshiaki Watanabe
@@ -42,7 +52,7 @@ int  main(int argc, char **argv)
   seteuid(getuid());
   
   /* if this is executed in shell with '-v' option, show makedir */
-  /* this is prepared to show information about version */
+  /* this is prepared to show the information about version */
   if(argc>1){
     if(strcmp(argv[1],"-v")==0){
       printf("makedir: %s\n", MAKEDIR);
@@ -78,7 +88,7 @@ int  main(int argc, char **argv)
   /* get post data */
   GetPostData(requestStr, BUFFMAXLN);
   
-  /* get userid. if not get, exit */
+  /* authentication. get userid. if not get, exit */
   if(!GetUserId(requestStr, userId, extraId, language, ADMINUSER, 
                GetConfValue("CheckCgi"), mailDefault, "")){
     CloseMngDb();
@@ -90,9 +100,8 @@ int  main(int argc, char **argv)
     AnalyzeCheckRequest(requestStr, &status, macAddress);
   }
 
-  /* send response to client and control watch process */
-  /* if status = OPEN/CLOSE, it is ajax request coded in html/macchk.js */
-  /* in this case, send back short message */
+  /* from second request (AJAX from html/macchk.js, status=OPEN/CLOSE), */
+  /* send back short message, and exec child process to open/close network */
   if(status==OPEN){
     PutMessageToClient("open");
     StartChildProc(macAddress);
@@ -102,7 +111,7 @@ int  main(int argc, char **argv)
     StopChildProc(macAddress);
   }
 
-  /* if not OPEN/CLOSE, send back new page */
+  /* at first request (null status), mac list is send back */
   else{
 
     /* make work table for checking client mac address */