summaryrefslogtreecommitdiff
path: root/lib/ipmi_channel.c
Commit message (Collapse)AuthorAgeFilesLines
* Finalize refactoring of string comparisonsAlexander Amelkin2020-06-101-11/+10
| | | | | | | | | | | | | | Unify the comparison idioms use. Always use `if(!strcmp())` for "if string equals" and `if(strcmp())` for "if string is not equal". Never use `== 0` and `!= 0` with `strcmp()`. Minor reformatting of the code immediately surrounding the refactored lines. Resolves ipmitool/ipmitool#104 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* channel: Refactor set_user_access option processingAlexander Amelkin2020-06-101-27/+59
| | | | | | | | Reduce code duplication by extracting option names, types, and value ranges into a separate structure, and rewriting the option parsing code without mixing it with the data. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Refactor string comparisonsJiang Junyu2020-06-101-16/+16
| | | | | | | Clean up use of strcmp/strncmp/strncasecmp for command line arguments. Never use anything but `strcmp()` unless absolutely neccessary. Partialy resolves ipmitool/ipmitool#104
* channel: Fix buffer overflowChrostoper Ertl2020-02-041-1/+4
| | | | | | | | | Partial fix for CVE-2020-5208, see https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp The `ipmi_get_channel_cipher_suites` function does not properly check the final response’s `data_len`, which can lead to stack buffer overflow on the final copy.
* event: Fix event submission via SSIFAlexander Amelkin2019-07-021-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPMI 2.0 specification is quite inconsistent about system interfaces. They have section 1.7.16 "System Interfaces" that clearly states that there are FOUR system interfaces (KCS, SMIC, BT and SSIF), but then they have section 1.7.31 saying that "It is mandatory to implement a system interface that is compatible with one of the **three** specified system interfaces" without specifying which three of the four interfaces are meant. Then in section 6 "IPMI Messaging interfaces" they again say that "As mentioned earlier, there are three System Interface implementations specified for the BMC: SMIC, KCS, and BT". Is all looks like during update from 1.5 to 2.0 they have updated section 1.7.16, but forgot to update Table 6-3, section 1.7.31 and section 6. Yet again, there is 'Get System Interface Capabilities' command that has a parameter 'System Interface Type' that can specify that SI is of SSIF type. All that have lead to a situation where some BMC manufacturers treated the specification as if it prohibited specifying media type 0xC (which is "System Interface") for system interfaces using SSIF (SMBus Sustem Interface), and so they specified an SMBUS media type for their system interface channels. As a result, ipmitool failed to properly send event data via such system interfaces as it treated them as non-system and didn't add the required Generator ID. To mitigate the inconsistency of IPMI specification and yet not ask BMC manufacturers to alter their code, thus increasing compatibility with legacy BMCs, this commit adds checking of current interface number. The system interface, according to Table 6-1 of IPMI Specification is required to have channel number 15 (0Fh). So with this commit the generator ID is added for any interfaces that are either marked as media type 0Ch 'System Interface' or have channel number 0Fh. Resolves ipmitool/ipmitool#111 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* lanplus: RefactoringAlexander Amelkin2018-11-011-64/+100
| | | | | | | Some minor formatting corrections. Also introduced a new helper function to reduce nesting level. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* lanplus: Auto-select 'best' cipher suite availableVernon Mauery2018-11-011-127/+115
| | | | | | | | | | | | | | | | | | | | | Based on current crypto alogrithms, one could rank cipher suites along these lines: 17 > 3 >> all the rest 17 and 3 are the only cipher suites that implement any sort of confidentiality alogorithm that is secure. In addition, any hmac-md5 or md5 integrity algorithm used in integrity is weak at best and dangerous for authentication. This could possibly be enabled in a simpler mechanism by simply checking for 17 and then choosing it before falling back to 3, but the way this is implemented, it makes it easy to change the list of acceptable algorithms from two to three or more items. Resolves ipmitool/ipmitool#29 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* Refactoring: optimize pointer checksAlexander Amelkin2018-08-211-8/+8
| | | | | | | | Remove all direct comparisons to 'NULL' for pointers. Replace them with boolean-like 'if (ptr)' and 'if (!ptr)'. This makes conditions shorter and easier to read. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Refactoring: get rid of superfluous comparisonsAlexander Amelkin2018-08-211-9/+10
| | | | | | | | | | | | | Make code better readable by replacing `if (rsp->ccode > 0)` and 'if (rsp->ccode != 0)' with just `if (rsp->ccode)` as rsp->ccode is anyway an unsigned byte and can't be negative. Also replace 'if (rsp->ccode == 0)' with 'if (!rsp->ccode)'. All these changes make lines shorter and easier to read as a non-zero ccode is an indication of some failure, and so !ccode naturally reads as 'no error'. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* general: Fix several misspellingsThorsten Horstmann2018-08-061-1/+1
| | | | | | Fix misspellings found by codespell in code comments, console output and documentation. Resolves ipmitool/ipmitool#28
* ID:457 - Display User ID enable/disable statusZdenek Styblik2016-08-211-1/+2
| | | | | | Commit implements `Enable status` which shows/is in alignment with (22.27) Get User Access Command and displays User ID Enable/Disable status of given User ID at given channel.
* ID:399 - Fixed channel getciphers command.Dmitry Bazhenov2015-11-061-1/+1
| | | | | | 'channel getciphers' command uses wrong command-line argument when parsing the target channel number. This patch fixes this problem.
* ID:398 - Fixed channel setaccess command.Dmitry Bazhenov2015-11-061-1/+1
| | | | | | 'channel setaccess' command uses wrong command-line arguments to construct the set user access request. This patch fixes this problem.
* ID:392 - _ipmi_get_user_name() work-around for some BMCsZdenek Styblik2015-10-091-1/+4
| | | | | | | 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.
* _ipmi_set_channel_access() - zero-out variable data before useZdenek Styblik2015-02-031-0/+1
|
* Add _ipmi_set_channel_access() functionZdenek Styblik2015-02-031-0/+60
| | | | | Commit adds _ipmi_set_channel_access() function which in implementation of (22.22) Set Channel Access Command.
* Put functions in ipmi_channel.c in A-Z orderZdenek Styblik2015-01-171-245/+249
|
* Re-work ccode eval in ipmi_get_channel_medium()Zdenek Styblik2015-01-161-6/+4
| | | | | Commit re-works ccode eval in ipmi_get_channel_medium() as the previous one didn't work and led to dead-code.
* Remove unused variable from ipmi_get_channel_cipher_suites()Zdenek Styblik2015-01-161-4/+0
| | | | Commit removes unused variable oem_record from ipmi_get_channel_cipher_suites().
* Print error message to STDERR in ipmi_channel.cZdenek Styblik2015-01-161-1/+1
| | | | Print error message to STDERR and not STDOUT in ipmi_channel_main().
* Hook ipmi_get_channel_medium() to new _ipmi_get_*() functionsZdenek Styblik2015-01-161-26/+13
| | | | Commit hooks ipmi_get_channel_medium() to new _ipmi_get_*() functions.
* Hook ipmi_get_channel_info() to _ipmi_get_*()Zdenek Styblik2015-01-161-83/+36
| | | | Commit hooks ipmi_get_channel_info() to new _ipmi_get_*() functions.
* Add _ipmi_get_channel_access() and _ipmi_get_channel_info()Zdenek Styblik2015-01-161-0/+90
| | | | | Commit adds _ipmi_get_channel_access() and _ipmi_get_channel_info() as well as supporting structures.
* ipmi_get_user_access() - change var name 'userid' to 'user_id'Zdenek Styblik2015-01-131-4/+4
| | | | | Commit changes variable/param name from 'userid' to 'user_id' in order to keep consistency.
* Add documentation to 'getaccess' and 'setaccess' functionsZdenek Styblik2015-01-111-0/+14
|
* Hook ipmi_user_priv() to _ipmi_set_user_access()Zdenek Styblik2015-01-091-1/+1
| | | | | | Commit hooks ipmi_user_priv() to _ipmi_set_user_access(). Later got extended for 'change_priv_limit_only', because of the former. Commit removes ipmi_user_set_userpriv(), because it's not used anywhere.
* Re-work 'channel getaccess' and 'channel setaccess'Zdenek Styblik2015-01-081-151/+96
| | | | | | Commit is a re-work of 'channel getaccess' and 'channel setaccess'. These are using _ipmi_* now. Also, bitfields and two structs are replaced by one unified struct.
* ID:355 - Fix ``ISO C forbids omitting the middle term of a ?: expression''Zdenek Styblik2014-12-301-1/+1
| | | | Commit fixes omitted middle terms of ternary expressions.
* Replace deprecated bzero() with memset()Zdenek Styblik2014-12-231-2/+1
| | | | Commit replaces deprecated bzero() with memset().
* Fix user input validation in Channel and User sub-commandsZdenek Styblik2014-12-221-33/+14
| | | | Commit fixes validation of user input in Channel and User sub-commands.
* Cleanup if/else in ipmi_channel_main()Zdenek Styblik2014-12-221-42/+50
|
* Cleanup of code formatting in ipmi_channel.cZdenek Styblik2014-12-221-164/+153
| | | | At least a bit.
* Move all files one level up in the file hierarcy, to avoid the useless ↵Petter Reinholdtsen2014-02-051-0/+903
ipmitool directory.