blob: c4a82edc55bb730b2a18edcca19f4f29a9efaa8c [file] [log] [blame]
diff '--color=auto' -wrBu a/Common/DtaDevEnterprise.cpp b/Common/DtaDevEnterprise.cpp
--- a/Common/DtaDevEnterprise.cpp 2023-05-04 22:50:11.459380518 -0700
+++ b/Common/DtaDevEnterprise.cpp 2023-05-04 20:40:37.034405137 -0700
@@ -384,11 +384,6 @@
string defaultPassword;
char *pwd = password, *newpwd = newpassword;
- if (securemode) {
- LOG(I) << "setSIDPassword in secure mode in the Enterprise SSC is not supported";
- return lastRC;
- }
-
if (11 > strnlen(userid, 15)) {
LOG(E) << "Invalid Userid " << userid;
return DTAERROR_INVALID_PARAMETER;
@@ -1280,11 +1275,6 @@
LOG(D1) << "Entering DtaDevEnterprise::setSIDPassword()";
uint8_t lastRC = 0;
- if (securemode) {
- LOG(I) << "setSIDPassword in the Enterprise SSC is not supported";
- return lastRC;
- }
-
vector<uint8_t> user;
set8(user, OPALUID[OPAL_SID_UID]);
diff '--color=auto' -wrBu a/Common/DtaOptions.h b/Common/DtaOptions.h
--- a/Common/DtaOptions.h 2023-05-04 22:50:11.459380518 -0700
+++ b/Common/DtaOptions.h 2023-05-04 22:19:12.038237932 -0700
@@ -45,6 +45,7 @@
bool no_hash_passwords; /** global parameter, disables hashing of passwords */
bool secure_mode; /** global parameter, enable the secure mode */
bool ask_password; /** global parameter, to know if the password needs to be interactively asked to the user */
+ bool ask_new_password; /** global parameter, to know if the new password needs to be interactively asked to the user */
sedutiloutput output_format;
} DTA_OPTIONS;
/** Print a usage message */
@@ -134,8 +135,12 @@
(!(strcasecmp(#option_field, "password")) || \
!(strcasecmp(#option_field, "newpassword")))) { \
opts->option_field = 255; \
- if (opts->action != sedutiloption::initialSetup)\
opts->ask_password = true; \
+ if (opts->action == sedutiloption::setSIDPassword || \
+ opts->action == sedutiloption::setAdmin1Pwd || \
+ opts->action == sedutiloption::setPassword) {\
+ opts->ask_new_password = true; \
+ } \
} \
else { \
opts->option_field = ++i; \
@@ -146,6 +151,6 @@
opts.secure_mode? (char*) interactive_password.c_str() : argv[opts.password]\
#define GET_NEW_PASSWORD() \
- opts.secure_mode? (char*)"" : argv[opts.newpassword]\
+ opts.secure_mode? (char*) new_interactive_password.c_str() : argv[opts.newpassword]\
#endif /* _DTAOPTIONS_H */
diff '--color=auto' -wrBu a/Common/sedutil.cpp b/Common/sedutil.cpp
--- a/Common/sedutil.cpp 2023-05-04 22:50:11.459380518 -0700
+++ b/Common/sedutil.cpp 2023-05-04 22:00:03.810890575 -0700
@@ -54,15 +54,20 @@
{
DTA_OPTIONS opts;
DtaDev *tempDev = NULL, *d = NULL;
- std::string interactive_password;
+ std::string interactive_password, new_interactive_password;
if (DtaOptions(argc, argv, &opts)) {
return DTAERROR_COMMAND_ERROR;
}
#ifdef __linux__
- if (opts.secure_mode && opts.ask_password) {
+ if (opts.secure_mode){
+ if (opts.ask_password) {
interactive_password = GetPassPhrase("Please enter password ");
}
+ if (opts.ask_new_password) {
+ new_interactive_password = GetPassPhrase("Please enter new password ");
+ }
+ }
#endif //__linux__
if ((opts.action != sedutiloption::scan) &&