OSDN Git Service

Ver1.5.28 Changed to deny duplicated open, added udp send and ohters.
[opengate/opengate.git] / opengate / opengatesrv / comm-cgi.c
index 52f5546..2fc16bb 100644 (file)
@@ -201,20 +201,31 @@ int getUserIdFromEnv(char *userid){
   /* if shibboleth or httpbasic, get uid from environment var */
   /* shibboleth */
   if(strcmp(GetConfValue("AuthServer/Protocol"), "shibboleth")==0){
-    pEnv=getenvEx(GetConfValue("AuthServer/UidAttribute"));
+    pEnv=getenvEx(GetConfValue("AuthServer/UidAttribute"),TRUE,TRUE);
     if(!isNull(pEnv)){
       strncpy(userid, pEnv, USERMAXLN);
 
-      /* if idp string can be get from env variable, concatinate it as uid@idp */
-      pEnv=getenvEx(GetConfValue("AuthServer/OrgAttribute"));
+      /* if idp string can be get from env variable, concatinate it as uid@org */
+      pEnv=getenvEx(GetConfValue("AuthServer/OrgAttribute"),TRUE,TRUE);
       if(!isNull(pEnv)){
        strncat(userid, GetConfValue("UserIdSeparator"), USERMAXLN);
        strncat(userid, pEnv, USERMAXLN);
       } 
       ret=TRUE;
-    }else{
+    }
+
+    /* get from env-variable for EPPN(edu person principal name) attribute */
+    else{
+      pEnv=getenvEx(GetConfValue("AuthServer/EppnAttribute"),TRUE,FALSE);
+      if(!isNull(pEnv)){
+       strncat(userid, pEnv, USERMAXLN);
+       ret=TRUE;
+      }
+    }
+
+    /* no env-variable is found */
+    if(ret==FALSE){
       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);
     }