version 1.2, 2001/12/13 14:54:33
|
version 1.9.14.1, 2006/07/27 23:12:11
|
|
|
//%//////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================= |
//============================================================================== |
// | // |
// Author: Sushma Fernandes, Hewlett Packard Company (sushma_fernandes@hp.com) | // Author: Sushma Fernandes, Hewlett Packard Company (sushma_fernandes@hp.com) |
// | // |
// Modified By: | // Modified By: |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP#101 |
// | // |
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <fstream> | #include <fstream> |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/AutoPtr.h> |
|
#include <Pegasus/Common/Mutex.h> |
| |
#include <Pegasus/Security/UserManager/PasswordFile.h> | #include <Pegasus/Security/UserManager/PasswordFile.h> |
#include <Pegasus/Security/UserManager/Linkage.h> | #include <Pegasus/Security/UserManager/Linkage.h> |
|
|
private: | private: |
| |
// | // |
// Contains the password file name |
// Contains the property name for password filepath |
// | // |
static const char _PASSWD_FILE[]; |
static const String _PROPERTY_NAME_PASSWORD_FILEPATH; |
| |
// | // |
// Contains the salt string for password encryption | // Contains the salt string for password encryption |
|
|
static const unsigned char _SALT_STRING[]; | static const unsigned char _SALT_STRING[]; |
| |
// | // |
// Contains the password file name with the full path |
// Denotes the types of update operations |
|
// |
|
enum UpdateOperations |
|
{ |
|
ADD_USER, |
|
MODIFY_USER, |
|
REMOVE_USER |
|
}; |
|
|
|
// |
|
// Contains the mutex timeout value |
// | // |
String _passwdFileName; |
static const Uint32 _MUTEX_TIMEOUT; |
| |
// | // |
// Flag to indicate whether password file exists | // Flag to indicate whether password file exists |
|
|
// | // |
// Instance of the PasswordFile | // Instance of the PasswordFile |
// | // |
PasswordFile *_passwordFile; |
AutoPtr<PasswordFile> _passwordFile; //PEP101 |
|
|
|
// |
|
// Mutex variable for consistent Password File and cache updates |
|
// |
|
AutoPtr<Mutex> _mutex; //PEP101 |
| |
/** | /** |
generate random salt key for password encryption | generate random salt key for password encryption |
|
|
*/ | */ |
void _GetSalt (char* salt); | void _GetSalt (char* salt); |
| |
|
/** |
|
Update the password hash table and write to password file |
|
*/ |
|
void _Update( |
|
char operation, |
|
const String& userName, |
|
const String& password = String::EMPTY); |
|
|
|
|
protected: | protected: |
| |
/** | /** |
|
|
/** Destructor. */ | /** Destructor. */ |
~UserFileHandler(); | ~UserFileHandler(); |
| |
|
|
/** | /** |
Add user entry to file | Add user entry to file |
| |