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

Diff for /pegasus/src/Pegasus/Security/UserManager/PasswordFile.cpp between version 1.26 and 1.27

version 1.26, 2007/04/03 18:50:58 version 1.27, 2007/05/25 18:35:19
Line 38 
Line 38 
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
   #include <Pegasus/Common/Executor.h>
 #if defined(PEGASUS_OS_OS400) #if defined(PEGASUS_OS_OS400)
 #include "OS400ConvertChar.h" #include "OS400ConvertChar.h"
 #endif #endif
Line 127 
Line 128 
     {     {
         if (FileSystem::exists(_passwordFile))         if (FileSystem::exists(_passwordFile))
         {         {
             if (! FileSystem::removeFile(_passwordFile))              if (Executor::removeFile(_passwordFile.getCString()) != 0)
             {             {
                 throw CannotRemoveFile(_passwordFile);                 throw CannotRemoveFile(_passwordFile);
             }             }
Line 138 
Line 139 
         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
             "Security.UserManager.PasswordFile.TRYING_TO_BACKUP_FILE",             "Security.UserManager.PasswordFile.TRYING_TO_BACKUP_FILE",
             "Trying to use the backup file : $0.", _passwordBackupFile);             "Trying to use the backup file : $0.", _passwordBackupFile);
         if (! FileSystem::renameFile(_passwordBackupFile, _passwordFile))          if (Executor::renameFile(
               _passwordBackupFile.getCString(),  _passwordFile.getCString()) != 0)
         {         {
                         //l10n                         //l10n
             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
Line 294 
Line 296 
     {     {
         if ( FileSystem::exists(_passwordFile))         if ( FileSystem::exists(_passwordFile))
         {         {
             if ( ! FileSystem::removeFile(_passwordFile))              if (Executor::removeFile(_passwordFile.getCString()) != 0)
             {             {
                         //l10n                         //l10n
                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
Line 310 
Line 312 
     {     {
         if ( FileSystem::exists(_passwordFile))         if ( FileSystem::exists(_passwordFile))
         {         {
             if ( ! FileSystem::renameFile(_passwordFile, _passwordBackupFile))              if (Executor::renameFile(_passwordFile.getCString(),
                   _passwordBackupFile.getCString()) != 0)
             {             {
                         //l10n                         //l10n
                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
Line 326 
Line 329 
     //     //
     // Open the password file for writing     // Open the password file for writing
     //     //
 #if defined(PEGASUS_OS_OS400)  
     ofstream ofs(_passwordFile.getCString(), PEGASUS_STD(_CCSID_T(1208)));      FILE* ofs = Executor::openFile(_passwordFile.getCString(), 'w');
 #else  
     ofstream ofs(_passwordFile.getCString());  
 #endif  
     if (!ofs)     if (!ofs)
     {     {
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw CannotOpenFile(getFileName());         throw CannotOpenFile(getFileName());
     }     }
  
     ofs.clear();  
   
     //     //
     // Save user names and passwords to the new file     // Save user names and passwords to the new file
     //     //
     for (PasswordTable::Iterator i = passwordTable.start(); i; i++)     for (PasswordTable::Iterator i = passwordTable.start(); i; i++)
     {     {
         ofs << i.key() << ":" << i.value() << endl;          CString key = i.key().getCString();
           CString value = i.value().getCString();
           fprintf(ofs, "%s:%s\n", (const char*)key, (const char*)value);
     }     }
  
     ofs.close();      fclose(ofs);
  
     if ( FileSystem::exists(_passwordBackupFile))     if ( FileSystem::exists(_passwordBackupFile))
     {     {
         if ( ! FileSystem::removeFile(_passwordBackupFile))          if (Executor::removeFile(_passwordBackupFile.getCString()) != 0)
         {         {
                 //l10n                 //l10n
             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER,             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER,


Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2