OSDN Git Service

Ver.1.5.13: Added shibboleth and httpbasic auth.
authorwatanaby <>
Thu, 29 Sep 2011 06:26:57 +0000 (06:26 +0000)
committerwatanaby <>
Thu, 29 Sep 2011 06:26:57 +0000 (06:26 +0000)
25 files changed:
opengate/conf/opengatesrv.conf.sample
opengate/doc/Changes.html
opengate/javahtml/en/accept-http.html
opengate/javahtml/en/accept-time.html
opengate/javahtml/en/accept2.html
opengate/javahtml/en/httpkeep.html
opengate/javahtml/en/retry.html
opengate/javahtml/en/topindex.html
opengate/javahtml/ja/accept-http.html
opengate/javahtml/ja/accept-time.html
opengate/javahtml/ja/accept2.html
opengate/javahtml/ja/deny.html
opengate/javahtml/ja/httpkeep.html
opengate/javahtml/ja/index-ssl.html
opengate/javahtml/ja/index.html
opengate/javahtml/ja/retry.html
opengate/javahtml/ja/skip-auth.html
opengate/javahtml/ja/topindex.html
opengate/opengatesrv/Makefile
opengate/opengatesrv/comm-auth.c
opengate/opengatesrv/comm-cgi.c
opengate/opengatesrv/get-param.c
opengate/opengatesrv/main.c
opengate/opengatesrv/opengateauth.c
opengate/opengatesrv/opengatesrv.h

index 5706158..ddb5da2 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Opengate ConfigVersion="1.5.0">
+<Opengate ConfigVersion="1.5.13">
 
 <!-- ################################################# 
      ####### NEED TO MODIFY FOLLOWING PARAMETERS #####  -->
             ## Authentication servers (can set multiple servers) ##
             ## REFER document at the end of this file            ## -->
 
-       <AuthServer>
-               <Protocol>pop3s</Protocol>
+        <AuthServer>
+                <Protocol>pop3s</Protocol>
                <Address>192.168.0.2</Address>
-       </AuthServer>
+        </AuthServer>
 
 <!-- ########################################################## 
      #### usually, need not to modify following parameters #### -->
        </AuthServer>
        #   The user is accepted or denied without inquiry.
        #   This setting is prepared for debugging.
+
+       #### TYPE 6 (Shibboleth) ####
+       <AuthServer>
+                <Protocol>shibboleth</Protocol>
+               <UidAttribute>-uid-env-var-</UidAttribute>
+        </AuthServer>
+
+       #   Auth by Shibboleth
+       #   Set 'opengatesrv.cgi/opengateauth.cgi' as SHIB-AUTH in .htaccess
+       #    <FILES opengateauth.cgi>
+       #      AuthType shibboleth
+       #      ShibRequestSetting requireSession 1
+       #      ShibRequireSession On
+       #      ShibUseHeaders On
+       #      require valid-user
+       #    </FILES>
+       #    <FILES opengatesrv.cgi>
+       #      AuthType shibboleth
+       #      ShibRequestSetting requireSession 1
+       #      ShibRequireSession On
+       #      ShibUseHeaders On
+       #      require valid-user
+       #    </FILES>
+       #   'UidAttiribute' means the environment variable for UserId
+
+       #### TYPE 7 (Http Basic) ####
+       <AuthServer>
+                <Protocol>httpbasic</Protocol>
+        </AuthServer>
+
+       #   Auth by http-basic
+       #   Set 'opengatesrv.cgi' as BASIC-AUTH in .htaccess
+       #    <FILES opengatesrv.cgi>
+       #      AuthType Basic
+       #      AuthUserFile /tmp/passwd.dat
+       #      AuthName "User"
+       #      require valid-user
+       #    </FILES>
+       #   environment variable REMOTE_USER is used for userid
 -->    
 
 <!--   ######## Examples of Auth Server Setting ##############
