mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Hook functions in ipmi_user to _ipmi_set_user_password()
Commit hooks functions in ipmi_user to _ipmi_set_user_password() instead of ipmi_user_set_password().
This commit is contained in:
parent
a6d47ceba4
commit
66eee40df4
@ -396,12 +396,9 @@ ipmi_user_set_username(
|
|||||||
* Setting/Testing passwords
|
* Setting/Testing passwords
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ipmi_user_set_password(
|
ipmi_user_set_password(struct ipmi_intf *intf, uint8_t user_id,
|
||||||
struct ipmi_intf * intf,
|
uint8_t operation, const char *password,
|
||||||
uint8_t user_id,
|
uint8_t is_twenty_byte_password)
|
||||||
uint8_t operation,
|
|
||||||
const char *password,
|
|
||||||
int is_twenty_byte_password)
|
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -445,24 +442,16 @@ ipmi_user_set_password(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* ipmi_user_test_password - Call _ipmi_set_user_password() with operation bit
|
||||||
* ipmi_user_test_password
|
* set to test password and interpret result.
|
||||||
*
|
|
||||||
* Call ipmi_user_set_password, and interpret the result
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ipmi_user_test_password(
|
ipmi_user_test_password(struct ipmi_intf *intf, uint8_t user_id,
|
||||||
struct ipmi_intf * intf,
|
const char *password, uint8_t is_twenty_byte_password)
|
||||||
uint8_t user_id,
|
|
||||||
const char * password,
|
|
||||||
int is_twenty_byte_password)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
ret = _ipmi_set_user_password(intf, user_id,
|
||||||
ret = ipmi_user_set_password(intf,
|
IPMI_PASSWORD_TEST_PASSWORD, password,
|
||||||
user_id,
|
|
||||||
IPMI_PASSWORD_TEST_PASSWORD,
|
|
||||||
password,
|
|
||||||
is_twenty_byte_password);
|
is_twenty_byte_password);
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
@ -668,7 +657,6 @@ ipmi_user_mod(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
/* Disable / Enable */
|
/* Disable / Enable */
|
||||||
uint8_t user_id;
|
uint8_t user_id;
|
||||||
uint8_t operation;
|
uint8_t operation;
|
||||||
char null_password[16]; /* Not used, but required */
|
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
print_user_usage();
|
print_user_usage();
|
||||||
@ -677,18 +665,18 @@ ipmi_user_mod(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
if (is_ipmi_user_id(argv[1], &user_id)) {
|
if (is_ipmi_user_id(argv[1], &user_id)) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
memset(null_password, 0, sizeof(null_password));
|
|
||||||
operation = (strncmp(argv[0], "disable", 7) == 0) ?
|
operation = (strncmp(argv[0], "disable", 7) == 0) ?
|
||||||
IPMI_PASSWORD_DISABLE_USER : IPMI_PASSWORD_ENABLE_USER;
|
IPMI_PASSWORD_DISABLE_USER : IPMI_PASSWORD_ENABLE_USER;
|
||||||
|
|
||||||
/* Last parameter is ignored */
|
return _ipmi_set_user_password(intf, user_id, operation,
|
||||||
return ipmi_user_set_password(intf, user_id, operation, null_password, 0);
|
(char *)NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_user_password(struct ipmi_intf *intf, int argc, char **argv)
|
ipmi_user_password(struct ipmi_intf *intf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *password = NULL;
|
char *password = NULL;
|
||||||
|
int ccode = 0;
|
||||||
uint8_t password_type = 16;
|
uint8_t password_type = 16;
|
||||||
uint8_t user_id = 0;
|
uint8_t user_id = 0;
|
||||||
if (is_ipmi_user_id(argv[2], &user_id)) {
|
if (is_ipmi_user_id(argv[2], &user_id)) {
|
||||||
@ -734,11 +722,18 @@ ipmi_user_password(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ipmi_user_set_password(intf,
|
ccode = _ipmi_set_user_password(intf, user_id,
|
||||||
user_id,
|
IPMI_PASSWORD_SET_PASSWORD, password,
|
||||||
IPMI_PASSWORD_SET_PASSWORD,
|
|
||||||
password,
|
|
||||||
password_type > 16);
|
password_type > 16);
|
||||||
|
if (eval_ccode(ccode) != 0) {
|
||||||
|
lprintf(LOG_ERR, "Set User Password command failed (user %d)",
|
||||||
|
user_id);
|
||||||
|
return (-1);
|
||||||
|
} else {
|
||||||
|
printf("Set User Password command successful (user %d)\n",
|
||||||
|
user_id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user