/**************************************************
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
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);
/* 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();
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);
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 */