index f49b7bb..24ff663 100644 (file)
@@ -683,6 +683,10 @@ Opengate History</H3>
        Ver.1.5.12 at 2011.6.16
        </DT><DD>
         Fixed error on reconnecting [contributed by S.Horikawa]. 
+       </DD><DT>
+       Ver.1.5.13 at 2011.9.29
+       </DT><DD>
+        Added Shibboleth/HttpBasic authentication.
        </DD>
        </DL>
 <P>
index 8b3c63c..76561f4 100644 (file)
@@ -28,7 +28,7 @@ the network will be closed after <b>%%DURATION%% minutes</b>.</p>
 align=center bgColor=lightyellow border=1>
 <TR><TD>
 <p align=center><a href="%%STARTURL%%" target=_blank>
-<b>NEXT &gt;</b></a></p>
+<b>Portal Site &gt;</b></a></p>
 </TD></TR>
 </TABLE>
 
index 2b0a309..81d40f2 100644 (file)
@@ -18,7 +18,7 @@
 <TABLE cellSpacing=0 cellPadding=10 
 align=center bgColor=lightyellow border=1>
 <TR><TD>
-<p align=center><a href="%%STARTURL%%" target=_blank>NEXT &gt;</a></p>
+<p align=center><a href="%%STARTURL%%" target=_blank>Portal Site &gt;</a></p>
 </TD></TR>
 </TABLE>
 </p>
index 47a2c9b..68b553f 100644 (file)
@@ -1,37 +1,4 @@
-<HTML>
-<link rel="shortcut icon" href="/opengate/favicon.ico" type="image/x-icon">
-<link rel="icon" href="/opengate/favicon.ico" type="image/x-icon">
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
-<HEAD>
-<TITLE>Opengatemain</TITLE>
-</HEAD>
-<BODY>
-You are authenticated. You can use the network.
-<P>
-<P>
-Your authentication is valid until you quit your browser.
-Do not forget to close your WEB brower when you have finished using the network.
-</P>
-
-<HR>
-<P>Saga university related sites</P>
-<A HREF="http://www.saga-u.ac.jp/">Official Page</A>
-<A HREF="http://www.cc.saga-u.ac.jp/">Computer and Network Center</A>
-(<A HREF="http://webmailer.cc.saga-u.ac.jp/">WebMailer</A>)
-<A HREF="http://www.domino.lib.saga-u.ac.jp/">University Library</A>
-<A HREF="http://job.admin.saga-u.ac.jp/">Job Consultant</A>
-</P>
-<HR>
-<P>Search Engines and Potal sites</P>
-<a href="http://www.yahoo.co.jp/">Yahoo! Japan</a>
-<a href="http://www.google.com/">Google</a>
-<a href="http://www.excite.co.jp/">Exite Japan</a>
-<a href="http://www.goo.ne.jp/">Goo</a>
-<a href="http://www.infoseek.co.jp/">Infoseek</a>
-<a href="http://www.ocn.ne.jp/">OCN</a>
-<a href="http://www.msn.co.jp/">MSN</a>
-<a href="http://www.fresheye.com/">Fresheye</a>
-<a href="http://www.livedoor.com/">Livedoor</a>
-<a href="http://www.isize.com/">ISIZE</a>
-
-</BODY>
+<?php
+$RedirectURL = "Location: " . "https://www.cc.saga-u.ac.jp/redirect/";
+header("$RedirectURL");
+?>
index 5ddfc22..25ba0d9 100644 (file)
@@ -35,11 +35,11 @@ the network will be closed.<p>
 Click below button to create a new window for browsing.</p>
 
 <FORM onclick='window.open("%%STARTURL%%")'>
-<div align=center><INPUT TYPE="button" VALUE="     NEXT >    "></div>
+<div align=center><INPUT TYPE="button" VALUE="     Portal Site >    "></div>
 </FORM>
 
 <noscript>
-<p align=center><a href="%%STARTURL%%" target=_blank>NEXT&gt;</a></p>
+<p align=center><a href="%%STARTURL%%" target=_blank>Portal Site&gt;</a></p>
 </noscript>
 
 <P align=center>
