Skip to content

IPMI command failed: Invalid data field in request Set User Password command failed (user 16) #80

Open
AlexanderAmelkin opened this issue May 18, 2017 · 2 comments

Comments

@AlexanderAmelkin
Copy link

Reported by: mareedu srinivasa rao
Original Ticket: ipmitool/bugs/485

Hi IPMITOOL Maintainer,

There is bug found while creating user by using ipmitool.
when tool try ot set password for user id == 16, it will always fails for user id 16.
the error which i am getting is

'Compl Code : 0xcc
IPMI command failed: Invalid data field in request
Set User Password command failed (user 16)'

Also have identified from the in the code from (highlited code) causing the issue. Masking of LSB bits will setting to all zeros in MSB bits by 0x0F. This will set 4th bit as zero for user id 16. finally user id will send in this function is 0.
We have to modify this masking as data[0] |= (0x7F & userid); this is the fix for this issue. Can you change code accordingly.

int
_ipmi_set_user_password(struct ipmi_intf *intf, uint8_t user_id,
uint8_t operation, const char *password,
uint8_t is_twenty_byte)
{
struct ipmi_rq req = {0};
struct ipmi_rs *rsp;
uint8_t *data;
uint8_t data_len = (is_twenty_byte) ? 22 : 18;
data = malloc(sizeof(uint8_t) * data_len);
if (data == NULL) {
return (-4);
}
memset(data, 0, data_len);
data[0] = (is_twenty_byte) ? 0x80 : 0x00;
data[0] |= (0x0F & user_id);
data[1] = 0x03 & operation;
if (password != NULL) {
size_t copy_len = strlen(password);
if (copy_len > (data_len - 2)) {
copy_len = data_len - 2;
} else if (copy_len < 1) {
copy_len = 0;
}
strncpy((char *)(data + 2), password, copy_len);
}

req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_SET_USER_PASSWORD;
req.msg.data = data;
req.msg.data_len = data_len;
rsp = intf->sendrecv(intf, &req);
free(data);
data = NULL;
if (rsp == NULL) {
	return (-1);
}
return rsp->ccode;

}

@AlexanderAmelkin
Copy link
Author

Hi Maintainer,

Please find the patch for bug.

Br,
MSR

Original comment by: mareedu srinivasa rao

@AlexanderAmelkin
Copy link
Author

Hi Z,

can i get any update on this.

Br,
MSR

Original comment by: mareedu srinivasa rao

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant