<!-- SQLite busy timeout (milli-seconds) -->
<SqliteBusyTimeout>100</SqliteBusyTimeout>
- <!-- Save Log of session to Management DB (1:YES/0:NO) -->
- <SaveLogToMngDb>1</SaveLogToMngDb>
-
<!-- SQLite database file -->
<!-- for opengatemd work -->
<SqliteDbMd>/tmp/opengatemd.db</SqliteDbMd>
<Device>fxp0</Device>
<!-- ### MUST BE MODIFIED ## -->
- <!-- auth server setting for administrators(watanaby,admin1,admin2) -->
+ <!-- auth server setting for Aadministrators(user1 user2) -->
<AuthServer>
<UserType>admin</UserType>
<Protocol>pop3s</Protocol>
<Address>192.168.0.2</Address>
- <AcceptUsers>watanaby admin1 admin2</AcceptUsers>
+ <MailDomain>opengate.example.com</MailDomain>
+ <AcceptUsers>user1 user2</AcceptUsers>
</AuthServer>
<!-- ### MUST BE MODIFIED ## -->
- <!-- auth server setting for normal(not admin) users -->
+ <!-- auth server setting for Normal(not admin) users -->
<AuthServer>
<Protocol>shibboleth</Protocol>
<UidAttribute>uid</UidAttribute>
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title></title>
+</head>
+<body bgcolor="#EEFFEE">
+<center>
+
+<h2>Management of MAC Address Registration</h2>
+
+<p><a href="%%CGINAME%%?lang=ja&redirectedurl=%%REDIRECTEDURL%%">Japanese Page</a></p>
+
+<P><font size=+1>This is the page to manage MAC address of your
+terminals. If you register this terminal, you can use the network
+without password entry.</font></P>
+
+<P><font size=+1>To proceed, you are requested to be authenticated.
+</font></P>
+
+<P><font size=+1>You will be authenticated with your user ID and
+password. If you do not know your user ID and/or password, please consult CNC.
+</font></P>
+
+<P>
+Please enter <font color=red>Administrator's user ID and password</font> in the box below, then press SEND.
+</P>
+
+<p><font color="red">
+%%ERRORLIST%%
+</font></p>
+
+<P>
+<form method="POST" action="%%CGINAME%%?lang=en&redirectedurl=%%REDIRECTEDURL%%">
+<INPUT TYPE="HIDDEN" NAME="redirected_url" VALUE="%%REDIRECTEDURL%%">
+
+<TABLE BORDER=0>
+<TR NOWRAP>
+<TD><strong>Administrator's User ID: </strong></TD><TD><INPUT TYPE="TEXT" SIZE=20 NAME="userid"></TD>
+</TR><TR NOWRAP>
+<TD><strong>Password: </strong></TD><TD><INPUT TYPE="PASSWORD" SIZE=20 NAME="password"></TD>
+</TR><TR NOWRAP>
+<TD></TD><TD><INPUT TYPE="SUBMIT" VALUE=" SEND "></TD>
+</TR>
+</TABLE>
+</form>
+</P>
+
+<p><font size=+1>If you have any questions,
+please contact network administrator.
+</center>
+
+<div align=right>Saga University</div>
+</body>
+</html>
+
try network access to confirm that the network for the terminal is closed.
</p></li>
<li><p>
- Load this page. If you already loaded, reload it.
+ Reload this page.
</p></li>
<li><p>
The above is the list of addresses using this access point recently.
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title></title>
+</head>
+<body bgcolor="#EEFFEE">
+<center>
+
+<h2>利用者端末MACアドレス登録管理</h2>
+
+<p><a href="%%CGINAME%%?lang=en&redirectedurl=%%REDIRECTEDURL%%">English Page</a></p>
+
+
+<P><font size=+1>ここは利用者端末のMACアドレスを登録管理するページです。
+端末を登録するとパスワード入力なしでネットワークを利用できます。
+</font></P>
+
+<P><font size=+1>登録管理に進むために利用資格の確認を行ってください。</font></P>
+
+<P><font size=+1>利用資格の確認には、ユーザ名とパスワードが必要です。自分のユーザ名やパスワードが解らない場合は、総合情報基盤センターに尋ねてください。</font></P>
+
+<P>
+下の入力欄に、<font color=red>管理担当者のユーザIDとパスワード</font>を入力して、「送信」ボタンを押して下さい。
+</P>
+
+
+<p><font color="red">
+%%ERRORLIST%%
+</font></p>
+
+<P>
+<form method="POST" action="%%CGINAME%%?lang=ja&redirectedurl=%%REDIRECTEDURL%%">
+<INPUT TYPE="HIDDEN" NAME="redirected_url" VALUE="%%REDIRECTEDURL%%">
+
+<TABLE BORDER=0>
+<TR NOWRAP>
+ <TD><strong>管理ユーザID:</strong></TD><TD><INPUT TYPE="TEXT" SIZE=20 NAME="userid"></TD>
+</TR><TR NOWRAP>
+<TD><strong>パスワード:</strong></TD><TD><INPUT TYPE="PASSWORD" SIZE=20 NAME="password"></TD>
+</TR><TR NOWRAP>
+<TD></TD><TD><INPUT TYPE="SUBMIT" VALUE=" 送 信 "></TD>
+</TR>
+</TABLE>
+</form>
+</P>
+<p>
+<font size=+1>不明な点などがありましたら、ネットワーク管理者にお尋ねく
+ださい。</font></p>
+</center>
+
+
+<div align=right>佐賀大学</div>
+
+</body>
+</html>
登録を希望する端末で、この端末と同じアクセスポイントに接続して、ネットワークアクセスを試み、ネットワークが閉鎖していることを確認する。
</p></li>
<li><p>
- このページを表示する。確認前に表示しているときはリロードを行う。
+ このページをリロードする。
</p></li>
<li><p>
上記の表は、同一アクセスポイントを最近利用した端末のアドレス一覧である。リストの先頭が最も最近に検出した端末である。
#include <mysql.h>
static MYSQL mysql;
-static int saveLogToMngDb=0;
+static int isSessionTableFoundInMngDb=TRUE;
/******************************************
initialize management db
char *password = GetConfValue("MySqlDb/Password");
char *database = GetConfValue("MySqlDb/Database");
my_bool reconnect;
- char *confStr;
/* initialize mysql */
mysql_library_init(-1,NULL,NULL);
reconnect = TRUE;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
- /* read logmode flag from conf file and hold in a variable */
- confStr = GetConfValue("SaveLogToMngDb");
- if(isNull(confStr)) saveLogToMngDb = 0; /* no conf means no-log */
- else saveLogToMngDb = strtol(confStr, NULL, 2);
-
- /* adjust relation of logmode in conf and logtable in mngdb */
- AdjustLogModeAndLogTable();
+ /* check existence of session table in management db(not work db) */
+ /* if it is FALSE, writing/reading log is skipped */
+ isSessionTableFoundInMngDb = IsTableFoundInMngDb("sessionmd");
return TRUE;
}
char queryStr[BUFFMAXLN];
struct utsname uts;
- /* if session log table is not used, return */
- if(!saveLogToMngDb) return FALSE;
+ /* if session log table is not found, return */
+ if(!isSessionTableFoundInMngDb) return FALSE;
/* get domain name */
uname(&uts);
char queryStr[BUFFMAXLN];
- /* if session log table is not used, return */
- if(!saveLogToMngDb) return FALSE;
+ /* if session log table is not found, return */
+ if(!isSessionTableFoundInMngDb) return FALSE;
/* prepare query string */
snprintf(queryStr, BUFFMAXLN,
char* queryStr="delete from sessionmd where closeTime>0 and closeTime<adddate(now(),interval -1 month)";
- /* if session log table is not used, return */
- if(!saveLogToMngDb) return FALSE;
+ /* if session log table is not found, return */
+ if(!isSessionTableFoundInMngDb) return FALSE;
/* send SQL query */
if (mysql_query(&mysql, queryStr)){
return found;
}
-/******************************************
-set closeTime to unclosed sessions in mngdb
-return value: 1=success, 0=error
-******************************************/
-int updateCloseTimeToUnclosedSessionInMngDb(void){
-
- char* queryStr="update sessionmd set closeTime=now() where closeTime=0";
-
- /* send SQL query */
- if (mysql_query(&mysql, queryStr)){
- err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
- mysql_error(&mysql));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**********************************************************
-adjust the relation of logmode(SaveLogToMngDb) in conf file
-and logtable(sessionmd) in management db
-***********************************************************/
-void adjustLogModeAndLogTable(void){
-
- /* check the existence of table sessionmd in management.db */
- int isSessionTableFoundInMngDb = IsTableFoundInMngDb("sessionmd");
-
- /* if logmode=off and session table exists, cleanup all sessions */
- if(!saveLogToMngDb && isSessionTableFoundInMngDb){
- UpdateCloseTimeToUnclosedSessionInMngDb();
- }
-
- /* if logmode=on and session table does not exist, write error */
- if(saveLogToMngDb && !isSessionTableFoundInMngDb){
- err_msg("ERR at %s#%d: please create mysql table. sample script is found in archive",
- __FILE__,__LINE__);
- }
-}
-
/********************************************
routines for debugging
return ret;
}
-int UpdateCloseTimeToUnclosedSessionInMngDb(void){
- int ret;
- if(debug>1) err_msg("DEBUG:=>updateCloseTimeToUnclosedSessionInMngDb()");
- ret = updateCloseTimeToUnclosedSessionInMngDb();
- if(debug>1) err_msg("DEBUG:(%d)<=updateCloseTimeToUnclosedSessionInMngDb()", ret);
- return ret;
-}
-
-void AdjustLogModeAndLogTable(void){
- if(debug>1) err_msg("DEBUG:=>adjustLogModeAndLogTable()");
- adjustLogModeAndLogTable();
- if(debug>1) err_msg("DEBUG:<=adjustLogModeAndLogTable()");
-}
int IsAllFoundInWatchlistTable(void);
int DelOldSessionLogInMngDb(void);
int IsTableFoundInMngDb(char* table);
-int UpdateCloseTimeToUnclosedSessionInMngDb(void);
-void AdjustLogModeAndLogTable(void);
/* workdb.c */
int SetupSqliteBusyTimeoutValue(void);
/* if all check is failed, put error */
if(authResult==DENY){
- SetMessage(NoInfoInDb);
+ SetMessage(NoInfoInDb);
+ if(userType==ADMINUSER) SetMessage(RequestAdminAuth);
PutDenyToClient(language);
err_msg("DENY: user %s", useridfull);
}
/* set default values */
macAddr[0]=deviceName[0]=openTime[0]=gatewayName[0]='\0';
- /* if do not get result yet */
+ /* if session table is not found in management db, return */
+ if(!IsTableFoundInMngDb("sessionmd")) return FALSE;
+
+ /* if do not get result yet (if first call) */
if(res==NULL){
/* prepare query string */
if (mysql_query(&mysql, queryStr)){
/* query error */
- /* might be caused by <SaveLogToMngDb> setting in opengatemd.conf */
+ err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
+ mysql_error(&mysql));
return FALSE;
}
return exists;
}
+/******************************************
+is found table in management db
+input=table name
+return value: 1=found,0=not found or error
+******************************************/
+int isTableFoundInMngDb(char* table){
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ int found=FALSE;
+ char queryStr[BUFFMAXLN];
+
+ /* if no table, return false */
+ if(isNull(table)) return FALSE;
+
+ /* prepare query string */
+ snprintf(queryStr, BUFFMAXLN,
+ "show tables like '%s'", table);
+
+ /* send SQL query */
+ if (mysql_query(&mysql, queryStr)){
+ err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
+ mysql_error(&mysql));
+ return ERROR;
+ }
+ res = mysql_use_result(&mysql);
+
+ /* output table row */
+ row = mysql_fetch_row(res);
+
+ /* row==NULL means getting no record */
+ if(row==NULL) found=FALSE;
+ else found=TRUE;
+
+ mysql_free_result(res);
+ return found;
+}
+
+
/********************************************
routines for debugging output
********************************************/
if(debug>1) err_msg("DEBUG:(%d)<=doesMacAddrBelongToUser( )",ret);
return ret;
}
+
+int IsTableFoundInMngDb(char* table){
+ int ret;
+ if(debug>1) err_msg("DEBUG:=>isTableFoundInMngDb(%s)", table);
+ ret = isTableFoundInMngDb(table);
+ if(debug>1) err_msg("DEBUG:(%d)<=isTableFoundInMngDb()", ret);
+ return ret;
+}
+
int RegOrUpNobodyMacAddr(char* macAddress);
int IsMacAddrStatusInactiveInMngDb(char* macAddress);
int DoesMacAddrBelongToUser(char* macAddr, char* userId, char* extraId);
+int IsTableFoundInMngDb(char* table);
/* workdb.c */
int SetupSqliteBusyTimeoutValue(void);