index 654f770..8e81f35 100644 (file)
@@ -26,8 +26,8 @@ The authentication page is displayed automatically.</P>
 <P>If you do not need IPv4/IPv6 dual stack support, use one of the following links. This way, the system will only controls either IPv4 or IPv6.
 </P>
 <P>
-<a href="https://%%AUTHCGIURL%%?addr=0-0-0&lang=en">Network Authentication</a> 
-<a href="http://%%AUTHCGIURL%%?addr=0-0-0&lang=en">Network Authentication(Unuse SSL)</a>
+<a href="https://%%AUTHCGIURL%%?0-0-0&en">Network Authentication</a> 
+<a href="http://%%AUTHCGIURL%%?0-0-0&en">Network Authentication(Unuse SSL)</a>
 </P>
 </SMALL>
 </BODY>
index 398896e..2433047 100644 (file)
@@ -12,8 +12,8 @@ by Opengate.
 <P>
 If you cannot move to the page automatically, click the following.
 <P>
-<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>
+<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(SSL)</a><br>
+<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=en">Network Authentication(NonSSL)</a>
 <hr>
 Saga University
 </BODY>
index a46b028..497848a 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
@@ -27,7 +27,7 @@ location.replace(%%HTTPKEEPURL%%);
 align=center bgColor=lightyellow border=1>
 <TR><TD>
 <p align=center><a href="%%STARTURL%%" target=_blank>
-<b>次へ &gt;</b></a></p>
+<b>ポータルサイトの表示 &gt;</b></a></p>
 </TD></TR>
 </TABLE>
 
index 64a31c2..dccf99e 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
index e422155..75a7b0b 100644 (file)
@@ -1,37 +1,4 @@
-<HTML>
-<link rel="shortcut icon" href="/opengate/favicon.ico" type="image/x-icon">
-<link rel="icon" href="/opengate/favicon.ico" type="image/x-icon">
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
-<HEAD>
-<TITLE>Opengatemain</TITLE>
-</HEAD>
-<BODY>
-利用者認証が通りました。ネットワークを利用できます。
-<P>
-<P>
-Webブラウザが終了したときに、ネットワーク利用許可も自動的に取り消されます。悪用されないために、利用が終ったら必ずWebブラウザを終了してください。
-</P>
-
-<HR>
-<P>佐賀大学関係サイト</P>
-<A HREF="http://www.saga-u.ac.jp/">大学公式ページ</A>
-<A HREF="http://www.cc.saga-u.ac.jp/">総合情報基盤センターのページ</A>
-(<A HREF="http://webmailer.cc.saga-u.ac.jp/">ウェブメイラー</A>)
-<A HREF="http://www.lib.saga-u.ac.jp/">大学附属図書館のページ</A>
-<A HREF="http://job.admin.saga-u.ac.jp/">大学就職相談室のページ</A>
-<A HREF="http://www.sagadirect.net/index.php">SAGAダイレクト</A>
-</P>
-<HR>
-<P>検索エンジン&amp;ポータルサイト</P>
-<a href="http://www.yahoo.co.jp/">Yahoo! Japan</a>
-<a href="http://www.google.com/">Google</a>
-<a href="http://www.excite.co.jp/">Exite Japan</a>
-<a href="http://www.goo.ne.jp/">Goo</a>
-<a href="http://www.infoseek.co.jp/">Infoseek</a>
-<a href="http://www.ocn.ne.jp/">OCN</a>
-<a href="http://www.msn.co.jp/">MSN</a>
-<a href="http://www.fresheye.com/">Fresheye</a>
-<a href="http://www.livedoor.com/">Livedoor</a>
-<a href="http://www.isize.com/">ISIZE</a>
-
-</BODY>
+<?php
+$RedirectURL = "Location: " . "https://www.cc.saga-u.ac.jp/redirect/";
+header("$RedirectURL");
+?>
\ No newline at end of file
index 4835575..6743a5b 100644 (file)
@@ -1,4 +1,4 @@
-<HTML>
+<HTML>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
index ef60b57..81281cf 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="http://%%OPENGATESERVERNAME%%%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="http://%%OPENGATESERVERNAME%%%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <script type="text/JavaScript" src="%%MD5JSURL%%"></script>
 
 </head>
