From ffeb535db80b954ee2ae74671d1355c9ee15c596 Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Fri, 9 Oct 2015 20:53:24 +0200 Subject: [PATCH] ID:392 - _ipmi_get_user_name() work-around for some BMCs Commit adds a work-around for some BMCs which return ccode 0xCC when user is disabled. However, this isn't reason to stop listing users as this ccode is perceived as being "normal". When 0xCC is returned, empty user name will be printed instead of bailing out. --- lib/ipmi_channel.c | 5 ++++- lib/ipmi_user.c | 22 ++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/ipmi_channel.c b/lib/ipmi_channel.c index 5921e21..95017b8 100644 --- a/lib/ipmi_channel.c +++ b/lib/ipmi_channel.c @@ -707,7 +707,10 @@ ipmi_get_user_access(struct ipmi_intf *intf, uint8_t channel, uint8_t user_id) memset(&user_name, 0, sizeof(user_name)); user_name.user_id = curr_uid; ccode = _ipmi_get_user_name(intf, &user_name); - if (eval_ccode(ccode) != 0) { + if (ccode == 0xCC) { + user_name.user_id = curr_uid; + memset(&user_name.user_name, '\0', 17); + } else if (eval_ccode(ccode) != 0) { lprintf(LOG_ERR, "Unable to Get User Name (id %d)", curr_uid); return (-1); } diff --git a/lib/ipmi_user.c b/lib/ipmi_user.c index a2bdda0..6074209 100644 --- a/lib/ipmi_user.c +++ b/lib/ipmi_user.c @@ -287,20 +287,18 @@ ipmi_print_user_list(struct ipmi_intf *intf, uint8_t channel_number) memset(&user_name, 0, sizeof(user_name)); user_name.user_id = current_user_id; ccode = _ipmi_get_user_name(intf, &user_name); - if (eval_ccode(ccode) != 0) { + if (ccode == 0xCC) { + user_name.user_id = current_user_id; + memset(&user_name.user_name, '\0', 17); + } else if (eval_ccode(ccode) != 0) { return (-1); } - if ((current_user_id == 0) - || user_access.link_auth - || user_access.ipmi_messaging - || strcmp("", (char *)user_name.user_name)) { - if (csv_output) { - dump_user_access_csv((char *)user_name.user_name, - &user_access); - } else { - dump_user_access((char *)user_name.user_name, - &user_access); - } + if (csv_output) { + dump_user_access_csv((char *)user_name.user_name, + &user_access); + } else { + dump_user_access((char *)user_name.user_name, + &user_access); } ++current_user_id; } while ((current_user_id <= user_access.max_user_ids)