OSDN Git Service

Ver.1.4.28: Fix error in PAM authentication.
authorwatanaby <>
Sat, 8 Mar 2008 09:16:50 +0000 (09:16 +0000)
committerwatanaby <>
Sat, 8 Mar 2008 09:16:50 +0000 (09:16 +0000)
opengate/doc/Changes.html
opengate/opengatesrv/auth-pam.c

index c1b6378..3a872f7 100644 (file)
@@ -618,6 +618,11 @@ Ver.1.4.27 at 2008.3.3</DT>
 <DD>\r
 Fix error in setting the default pam service name. Fix previous fix.\r
 </DD>\r
+<DT>\r
+Ver.1.4.28 at 2008.3.8</DT>\r
+<DD>\r
+Fix error in pam authentication.\r
+</DD>\r
 \r
 </DL>\r
 <b>Please see CVS in SourceForge.net to check the file difference between versions.</b>\r
index 0db4b7c..bebca02 100644 (file)
@@ -72,6 +72,12 @@ int authPam(char *userid, char *passwd)
   pamConv.conv=pamCallback;
   pamConv.appdata_ptr=&userInfo;
   
+  /* root privilege is needed to control PAM */
+  if(seteuid(0)!=0){
+    err_msg("ERR at %s#%d: cannot add root privilege ",
+           __FILE__,__LINE__);
+  } 
+
   /* PAM start */
   retval = pam_start(serviceName, userid, &pamConv, &pamh);
   
@@ -96,7 +102,12 @@ int authPam(char *userid, char *passwd)
     err_msg("ERR at %s#%d: failed to release authenticator",__FILE__,__LINE__);
   }
   
+  /* remove root privilege */
+  seteuid(getuid()); 
+
+  /* clear password */
   userInfo.password = NULL;
+
   return ( retval == PAM_SUCCESS ? ACCEPT:DENY );       /* indicate success */
 }