+<style TYPE="text/css">
+<!--
+.button {font-size:16pt;}
+-->
+</style>
 
 <body onunload="endHttpkeep();">
 
@@ -30,12 +35,12 @@ align=center bgColor=lightyellow border=1>
 このページを移動したり閉じたりすると、ネットワークが閉鎖されます。<p>
 
 <P align=center>
-Webの利用には下のボタンを押して表示される別ウインドウを使ってください。
+Webの利用には下のボタンを押して表示されるポータルサイトを使ってください。
 </p>
 
 
 <FORM onclick='window.open("%%STARTURL%%")'>
-  <div align=center><INPUT TYPE="button" VALUE="     次 へ >     "></div>
+<div align=center><INPUT TYPE="button" VALUE="ポータルサイトの表示" class="button"></div>
 </FORM>
 
 </p>
@@ -68,6 +73,7 @@ Webの利用には下のボタンを押して表示される別ウインドウ
 <p>上の2本の線の間に[Error!]が表示されたときは、別のページを利用してください。動作がおかしい時はブラウザを終了してから再試行してください。また認証画面の利用時間フィールドに値をいれると、その時間だけ使用することができます。
 </p>
 
+
 <script type="text/JavaScript">
 //<!--
   window.open("%%STARTURL%%","window1");
index a52eca1..e21671e 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
@@ -46,7 +46,7 @@
 <b>以下は、切断が頻発して利用継続できない場合に限って設定して下さい
 (推奨されません)。</b><br>
 必要とする利用継続時間: <input type="TEXT" size="4" name="duration" value="Auto">
-分(指定可能:1%%DURATIONMAX%%分)。
+分(指定可能:1%%DURATIONMAX%%分)。
 この時間が経過するまで、ネットワークをあなたの利用資格で開放しています。
 あなたが去った後で他人が不正利用すると、それに伴うトラブルに巻き込まれます。
 指定した時間より前に利用を終わるには、許可ページにある「利用中断」のリンクを
index 7672c50..7cacbd0 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
@@ -49,7 +49,7 @@ SSL対応認証</A></P>
 <b>以下は、切断が頻発して利用継続できない場合に限って設定して下さい
 (推奨されません)。</b><br>
 必要とする利用継続時間: <input type="TEXT" size="4" name="duration" value="Auto">
-分(指定可能:1%%DURATIONMAX%%分)。
+分(指定可能:1%%DURATIONMAX%%分)。
 この時間が経過するまで、ネットワークをあなたの利用資格で開放しています。
 あなたが去った後で他人が不正利用すると、それに伴うトラブルに巻き込まれます。
 指定した時間より前に利用を終わるには、許可ページにある「利用中断」のリンクを
index 98b8d9c..c45ce78 100644 (file)
@@ -1,4 +1,4 @@
-<HTML>
+<HTML>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
@@ -26,7 +26,7 @@
 以下のリンクも使用できますが、IPv4とIPv6のどちらか一方のみを制御します。
 </P>
 <P>
-<a href="https://%%AUTHCGIURL%%?addr=0-0-0&lang=ja">ネットワーク利用者認証</a> <a href="http://%%AUTHCGIURL%%?addr=0-0-0&lang=ja">ネットワーク利用者認証(SSL非対応)</a>
+<a href="https://%%AUTHCGIURL%%?0-0-0&ja">ネットワーク利用者認証</a> <a href="http://%%AUTHCGIURL%%?0-0-0&ja">ネットワーク利用者認証(SSL非対応)</a>
 </P>
 </SMALL>
 </BODY>
