version 1.41, 2006/01/30 16:16:33
|
version 1.42, 2007/04/03 18:50:47
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Sushma Fernandes, Hewlett Packard Company (sushma_fernandes@hp.com) |
|
// |
|
// Modified By: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP-101 |
|
// Alagaraja Ramasubramanian, IBM (alags_raj@in.ibm.com) - PEP-167 |
|
// Amit K Arora, IBM (amita@in.ibm.com) - Bug#2311,#2333,#2351 |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2756 |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3032 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
|
Initialize the instance variables. | Initialize the instance variables. |
*/ | */ |
_operationType = OPERATION_TYPE_UNINITIALIZED; | _operationType = OPERATION_TYPE_UNINITIALIZED; |
_userName = String::EMPTY; |
|
_password = String::EMPTY; |
|
_newpassword = String::EMPTY; |
|
_hostName = String::EMPTY; |
|
_passwordSet = false; | _passwordSet = false; |
_newpasswordSet = false; | _newpasswordSet = false; |
_userNameSet = false; | _userNameSet = false; |
|
|
// | // |
// Password is not set, prompt for the password | // Password is not set, prompt for the password |
// | // |
String pw = String::EMPTY; |
String pw; |
do | do |
{ | { |
pw = System::getPassword(PASSWORD_PROMPT); | pw = System::getPassword(PASSWORD_PROMPT); |
| |
if (pw == String::EMPTY || pw == "") |
if (pw == String::EMPTY) |
{ | { |
//l10n |
errPrintWriter << localizeMessage( |
//errPrintWriter << PASSWORD_BLANK << endl; |
MSG_PATH, PASSWORD_BLANK_KEY, PASSWORD_BLANK) << endl; |
errPrintWriter << localizeMessage(MSG_PATH,PASSWORD_BLANK_KEY,PASSWORD_BLANK) << endl; |
|
pw = String::EMPTY; |
|
continue; | continue; |
} | } |
if (pw != System::getPassword(RE_ENTER_PROMPT)) | if (pw != System::getPassword(RE_ENTER_PROMPT)) |
{ | { |
//l10n |
errPrintWriter << |
//errPrintWriter << PASSWORD_DOES_NOT_MATCH << endl; |
localizeMessage( |
errPrintWriter << localizeMessage(MSG_PATH,PASSWORD_DOES_NOT_MATCH_KEY,PASSWORD_DOES_NOT_MATCH_KEY) << endl; |
MSG_PATH, |
|
PASSWORD_DOES_NOT_MATCH_KEY, |
|
PASSWORD_DOES_NOT_MATCH_KEY) << |
|
endl; |
pw = String::EMPTY; | pw = String::EMPTY; |
} | } |
} | } |
|
|
// | // |
// Password is not set, prompt for the old password once | // Password is not set, prompt for the old password once |
// | // |
String pw = String::EMPTY; |
String pw; |
do | do |
{ | { |
pw = System::getPassword(OLD_PASSWORD_PROMPT); | pw = System::getPassword(OLD_PASSWORD_PROMPT); |
if (pw == String::EMPTY || pw == "") |
if (pw == String::EMPTY) |
{ | { |
//l10n |
errPrintWriter << localizeMessage( |
//errPrintWriter << PASSWORD_BLANK << endl; |
MSG_PATH, PASSWORD_BLANK_KEY, PASSWORD_BLANK) << endl; |
errPrintWriter << localizeMessage(MSG_PATH,PASSWORD_BLANK_KEY,PASSWORD_BLANK) << endl; |
|
pw = String::EMPTY; |
|
continue; | continue; |
} | } |
} | } |
|
|
// | // |
// Password is not set, prompt for the new password twice | // Password is not set, prompt for the new password twice |
// | // |
String newPw = String::EMPTY; |
String newPw; |
do | do |
{ | { |
newPw = System::getPassword(NEW_PASSWORD_PROMPT); | newPw = System::getPassword(NEW_PASSWORD_PROMPT); |
if (newPw == String::EMPTY || newPw == "") |
if (newPw == String::EMPTY) |
{ | { |
//l10n |
errPrintWriter << localizeMessage( |
//errPrintWriter << PASSWORD_BLANK << endl; |
MSG_PATH, PASSWORD_BLANK_KEY, PASSWORD_BLANK) << endl; |
errPrintWriter << localizeMessage(MSG_PATH,PASSWORD_BLANK_KEY,PASSWORD_BLANK) << endl; |
|
newPw = String::EMPTY; |
|
continue; | continue; |
} | } |
| |
if (newPw != System::getPassword(RE_ENTER_PROMPT)) | if (newPw != System::getPassword(RE_ENTER_PROMPT)) |
{ | { |
//l10n |
errPrintWriter << |
//errPrintWriter << PASSWORD_DOES_NOT_MATCH << endl; |
localizeMessage( |
errPrintWriter << localizeMessage(MSG_PATH,PASSWORD_DOES_NOT_MATCH_KEY,PASSWORD_DOES_NOT_MATCH) << endl; |
MSG_PATH, |
|
PASSWORD_DOES_NOT_MATCH_KEY, |
|
PASSWORD_DOES_NOT_MATCH) << |
|
endl; |
newPw = String::EMPTY; | newPw = String::EMPTY; |
} | } |
} | } |
|
|
_newpassword = newPw ; | _newpassword = newPw ; |
if (_newpassword == _password) | if (_newpassword == _password) |
{ | { |
//l10n |
cerr << localizeMessage( |
//cerr << PASSWORD_SAME_ERROR << endl; |
MSG_PATH, PASSWORD_SAME_ERROR_KEY, PASSWORD_SAME_ERROR) << |
cerr << localizeMessage(MSG_PATH,PASSWORD_SAME_ERROR_KEY, PASSWORD_SAME_ERROR) << endl; |
endl; |
exit (-1); | exit (-1); |
} | } |
} | } |