(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.25.30.2 and 1.26

version 1.25.30.2, 2007/01/02 06:14:47 version 1.26, 2007/04/03 18:50:58
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Sushma Fernandes, Hewlett Packard Company (sushma_fernandes@hp.com)  
 //  
 // Modified By: Amit K Arora, IBM (amita@in.ibm.com) for Bug#1519  
 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for PEP#101  
 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for PEP#1791, Bug#3606  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
  
Line 44 
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 134 
Line 127 
     {     {
         if (FileSystem::exists(_passwordFile))         if (FileSystem::exists(_passwordFile))
         {         {
             if (Executor::removeFile(_passwordFile.getCString()) != 0)              if (! FileSystem::removeFile(_passwordFile))
             {             {
                 throw CannotRemoveFile(_passwordFile);                 throw CannotRemoveFile(_passwordFile);
             }             }
Line 145 
Line 138 
         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 (Executor::renameFile(          if (! FileSystem::renameFile(_passwordBackupFile, _passwordFile))
             _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 212 
Line 204 
         //         //
         // Get the userName         // Get the userName
         //         //
         String userName = String::EMPTY;          String userName;
  
         userName.append(*p++);         userName.append(*p++);
  
Line 258 
Line 250 
         //         //
         // Get the password         // Get the password
         //         //
         String password = String::EMPTY;          String password;
  
         while (*p)         while (*p)
         {         {
Line 302 
Line 294 
     {     {
         if ( FileSystem::exists(_passwordFile))         if ( FileSystem::exists(_passwordFile))
         {         {
             if (Executor::removeFile(_passwordFile.getCString()) != 0)              if ( ! FileSystem::removeFile(_passwordFile))
             {             {
                         //l10n                         //l10n
                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
Line 318 
Line 310 
     {     {
         if ( FileSystem::exists(_passwordFile))         if ( FileSystem::exists(_passwordFile))
         {         {
             if (Executor::renameFile(_passwordFile.getCString(),              if ( ! FileSystem::renameFile(_passwordFile, _passwordBackupFile))
                 _passwordBackupFile.getCString()) != 0)  
             {             {
                         //l10n                         //l10n
                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
Line 335 
Line 326 
     //     //
     // Open the password file for writing     // Open the password file for writing
     //     //
   #if defined(PEGASUS_OS_OS400)
     FILE* ofs = Executor::openFile(_passwordFile.getCString(), 'w');      ofstream ofs(_passwordFile.getCString(), PEGASUS_STD(_CCSID_T(1208)));
   #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++)
     {     {
         CString key = i.key().getCString();          ofs << i.key() << ":" << i.value() << endl;
         CString value = i.value().getCString();  
         fprintf(ofs, "%s:%s\n", (const char*)key, (const char*)value);  
     }     }
  
     fclose(ofs);      ofs.close();
  
     if ( FileSystem::exists(_passwordBackupFile))     if ( FileSystem::exists(_passwordBackupFile))
     {     {
         if (Executor::removeFile(_passwordBackupFile.getCString()) != 0)          if ( ! FileSystem::removeFile(_passwordBackupFile))
         {         {
                 //l10n                 //l10n
             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER,             //Logger::put(Logger::ERROR_LOG, System::CIMSERVER,


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2