index 3f307a6..a85c068 100644 (file)
@@ -1,4 +1,4 @@
-<html>
+<html>
 <head>
 <link rel="shortcut icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 <link rel="icon" href="%%OPENGATEDIR%%/favicon.ico" type="image/x-icon">
 </HEAD>
 <BODY onload="document.form1.submit();">
 
-<P align=CENTER>
-ネットワークが閉鎖しました。再開放を確認します。<BR>
-自動移動できない方は下のボタンをクリックして下さい。
-</P>
-
 <TABLE align=CENTER>
 <TR><TD>
 <FORM NAME="form1" METHOD="POST" ACTION="%%PROTOCOL%%://%%CGIURL%%">
index 5c476cf..f5b24d2 100644 (file)
@@ -1,4 +1,4 @@
-<HTML>
+<HTML>
 <HEAD>
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
@@ -11,8 +11,8 @@ Opengateによる「ネットワーク利用者認証」のページへ自動移
 <P>
 自動移動できない方はこちらをクリックして下さい。
 <P>
-<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証</a><br>
-<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(SSL非対応)</a>
+<a href="https://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(SSL)</a><br>
+<a href="http://%%AUTHCGIURL%%?addr=%%ADDR4%%&lang=ja">ネットワーク利用者認証(NonSSL)</a><br>
 <HR>
 佐賀大学
 </BODY>
index 7e3d896..57d86a8 100644 (file)
@@ -73,6 +73,7 @@ ezxml:
 clean:
                rm -f ${MAINPROG} ${AUTHPROG} ${FWDPROG} ${TESTPROGS} ${CLEANFILES}
                ${MAKE} clean -C ../ezxml
+               rm -f ../*/*~  ../*~ ../*/*/*~
 
 install:       del-lockfile install-cgi install-html install-conf
 
index 75ac36e..c490b2b 100644 (file)
@@ -52,10 +52,6 @@ int authenticateUser(char *userid, char *passwd)
   int authResult;
   int timeout;
 
-  /* if no userid or no passwd, then deny */
-  //if(userid[0]=='\0')return DENY;
-  //if(passwd[0]=='\0')return DENY;
-
   /* authserver get timeout value */
   timeout=atoi(GetConfValue("AuthServer/Timeout"));
 
@@ -100,6 +96,16 @@ int authenticateUser(char *userid, char *passwd)
     /* authenticate by ftps-implicit */
     authResult=AuthFtpsi(userid, passwd);
 
