# see the information of ExtraSet at the end of this file.\r
# ################################################### --> \r
\r
- <!-- Set 1 to write many information to syslog -->\r
<!-- Set 0 to write only open/close and error messages to syslog -->\r
- <Debug>0</Debug>\r
+ <!-- Set 1 to write some information adding to 0 -->\r
+ <!-- Set 2 to write many information to syslog -->\r
+ <Debug>1</Debug>\r
\r
<!-- client usage watch mode in default('Java', 'Http', or 'Time') -->\r
<WatchMode>Http</WatchMode>\r
<DD>\r
Move JavaScript from html-file to external js-file. Modify some message.\r
</DD>\r
+<DT>\r
+Ver.1.4.4 at 2006.10.25</DT>\r
+<DD>\r
+Add automatic start of java applet at failing http keep-alive. Modify http-get format. Add session-id. Fix read bug.\r
+</DD>\r
\r
</DL>\r
<b>Please see CVS in SourceForge.net to check the file difference between versions.</b>\r
String hostname;\r
int port;\r
String userid;\r
+ String sessionId;\r
String language;\r
int intlang=0;/* if language is japanese, set 1*/\r
OpengateClient client;\r
/* Get Applet Parameters */\r
port=Integer.parseInt(getParameter("port"));\r
userid=getParameter("user");\r
+ sessionId=getParameter("sessionid");\r
hostname =getCodeBase().getHost();\r
language = getParameter("lang");\r
if(language.equals("ja")) intlang=1;\r
}\r
\r
/* Connect to Server */\r
- client=new OpengateClient(hostname, port, userid, intlang, this);\r
+ client=new OpengateClient(hostname, port, userid, sessionId, intlang, this);\r
client.start();\r
}\r
public void msgout(String msg){\r
String hostname; /* java download host name */\r
Socket socket; /* Socket for server */\r
String userid;\r
+ String sessionId;\r
PrintStream outStream; /* output stream to server */\r
BufferedReader inStream; /* input stream from server */\r
String currentReply; /* reserve last reply from server */\r
\r
/* Instance Creater */\r
public OpengateClient(String hostname, int port, \r
- String userid, int intlang, Opengate main){\r
+ String userid, String sessionId, int intlang, Opengate main){\r
this.hostname=hostname;\r
this.port=port;\r
this.userid=userid;\r
+ this.sessionId=sessionId;\r
this.main=main;\r
this.intlang=intlang;\r
onLine=false;\r
disconnect();\r
return;\r
}\r
- putLine(userid);\r
+ putLine(userid+"-"+sessionId);\r
if(getLine().indexOf("accept")==-1){\r
if(intlang==1)\r
main.msgout("\83T\81[\83o\82©\82çAccept\82ª\91\97\82ç\82ê\82Ä\97\88\82Ü\82¹\82ñ");\r
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Refresh" content="0; URL=%%HTTPKEEPURL%%">
-
<title>Opengatemain</title>
</head>
<body>
<p>You can use the network.
-If you cannot move to a new page automatically,
-click <a href="%%HTTPKEEPURL%%">Jump</a>.
-</p>
-</body>
-</html>
+<p>When you finish to use the network, stop your WEB browser.
+You will be disconnected from the network automatically.</p>
+
+<script language="JavaScript">
+<!--
+// usually the page is jumped to httpkeep.html
+location.replace(%%HTTPKEEPURL%%);
+
+// if not jumped, process following
+if(!navigator.javaEnabled()){
+ document.write("<p><b>Java is disabled. Change it.</b></p>");
+}
+//-->
+</script>
+<noscript>
+<p><b>JavaScript is disabled. Change it.</b></p>
+</noscript>
+
+<hr />
+<div align="center">
+ <applet code="Opengate.class" archive="Opengate.jar"
+ codebase="%%OPENGATEDIR%%" width="600" height="30" >
+ <param name=port value="%%OPENGATEPORT%%">
+ <param name=user value="%%USERID%%">
+ <param name=sessionid value="%%SESSIONID%%">
+ <param name=lang value="%%LANGUAGE%%">
+ </applet>
+</div>
+
+<hr />
+
+<p>If yellow bar is not displayed between above two lines, please click <a href="%%TERMINATEURL%%"><b>TERMINATE</b></a>
+and close your browser.
+
+<SCRIPT LANGUAGE="JavaScript">
+<!--
+ window.open("%%STARTURL%%","window1");
+//-->
+</SCRIPT>
+
+<table bgcolor="lightyellow" border="1">
+<tr><td>
+Please leave this window as it is (or minimized), and work on another window.
+If another working window is not popped up,
+click <a href="%%STARTURL%%" target="_blank"><h3>[Start Page]</h3></a>
+ to open.
+</td></tr>
+</table>
+</BODY>
+</HTML>
<script language="JavaScript">
<!--
if(!navigator.javaEnabled()){
- document.write("<p><b>Java is disabled.</b></p>");
+ document.write("<p><b>Java is disabled. Change it.</b></p>");
}
//-->
</script>
codebase="%%OPENGATEDIR%%" width="600" height="30" >
<param name=port value="%%OPENGATEPORT%%">
<param name=user value="%%USERID%%">
+ <param name=sessionid value="%%SESSIONID%%">
<param name=lang value="%%LANGUAGE%%">
</applet>
</div>
<p>If yellow bar is not displayed between above two lines, Java does not run.
In this case, please click <a href="%%TERMINATEURL%%"><b>TERMINATE</b></a>,
- close your browser, and try to select HTTP in authentication page.
-Java will run, if you download JavaPlugIn from <a href=http://java.com/ja/index.jsp><b>java.com</b></a>.</p>
+ close your browser, and try to select other watch mode in authentication page.
+Or you can run Java, if you download JavaPlugIn from <a href=http://java.com/ja/index.jsp><b>java.com</b></a>.</p>
-<SCRIPT LANGUAGE="JavaScript">
+<script language="JavaScript">
<!--
window.open("%%STARTURL%%","window1");
//-->
-</SCRIPT>
+</script>
<table bgcolor="lightyellow" border="1">
<tr><td>
</td></tr>
</table>
-</BODY>
-</HTML>
+</body>
+</html>
</head>
<body>
-<p>You can use the network. Network will be closed after duration entered.</p>
+<p>You can use the network. Network will be closed at the timeout of entered duration.</p>
<p>When you finish to use the network, click the link:
<a href="%%TERMINATEURL%%"></a> for security.</p>
-<p>Please use this method only when other methods are failed.</p>
+<p>Please use this method only when other watch modes cannot be used.</p>
<script language="JavaScript">
<!--
<P>
Network authentication failed. Please retry again.
</P>
-<A HREF=https://%%AUTHCGIURL%%?%%ADDR4%%&en><h3>BACK</h3></A>
+<A HREF="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en"><h3>BACK</h3></A>
</BODY>
</HTML>
<P>
Network authentication failed. Please retry again.
</P>
-<A HREF=http://%%AUTHCGIURL%%?%%ADDR4%%&en><h3>BACK</h3></A>
+<A HREF="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en"><h3>BACK</h3></A>
</BODY>
</HTML>
<body>
-</script>
-<noscript>
-<p><b>JavaScript is disabled. Change it.</b></p>
-</noscript>
<p>You can use the network.</p>
<p>When you finish to use the network, stop your WEB browser.
You will be disconnected from the network automatically.</p>
+<noscript>
+<p><b>JavaScript is disabled. Change it.</b></p>
+</noscript>
+
<hr />
<p>
-<div align="center">
+<div id="watchdog" align="center">
<table width="60%" bgcolor="yellow" >
<tr>
<td align='center'>Authenticated for networt use </td>
<hr />
-<p>Normally, the clock at the rightside of above bar is updated. If not,
+<p>If yellow bar is not displayed between above two lines
+or other malfunction is occured,
click <a href="%%TERMINATEURL%%"><b>TERMINATE</b></a>,
- close your browser, and try to select JAVA in authentication page.</p>
+ close your browser, and try to select other watch mode
+ in authentication page.</p>
<table bgcolor="lightyellow" border="1">
<tr><td>
</td></tr>
</table>
-<script>
+<script type="text/JavaScript">
//<!--
window.open("%%STARTURL%%","window1");
- initHttpkeep(%%HTTPHELLOINTERVAL%%,"%%HTTPHELLOURL%%");
+
+ applet =' <applet code="Opengate.class" archive="Opengate.jar" ';
+ applet +=' codebase="%%OPENGATEDIR%%" width="600" height="30" > ';
+ applet +=' <param name=port value="%%OPENGATEPORT%%"> ';
+ applet +=' <param name=user value="%%USERID%%"> ';
+ applet +=' <param name=sessionid value="%%SESSIONID%%"> ';
+ applet +=' <param name=lang value="%%LANGUAGE%%"> ';
+ applet +=' </applet> ';
+
+ initHttpkeep(%%HTTPHELLOINTERVAL%%,"%%HTTPHELLOURL%%",applet);
//-->
</script>
<H2>Network User Authentication</H2>
<hr>
-[<a href="https://%%AUTHCGIURL%%?%%ADDR4%%&ja">Japanese version</a>]
+[<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">Japanese version</a>]
<hr SIZE=4 WIDTH="100%">
<P><font size=+1>You are requested to be authenticated before using network.
<hr>
-Watch dog (Only change when default is mulfunctioned)<br />
+Watch dog (Only change when default is malfunctioned)<br />
<input type="radio" name="watchmode" value="H" %%CHECKHTTP%% >HTTP
<input type="radio" name="watchmode" value="J" %%CHECKJAVA%% >JAVA
<input type="radio" name="watchmode" value="T" %%CHECKTIME%% >
<H2 align=center>Network User Authentication</H2>
<hr>
-[<a href="http://%%AUTHCGIURL%%?%%ADDR4%%&ja">Japanese version</a>]
+[<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">Japanese version</a>]
<hr>
<div align=center>
<P><font size=+1>You are requested to be authenticated before using network.
Please enter your user ID and password in the box below, then press SEND.
Please use SSL Authentication as far as possible to prevent wiretapping.
</P>
-<P><A HREF="https://%%AUTHCGIURL%%?%%ADDR4%%&en">SSL Authentication</A></P>
+<P><A HREF="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">SSL Authentication</A></P>
<P>
<FORM METHOD="POST" ACTION="http://%%CGIURL%%">
</TABLE>
<hr>
-Watch dog (Only change when the system is mulfunctioned)<br />
+Watch dog (Only change when the system is malfunctioned)<br />
<input type="radio" name="watchmode" value="H" %%CHECKHTTP%% >HTTP
<input type="radio" name="watchmode" value="J" %%CHECKJAVA%% >JAVA
<input type="radio" name="watchmode" value="T" %%CHECKTIME%% >
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-<META HTTP-EQUIV="Refresh" CONTENT="1; URL=https://%%AUTHCGIURL%%?%%ADDR4%%&en">
+<META HTTP-EQUIV="Refresh" CONTENT="1; URL=https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">
<TITLE>OpengateStart</TITLE>
</HEAD>
<BODY>
<P>
If you cannot move to the page automatically, click the following.
<P>
-<a href="https://%%AUTHCGIURL%%?%%ADDR4%%&en">Network Authentication</a><br>
-<a href="http://%%AUTHCGIURL%%?%%ADDR4%%&en">Network Authentication(Unuse SSL)</a>
+<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication</a><br>
+<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(Unuse SSL)</a>
<hr>
Saga University
</BODY>
//<!--
-var connect;
-var timeInterval;
+var checkInterval;
var httpkeepUrl;
+var appletDescription;
var httpObj;
function createXMLHttpRequest() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
try { return new XMLHttpRequest(); } catch(e) {}
- document.getElementById("dispmsg").innerHTML = 'ERROR-noAJAX';
return null;
}
function onTimeout()
{
- if(httpObj.readyState!=4){
- document.getElementById("dispmsg").innerHTML = 'ERROR-noREPLY';
- connect=0;
- }
-
- if(connect==1){
+ if(httpObj.readyState==4&&httpObj.status==200){
sendHello();
- setTimeout('onTimeout()', timeInterval);
+ setTimeout('onTimeout()', checkInterval*1000);
+ }
+ else{
+ document.getElementById("dispmsg").innerHTML = 'Error!';
}
}
function sendHello(){
- // http communication object
- httpObj=createXMLHttpRequest();
- httpObj.onreadystatechange = displayResponse;
+ // http communication
+ if((httpObj=createXMLHttpRequest())!=null){
+ httpObj.onreadystatechange = displayResponse;
- try{
- httpObj.open("GET",httpkeepUrl+Math.random(),true);
- }catch(e){
- document.getElementById("dispmsg").innerHTML = "ERROR-noOPEN";
- connect=0;
- }
+ try{
+ httpObj.open("GET",httpkeepUrl+Math.random(),true);
+ httpObj.send(null);
+ }catch(e){
+ document.getElementById("watchdog").innerHTML = appletDescription;
+ setTimeout('', 0);
+ }
- httpObj.send(null);
+ }
+ // java communication
+ else{
+ document.getElementById("watchdog").innerHTML = appletDescription;
+ setTimeout('', 0);
+ }
}
function displayResponse()
{
- if(httpObj.readyState==4){
- today=new Date;
- hh=today.getHours(); mm=today.getMinutes();
- if(hh<10)hh='0'+hh; if(mm<10)mm='0'+mm;
- document.getElementById("dispmsg").innerHTML = hh+':'+mm;
+ try{
+ if(httpObj.readyState==4&&httpObj.status==200){
+ today=new Date;
+ hh=today.getHours(); mm=today.getMinutes();
+ if(hh<10)hh='0'+hh; if(mm<10)mm='0'+mm;
+ document.getElementById("dispmsg").innerHTML = hh+':'+mm;
+ }else{
+ document.getElementById("dispmsg").innerHTML = 'Waiting...';
+ }
+ }catch(e){
+ document.getElementById("watchdog").innerHTML = appletDescription;
+ setTimeout('onTimeout()', 0);
}
}
-function initHttpkeep(interval, url)
+function initHttpkeep(intervalArg, urlArg, appletArg)
{
- connect=1;
- sendHello();
+ // save arguments
+ checkInterval = intervalArg;
+ httpkeepUrl=urlArg;
+ appletDescription=appletArg;
- // http request after timeInterval(ms)
- timeInterval = interval*1000;
- httpkeepUrl=url;
-
- // get next text after some delay
- setTimeout('onTimeout()', timeInterval);
+ // set timeout and send hello
+ setTimeout('onTimeout()', checkInterval*1000);
+ sendHello();
}
-//-->
\ No newline at end of file
+//-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-2022-jp">
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Refresh" content="0; URL=%%HTTPKEEPURL%%">
-
<title>Opengatemain</title>
</head>
<body>
<p>
-\e$B%M%C%H%o!<%/$rMxMQ$G$-$^$9!#$3$N%Z!<%8$+$i<+F00\F0$7$J$$J}$O\e(B
-<a href="%%HTTPKEEPURL%%">\e$B<!$X\e(B</a>\e$B$r%/%j%C%/$7$F2<$5$$!#\e(B
+<p>\e$B%M%C%H%o!<%/$rMxMQ$G$-$^$9!#\e(B</p>
+<p>\e$BMxMQ$,=*$C$?$iI,$:\e(BWeb\e$B%V%i%&%6$r=*N;$7$F$/$@$5$$!#%M%C%H%o!<%/MxMQ5v2D$b<+F0E*$K<h$j>C$5$l$^$9!#\e(B
</p>
+<script language="JavaScript">
+<!--
+// usually the page is jumped to httpkeep.html
+location.replace(%%HTTPKEEPURL%%);
+
+// if not jumped, process following
+if(!navigator.javaEnabled()){
+ document.write("<p><b>Java\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#@_Dj$rJQ99$7$F2<$5$$!#\e(B</b></p>");
+}
+//-->
+</script>
+<noscript>
+<p><b>JavaScript\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#@_Dj$rJQ99$7$F2<$5$$!#\e(B</b></p>
+</noscript>
+
+<hr />
+<div align="center">
+ <applet code="Opengate.class" archive="Opengate.jar"
+ codebase="%%OPENGATEDIR%%" width="600" height="30" >
+ <param name=port value="%%OPENGATEPORT%%">
+ <param name=user value="%%USERID%%">
+ <param name=sessionid value="%%SESSIONID%%">
+ <param name=lang value="%%LANGUAGE%%">
+ </applet>
+</div>
+<hr />
+
+<p>\e$B>e$N\e(B2\e$BK\$N@~$N4V$K2+?'$N%P!<$,I=<($5$l$J$$>l9g!"\e(B<a href="%%TERMINATEURL%%"><b>\e$BMxMQCfCG\e(B</b></a>\e$B$r%/%j%C%/$7$F$+$i\e(B
+\e$B%V%i%&%6$r=*N;$7$F$/$@$5$$!#\e(B
+
+<script language="JavaScript">
+<!--
+ window.open("%%STARTURL%%","window1");
+//-->
+</script>
+
+<table bgcolor="lightyellow" border="1">
+<tr><td>
+<b>\e$B$3$N%Z!<%8$O$3$N$^$^$K!JKt$O:G>/2=!K$7$F!"JL$N%&%$%s%I%&$G:n6H$7$F$/$@$5$$!#\e(B</b>
+\e$B:n6HMQ%&%#%s%I%&$,3+$+$J$$>l9g$K$O!"\e(B<a href="%%STARTURL%%" target="_blank"><h3>[\e$B%9%?!<%H%Z!<%8\e(B]</h3></a>\e$B$r%/%j%C%/$7$F$/$@$5$$!#\e(B
+
+</td></tr>
+</table>
+
</body>
</html>
<script language="JavaScript">
<!--
if(!navigator.javaEnabled()){
- document.write("<p><b>Java\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#JQ992<$5$$!#\e(B</b></p>");
+ document.write("<p><b>Java\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#JQ99$7$F2<$5$$!#\e(B</b></p>");
}
//-->
</script>
<noscript>
-<p><b>JavaScript\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#JQ992<$5$$!#\e(B</b></p>
+<p><b>JavaScript\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#JQ99$7$F2<$5$$!#\e(B</b></p>
</noscript>
<hr />
codebase="%%OPENGATEDIR%%" width="600" height="30" >
<param name=port value="%%OPENGATEPORT%%">
<param name=user value="%%USERID%%">
+ <param name=sessionid value="%%SESSIONID%%">
<param name=lang value="%%LANGUAGE%%">
</applet>
</div>
<p>\e$B>e$N\e(B2\e$BK\$N@~$N4V$K2+?'$N%P!<$,I=<($5$l$J$$>l9g!"\e(BJava\e$B$,F0$$$F$$$^$;$s!#\e(B
<a href="%%TERMINATEURL%%"><b>\e$BMxMQCfCG\e(B</b></a>\e$B$r%/%j%C%/$7$F\e(B
-\e$B%V%i%&%6$r=*N;$7$?8e!"G'>Z%Z!<%8$K$*$$$F\e(BHTTP\e$BJ}<0$rA*Br$7$F$/$@$5$$!#\e(B
+\e$B%V%i%&%6$r=*N;$7$?8e!"G'>Z%Z!<%8$K$*$$$FB>$N4F;kJ}<0$rA*Br$7$F$/$@$5$$!#\e(B
\e$B$^$?$O!"\e(B<a href=http://java.com/ja/index.jsp><b>java.com</b></a>
\e$B$+$i\e(BJavaPlugIn\e$B$r%@%&%s%m!<%I$9$l$P!"\e(BJava\e$B$rF0$+$9$3$H$,$G$-$^$9!#\e(B
</body>
</html>
+
+
+
+
</head>
<body>
-<p>\e$B%M%C%H%o!<%/$rMxMQ$G$-$^$9!#\e(B
-\e$B%M%C%H%o!<%/$O;XDj;~4V8e$KJD:?$H$J$j$^$9!#\e(B</p>
-<p>\e$B0BA4$N$?$a$K!"MxMQ=*N;;~$K$O!"\e(B<a href="%%TERMINATEURL%%">
-<b>\e$BMxMQCfCG\e(B</b></a>\e$B$r%/%j%C%/$7$F$/$@$5$$!#\e(B</p>
-<p>\e$B$3$NJ}K!$O!"B>$NJ}K!$,<:GT$9$k>l9g$K$N$_MxMQ$7$F2<$5$$!#\e(B</p>
+<p>\e$B%M%C%H%o!<%/$rMxMQ$G$-$^$9!#\e(J
+\e$B%M%C%H%o!<%/$O;XDj;~4V7P2a8e$KJD:?$H$J$j$^$9!#\e(J</p>
+<p>\e$B0BA4$N$?$a$K!"MxMQ=*N;;~$K$O!"\e(J<a href="%%TERMINATEURL%%">
+<b>\e$BMxMQCfCG\e(J</b></a>\e$B$r%/%j%C%/$7$F$/$@$5$$!#\e(J</p>
+<p>\e$B$3$NJ}K!$O!"B>$N4F;kJ}K!$,;HMQ$G$-$J$$>l9g$K$N$_MxMQ$7$F2<$5$$!#\e(J</p>
<script language="JavaScript">
<!--
<table bgcolor="lightyellow" border="1">
<tr><td>
-<b>\e$B$3$N%Z!<%8$O$3$N$^$^$K!JKt$O:G>/2=!K$7$F!"JL$N%&%$%s%I%&$G:n6H$7$F$/$@$5$$!#\e(B</b>
-\e$B:n6HMQ%&%#%s%I%&$,3+$+$J$$>l9g$K$O!"\e(B
-<a href="%%STARTURL%%" target="_blank"><h3>[\e$B%9%?!<%H%Z!<%8\e(B]</h3></a>\e$B$r%/%j%C%/$7$F$/$@$5$$!#\e(B
+<b>\e$B$3$N%Z!<%8$O$3$N$^$^$K!JKt$O:G>/2=!K$7$F!"JL$N%&%$%s%I%&$G:n6H$7$F$/$@$5$$!#\e(J</b>
+\e$B:n6HMQ%&%#%s%I%&$,3+$+$J$$>l9g$K$O!"\e(J
+<a href="%%STARTURL%%" target="_blank"><h3>[\e$B%9%?!<%H%Z!<%8\e(J]</h3></a>\e$B$r%/%j%C%/$7$F$/$@$5$$!#\e(J
</td></tr>
</table>
<P>
\e$B%M%C%H%o!<%/MxMQG'>Z$K<:GT$7$^$7$?!#$b$&0lEY$d$jD>$7$F2<$5$$!#\e(B
</P>
-<A HREF=https://%%AUTHCGIURL%%?%%ADDR4%%&ja><H3>\e$BLa$k\e(B</H3></A>
+<A HREF="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja"><H3>\e$BLa$k\e(B</H3></A>
</BODY>
</HTML>
<P>
\e$B%M%C%H%o!<%/MxMQG'>Z$K<:GT$7$^$7$?!#$b$&0lEY$d$jD>$7$F2<$5$$!#\e(B
</P>
-<A HREF=http://%%AUTHCGIURL%%?%%ADDR4%%&ja><H3>\e$BLa$k\e(B</H3></A>
+<A HREF="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja"><H3>\e$BLa$k\e(B</H3></A>
</BODY>
</HTML>
<body>
-<noscript>
-<p><b>JavaScript\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#3NG'2<$5$$!#\e(B</b></p>
-</noscript>
<p>\e$B%M%C%H%o!<%/$rMxMQ$G$-$^$9!#\e(B</p>
-<p>\e$BMxMQ$,=*$C$?$iI,$:\e(BWeb\e$B%V%i%&%6$r=*N;$7$F$/$@$5$$!#%M%C%H%o!<%/MxMQ5v2D$b<+F0E*$K<h$j>C$5$l$^$9!#\e(B
-</p>
+<p>\e$BMxMQ$,=*$C$?$iI,$:\e(BWeb\e$B%V%i%&%6$r=*N;$7$F$/$@$5$$!#%M%C%H%o!<%/MxMQ5v2D$b<+F0E*$K<h$j>C$5$l$^$9!#\e(B</p>
+<noscript>
+<p><b>JavaScript\e$B$,L58z$K@_Dj$5$l$F$$$^$9!#JQ99$7$F2<$5$$!#\e(B</b></p>
+</noscript>
<hr />
<p>
-<div align="center">
+<div id="watchdog" align="center">
<table width="60%" bgcolor="yellow" >
<tr>
<td align='center'>\e$B%M%C%H%o!<%/MxMQ5v2D\e(B</td>
</p>
<hr />
-<p>\e$B@5>o;~$K$O!">e$N%P!<1&C<$N;~7W$,99?7$5$l$^$9!#$=$&$J$i$J$$>l9g$O!"\e(B
+<p>\e$B>e$N\e(B2\e$BK\$N@~$N4V$K2+?'$N%P!<$,I=<($5$l$J$$>l9g$J$IF0:n$,$*$+$7$$>l9g$O!"\e(B
<a href="%%TERMINATEURL%%"><b>\e$BMxMQCfCG\e(B</b></a>\e$B$r%/%j%C%/$7$F\e(B
-\e$B%V%i%&%6$r=*N;$7$?8e!"G'>Z%Z!<%8$K$*$$$F\e(BJAVA\e$BJ}<0$rA*Br$7$F$/$@$5$$!#\e(B
+\e$B%V%i%&%6$r=*N;$7$?8e!"G'>Z%Z!<%8$K$*$$$FB>$N4F;kJ}<0$rA*Br$7$F$/$@$5$$!#\e(B
</p>
<table bgcolor="lightyellow" border="1">
</td></tr>
</table>
-<script>
+<script type="text/JavaScript">
//<!--
window.open("%%STARTURL%%","window1");
- initHttpkeep(%%HTTPHELLOINTERVAL%%,"%%HTTPHELLOURL%%");
+
+ applet =' <applet code="Opengate.class" archive="Opengate.jar" ';
+ applet +=' codebase="%%OPENGATEDIR%%" width="600" height="30" > ';
+ applet +=' <param name=port value="%%OPENGATEPORT%%"> ';
+ applet +=' <param name=user value="%%USERID%%"> ';
+ applet +=' <param name=sessionid value="%%SESSIONID%%"> ';
+ applet +=' <param name=lang value="%%LANGUAGE%%"> ';
+ applet +=' </applet> ';
+
+ initHttpkeep(%%HTTPHELLOINTERVAL%%,"%%HTTPHELLOURL%%",applet);
//-->
</script>
<H2>\e$B%M%C%H%o!<%/MxMQ<TG'>Z\e(B</H2>
<hr>
-[<a href="https://%%AUTHCGIURL%%?%%ADDR4%%&en">English version</a>]
+[<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">English version</a>]
<hr SIZE=4 WIDTH="100%">
<P><font size=+1>\e$B%M%C%H%o!<%/$NMxMQ$r;O$a$kA0$K!"\e(B \e$BMxMQ;q3J$N3NG'$r9T$C$F$/$@$5$$!#\e(B</font></P>
<H2>\e$B%M%C%H%o!<%/MxMQ<TG'>Z\e(B</H2>
<hr>
-[<a href="http://%%AUTHCGIURL%%?%%ADDR4%%&en">English version</a>]
+[<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">English version</a>]
<hr>
<div align=center>
\e$B%Q%9%o!<%I$NEpD0$rKI$0$?$a$K!"$G$-$k$@$1\e(BSSL\e$BBP1~G'>Z$rMxMQ$7$F2<$5$$!#\e(B
</P>
-<P><A HREF="https://%%AUTHCGIURL%%?%%ADDR4%%&ja">SSL\e$BBP1~G'>Z\e(B</A></P>
+<P><A HREF="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">SSL\e$BBP1~G'>Z\e(B</A></P>
<P>
<FORM METHOD="POST" ACTION="http://%%CGIURL%%">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-2022-jp">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-<META HTTP-EQUIV="Refresh" CONTENT="1; URL=https://%%AUTHCGIURL%%?%%ADDR4%%&ja">
+<META HTTP-EQUIV="Refresh" CONTENT="1; URL=https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">
<TITLE>OpengateStart</TITLE>
</HEAD>
<P>
\e$B<+F00\F0$G$-$J$$J}$O$3$A$i$r%/%j%C%/$7$F2<$5$$!#\e(B
<P>
-<a href="https://%%AUTHCGIURL%%?%%ADDR4%%&ja">\e$B%M%C%H%o!<%/MxMQ<TG'>Z\e(B</a><br>
-<a href="http://%%AUTHCGIURL%%?%%ADDR4%%&ja">\e$B%M%C%H%o!<%/MxMQ<TG'>Z!J\e(BSSL\e$BHsBP1~!K\e(B</a>
+<a href="https://%%AUTHCGIURL%%?%%addr=ADDR4%%&lang=ja">\e$B%M%C%H%o!<%/MxMQ<TG'>Z\e(B</a><br>
+<a href="http://%%AUTHCGIURL%%?%%addr=ADDR4%%&lang=ja">\e$B%M%C%H%o!<%/MxMQ<TG'>Z!J\e(BSSL\e$BHsBP1~!K\e(B</a>
<HR>
\e$B:42lBg3X\e(B
</BODY>
cp ../conf/ipfwctrl.pl.sample ${CONFIGPATH}
#
#------------------------------------------------------#
- # Rename above x.sample, if you need to enable these. #
+ # COPY above x.sample to x and EDIT it, if you need. #
# Eg. 'cp opengatesrv.conf.sample opengatesrv.conf' #
#------------------------------------------------------#
int AddrEncode(char encodeAddr[], char dotSepAddr[]){
int ret;
- if(debug) err_msg("DEBUG:=>addrEncode(,%s)",dotSepAddr);
+ if(debug>1) err_msg("DEBUG:=>addrEncode(,%s)",dotSepAddr);
ret = addrEncode(encodeAddr, dotSepAddr);
- if(debug) err_msg("DEBUG:(%d)<=addrEncode(%s,)",ret,encodeAddr);
+ if(debug>1) err_msg("DEBUG:(%d)<=addrEncode(%s,)",ret,encodeAddr);
return ret;
}
int AddrDecode(char dotSepAddr[], char encodeAddr[]){
int ret;
- if(debug) err_msg("DEBUG:=>addrDecode(,%s)",encodeAddr);
+ if(debug>1) err_msg("DEBUG:=>addrDecode(,%s)",encodeAddr);
ret = addrDecode(dotSepAddr, encodeAddr);
- if(debug) err_msg("DEBUG:(%d)<=addrDecode(%s,)",ret,dotSepAddr);
+ if(debug>1) err_msg("DEBUG:(%d)<=addrDecode(%s,)",ret,dotSepAddr);
return ret;
}
}
/* get [220 <host> FTP server ..]*/
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpse server is not normal 1",__FILE__,__LINE__);
Close(sockfd);
return DENY;
Writefmt(sockfd, "AUTH TLS\r\n");
/* get [234 AUTH TLS successful] */
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpse server is not normal 3",__FILE__,__LINE__);
Close(sockfd);
return DENY;
WritefmtSSL(ssl, "USER %s\r\n", userid);
/* get [331 Password required ..] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpse server is not normal 5",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
/* if multi-line greeting [220 ...] exist, skip them. */
while(strstr(recvline,"220")==recvline){
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpse server is not normal 6",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
WritefmtSSL(ssl, "PASS %s\r\n", passwd);
/* get [230 User <userid> logged in] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpse server is not normal 8",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
/* DATA EXCHANGE - Send a message and receive a reply. */
/* get [220 <host> FTP server ..]*/
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpsi server is not normal 1",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
WritefmtSSL(ssl, "USER %s\r\n", userid);
/* get [331 Password required ..] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpi server is not normal 3",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
/* if multi-line greeting [220 ...] exist, skip them. */
while(strstr(recvline,"220")==recvline){
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpsi server is not normal 4",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
WritefmtSSL(ssl, "PASS %s\r\n", passwd);
/* get [230 User <userid> logged in] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftpsi server is not normal 6",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
{
int ret;
- if(debug) err_msg("DEBUG:=>authFtpse(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authFtpse(%s,passwd)",userid);
ret=authFtpse(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authFtpse( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authFtpse( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>authFtpsi(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authFtpsi(%s,passwd)",userid);
ret=authFtpsi(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authFtpsi( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authFtpsi( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>authPam(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authPam(%s,passwd)",userid);
ret=authPam(userid, passwd);
- if(debug) err_msg("DEBUG:(%d)<=authPam( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authPam( )",ret);
return ret;
}
/* pop3 message exchange */
/* get [+OK POP3 <host> <ver> server ready]*/
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3s server is not normal 1",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
WritefmtSSL(ssl, "user %s\r\n", userid);
/* get [+OK User name accepted, password please] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3s server is not normal 3",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
WritefmtSSL(ssl, "pass %s\r\n", passwd);
/* get [+OK Mailbox open, <count> messages] */
- if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readlnSSL(ssl, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3s server is not normal 5",__FILE__,__LINE__);
authResult=DENY;
goto EXITPOINT;
{
int ret;
- if(debug) err_msg("DEBUG:=>authPop3s(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authPop3s(%s,passwd)",userid);
ret=authPop3s(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authPop3s( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authPop3s( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>authRadius(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authRadius(%s,passwd)",userid);
ret=authRadius(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authRadius( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authRadius( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getMacAddrFromArp(%s,)",clientAddr4);
+ if(debug>1) err_msg("DEBUG:=>getMacAddrFromArp(%s,)",clientAddr4);
ret=getMacAddrFromArp(clientAddr4,macAddr4);
- if(debug) err_msg("DEBUG:(%d)<=getMacAddrFromArp(,%s)",ret,macAddr4);
+ if(debug>1) err_msg("DEBUG:(%d)<=getMacAddrFromArp(,%s)",ret,macAddr4);
return ret;
}
}
/* get [220 <host> FTP server ..]*/
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftp server is not normal 1",__FILE__,__LINE__);
Close(sockfd);
return DENY;
Writefmt(sockfd, "user %s\r\n", userid);
/* get [331 Password required ..] */
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftp server is not normal 3",__FILE__,__LINE__);
Close(sockfd);
return DENY;
/* if multi-line greeting [220 ...] exist, skip them. */
while(strstr(recvline,"220")==recvline){
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftp server is not normal 3",__FILE__,__LINE__);
Close(sockfd);
return DENY;
Writefmt(sockfd, "pass %s\r\n", passwd);
/* get [230 User <userid> logged in] */
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Ftp server is not normal 5",__FILE__,__LINE__);
Close(sockfd);
return DENY;
}
/* get [+OK POP3 <host> <ver> server ready]*/
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3 server is not normal 1",__FILE__,__LINE__);
Close(sockfd);
return DENY;
Writefmt(sockfd, "user %s\r\n", userid);
/* get [+OK User name accepted, password please] */
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3 server is not normal 3",__FILE__,__LINE__);
Close(sockfd);
return DENY;
Writefmt(sockfd, "pass %s\r\n", passwd);
/* get [+OK Mailbox open, <count> messages] */
- if((n = readln(sockfd, recvline, BUFFMAXLN)) <= 0) {
+ if((n = readln(sockfd, recvline, BUFFMAXLN)) < 0) {
err_msg("ERR at %s#%d: Pop3 server is not normal 5",__FILE__,__LINE__);
Close(sockfd);
return DENY;
{
int ret;
- if(debug) err_msg("DEBUG:=>authFtp(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authFtp(%s,passwd)",userid);
ret=authFtp(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authFtp( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authFtp( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>authPop3(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authPop3(%s,passwd)",userid);
ret=authPop3(userid,passwd);
- if(debug) err_msg("DEBUG:(%d)<=authPop3( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authPop3( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>authenticateUser(%s,passwd)",userid);
+ if(debug>1) err_msg("DEBUG:=>authenticateUser(%s,passwd)",userid);
ret=authenticateUser(userid,password);
- if(debug) err_msg("DEBUG:(%d)<=authenticateUser( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=authenticateUser( )",ret);
return ret;
}
void SplitId(char* userid, char* useridshort, char* extraId)
{
- if(debug) err_msg("DEBUG:=>splitId(%s,,)",userid);
+ if(debug>1) err_msg("DEBUG:=>splitId(%s,,)",userid);
splitId(userid,useridshort,extraId);
- if(debug) err_msg("DEBUG:<=splitId(%s,%s,%s)",userid,useridshort,extraId);
+ if(debug>1) err_msg("DEBUG:<=splitId(%s,%s,%s)",userid,useridshort,extraId);
}
/*********************************************/
/* put accept message and java to the client */
/*********************************************/
-void putClientAccept(char *userid, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode)
+void putClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode)
{
FILE *fp;
char buff[BUFFMAXLN];
"http://%s%s/%s/%s",GetConfValue("OpengateServerName"),
GetConfValue("OpengateDir"),language,GetConfValue("AcceptDoc2"));
- /* create terminate url [http://<servaddr>:<port>/terminate<pid>] */
- snprintf(terminateurl, BUFFMAXLN, "http://%s:%d/terminate%d",
- GetConfValue("OpengateServerName"), port, pid);
+ /* create terminate url [http://<servaddr>:<port>/terminate-<pid>] */
+ snprintf(terminateurl, BUFFMAXLN, "http://%s:%d/terminate-%d",
+ GetConfValue("OpengateServerName"), port, getpid());
/* create httpkeep page url
['http://<servaddr>:<port>/httpkeep-<userid>'] */
snprintf(httpkeepUrl, BUFFMAXLN,
- "'http://%s:%d/httpkeep-%s'",
- GetConfValue("OpengateServerName"), port, userid);
+ "'http://%s:%d/httpkeep-%s-%s'",
+ GetConfValue("OpengateServerName"), port, userid,sessionId);
/* create port string */
snprintf(portStr, WORDMAXLN, "%d", port);
htmlReplace(buff, "%%OPENGATEDIR%%", opengateDir);
htmlReplace(buff, "%%OPENGATEPORT%%", portStr);
htmlReplace(buff, "%%USERID%%", userid);
+ htmlReplace(buff, "%%SESSIONID%%", sessionId);
htmlReplace(buff, "%%LANGUAGE%%", language);
htmlReplace(buff, "%%TERMINATEURL%%", terminateurl);
/*******************************/
void GetClientAddr(char *clientAddr)
{
- if(debug) err_msg("DEBUG:=>getClientAddr( )");
+ if(debug>1) err_msg("DEBUG:=>getClientAddr( )");
getClientAddr(clientAddr);
- if(debug) err_msg("DEBUG:<=getClientAddr(%s)",clientAddr);
+ if(debug>1) err_msg("DEBUG:<=getClientAddr(%s)",clientAddr);
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getPostData( )");
+ if(debug>1) err_msg("DEBUG:=>getPostData( )");
ret=getPostData(userid,password,clientAddr4,durationPtr, watchMode);
- if(debug) err_msg("DEBUG:%d<=getPostData(%s,passwd,%s,%d,%s)",ret,userid,clientAddr4,*durationPtr,watchMode);
+ if(debug>1) err_msg("DEBUG:%d<=getPostData(%s,passwd,%s,%d,%s)",ret,userid,clientAddr4,*durationPtr,watchMode);
return ret;
}
-void PutClientAccept(char *userid, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode)
+void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode)
{
- if(debug) err_msg("DEBUG:=>putClientAccept(%s,%d,%d,%s,%s,%d,%d,%s)",userid,port,pid,clientAddr4,clientAddr6,ipStatus, duration, watchMode);
- putClientAccept(userid,port,pid,clientAddr4,clientAddr6,ipStatus,duration,watchMode);
- if(debug) err_msg("DEBUG:<=putClientAccept( )");
+ if(debug>1) err_msg("DEBUG:=>putClientAccept(%s,%s,%d,%d,%s,%s,%d,%d,%s)",userid,sessionId,port,pid,clientAddr4,clientAddr6,ipStatus, duration, watchMode);
+ putClientAccept(userid,sessionId,port,pid,clientAddr4,clientAddr6,ipStatus,duration,watchMode);
+ if(debug>1) err_msg("DEBUG:<=putClientAccept( )");
}
void PutClientDeny(char *clientAddr4)
{
- if(debug) err_msg("DEBUG:=>putClientDeny(&s)",clientAddr4);
+ if(debug>1) err_msg("DEBUG:=>putClientDeny(&s)",clientAddr4);
putClientDeny(clientAddr4);
- if(debug) err_msg("DEBUG:<=putClientDeny( )");
+ if(debug>1) err_msg("DEBUG:<=putClientDeny( )");
}
void PutClientRetry(char *lang)
{
- if(debug) err_msg("DEBUG:=>putClientRetry(%s)",lang);
+ if(debug>1) err_msg("DEBUG:=>putClientRetry(%s)",lang);
putClientRetry(lang);
- if(debug) err_msg("DEBUG:<=putClientRetry( )");
+ if(debug>1) err_msg("DEBUG:<=putClientRetry( )");
}
void PutClientMsg(char *message)
{
- if(debug) err_msg("DEBUG:=>putClientMsg( %s )",message);
+ if(debug>1) err_msg("DEBUG:=>putClientMsg( %s )",message);
putClientMsg(message);
- if(debug) err_msg("DEBUG:<=putClientMsg( )");
+ if(debug>1) err_msg("DEBUG:<=putClientMsg( )");
}
int CheckReferer(void)
{
int ret;
- if(debug) err_msg("DEBUG:=>checkReferer( )");
+ if(debug>1) err_msg("DEBUG:=>checkReferer( )");
ret = checkReferer();
- if(debug) err_msg("DEBUG:(%d)<=checkReferer( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=checkReferer( )",ret);
return ret;
}
{\r
int ret;\r
\r
- if(debug) err_msg("DEBUG:=>getRuleNumber6(%s)",clientAddr6);\r
+ if(debug>1) err_msg("DEBUG:=>getRuleNumber6(%s)",clientAddr6);\r
ret=getRuleNumber6(clientAddr6);\r
- if(debug) err_msg("DEBUG:(%d)<=getRuleNumber6( )",ret);\r
+ if(debug>1) err_msg("DEBUG:(%d)<=getRuleNumber6( )",ret);\r
\r
return ret;\r
}\r
{\r
int ret;\r
\r
- if(debug) err_msg("DEBUG:=>openClientGate6(%s,%s,%s,%s)",clientAddr6,userid,macAddr6,userProperty);\r
+ if(debug>1) err_msg("DEBUG:=>openClientGate6(%s,%s,%s,%s)",clientAddr6,userid,macAddr6,userProperty);\r
ret=openClientGate6(clientAddr6, userid, macAddr6, userProperty);\r
- if(debug) err_msg("DEBUG:(%d)<=openClientGate6( )",ret);\r
+ if(debug>1) err_msg("DEBUG:(%d)<=openClientGate6( )",ret);\r
\r
return ret;\r
}\r
\r
void CloseClientGate6(struct clientAddr *pClientAddr, char *userid, char *macAddr6)\r
{\r
- if(debug) err_msg("DEBUG:=>closeClientGate6(%p,%s,%s)",pClientAddr,userid,macAddr6);\r
+ if(debug>1) err_msg("DEBUG:=>closeClientGate6(%p,%s,%s)",pClientAddr,userid,macAddr6);\r
closeClientGate6(pClientAddr,userid,macAddr6);\r
- if(debug) err_msg("DEBUG:<=closeClientGate6( )");\r
+ if(debug>1) err_msg("DEBUG:<=closeClientGate6( )");\r
}\r
\r
int GetPacketCount6(char *ruleNumber)\r
{\r
int ret;\r
\r
- if(debug) err_msg("DEBUG:=>getPacketCount6(%s)",ruleNumber);\r
+ if(debug>1) err_msg("DEBUG:=>getPacketCount6(%s)",ruleNumber);\r
ret=getPacketCount6(ruleNumber);\r
- if(debug) err_msg("DEBUG:(%d)<=getPacketCount6( )",ret);\r
+ if(debug>1) err_msg("DEBUG:(%d)<=getPacketCount6( )",ret);\r
\r
return ret;\r
}\r
{\r
int ret;\r
\r
- if(debug) err_msg("DEBUG:=>countRuleNumber6(%s)", ruleNumber);\r
+ if(debug>1) err_msg("DEBUG:=>countRuleNumber6(%s)", ruleNumber);\r
ret=countRuleNumber6(ruleNumber);\r
- if(debug) err_msg("DEBUG:(%d)<=countRuleNumber6( )",ret);\r
+ if(debug>1) err_msg("DEBUG:(%d)<=countRuleNumber6( )",ret);\r
\r
return ret;\r
}\r
\r
void DelIp6fwRule(char *ruleNumber){\r
- if(debug) err_msg("DEBUG:=>delIp6fwRule(%s)",ruleNumber);\r
+ if(debug>1) err_msg("DEBUG:=>delIp6fwRule(%s)",ruleNumber);\r
delIp6fwRule(ruleNumber);\r
- if(debug) err_msg("DEBUG:<=delIp6fwRule( )");\r
+ if(debug>1) err_msg("DEBUG:<=delIp6fwRule( )");\r
}\r
{
int ret;
- if(debug) err_msg("DEBUG:=>getRuleNumber4(%s)",clientAddr4);
+ if(debug>1) err_msg("DEBUG:=>getRuleNumber4(%s)",clientAddr4);
ret=getRuleNumber4(clientAddr4);
- if(debug) err_msg("DEBUG:(%d)<=getRuleNumber4( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=getRuleNumber4( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>openClientGate4(%s,%s,%s,%s)",clientAddr4,userid,macAddr4,userProperty);
+ if(debug>1) err_msg("DEBUG:=>openClientGate4(%s,%s,%s,%s)",clientAddr4,userid,macAddr4,userProperty);
ret=openClientGate4(clientAddr4, userid, macAddr4, userProperty);
- if(debug) err_msg("DEBUG:(%d)<=openClientGate4( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=openClientGate4( )",ret);
return ret;
}
void CloseClientGate4(struct clientAddr *pClientAddr, char *userid, char *macAddr4)
{
- if(debug) err_msg("DEBUG:=>closeClientGate4(%p,%s,%s)",pClientAddr,userid,macAddr4);
+ if(debug>1) err_msg("DEBUG:=>closeClientGate4(%p,%s,%s)",pClientAddr,userid,macAddr4);
closeClientGate4(pClientAddr,userid,macAddr4);
- if(debug) err_msg("DEBUG:<=closeClientGate4( )");
+ if(debug>1) err_msg("DEBUG:<=closeClientGate4( )");
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getPacketCount4(%s)",ruleNumber);
+ if(debug>1) err_msg("DEBUG:=>getPacketCount4(%s)",ruleNumber);
ret=getPacketCount4(ruleNumber);
- if(debug) err_msg("DEBUG:(%d)<=getPacketCount4( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=getPacketCount4( )",ret);
return ret;
}
void DelIpfwRule(char *ruleNumber){
- if(debug) err_msg("DEBUG:=>delIpfwRule(%s)",ruleNumber);
+ if(debug>1) err_msg("DEBUG:=>delIpfwRule(%s)",ruleNumber);
delIpfwRule(ruleNumber);
- if(debug) err_msg("DEBUG:<=delIpfwRule( )");
+ if(debug>1) err_msg("DEBUG:<=delIpfwRule( )");
}
int CountRuleNumber4(char *ruleNumber)
{
int ret;
- if(debug) err_msg("DEBUG:=>countRuleNumber4(%s)", ruleNumber);
+ if(debug>1) err_msg("DEBUG:=>countRuleNumber4(%s)", ruleNumber);
ret=countRuleNumber4(ruleNumber);
- if(debug) err_msg("DEBUG:(%d)<=countRuleNumber4( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=countRuleNumber4( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getMacAddrFromNdp(%s,)",clientAddr6);
+ if(debug>1) err_msg("DEBUG:=>getMacAddrFromNdp(%s,)",clientAddr6);
ret=getMacAddrFromNdp(clientAddr6,macAddr6);
- if(debug) err_msg("DEBUG:(%d)<=getMacAddrFromNdp(,%s)",ret,macAddr6);
+ if(debug>1) err_msg("DEBUG:(%d)<=getMacAddrFromNdp(,%s)",ret,macAddr6);
return ret;
}
void DeleteNdpEntry(char *clientAddr6)
{
- if(debug) err_msg("DEBUG:=>deleteNdpEntry(%s)",clientAddr6);
+ if(debug>1) err_msg("DEBUG:=>deleteNdpEntry(%s)",clientAddr6);
deleteNdpEntry(clientAddr6);
- if(debug) err_msg("DEBUG:<=deleteNdpEntry( )");
+ if(debug>1) err_msg("DEBUG:<=deleteNdpEntry( )");
}
void ScanNdpEntry(struct clientAddr *pClientAddr, char *userid, char *macAddr6, char *userProperty)
{
- if(debug) err_msg("DEBUG:=>scanNdpEntry(%p,%s,%s,%s)",pClientAddr,userid,macAddr6, userProperty);
+ if(debug>1) err_msg("DEBUG:=>scanNdpEntry(%p,%s,%s,%s)",pClientAddr,userid,macAddr6, userProperty);
scanNdpEntry(pClientAddr,userid,macAddr6,userProperty);
- if(debug) err_msg("DEBUG:<=scanNdpEntry( )");
+ if(debug>1) err_msg("DEBUG:<=scanNdpEntry( )");
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getUserProperty(%s,)",userid);
+ if(debug>1) err_msg("DEBUG:=>getUserProperty(%s,)",userid);
ret=getUserProperty(userid,userProperty);
- if(debug) err_msg("DEBUG:(%d)<=getUserProperty(,%s)",ret, userProperty);
+ if(debug>1) err_msg("DEBUG:(%d)<=getUserProperty(,%s)",ret, userProperty);
return ret;
}
int AddAlarm(char *name, int timeout, int preceding, Sigfunc *func){
int ret;
- if(debug) err_msg("DEBUG:=>addAlarm(%s,%d, %d, %x)",
+ if(debug>1) err_msg("DEBUG:=>addAlarm(%s,%d, %d, %x)",
name, timeout, preceding, func);
ret=addAlarm(name, timeout, preceding, func);
- if(debug) err_msg("DEBUG:(%d)<=addAlarm( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=addAlarm( )",ret);
return ret;
}
int RemoveAlarm(char *name){
int ret;
- if(debug){
+ if(debug>1){
if(name==NULL) err_msg("DEBUG:=>removeAlarm(NULL)");
else err_msg("DEBUG:=>removeAlarm(%s)", name);
}
ret=removeAlarm(name);
- if(debug) err_msg("DEBUG:(%d)<=removeAlarm( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=removeAlarm( )",ret);
return ret;
}
int EnableAlarm(void){
int ret;
- if(debug) err_msg("DEBUG:=>enableAlarm()");
+ if(debug>1) err_msg("DEBUG:=>enableAlarm()");
ret=enableAlarm();
- if(debug) err_msg("DEBUG:(%d)<=enableAlarm( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=enableAlarm( )",ret);
return ret;
}
int DisableAlarm(void){
int ret;
- // if(debug) err_msg("DEBUG:=>disableAlarm()");
+ // if(debug>1) err_msg("DEBUG:=>disableAlarm()");
ret=disableAlarm();
- // if(debug) err_msg("DEBUG:(%d)<=disableAlarm( )",ret);
+ // if(debug>1) err_msg("DEBUG:(%d)<=disableAlarm( )",ret);
return ret;
}
int OpenClientGate(char *clientAddr4, char *macAddr4, char *clientAddr6, char *macAddr6, char *userid, char *userProperty, int ipStatus)
{
int ret;
- if(debug) err_msg("DEBUG:=>openClientGate(%s,%s,%s,%s,%s,%s,%d)",clientAddr4,macAddr4,clientAddr6,macAddr6,userid,userProperty, ipStatus);
+ if(debug>1) err_msg("DEBUG:=>openClientGate(%s,%s,%s,%s,%s,%s,%d)",clientAddr4,macAddr4,clientAddr6,macAddr6,userid,userProperty, ipStatus);
ret = openClientGate(clientAddr4,macAddr4,clientAddr6,macAddr6,userid,userProperty, ipStatus);
- if(debug) err_msg("DEBUG:(%d)<=openClientGate()",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=openClientGate()",ret);
return ret;
}
struct clientAddr *CreateAddrListItem(char* ipAddr, char *ruleNumber, int ipType)
{
struct clientAddr *ret;
- if(debug) err_msg("DEBUG:=>createAddrListItem(%s,%s,%d)",ipAddr,ruleNumber,ipType);
+ if(debug>1) err_msg("DEBUG:=>createAddrListItem(%s,%s,%d)",ipAddr,ruleNumber,ipType);
ret = createAddrListItem(ipAddr, ruleNumber, ipType);
- if(debug) err_msg("DEBUG: [%p] <=createAddrListItem( )",ret);
+ if(debug>1) err_msg("DEBUG: [%p] <=createAddrListItem( )",ret);
return ret;
}
int CheckIpVersions(char *clientAddr4, char *clientAddr6)
{
int ret;
- if(debug) err_msg("DEBUG:=>checkIpVersions(%s,%s)", clientAddr4, clientAddr6);
+ if(debug>1) err_msg("DEBUG:=>checkIpVersions(%s,%s)", clientAddr4, clientAddr6);
ret=checkIpVersions(clientAddr4, clientAddr6);
- if(debug) err_msg("DEBUG:(%d)<=checkIpVersions( )", ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=checkIpVersions( )", ret);
return ret;
}
void RemoveOverlapRule(int overlapRule4, int overlapRule6){
- if(debug) err_msg("DEBUG:=>removeOverlapRule(%d,%d)",overlapRule4,overlapRule6);
+ if(debug>1) err_msg("DEBUG:=>removeOverlapRule(%d,%d)",overlapRule4,overlapRule6);
removeOverlapRule(overlapRule4,overlapRule6);
- if(debug) err_msg("DEBUG:<=removeOverlapRule( )");
+ if(debug>1) err_msg("DEBUG:<=removeOverlapRule( )");
}
void KillOverlapProcess(int overlapRule4, int overlapRule6,
char *clientAddr4, char *clientAddr6){
- if(debug) err_msg("DEBUG:=>killOverlapProcess(%d,%d,%s,%s)",
+ if(debug>1) err_msg("DEBUG:=>killOverlapProcess(%d,%d,%s,%s)",
overlapRule4,overlapRule6,clientAddr4,clientAddr6);
killOverlapProcess(overlapRule4,overlapRule6,clientAddr4,clientAddr6);
- if(debug) err_msg("DEBUG:<=killOverlapProcess( )");
+ if(debug>1) err_msg("DEBUG:<=killOverlapProcess( )");
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getPacketCount(%p)",pClientAddr);
+ if(debug>1) err_msg("DEBUG:=>getPacketCount(%p)",pClientAddr);
ret=getPacketCount(pClientAddr);
- if(debug) err_msg("DEBUG:(%d)<=getPacketCount( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=getPacketCount( )",ret);
return ret;
}
/*****************************************************/
void ReFormatMacAddr(char* macAddr4, char* macAddr6)
{
- if(debug) err_msg("DEBUG:=>reFormatMacAddr(%s)", macAddr4);
+ if(debug>1) err_msg("DEBUG:=>reFormatMacAddr(%s)", macAddr4);
reFormatMacAddr(macAddr4, macAddr6);
- if(debug) err_msg("DEBUG:<=reFormatMacAddr(%s)", macAddr6);
+ if(debug>1) err_msg("DEBUG:<=reFormatMacAddr(%s)", macAddr6);
}
void GetMacAddr(char *clientAddr4, char *macAddr4, char *clientAddr6, char *macAddr6, int ipStatus)
{
- if(debug) err_msg("DEBUG:=>getMacAddr(%s,,%s,,%d)",clientAddr4,clientAddr6,ipStatus);
+ if(debug>1) err_msg("DEBUG:=>getMacAddr(%s,,%s,,%d)",clientAddr4,clientAddr6,ipStatus);
getMacAddr(clientAddr4,macAddr4,clientAddr6,macAddr6, ipStatus);
- if(debug) err_msg("DEBUG:<=getMacAddr(,%s,,%s)", macAddr4, macAddr6);
+ if(debug>1) err_msg("DEBUG:<=getMacAddr(,%s,,%s)", macAddr4, macAddr6);
}
int IsSameMacAddr(char* macAddr4, char* macAddr6){
int ret;
- if(debug) err_msg("DEBUG:=>isSameMacAddr(%s,%s)",macAddr4,macAddr6);
+ if(debug>1) err_msg("DEBUG:=>isSameMacAddr(%s,%s)",macAddr4,macAddr6);
ret=isSameMacAddr(macAddr4,macAddr6);
- if(debug) err_msg("DEBUG:(%d)<=isSameMacAddr( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=isSameMacAddr( )",ret);
return ret;
}
/***********************************************/
int OpenConfFile(void){
int ret;
- if(debug) err_msg("DEBUG:=>openConfFile( )");
+ if(debug>1) err_msg("DEBUG:=>openConfFile( )");
ret = openConfFile();
- if(debug) err_msg("DEBUG:(%d)<=openConfFile( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=openConfFile( )",ret);
return ret;
}
void CloseConfFile(void){
- if(debug) err_msg("DEBUG:=>closeConfFile( )");
+ if(debug>1) err_msg("DEBUG:=>closeConfFile( )");
closeConfFile();
- if(debug) err_msg("DEBUG:<=closeConfFile( )");
+ if(debug>1) err_msg("DEBUG:<=closeConfFile( )");
}
void SetupConfExtra(char *userId, char *extraId){
- if(debug) err_msg("DEBUG:=>setupConfExtra(%s,%s)",userId, extraId);
+ if(debug>1) err_msg("DEBUG:=>setupConfExtra(%s,%s)",userId, extraId);
setupConfExtra(userId, extraId);
- if(debug) err_msg("DEBUG:<=setupConfExtra( )");
+ if(debug>1) err_msg("DEBUG:<=setupConfExtra( )");
}
char *GetConfValue(char *name){
char *ret;
- if(debug) err_msg("DEBUG:=>getConfValue(%s)",name);
+ if(debug>1) err_msg("DEBUG:=>getConfValue(%s)",name);
ret=getConfValue(name);
- if(debug) err_msg("DEBUG:(%s)<=getConfValue( )",ret);
+ if(debug>1) err_msg("DEBUG:(%s)<=getConfValue( )",ret);
return ret;
}
char *GetConfValueExtra(char *name){
char *ret;
- if(debug) err_msg("DEBUG:=>getConfValueExtra(%s)",name);
+ if(debug>1) err_msg("DEBUG:=>getConfValueExtra(%s)",name);
ret=getConfValueExtra(name);
- if(debug) err_msg("DEBUG:(%s)<=getConfValueExtra( )",ret);
+ if(debug>1) err_msg("DEBUG:(%s)<=getConfValueExtra( )",ret);
return ret;
}
void InitConf(void){
- if(debug) err_msg("DEBUG:=>initConf( )");
+ if(debug>1) err_msg("DEBUG:=>initConf( )");
initConf();
- if(debug) err_msg("DEBUG:<=initConf( )");
+ if(debug>1) err_msg("DEBUG:<=initConf( )");
}
int RegExMatch(const char *inStr, const char *regEx){
int ret;
- if(debug) err_msg("DEBUG:=>regExMatch(%s,%s)", inStr, regEx);
+ if(debug>1) err_msg("DEBUG:=>regExMatch(%s,%s)", inStr, regEx);
ret=regExMatch(inStr, regEx);
- if(debug) err_msg("DEBUG:(%d)<=regExMatch( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=regExMatch( )",ret);
return ret;
}
int HtmlTemplate(char* filename, struct html_key* keys){
int ret;
- if(debug) err_msg("DEBUG:=>htmlTemlate(%s,..)",
+ if(debug>1) err_msg("DEBUG:=>htmlTemlate(%s,..)",
filename);
ret = htmlTemplate(filename,keys);
- if(debug) err_msg("DEBUG:(%d)<=htmlTemplate()",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=htmlTemplate()",ret);
return ret;
}
int HtmlReplace(char* buff,char *beforeStr,char *afterStr){
int ret;
- if(debug) err_msg("DEBUG:=>htmlReplace(%s,%s,%s)",buff,beforeStr,afterStr);
+ if(debug>1) err_msg("DEBUG:=>htmlReplace(%s,%s,%s)",buff,beforeStr,afterStr);
ret = htmlReplace(buff, beforeStr, afterStr);
- if(debug) err_msg("DEBUG:(%d)<=htmlReplace()",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=htmlReplace()",ret);
return ret;
}
char* StrSplit(char* str,const char* delimStr){
char* ret;
- if(debug) err_msg("DEBUG:=>strSplit(%s,%s)",str,delimStr);
+ if(debug>1) err_msg("DEBUG:=>strSplit(%s,%s)",str,delimStr);
ret = strSplit(str, delimStr);
- if(debug) err_msg("DEBUG:(%s)<=strSplit()",ret);
+ if(debug>1) err_msg("DEBUG:(%s)<=strSplit()",ret);
return ret;
}
char userProperty[BUFFMAXLN];
time_t timeIn, timeOut;
int connectionMode; /* client connect mode */
+char sessionId[BUFFMAXLN]; /* session ID */
void PutCloseMsg(time_t timeOut, time_t timeIn);
void SetProcessTitle(char *useridshort, char *clientAddr4, char * ruleNumber4, char *clientAddr6, char * ruleNumber6, int ipStatus);
int port;
int dummyfd[2];
int pid;
+ int parentpid;
int duration; /* requested usage duration */
int authResult;
int ipStatus; /* flag for IPv4 or IPv6 */
return 0;
}
+ /* create session ID */
+ CreateSessionId(sessionId);
+
/* set terminate signal handler */
if(Signal(SIGTERM, closeExit)==SIG_ERR){
PutClientMsg("Error: Please contact to the administrator");
closeExit(1);
}
+ parentpid=getpid();
+
/* fork */
if((pid=Fork())==-1){
err_msg("ERR at %s#%d: fork error",__FILE__,__LINE__);
if(pid!=0){
/** parent process **/
/* send accept page with java */
- PutClientAccept(userid, port, pid, clientAddr4, clientAddr6, ipStatus, duration, watchMode);
+ PutClientAccept(userid, sessionId, port, pid, clientAddr4, clientAddr6, ipStatus, duration, watchMode);
/* detach from Web server */
return 0;
/* wait connection from the client */
/* if no connection, close gate when duration is passed */
/* or ipaddr for the macAddr4 is changed */
- connectionMode=WaitClientConnect(userid, userProperty, clientAddr4, clientAddr6, duration, macAddr4, macAddr6, ipStatus, pClientAddr, language, port);
+ connectionMode=WaitClientConnect(userid, userProperty, sessionId, clientAddr4, clientAddr6, duration, macAddr4, macAddr6, ipStatus, pClientAddr, language, port, parentpid);
if(connectionMode==JAVACONNECT){
/* put out time */
timeOut=time(NULL);
PutCloseMsg(timeOut,timeIn);
- if(debug) err_msg("DEBUG:terminated");
+ if(debug>1) err_msg("DEBUG:terminated");
exit(1);
}
char *mode[4]={"NONE","JAVA","HTTP","TIME"};
if(connectionMode<0 || connectionMode>3) connectionMode=0;
- err_msg("INFO: user %s is watched by [%s]",userid, mode[connectionMode]);
+ if(debug>0) err_msg("INFO: user %s is watched by [%s]",userid, mode[connectionMode]);
}
/*****************************/
void PutCloseMsg(time_t timeOut, time_t timeIn)
{
- if(debug) err_msg("DEBUG:=>putCloseMsg( )");
+ if(debug>1) err_msg("DEBUG:=>putCloseMsg( )");
putCloseMsg(timeOut,timeIn);
- if(debug) err_msg("DEBUG:<=putCloseMsg( )");
+ if(debug>1) err_msg("DEBUG:<=putCloseMsg( )");
}
void SetProcessTitle(char *useridshort, char *clientAddr4, char * ruleNumber4, char *clientAddr6, char * ruleNumber6, int ipStatus){
- if(debug) err_msg("DEBUG:=>setProcessTitle(%s,%s,%s,%s,%s,%d)",useridshort,
+ if(debug>1) err_msg("DEBUG:=>setProcessTitle(%s,%s,%s,%s,%s,%d)",useridshort,
clientAddr4,ruleNumber4,clientAddr6,ruleNumber6, ipStatus);
setProcessTitle(useridshort,clientAddr4,ruleNumber4,clientAddr6,ruleNumber6,ipStatus);
- if(debug) err_msg("DEBUG:<=setProcessTitle( )");
+ if(debug>1) err_msg("DEBUG:<=setProcessTitle( )");
}
/**************************************************
Opengate authentication CGI main
-This program is accessed as [http(s)://xx.yy/opengateauth.cgi?ja]
+This program is accessed as [http(s)://xx.yy/opengateauth.cgi?0-0-0&ja]
It send out the authentication page after keywords replacement.
Copyright (C) 2005 Opengate Project Team
/* initialize config */
InitConf();
- if(debug) err_msg("DEBUG: started");
+ if(debug>1) err_msg("DEBUG: started");
/* create URL string */
snprintf(authCgiUrl, BUFFMAXLN, "%s%s%s/%s",
paramString[0]='\0';
}
- /* split language and address */
+ /* split language and address in paramString[addr=0-0-0&lang=ja] */
pAddr4=paramString;
- pLang=strnstr(paramString, "&", BUFFMAXLN);
- if(pLang!=NULL){
- *pLang='\0';
- pLang++;
+ if((pLang=strnstr(paramString, "&", BUFFMAXLN))!=NULL){
+ *pLang='\0'; pLang++;
}
+ if(strnstr(pAddr4, "addr=", BUFFMAXLN)==pAddr4) pAddr4+=5;
+ if(strnstr(pLang, "lang=", BUFFMAXLN)==pLang) pLang+=5;
/* copy clientAddr(encoded) */
if(isNull(pAddr4)){
/* replace keywords and send out */
HtmlTemplate(htmlFile, keys);
- if(debug) err_msg("DEBUG: terminated");
+ if(debug>1) err_msg("DEBUG: terminated");
return 0;
}
/* initialize config */
InitConf();
- if(debug) err_msg("DEBUG: started");
+ if(debug>1) err_msg("DEBUG: started");
/* create authcgi URL string */
snprintf(authCgiUrl, BUFFMAXLN, "%s%s%s/%s",
/* relpace keywords and send out */
HtmlTemplate(htmlFile, keys);
- if(debug) err_msg("DEBUG: terminated");
+ if(debug>1) err_msg("DEBUG: terminated");
return 0;
}
#define CONFIGFILE "/etc/opengate/opengatesrv.conf"
-#define COMMWAITTIMEOUT 60 /* communication reply timeout(second) */
+#define COMMWAITTIMEOUT 30 /* communication reply timeout(second) */
#define PACKETLOGDELAY 10 /* wait log writing time(second) */
#define LOCKTIMEOUT 10 /* ipfw exclusive exec lock timeout (second) */
#define MAXFWDDELAY 300 /* max delay from fwd.cgi to auth.cgi (second) */
void PutClientDeny(char *clientAddr4);
void PutClientRetry(char *lang);
void PutClientMsg(char *message);
-void PutClientAccept(char *userid, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode);
+void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, char *watchMode);
-/* TCP communication with java applet */
+/* TCP communication with client */
void WaitJavaClose(struct clientAddr *pClientAddr, char *userid, char *userProperty, char *macAddr6, int ipStatus);
int GetListenPort(void);
-int WaitClientConnect(char *userid, char *userProperty, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port);
+int WaitClientConnect(char *userid, char *userProperty, char *sessionId, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port, int pid);
void WaitHttpClose(struct clientAddr *pClientAddr, char *userid, char *userProperty, char *macAddr6, int ipStatus);
/* utilities */
int Pclose(FILE *stream);
int isNull(const char *pStr);
char *GetServicePortStr(char *servName);
+void CreateSessionId(char *sessionId);
void ReFormatMacAddr(char* macAddr4, char* macAddr6);
void GetMacAddr(char *clientAddr4, char *macAddr4, char *clientAddr6, char *macAddr6, int ipStatus);
printf("===============================================\n\n");
/* connection wait */
- connMode=WaitClientConnect(userID, "", clientAddr4,clientAddr6,
- duration,"?","?",4,pClientAddr, language, port);
+ connMode=WaitClientConnect(userID, "", "999",clientAddr4,clientAddr6,
+ duration,"?","?",4,pClientAddr, language, port, 99);
switch(connMode){
case JAVACONNECT:
return;
}
-/**************************************************/
-/* Read one line */
-/* fd: file descriptor */
-/* vptr: input buffer pointer */
-/* maxlen: buffer length */
-/**************************************************/
+/****************************************************/
+/* Read one line */
+/* fd: file descriptor */
+/* vptr: input buffer pointer */
+/* maxlen: buffer length */
+/* return value is the count of readin chars */
+/* if error, return -1 */
+/* ## this function assumes two EOL chars [CR LF] */
+/****************************************************/
ssize_t
readln(int fd, void *vptr, size_t maxlen)
{
/* pre read */
rc = read(fd, &c, 1);
- if(rc <= 0) return rc;
-
- /* skip one control char, if exist */
- /* this is the second char of CR LF */
- /* the first char is read as the end of previous line */
- if(iscntrl(c)){
- rc = read(fd, &c, 1);
- if(rc <= 0) return rc;
- }
+ if(rc<=0) return(-1);
/* get char loop */
n=0;
while(n < maxlen-1) {
if ( rc == 1) { /* get some char */
- if (iscntrl(c))break; /* cntrl char means line end */
+ if (iscntrl(c)){ /* get control char (means EOL) */
+ rc = read(fd, &c, 1); /* skip second EOL char */
+ break;
+ }
*ptr++ = c;
n++;
}else if (rc == 0) { /* EOF */
break;
} else { /* ERR */
- if (errno != EINTR) return(-1);
+ return(-1);
}
rc = read(fd, &c, 1);
}
/* null terminate string */
*ptr++ = 0;
- n++;
return(n);
}
-
ssize_t
readlnSSL(SSL *fd, void *vptr, size_t maxlen)
{
ptr=vptr;
- /* skip pre ctrl char */
- while(1){
- rc = SSL_read(fd, &c, 1);
- if(rc <= 0) return rc;
- if(iscntrl(c)) continue;
- break; /* get some normal char */
- }
+ /* pre read */
+ rc = SSL_read(fd, &c, 1);
+ if(rc<=0) return(-1);
/* get char loop */
n=0;
while(n < maxlen-1) {
if ( rc == 1) { /* get some char */
- if (iscntrl(c))break; /* cntrl char means line end */
+ if (iscntrl(c)){ /* get control char (means EOL) */
+ rc = SSL_read(fd, &c, 1); /* skip second EOL char */
+ break;
+ }
*ptr++ = c;
n++;
}else if (rc == 0) { /* EOF */
break;
} else { /* ERR */
- if (errno != EINTR) return(-1);
+ return(-1);
}
rc = SSL_read(fd, &c, 1);
}
/* null terminate string */
*ptr++ = 0;
- n++;
return(n);
}
va_end(ap);
/* open the pipe to the program */
- if(debug) err_msg("DEBUG:=>popen(%s, %s)", commandLine, type);
+ if(debug>1) err_msg("DEBUG:=>popen(%s, %s)", commandLine, type);
file=popen(commandLine, type);
- if(debug) err_msg("DEBUG:(%x)<=popen( )",file);
+ if(debug>1) err_msg("DEBUG:(%x)<=popen( )",file);
return file;
}
va_end(ap);
/* execute shell */
- if(debug) err_msg("DEBUG:=>system(%s)", commandLine);
+ if(debug>1) err_msg("DEBUG:=>system(%s)", commandLine);
ret=system(commandLine);
- if(debug) err_msg("DEBUG:<=system()");
+ if(debug>1) err_msg("DEBUG:<=system()");
return ret;
}
return portStr;
}
+/*******************************************/
+/* create random session id */
+/* simple but might be overlapped */
+/* change logic, if you need identical id */
+/*******************************************/
+void createSessionId(char *sessionId)
+{
+ srandom(getpid()+time(NULL));
+ snprintf(sessionId, BUFFMAXLN, "%ld", random() );
+}
/****************************************/
/****************************************/
{
int ret;
- if(debug) err_msg("DEBUG:=>pclose( )");
+ if(debug>1) err_msg("DEBUG:=>pclose( )");
ret = pclose(stream);
- if(debug) err_msg("DEBUG:<=pclose( )");
+ if(debug>1) err_msg("DEBUG:<=pclose( )");
return ret;
}
{
char *ret;
- if(debug) err_msg("DEBUG:=>getServicePortStr(%s)", servName);
+ if(debug>1) err_msg("DEBUG:=>getServicePortStr(%s)", servName);
ret = getServicePortStr(servName);
- if(debug) err_msg("DEBUG:(%s)<=getServicePortStr( )", ret);
+ if(debug>1) err_msg("DEBUG:(%s)<=getServicePortStr( )", ret);
return ret;
}
{
ssize_t n;
- if(debug) err_msg("DEBUG:=>readln( )");
+ if(debug>1) err_msg("DEBUG:=>readln( )");
if ( (n = readln(fd, ptr, maxlen)) < 0){
err_msg("ERR at %s#%d: readln error",__FILE__,__LINE__);
}
- if(debug) err_msg("DEBUG:(%d)<=readln( )",n);
+ if(debug>1) err_msg("DEBUG:(%d)<=readln( )",n);
return(n);
}
{
int ret;
- if(debug) err_msg("DEBUG:=>lock( )");
+ if(debug>1) err_msg("DEBUG:=>lock( )");
ret=lock(fd);
- if(debug) err_msg("DEBUG:(%d)<=lock( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=lock( )",ret);
return ret;
}
{
int ret;
- if(debug) err_msg("DEBUG:=>unlock( )");
+ if(debug>1) err_msg("DEBUG:=>unlock( )");
ret=unlock(fd);
- if(debug) err_msg("DEBUG:(%d)<=unlock( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=unlock( )",ret);
return ret;
}
+void CreateSessionId(char *sessionId){
+ if(debug>1) err_msg("DEBUG:=>createSessionId( )");
+ createSessionId(sessionId);
+ if(debug>1) err_msg("DEBUG:<=createSessionId(%s)",sessionId);
+}
void SendTerminateReply(void);
void ReadHttpHeaders(void);
void SendReplyToGetHello(void);
-void SendHttpKeepPage(char *userid, char *language, int port);
+void SendHttpKeepPage(char *userid, char *sessionId, char *language, int port);
int SelectAccept(void);
void OnUsageTimeLimitAlarm(int signo);
extern char ruleNumber4[WORDMAXLN]; /* ipfw rule number in string form */
extern char ruleNumber6[WORDMAXLN]; /* ip6fw rule number in string form */
+extern char language[WORDMAXLN]; /* message language */
int ipType=IPV4; /* using IP type */
int listenfd[2]; /* file descriptor for listen port */
/************************************/
/* wait for connection of client side program */
/************************************/
-int waitClientConnect(char *userid, char *userProperty, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port)
+int waitClientConnect(char *userid, char *userProperty, char *sessionId, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port, int pid)
{
char buff[BUFFMAXLN]; /* read in buffer */
char connectAddr[ADDRMAXLN]; /* connected client address */
char httpStr[BUFFMAXLN]; /* HTTP GET string at terminate */
+ char useridAndSessionId[BUFFMAXLN]; /* comcat userid and sessionid */
/* set alarm function arguments */
alarmArg.pClientAddr=pClientAddr;
alarmArg.ipStatus=ipStatus;
alarmArg.checkInterval=atoi(GetConfValue("ActiveCheck/Interval"));
alarmArg.noPacketInterval=atoi(GetConfValue("ActiveCheck/NoPacketInterval"));
+
+ /* set no conection initially */
+ connectMode=NOCONNECT;
+
/* set the alarm for usage time limit */
AddAlarm("UsageTimeLimitAlarm",duration,FALSE,OnUsageTimeLimitAlarm);
/* set the alarm for periodic keep alive check */
AddAlarm("CheckBasicAlarm", alarmArg.checkInterval, FALSE, OnCheckBasicAlarm);
- /* start the alarms */
- EnableAlarm();
-
/* loop until accepting correct user */
- while(1){
+ while(connectMode == NOCONNECT){
- /* at termination, exit loop */
- if(connectMode == ENDCONNECT) break;
+ /* start alarms */
+ EnableAlarm();
/* connection wait */
connfd = SelectAccept();
- /* some abnormal connect */
- if(connfd < 0){
- if(connectMode==ENDCONNECT) break;
- else continue;
- }
+ /*at abnormal connect */
+ if(connfd < 0) continue;
- /* normal connection */
- /* stop alarm interupt between check exec */
+ /* at normal connection */
+ /* stop alarm interupt between checking */
DisableAlarm();
/* is it from the correct client addr */
if(ipType==IPV4 && ipStatus!=IPV6ONLY){
GetPeerAddr(connfd, connectAddr);
if(isNull(connectAddr)||strcmp(connectAddr, clientAddr4)!=0){
+ connectMode=NOCONNECT;
Close(connfd);
continue;
}
AddAlarm("ReadWaitAlarm",COMMWAITTIMEOUT, TRUE, OnReadWaitAlarm);
EnableAlarm();
/* get string from connection */
- if(readln(connfd, buff, BUFFMAXLN) <=0){
- /* if abnormal, exit */
- connectMode=ENDCONNECT;
- err_msg("ERR at %s#%d: abnormal readin ",
- __FILE__,__LINE__);
- break;
+ if(readln(connfd, buff, BUFFMAXLN) <0){
+ /* if abnormal, wait next request */
+ connectMode=NOCONNECT;
+ Close(connfd);
+ continue;
}
RemoveAlarm("ReadWaitAlarm");
-
/* is it the correct userid from java applet */
- if(strcmp(buff, userid)==0){
+ /* the request is [<userid>:<sessionId>] */
+ snprintf(useridAndSessionId, BUFFMAXLN, "%s-%s", userid,sessionId);
+ if(strcmp(buff, useridAndSessionId)==0){
+
+ /* enter to the Java watch mode on the connection */
connectMode=JAVACONNECT;
break;
}
/* is it the httpkeep page download request */
/* the request is [GET /httpkeep.html ....] */
- snprintf(httpStr, BUFFMAXLN, "GET /httpkeep-%s", userid);
+ snprintf(httpStr, BUFFMAXLN, "GET /httpkeep-%s-%s", userid,sessionId);
if(strstr(buff, httpStr)==buff){
/* page download request found */
/* read out the remained headers and send the page */
ReadHttpHeaders();
- SendHttpKeepPage(userid, language, port);
-
+ SendHttpKeepPage(userid, sessionId, language, port);
+
/* to check the ajax ablility of the client, wait ajax request */
AddAlarm("AjaxWaitAlarm",COMMWAITTIMEOUT, TRUE, OnAjaxWaitAlarm);
EnableAlarm();
/* read wait for ajax request in the connection */
- if(readln(connfd, buff, BUFFMAXLN) <=0){
- connectMode=ENDCONNECT; /* if abnormal or timeout, exit */
- err_msg("ERR at %s#%d: abnormal readin or timeout",
- __FILE__,__LINE__);
- break;
+ if(readln(connfd, buff, BUFFMAXLN) <0){
+ /* if timeout, no ajax ability */
+ connectMode=NOCONNECT;
+ Close(connfd);
+ continue;
}
+ /* recieve request */
RemoveAlarm("AjaxWaitAlarm");
ReadHttpHeaders();
+
+ /* enter to the Http watch mode on the connection */
connectMode=HTTPCONNECT;
break;
}
/* is it the terminate request */
- /* the request is [GET /terminate<pid> ....] */
- snprintf(httpStr, BUFFMAXLN, "GET /terminate%d", getpid());
+ /* the request is [GET /terminate-<pid> ..] */
+ snprintf(httpStr, BUFFMAXLN, "GET /terminate-%d", pid);
if(strstr(buff, httpStr)==buff){
/* terminate request found */
SendTerminateReply();
connectMode=ENDCONNECT;
+ Close(connfd);
break;
}
-
+
+ /* some other unknown request */
err_msg("ERR at %s#%d: unknown request [%s] sent from client",
__FILE__,__LINE__);
connectMode=NOCONNECT;
-
- /* wait new connection */
Close(connfd);
- EnableAlarm();
+ continue;
}
/* stop all alarms */
/* stop alarm */
DisableAlarm();
- if(ret>0){
+ if(ret>=0){
/* normal read */
connectMode=JAVACONNECT;
/* read quit, then quit */
/* at some request, stop alarm between readin check*/
DisableAlarm();
- if(ret>0){
+ if(ret>=0){
/* normal read */
connectMode=HTTPCONNECT;
else{
/*abnormal read */
/* some alarm is ringed or connecion is closed */
+ /* connectionMode might be modified in onAlarm */
if(connectMode==ENDCONNECT) break;
}
char buff[BUFFMAXLN]; /* read in buffer */
int n;
- /* read until null line (only CR code) */
- while((n=readln(connfd, buff, BUFFMAXLN))>1);
+ /* read until null line (only CRLF code) */
+ while((n=readln(connfd, buff, BUFFMAXLN))>0){
+ ;
+ }
}
/********************************************************/
/***************************************************/
/* send httpkeep page to client via connfd */
/***************************************************/
-void sendHttpKeepPage(char *userid, char *language, int port)
+void sendHttpKeepPage(char *userid, char *sessionId, char *language, int port)
{
char buff[BUFFMAXLN]; /* read in buffer */
FILE *fp;
char httpkeepJsUrl[BUFFMAXLN];
char *startPageUrl=GetConfValue("StartPage/Url");
int startPageType=atoi(GetConfValue("StartPage/Type"));
+ char opengateDir[BUFFMAXLN];
+ char portStr[WORDMAXLN];
+
/* create path to accept2 doc */
snprintf(acceptDoc2Url, BUFFMAXLN,
"http://%s%s/%s/%s",GetConfValue("OpengateServerName"),
GetConfValue("OpengateDir"),language,GetConfValue("AcceptDoc2"));
- /* create terminate url [http://<servaddr>:<port>/terminate<pid>] */
- snprintf(terminateUrl, BUFFMAXLN, "http://%s:%d/terminate%d",
+ /* create terminate url [http://<servaddr>:<port>/terminate-<pid>] */
+ snprintf(terminateUrl, BUFFMAXLN, "http://%s:%d/terminate-%d",
GetConfValue("OpengateServerName"), port, getpid());
- /* create httphello url [http://<servaddr>:<port>/hello-<userid>] */
- snprintf(httpHelloUrl, BUFFMAXLN, "http://%s:%d/hello-%s",
- GetConfValue("OpengateServerName"), port, userid);
+ /* create httphello url [http://<servaddr>:<port>/hello] */
+ snprintf(httpHelloUrl, BUFFMAXLN, "http://%s:%d/hello",
+ GetConfValue("OpengateServerName"), port);
/* create httphello interval [50] */
snprintf(httpHelloInterval, WORDMAXLN, "%s", GetConfValue("HttpHelloInterval"));
snprintf(httpKeepDoc,BUFFMAXLN, "%s%s/%s/%s",GetConfValue("DocumentRoot"),
GetConfValue("OpengateDir"),language,GetConfValue("HttpKeepDoc"));
+ /* create port string */
+ snprintf(portStr, WORDMAXLN, "%d", port);
+
+ /* create absolute url to opengateDir[http://<serveraddr>/opengate] */
+ snprintf(opengateDir, BUFFMAXLN, "http://%s%s",
+ GetConfValue("OpengateServerName"), GetConfValue("OpengateDir"));
+
/* open httpkeepdoc */
if((fp=fopen(httpKeepDoc, "r"))==NULL){
err_msg("ERR at %s#%d: cannot open %s",__FILE__,__LINE__,httpKeepDoc);
htmlReplace(buff, "%%HTTPHELLOINTERVAL%%", httpHelloInterval);
htmlReplace(buff, "%%HTTPHELLOURL%%", httpHelloUrl);
htmlReplace(buff, "%%USERID%%", userid);
+ htmlReplace(buff, "%%SESSIONID%%", sessionId);
htmlReplace(buff, "%%TERMINATEURL%%", terminateUrl);
htmlReplace(buff, "%%HTTPKEEPJSURL%%", httpkeepJsUrl);
+ htmlReplace(buff, "%%OPENGATEDIR%%", opengateDir);
+ htmlReplace(buff, "%%OPENGATEPORT%%", portStr);
+ htmlReplace(buff, "%%LANGUAGE%%", language);
+
/* replace start url mark */
if( startPageType==1 ){
htmlReplace(buff, "%%STARTURL%%", startPageUrl);
/***************************************************/
void GetPeerAddr(int sockfd, char *peerAddr)
{
- if(debug) err_msg("DEBUG:=>getPeerAddr( )");
+ if(debug>1) err_msg("DEBUG:=>getPeerAddr( )");
getPeerAddr(sockfd,peerAddr);
- if(debug) err_msg("DEBUG:<=getPeerAddr(,%s)",peerAddr);
+ if(debug>1) err_msg("DEBUG:<=getPeerAddr(,%s)",peerAddr);
}
{
int ret;
- if(debug) err_msg("DEBUG:=>getListenPort( )");
+ if(debug>1) err_msg("DEBUG:=>getListenPort( )");
ret=getListenPort();
- if(debug) err_msg("DEBUG:(%d)<=getListenPort( )",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=getListenPort( )",ret);
return ret;
}
-int WaitClientConnect(char *userid, char *userProperty, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port)
+int WaitClientConnect(char *userid, char *userProperty, char *sessionId, char *clientAddr4, char *clientAddr6, int duration, char *macAddr4, char *macAddr6, int ipStatus, struct clientAddr *pClientAddr, char *language, int port, int pid)
{
int ret;
- if(debug) err_msg("DEBUG:=>waitClientConnect(%s,%s,%s,%s,%d,%s,%s,%d,%s,%d)",userid,userProperty,clientAddr4,clientAddr6,duration,macAddr4,macAddr6,ipStatus,language,port);
- ret=waitClientConnect(userid,userProperty,clientAddr4,clientAddr6,duration,macAddr4,macAddr6,ipStatus,pClientAddr,language,port);
- if(debug) err_msg("DEBUG:(%d)<=waitClientConnect( )",ret);
+ if(debug>1) err_msg("DEBUG:=>waitClientConnect(%s,%s,%s,%s,%s,%d,%s,%s,%d,%s,%d,%d)",userid,userProperty,sessionId,clientAddr4,clientAddr6,duration,macAddr4,macAddr6,ipStatus,language,port,pid);
+ ret=waitClientConnect(userid,userProperty,sessionId,clientAddr4,clientAddr6,duration,macAddr4,macAddr6,ipStatus,pClientAddr,language,port,pid);
+ if(debug>1) err_msg("DEBUG:(%d)<=waitClientConnect( )",ret);
return ret;
}
void WaitJavaClose(struct clientAddr *pClientAddr, char *userid, char *userProperty, char *macAddr6, int ipStatus)
{
- if(debug) err_msg("DEBUG:=>waitJavaClose(%p,%s,%s,userProperty,%d)",pClientAddr,userid,macAddr6,ipStatus);
+ if(debug>1) err_msg("DEBUG:=>waitJavaClose(%p,%s,userProperty,%s,%d)",pClientAddr,userid,macAddr6,ipStatus);
waitJavaClose(pClientAddr,userid,userProperty,macAddr6,ipStatus);
- if(debug) err_msg("DEBUG:<=waitJavaClose( )");
+ if(debug>1) err_msg("DEBUG:<=waitJavaClose( )");
}
void SendQuitClient(void)
{
- if(debug) err_msg("DEBUG:=>sendQuitClient( )");
+ if(debug>1) err_msg("DEBUG:=>sendQuitClient( )");
sendQuitClient();
- if(debug) err_msg("DEBUG:<=sendQuitClient( )");
+ if(debug>1) err_msg("DEBUG:<=sendQuitClient( )");
}
void SendTerminateReply(void)
{
- if(debug) err_msg("DEBUG:=>sendTerminateReply( )");
+ if(debug>1) err_msg("DEBUG:=>sendTerminateReply( )");
sendTerminateReply();
- if(debug) err_msg("DEBUG:<=sendTerminateReply( )");
+ if(debug>1) err_msg("DEBUG:<=sendTerminateReply( )");
}
void WaitHttpClose(struct clientAddr *pClientAddr, char *userid, char *userProperty, char *macAddr6, int ipStatus)
{
- if(debug) err_msg("DEBUG:=>waitHttpClose(%p,%s,%s,userProperty,%d)",pClientAddr,userid,macAddr6,ipStatus);
+ if(debug>1) err_msg("DEBUG:=>waitHttpClose(%p,%s,userProperty,%s,%d)",pClientAddr,userid,macAddr6,ipStatus);
waitHttpClose(pClientAddr,userid,userProperty,macAddr6,ipStatus);
- if(debug) err_msg("DEBUG:<=waitHttpClose( )");
+ if(debug>1) err_msg("DEBUG:<=waitHttpClose( )");
}
void ReadHttpHeaders(void)
{
- if(debug) err_msg("DEBUG:=>readHttpHeaders( )");
+ if(debug>1) err_msg("DEBUG:=>readHttpHeaders( )");
readHttpHeaders();
- if(debug) err_msg("DEBUG:<=readHttpHeaders( )");
+ if(debug>1) err_msg("DEBUG:<=readHttpHeaders( )");
}
void SendReplyToGetHello(void)
{
- if(debug) err_msg("DEBUG:=>sendReplyToGetHello( )");
+ if(debug>1) err_msg("DEBUG:=>sendReplyToGetHello( )");
sendReplyToGetHello();
- if(debug) err_msg("DEBUG:<=sendReplyToGetHello( )");
+ if(debug>1) err_msg("DEBUG:<=sendReplyToGetHello( )");
}
-void SendHttpKeepPage(char *userid, char *language, int port)
+void SendHttpKeepPage(char *userid, char *sessionId, char *language, int port)
{
- if(debug) err_msg("DEBUG:=>sendHttpKeepPage(%s,%s,%d,%d)", userid, language, port);
- sendHttpKeepPage(userid, language, port);
- if(debug) err_msg("DEBUG:<=sendHttpKeepPage( )");
+ if(debug>1) err_msg("DEBUG:=>sendHttpKeepPage(%s,%s,%s,%d)", userid, sessionId, language, port);
+ sendHttpKeepPage(userid, sessionId, language, port);
+ if(debug>1) err_msg("DEBUG:<=sendHttpKeepPage( )");
}
void OnUsageTimeLimitAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onUsageTimeLimitAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onUsageTimeLimitAlarm()");
onUsageTimeLimitAlarm(signo);
- if(debug) err_msg("DEBUG:<=onUsageTimeLimitAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onUsageTimeLimitAlarm()");
}
void OnCheckBasicAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onCheckBasicAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onCheckBasicAlarm()");
onCheckBasicAlarm(signo);
- if(debug) err_msg("DEBUG:<=onCheckBasicAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onCheckBasicAlarm()");
}
void OnCheckJavaAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onCheckJavaAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onCheckJavaAlarm()");
onCheckJavaAlarm(signo);
- if(debug) err_msg("DEBUG:<=onCheckJavaAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onCheckJavaAlarm()");
}
void OnCheckHttpAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onCheckHttpAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onCheckHttpAlarm()");
onCheckHttpAlarm(signo);
- if(debug) err_msg("DEBUG:<=onCheckHttpAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onCheckHttpAlarm()");
}
void OnReadWaitAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onReadWaitAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onReadWaitAlarm()");
onReadWaitAlarm(signo);
- if(debug) err_msg("DEBUG:<=onReadWaitAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onReadWaitAlarm()");
}
void OnAjaxWaitAlarm(int signo){
- if(debug) err_msg("DEBUG:=>onAjaxWaitAlarm()");
+ if(debug>1) err_msg("DEBUG:=>onAjaxWaitAlarm()");
onAjaxWaitAlarm(signo);
- if(debug) err_msg("DEBUG:<=onAjaxWaitAlarm()");
+ if(debug>1) err_msg("DEBUG:<=onAjaxWaitAlarm()");
}
int SelectAccept(void){
int ret;
- if(debug) err_msg("DEBUG:=>selectAccept()");
+ if(debug>1) err_msg("DEBUG:=>selectAccept()");
ret=selectAccept();
- if(debug) err_msg("DEBUG:(%d)<=selectAccept()",ret);
+ if(debug>1) err_msg("DEBUG:(%d)<=selectAccept()",ret);
return ret;
}