(file) Return to LocalAuth.c CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Executor

Diff for /pegasus/src/Executor/LocalAuth.c between version 1.1.2.5 and 1.2

version 1.1.2.5, 2007/01/17 18:48:53 version 1.2, 2007/05/25 18:35:07
Line 45 
Line 45 
 #include "Strlcat.h" #include "Strlcat.h"
 #include "User.h" #include "User.h"
 #include "Random.h" #include "Random.h"
 #include "SessionKey.h"  
 #include "Log.h" #include "Log.h"
 #include "User.h" #include "User.h"
  
Line 149 
Line 148 
     if (GetUserInfo(user, &uid, &gid) != 0)     if (GetUserInfo(user, &uid, &gid) != 0)
     {     {
         close(fd);         close(fd);
           unlink(path);
         return -1;         return -1;
     }     }
  
     if (fchown(fd, uid, gid) != 0)     if (fchown(fd, uid, gid) != 0)
     {     {
         close(fd);         close(fd);
           unlink(path);
         return -1;         return -1;
     }     }
  
Line 204 
Line 205 
     }     }
  
     /* Okay! */     /* Okay! */
       close(fd);
     return 0;     return 0;
 } }
  
 /* /*
 **============================================================================== **==============================================================================
 ** **
 ** _destructor()  
 **  
 **     Destructor for session key data.  
 **  
 **==============================================================================  
 */  
   
 static void _destructor(long data)  
 {  
     if (!data)  
         return;  
   
     unlink((char*)data);  
     free((char*)data);  
 }  
   
 /*  
 **==============================================================================  
 **  
 ** StartLocalAuthentication() ** StartLocalAuthentication()
 ** **
 **     Initiate first phase of local authentication. **     Initiate first phase of local authentication.
Line 238 
Line 221 
  
 int StartLocalAuthentication( int StartLocalAuthentication(
     const char* user,     const char* user,
     char path[EXECUTOR_BUFFER_SIZE],      char challenge[EXECUTOR_BUFFER_SIZE])
     SessionKey* key)  
 { {
     /* Get uid: */     /* Get uid: */
  
Line 251 
Line 233 
  
     /* Create the local authentication file. */     /* Create the local authentication file. */
  
     if (CreateLocalAuthFile(user, path) != 0)      if (CreateLocalAuthFile(user, challenge) != 0)
     {  
         return -1;         return -1;
     }  
   
     /* Create the session key (associated with path). */  
   
     *key = NewSessionKey(uid, (long)strdup(path), _destructor, 0);  
  
     return 0;     return 0;
 } }
Line 268 
Line 244 
 ** **
 ** FinishLocalAuthentication() ** FinishLocalAuthentication()
 ** **
 **     Initiate second and last phase of local authentication.  **     Initiate second and last phase of local authentication. Else return
   **     negative one.
 ** **
 **============================================================================== **==============================================================================
 */ */
  
 int FinishLocalAuthentication( int FinishLocalAuthentication(
     const SessionKey* key,      const char* challenge,
     const char* token)      const char* response)
 { {
     long data = 0;  
   
     /* Get session key data (the path). */  
   
     if (GetSessionKeyData(key, &data) != 0)  
         return -1;  
   
     /* Check token against the one in the file. */     /* Check token against the one in the file. */
  
     if (CheckLocalAuthToken((const char*)data, token) != 0)      int rc = CheckLocalAuthToken(challenge, response);
     {  
         DeleteSessionKey(key);  
         return -1;  
     }  
   
     /* Delete session key data. */  
   
     if (DeleteSessionKeyData(key) != 0)  
         return -1;  
   
     /* Set authentication flag. */  
  
     if (SetSessionKeyAuthenticated(key) != 0)      if (challenge)
         return -1;          unlink((char*)challenge);
  
     return 0;      return rc;
 } }


Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2