+  }else if(strcmp(proto, "shibboleth")==0){
+    /* deny all request */
+    /* if shibboleth auth is accepted, cannot reach at this point */
+    authResult=DENY;
+
+  }else if(strcmp(proto, "httpbasic")==0){
+    /* deny all request */
+    /* if httpbasic auth is accepted, cannot reach at this point */
+    authResult=DENY;
+
   }else if(strcmp(proto, "deny")==0){
     /* deny all request */
     authResult=DENY;
index 7fcf2b9..041467c 100644 (file)
@@ -25,6 +25,7 @@ Email: watanaby@is.saga-u.ac.jp
 Programmed by Yoshiaki WATANABE
 Modified by Shin-ichi TADAKI
 Modified by Katsuhiko Eguchi
+Modified by Makoto Otani
 **************************************************/
 
 #include       "opengatesrv.h"
@@ -190,6 +191,39 @@ int getPostData(char *userid, char *password, char *clientAddr4, int *durationPt
 
 
 /********************************************/
+/* get userid from environment variable     */
+/********************************************/
+int getUserIdFromEnv(char *userid){
+
+  int ret=FALSE;
+
+  /* if shibboleth or httpbasic, get uid from environment var */
+  if(strcmp(GetConfValue("AuthServer/Protocol"), "shibboleth")==0){
+    if(!isNull(getenv(GetConfValue("AuthServer/UidAttribute")))){
+      strncpy(userid,getenv(GetConfValue("AuthServer/UidAttribute")),USERMAXLN);
+      ret=TRUE;
+    }else{
+      err_msg("ERR at %s#%d: Cannot get user info from shibboleth",__FILE__,__LINE__);
+      ret=FALSE;
+      PutClientMsg("Cannot get user info from shibboleth<br>Check shibboleth setting in .htaccess and other");
+      exit(0);
+    }    
+  }
+  else if(strcmp(GetConfValue("AuthServer/Protocol"), "httpbasic")==0){
+    if(!isNull(getenv("REMOTE_USER"))){
+      strncpy(userid,getenv("REMOTE_USER"),USERMAXLN);
+      ret=TRUE;
+    }else{
+      err_msg("ERR at %s#%d: Cannot get user info from httpbasic",__FILE__,__LINE__);
+      ret=FALSE;
+      PutClientMsg("Cannot get user info from http basic<br>Check http basic setting in .htaccess and other");
+      exit(0);
+    }
+  }
+  return ret;
+}
+
+/********************************************/
 /* get data related to cookie from client  */
 /********************************************/
 int getCookieData(char *userid, char *clientAddr4, int *duration, int *durationEntered, char *language)
@@ -615,6 +649,14 @@ int GetPostData(char *userid, char *password, char *clientAddr4, int *durationPt
   return ret;
 }
 
+int GetUserIdFromEnv(char *userid){
+  int ret;
+  if(debug>1) err_msg("DEBUG:=>getUserIdFromEnv(%s)",userid);
+  ret=getUserIdFromEnv(userid);
+  if(debug>1) err_msg("DEBUG:%d<=getUserIdFromEnv(%s)",ret,userid);
+  return ret;
+}
+
 void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, int durationEntered, char *language, char *cookie, int cookieAuth, char *redirectedUrl)
 {
   if(debug>1) err_msg("DEBUG:=>putClientAccept(%s,%s,%d,%d,%s,%s,%d,%d,%d,%s,%s,%d,%s)",userid,sessionId,port,pid,clientAddr4,clientAddr6,ipStatus, duration, durationEntered, language, cookie, cookieAuth, redirectedUrl);
index 3949a91..a821ac7 100644 (file)
@@ -28,7 +28,7 @@ Programmed by Yoshiaki WATANABE
 #include "opengatesrv.h"
 #include "../ezxml/ezxml.h"
 
-#define CONFIG_VERSION "1.5.0"
+#define CONFIG_VERSION "1.5.13"
 #define SEPARATOR "/"
 
 int debug=0;
@@ -345,7 +345,7 @@ char *getConfAuthServer(char *name)
 int selectNextAuthServer(void){
 
   ezxml_t xmlTmp; /* temporary variable */
-  
+
   /* first call (initialize) */
   /* xmlAuthPointer is the static variable to save authserver pointer */
   if(xmlAuthServer==NULL){
@@ -369,8 +369,18 @@ int selectNextAuthServer(void){
   }
 
   /* if not found return False */
-  if(xmlAuthServer==NULL) return FALSE;
-  else return TRUE;
+  if(xmlAuthServer==NULL){
+    return FALSE;
+  }else{
+    return TRUE;
+  }
+}
+
+/**********************************************
+reset pointer for auth server list
+**********************************************/
+void resetAuthServerPointer(void){
+  xmlAuthServer=NULL;
 }
 
 /***********************************************/
@@ -464,3 +474,8 @@ int RegExMatch(const char *inStr, const char *regEx){
   return ret;
 }
   
+void ResetAuthServerPointer(void){
+  if(debug>1) err_msg("DEBUG:=>resetAuthServerPointer( )");
+  resetAuthServerPointer();
+  if(debug>1) err_msg("DEBUG:<=resetAuthServerPointer( )");
+}
index 777a2b5..d15af59 100644 (file)
@@ -71,6 +71,7 @@ int  main(int argc, char **argv)
   int authResult=DENY;
   int authNum=1; /* present authserver number to check user */
   int cookieAuth=FALSE; /* Auth with HTTP-Cookie is passed */
+  int isUidInEnv=FALSE; /* userid is included in environment (shibb/basic) */
 
   /* drop root privilege */
   seteuid(getuid());
@@ -104,6 +105,9 @@ int  main(int argc, char **argv)
     return 0;
   }
 
+  /* get userid from environment var(available on shbboleth or httpbasic) */
+  isUidInEnv=GetUserIdFromEnv(userid);
+
   /* try to authentication with cookie data, */
   /* if cookie auth is enabled. */
   if( (*GetConfValue("EnableCookieAuth")!='0') ){
@@ -130,8 +134,9 @@ int  main(int argc, char **argv)
   GetMacAddr(clientAddr4, macAddr4, clientAddr6, macAddr6,ipStatus);
 
   /* check user by authenticate servers */
-  if(cookieAuth) authResult=ACCEPT;
+  if(cookieAuth||isUidInEnv) authResult=ACCEPT;
   else{
+    ResetAuthServerPointer();
     while(SelectNextAuthServer()){
 
       /* authenticate the user with authentication servers */
index d00a143..e9ecce4 100644 (file)
@@ -50,6 +50,7 @@ int  main(int argc, char **argv)
   char *value[1];
   char *next[1];
   char *ptr;
+  char *authProtocol;
 
   /* keyword pairs */
   /*  the left key is replaced by the right value */
@@ -148,11 +149,13 @@ int  main(int argc, char **argv)
   sprintf(htmlFile, "%s%s/%s/", GetConfValue("DocumentRoot"),
          opengateDir, lang);
 
-  /*** if http-cookie for opengate authentication exist */
-  /* and cookie auth is enabled, */
+  /*** if http-cookie exists or auth by shibboleth/httpbasic */
   /* skip authenticaion */
-  if( (*GetConfValue("EnableCookieAuth")!='0')
-     && GetAuthCookie(cookie,userid)){
+  authProtocol=GetConfValue("AuthServer/Protocol");
+  if(((*GetConfValue("EnableCookieAuth")!='0') && GetAuthCookie(cookie,userid))
+     || strcmp(authProtocol, "shibboleth")==0 
+     || strcmp(authProtocol, "httpbasic")==0 ){
+
     strncat(htmlFile, GetConfValue("SkipAuthDoc"), BUFFMAXLN);
 
     /* ssl or non-ssl protocol  */
index a3fe745..4e87aa1 100644 (file)
@@ -151,6 +151,7 @@ void PutClientRetry(char *lang);
 void PutClientMsg(char *message);
 void PutClientAccept(char *userid, char *sessionId, int port, int pid, char *clientAddr4, char *clientAddr6, int ipStatus, int duration, int durationEntered, char *language, char *cookie, int cookieAuth, char *redirectedUrl);
 void split(char content[], char *name[], char *value[], char *next[]);
+int GetUserIdFromEnv(char *userid);
 
 /* db interface*/
 int PutSessionBeginToDb(char* cookie, char* userid, 
@@ -214,11 +215,12 @@ void * Malloc(size_t size);
 int AddrEncode(char encodeAddr[], char dotSepAddr[]);
 int AddrDecode(char dotSepAddr[], char encodeAddr[]);
 
-/* replace keywords in html document */
+/* htmltemplate.c */
 int HtmlTemplate(char* filename,struct html_key* key);
 int htmlReplace(char* buff,char *before,char *after);
 char* strSplit(char* str,const char* delimStr);
 
+/* get-param.c */
 int OpenConfFile(void);
 void CloseConfFile(void);
 void SetupConfExtra(char *userId, char *extraId);
@@ -226,7 +228,9 @@ char *GetConfValue(char *name);
 int SelectNextAuthServer(void);
 void  InitConf();
 int RegExMatch(const char *inStr, const char *regEx);
+void ResetAuthServerPointer(void);
 
+/* ctrl-alarms.c */
 int AddAlarm(char *name, int timeout, int preceding, Sigfunc *func);
 int RemoveAlarm(char *name);
 int EnableAlarm(void);