Commit is a response(and fix) to double-free bug in 'lib/ipmi_main.c' via
username. Now, pointers should be set to NULL after calling free().
Reported-by: Ales Ledvinka
Commit changes code formatting in 'lib/ipmi_delloem.c' to be more consistent
with the rest of ipmitool's code. No functional changes are intended.
Clean up isn't perfect, but it's one of steps in long term effort.
Commit removes 'size' check from ipmi_fru_get_multirec_from_file() as
an unsigned value can't be less than zero(0).
This error has been introduced by ID#3600911.
Reported-by: Ales Ledvinka
Commit fixes possible NULL reference in 'lib/ipmi_lanp.c' which is caused by not
checking return value of get_lan_param(), resp. get_lan_param_select(). This
function can return NULL in certain situations.
I'm reverting previous commit. I'm not sure what happened, but there is a huge
difference between what got committed, what came as a diff in e-mail and what
should have been committed in the first place.
Commit replaces condition ``if (p == NULL)'' in get_lan_param_select(). This
condition is never met, because structure is on heap.
Condition is replaced by for() control structure which goes through structure
ipmi_lan_params and checks whether requested LAN parameter is defined in
structure or not.
Reported-by: Ales Ledvinka
Commit fixes possible integer *flows in 'lib/ipmi_delloem.c'. Function
make_int() is removed and replaced with calls to appropriate str2*() function
calls from 'lib/helper.c'.
Reported-by: Duncan Idaho
Commit changes handling of response in ipmi_event_fromsensor(). If ccode doesn't
equal to 0, then error message is printed and function returns.
Reported-by: Duncan Idaho
Commit is a rewrite of function ipmi_fru_get_multirec_from_file() in
'lib/ipmi_fru.c'.
Changes:
* argument size is checked; size must be greater than 0
* argument pFileName is checked
* return value of seek() is checked
* error messages are printed on STDERR
* code flow got a re-work
Commit moves one #ifdef upwards in the code, so resources are not wasted
pointlessly. There is no need to allocate memory for variables/structs and open
interface, if we're about to quit immediately because LAN+ support is not
enabled.
Error message got changed as well and it gets printed on STDERR where it
belongs!
Commit changes return value of ipmi_fru_get_adjust_size_from_buffer() from void
to int in order to determine whether call was successful or wasn't.
ipmi_fru_upg_ekeying() got re-work as well.
Changes to ipmi_fru_get_adjust_size_from_buffer():
* CHUNK_SIZE removed
* code formatting
* return value void -> int
Changes to ipmi_fru_upg_ekeying():
* check whether pFilename is NULL
* check return values of called functions
* re-work code - return early on error instead of nested if()
* added (error) messages
Commit fixes memory leanks in functions ipmi_fru_set_field_string() and
ipmi_fru_set_field_string_rebuild() in 'lib/ipmi_fru.c'.
Note: it seems to me like these for() cycles do nothing.
Reported-by: Ales Ledvinka
Commit changes function ipmi_lcd_get_platform_model_name() to return integer
instead of void to signal potentional problems/issues.
Reported-by: Ales Ledvinka
Commit changes are related to ipmi_ldc_set_lock() in 'lib/ipmi_delloem.c':
* use 'else if' instead of 'if' since it's the same given the context and
probably better
* use 'rc' variable, since it's there, rather than 'return'
Note: ipmi_lcd_set_lock() would use some re-write.
Reported-by: Ales Ledvinka
Commit changes evaluation order of 'oemtype' which is an input parameter to
ipmi_oem_setup() in 'lib/ipmi_oem.c'. Make the check whether 'oemtype' is NULL
or not one of the first things we do rather than blindly use 'oemtype' in
strncmp() and then check if it isn't NULL. Yes, this is a potential crash
waiting to happen.
Reported-by: Ales Ledvinka
Commit fixes NULL dereference in 'lib/ipmi_sdr.c' by checking whether Sensor is
type of 'full' or 'compact'.
Fix by: Jim Mank
Reported by: Ales Ledvinka
ID: 3601106 - # ipmitool sensor get NACname; output incorrect/inconsistent
After a lengthy discussion with Jim, I'm removing free() of sdr_record_list in
ipmi_sensor_get() as this is freed in 'lib/ipmi_main.c' on/prior to ipmitool's
exit.
Commit re-works output of # ipmitool sensor get; command. It removes calls to
sensor specific functions with call to ipmi_sdr_print_listentry(). This way,
output is unified with the output of '-v sdr list' and actually has corrent
information. Well, at least errors are gone and no information seems to be
missing.
Commit fixes help and return codes as well.
Commit fixes crash in ipmi_print_sensor_info() in 'lib/ipmi_dcmi.c' due to NULL
reference. 'rec' is correctly checked whether NULL or not, but it's used
immediately despite of the outcome of the NULL test.
Also, ipmi_sdr_print_rawentry() is used instead of specific print function.
ID: 3597782 - 'lib/ipmi_mc' - sysinfo_param() has two consecutive returns
ID: 3597781 - 'mc getsysinfo|setsysinfo' help has typos
Commit changes/fixes issues described in tickets #3598203, #3597782 and
#3597781.
Typos in help text of 'getsysinfo'/'setsysinfo' got fixed and function
printf_sysinfo_usage() has been created.
Consecutive return in function sysinfo_param() has been removed.
Some code has been re-worked:
* ipmi_getsysinfo() -> ipmi_mc_getsysinfo(),
* ipmi_setsysinfo() -> ipmi_mc_setsysinfo();
* ipmi_sysinfo_main() extended for 'is_set' parameter to signal whether it's
a get/set operation
* return codes changed
* code styling clean-up
* a bit of code clean-up in ipmi_sysinfo_main(), ipmi_mc_getsysinfo(),
ipmi_mc_setsysinfo()