(file) Return to SecureLocalAuthenticator.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Security / Authentication

Diff for /pegasus/src/Pegasus/Security/Authentication/SecureLocalAuthenticator.cpp between version 1.12 and 1.12.2.2

version 1.12, 2007/03/02 19:00:44 version 1.12.2.2, 2007/03/30 00:35:04
Line 34 
Line 34 
  
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
   #include <Pegasus/Common/Executor.h>
   #include <Executor/Strlcpy.h>
  
 #include "LocalAuthFile.h" #include "LocalAuthFile.h"
 #include "SecureLocalAuthenticator.h" #include "SecureLocalAuthenticator.h"
Line 72 
Line 74 
 // //
 // Does local authentication // Does local authentication
 // //
 Boolean SecureLocalAuthenticator::authenticate  Boolean SecureLocalAuthenticator::authenticate(
 (  
    const String& filePath,    const String& filePath,
    const String& secretReceived,    const String& secretReceived,
    const String& secretKept     const String& secretKept)
 )  
 { {
     PEG_METHOD_ENTER(TRC_AUTHENTICATION,     PEG_METHOD_ENTER(TRC_AUTHENTICATION,
         "SecureLocalAuthenticator::authenticate()");         "SecureLocalAuthenticator::authenticate()");
  
     Boolean authenticated = false;     Boolean authenticated = false;
  
       // Use executor, if present.
   
       if (Executor::detectExecutor() == 0)
       {
           if (Executor::authenticateLocal(
               (const char*)secretKept.getCString(),
               (const char*)secretReceived.getCString()) == 0)
           {
               authenticated = true;
           }
       }
       else
       {
           // Check secret.
  
     if ((!String::equal(secretReceived, String::EMPTY)) &&     if ((!String::equal(secretReceived, String::EMPTY)) &&
         (!String::equal(secretKept, String::EMPTY)))         (!String::equal(secretKept, String::EMPTY)))
Line 94 
Line 108 
         }         }
     }     }
  
     //          // Remove the auth file created for this user request
     // remove the auth file created for this user request  
     //  
     if (filePath.size())     if (filePath.size())
     {     {
         if (FileSystem::exists(filePath))         if (FileSystem::exists(filePath))
Line 104 
Line 117 
             FileSystem::removeFile(filePath);             FileSystem::removeFile(filePath);
         }         }
     }     }
       }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
  
     return (authenticated);      return authenticated;
 } }
  
   
 Boolean SecureLocalAuthenticator::validateUser (const String& userName) Boolean SecureLocalAuthenticator::validateUser (const String& userName)
 { {
     PEG_METHOD_ENTER(TRC_AUTHENTICATION,     PEG_METHOD_ENTER(TRC_AUTHENTICATION,
Line 142 
Line 155 
     responseHeader.append(authType);     responseHeader.append(authType);
     responseHeader.append(" \"");     responseHeader.append(" \"");
  
     //      // Use executor, if present.
   
       if (Executor::detectExecutor() == 0)
       {
           char challenge[EXECUTOR_BUFFER_SIZE];
   
           if (Executor::challengeLocal(userName.getCString(), challenge) != 0)
           {
               throw CannotOpenFile(challenge);
           }
           secret = challenge;
   
           responseHeader.append(challenge);
           responseHeader.append("\"");
       }
       else
       {
     // create a file using user name and write a random number in it.     // create a file using user name and write a random number in it.
     //  
     LocalAuthFile localAuthFile(userName);     LocalAuthFile localAuthFile(userName);
     String filePath  = localAuthFile.create();     String filePath  = localAuthFile.create();
  
Line 153 
Line 181 
     //     //
     secret = localAuthFile.getSecretString();     secret = localAuthFile.getSecretString();
  
     //  
     // build response header with file path and challenge string.     // build response header with file path and challenge string.
     //  
     responseHeader.append(filePath);     responseHeader.append(filePath);
     responseHeader.append("\"");     responseHeader.append("\"");
       }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
  
     return (responseHeader);      return responseHeader;
 } }
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2