Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: ipmit...@packages.debian.org, z...@debian.org, a...@debian.org, 
shankerwangm...@gmail.com
Control: affects -1 + src:ipmitool

[ Reason ]

There are some upstream bugs. Please see Changes section for details.

[ Impact ]

Users would still suffer from upstream bugs. #1061770 and #1082101 would
render some important functionality of this package unusable.

[ Tests ]

I tested the patched version manually and confirm problems have been fixed.

[ Risks ]

All changes are simple and self-explanatory. Risks are minimal.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]

Mainly patches backported from upstream (and applied in sid):

* 0800-fix-buffer-overrun.patch: a slight stack buffer overflow,
  but this function is widely used. Very tiny fix.
* 0801-fix-lan-print-fails-on-unsupported-parameters.patch:
  this is an important issue that affects the package usability (#1061770)
* 0802-fix-temp-read-parameters.patch: fix temperature reading,
  this also confuses users. Although no BTS bug, I heard user complaints.
* 0803-fix-sdr-hex-value.patch: fixes an important bug report (#1082101)

And drop lsb-base in Depends, to make lintian happy.

-- 
Thanks,
Shengqi Chen
diff -Nru ipmitool-1.8.19/debian/changelog ipmitool-1.8.19/debian/changelog
--- ipmitool-1.8.19/debian/changelog    2024-05-17 20:26:20.000000000 +0800
+++ ipmitool-1.8.19/debian/changelog    2024-11-02 14:52:14.000000000 +0800
@@ -1,3 +1,15 @@
+ipmitool (1.8.19-4+deb12u2) bookworm; urgency=medium
+
+  * Non-maintainer upload.
+  * d/control: Remove obsolete lsb-base from Depends
+  * d/patches: backport several important fixes from upstream
+    + fix a buffer overrun in `open` interface
+    + fix lan print fails on unsupported parameters (see: #1061770)
+    + fix parameter passed to read temperature sensors
+    + fix using hex values when sending raw data (see: #1082101)
+
+ -- Shengqi Chen <harry-c...@outlook.com>  Sat, 02 Nov 2024 14:52:14 +0800
+
 ipmitool (1.8.19-4+deb12u1) bookworm; urgency=medium
 
   * Non-maintainer upload.
diff -Nru ipmitool-1.8.19/debian/control ipmitool-1.8.19/debian/control
--- ipmitool-1.8.19/debian/control      2024-05-17 20:26:20.000000000 +0800
+++ ipmitool-1.8.19/debian/control      2024-11-02 14:52:07.000000000 +0800
@@ -19,8 +19,7 @@
 Architecture: any
 Depends:
  ${misc:Depends},
- ${shlibs:Depends},
- lsb-base (>= 3.0-6)
+ ${shlibs:Depends}
 Pre-Depends:
  ${misc:Pre-Depends}
 Recommends: openipmi
diff -Nru ipmitool-1.8.19/debian/patches/0800-fix-buffer-overrun.patch 
ipmitool-1.8.19/debian/patches/0800-fix-buffer-overrun.patch
--- ipmitool-1.8.19/debian/patches/0800-fix-buffer-overrun.patch        
1970-01-01 08:00:00.000000000 +0800
+++ ipmitool-1.8.19/debian/patches/0800-fix-buffer-overrun.patch        
2024-11-02 14:40:23.000000000 +0800
@@ -0,0 +1,35 @@
+From b4bc5c335159b1c272e06dba98e2916e3ecc0462 Mon Sep 17 00:00:00 2001
+From: Howitzer105mm <howitzer10...@noreply.codeberg.org>
+Date: Tue, 26 Mar 2024 11:28:16 +0000
+Subject: [PATCH] open: Eliminate buffer overrun (#24)
+
+clangd reports a buffer overrun issue in `open` interface.
+
+The sprintf() used to fill ipmi_devfs2 requires 17 bytes to store the
+null terminated string. The character buffer is only 16 bytes in
+length.
+
+Signed-off-by: Johnathan Mantey <johnathanx.man...@intel.com>
+Reviewed-on: https://codeberg.org/IPMITool/ipmitool/pulls/24
+Reviewed-by: Alexander Amelkin <alexan...@amelkin.msk.ru>
+Co-authored-by: Howitzer105mm <howitzer10...@noreply.codeberg.org>
+Co-committed-by: Howitzer105mm <howitzer10...@noreply.codeberg.org>
+Forwarded: not-needed
+Applied-Upstream: 
https://codeberg.org/IPMITool/ipmitool/commit/b4bc5c335159b1c272e06dba98e2916e3ecc0462
+---
+ src/plugins/open/open.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/plugins/open/open.c b/src/plugins/open/open.c
+index 39c8ea2..88cb6c3 100644
+--- a/src/plugins/open/open.c
++++ b/src/plugins/open/open.c
+@@ -94,7 +94,7 @@ ipmi_openipmi_open(struct ipmi_intf *intf)
+ {
+       char ipmi_dev[16];
+       char ipmi_devfs[16];
+-      char ipmi_devfs2[16];
++      char ipmi_devfs2[17];
+       int devnum = 0;
+ 
+       devnum = intf->devnum;
diff -Nru 
ipmitool-1.8.19/debian/patches/0801-fix-lan-print-fails-on-unsupported-parameters.patch
 
ipmitool-1.8.19/debian/patches/0801-fix-lan-print-fails-on-unsupported-parameters.patch
--- 
ipmitool-1.8.19/debian/patches/0801-fix-lan-print-fails-on-unsupported-parameters.patch
     1970-01-01 08:00:00.000000000 +0800
+++ 
ipmitool-1.8.19/debian/patches/0801-fix-lan-print-fails-on-unsupported-parameters.patch
     2024-11-02 14:40:23.000000000 +0800
@@ -0,0 +1,39 @@
+From 137aeb64cbb493d61d6945cac156aba5f0510780 Mon Sep 17 00:00:00 2001
+From: Miao Wang <shankerwangm...@gmail.com>
+Date: Sat, 10 Feb 2024 12:51:15 +0800
+Subject: [PATCH] lan: fix lan print fails on unsupported parameters
+
+After upgrading to ipmitool 1.8.19, ipmitool lan print can only print out
+`Set in Progress` and other parameters are missing on our servers. After
+bisecting, commit:
+
+  351dad24a26f lan: Add processing of get/set specific CCs
+
+is identified to be the source of the problem, where the function
+get_lan_param_select is expected to consider severial error codes it
+receives as empty response. It then constructs an empty response in `p`
+and assigns `p` to `rc` and the control flow falls through to the
+default case, which prints the error code in verbose mode and should
+return `rc` instead of `NULL`.
+
+Signed-off-by: Miao Wang <shankerwangm...@gmail.com>
+Forwarded: not-needed
+Applied-Upstream: 
https://codeberg.org/IPMITool/ipmitool/commit/137aeb64cbb493d61d6945cac156aba5f0510780
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061770
+---
+ lib/ipmi_lanp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/ipmi_lanp.c b/lib/ipmi_lanp.c
+index fe0046f..26e7365 100644
+--- a/lib/ipmi_lanp.c
++++ b/lib/ipmi_lanp.c
+@@ -245,7 +245,7 @@ get_lan_param_select(struct ipmi_intf *intf, uint8_t chan, 
int param, int select
+                       specific_val2str(rsp->ccode,
+                                        get_lan_cc_vals,
+                                        completion_code_vals));
+-              return NULL;
++              return rc;
+       }
+ 
+       p->data = rsp->data + 1;
diff -Nru ipmitool-1.8.19/debian/patches/0802-fix-temp-read-parameters.patch 
ipmitool-1.8.19/debian/patches/0802-fix-temp-read-parameters.patch
--- ipmitool-1.8.19/debian/patches/0802-fix-temp-read-parameters.patch  
1970-01-01 08:00:00.000000000 +0800
+++ ipmitool-1.8.19/debian/patches/0802-fix-temp-read-parameters.patch  
2024-11-02 14:40:23.000000000 +0800
@@ -0,0 +1,59 @@
+From ab5ce5baff097ebb6e2a17a171858be213ee68d3 Mon Sep 17 00:00:00 2001
+From: Thang Tran <thuut...@amperecomputing.com>
+Date: Tue, 11 Jul 2023 17:27:12 +0700
+Subject: [PATCH] dcmi: update parameters to read temperature sensors
+
+Issue:
+When the system has number of CPU temperature sensors more than 8,
+"ipmitool dcmi get_temp_reading" can not show all of sensors.
+
+Root cause:
+To request to read multiple sensors for each message, ipmitool has to
+send "Get Temperature Readings" command with the "Entity Instance" always
+0 and the "Entity Instance Start" as the offset. But the current code is
+sending "Entity Instance" is offset and "Entity Instance Start" always is
+0. It makes ipmitool only read 1 sensor each time. Besides that, the
+"Entity Instance Start" value starts from 1 (not 0), therefore, the
+initialization has to be set to 1.
+
+Solution:
+This commit corrects the order of parameters and the initialization of
+"Entity Instance Start" byte.
+
+Resolves ipmitool/ipmitool#3
+
+Tested:
+1. Update BMC software to support 24 CPU temperature sensors
+2. Request to read the temperature sensors
+$ipmitool dcmi get_temp_reading
+3. Display full 24 CPU temperature sensors.
+
+Signed-off-by: Thang Tran <thuut...@amperecomputing.com>
+Forwarded: not-needed
+Applied-Upstream: 
https://codeberg.org/IPMITool/ipmitool/commit/ab5ce5baff097ebb6e2a17a171858be213ee68d3
+---
+ lib/ipmi_dcmi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/ipmi_dcmi.c b/lib/ipmi_dcmi.c
+index 8ed87a9..8cf6d66 100644
+--- a/lib/ipmi_dcmi.c
++++ b/lib/ipmi_dcmi.c
+@@ -1595,7 +1595,7 @@ ipmi_dcmi_prnt_get_temp_readings(struct ipmi_intf * intf)
+                       continue;
+               }
+               /* Total number of available instances for the Entity ID */
+-              offset = 0;
++              offset = 1;
+               tota_inst = rsp->data[1];
+               while (tota_inst > 0) {
+                       get_inst = ((tota_inst / DCMI_MAX_BYTE_TEMP_READ_SIZE) ?
+@@ -1603,7 +1603,7 @@ ipmi_dcmi_prnt_get_temp_readings(struct ipmi_intf * intf)
+                                   (tota_inst % DCMI_MAX_BYTE_TEMP_READ_SIZE));
+                       rsp = ipmi_dcmi_get_temp_readings(intf,
+                                                         
dcmi_temp_read_vals[i].val,
+-                                                        offset, 0);
++                                                        0, offset);
+                       if (chk_rsp(rsp)) {
+                               continue;
+                       }
diff -Nru ipmitool-1.8.19/debian/patches/0803-fix-sdr-hex-value.patch 
ipmitool-1.8.19/debian/patches/0803-fix-sdr-hex-value.patch
--- ipmitool-1.8.19/debian/patches/0803-fix-sdr-hex-value.patch 1970-01-01 
08:00:00.000000000 +0800
+++ ipmitool-1.8.19/debian/patches/0803-fix-sdr-hex-value.patch 2024-11-02 
14:40:23.000000000 +0800
@@ -0,0 +1,77 @@
+From 202f7427e0a4d1f319fc4b914676cc2f08da6c6c Mon Sep 17 00:00:00 2001
+From: Alexander Amelkin <alexan...@amelkin.msk.ru>
+Date: Tue, 17 Sep 2024 15:15:45 +0300
+Subject: [PATCH] sdr: Refix 6e037d6bfbbb93b349c8ca331ebde03a (#41)
+
+A bug was introduced by commit 6e037d6bfbbb93b349c8ca331ebde03a837f76bf
+due to which the command `ipmitool sdr type` stopped accepting raw
+hex values for the type and would only accept strings.
+
+Fix that by partially reverting the troublesome commit.
+
+Additionally, apply the logic of that commit to calls of
+`strcasecmp()` in ipmi_sdr.c.
+
+Resolves https://codeberg.org/IPMITool/ipmitool/issues/41
+
+Signed-off-by: Alexander Amelkin <alexan...@amelkin.msk.ru>
+Forwarded: not-needed
+Applied-Upstream: 
https://codeberg.org/IPMITool/ipmitool/commit/202f7427e0a4d1f319fc4b914676cc2f08da6c6c
+---
+ lib/ipmi_sdr.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/lib/ipmi_sdr.c b/lib/ipmi_sdr.c
+index abd4ee1..4732762 100644
+--- a/lib/ipmi_sdr.c
++++ b/lib/ipmi_sdr.c
+@@ -4570,8 +4570,9 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
+       uint8_t sensor_type = 0;
+ 
+       if (!type ||
+-          strcasecmp(type, "help") == 0 ||
+-          strcasecmp(type, "list") == 0) {
++          !strcasecmp(type, "help") ||
++          !strcasecmp(type, "list"))
++      {
+               printf("Sensor Types:\n");
+               for (x = 1; x < SENSOR_TYPE_MAX; x += 2) {
+                       printf("\t%-25s (0x%02x)   %-25s (0x%02x)\n",
+@@ -4581,7 +4582,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
+               return 0;
+       }
+ 
+-      if (!strcmp(type, "0x")) {
++      if (!strncmp(type, "0x", 2)) {
+               /* begins with 0x so let it be entered as raw hex value */
+               if (str2uchar(type, &sensor_type) != 0) {
+                       lprintf(LOG_ERR,
+@@ -4591,7 +4592,7 @@ ipmi_sdr_print_type(struct ipmi_intf *intf, char *type)
+               }
+       } else {
+               for (x = 1; x < SENSOR_TYPE_MAX; x++) {
+-                      if (strcasecmp(sensor_type_desc[x], type) == 0) {
++                      if (!strcasecmp(sensor_type_desc[x], type)) {
+                               sensor_type = x;
+                               break;
+                       }
+@@ -4638,8 +4639,8 @@ ipmi_sdr_print_entity(struct ipmi_intf *intf, char 
*entitystr)
+       int rc = 0;
+ 
+       if (!entitystr ||
+-          strcasecmp(entitystr, "help") == 0 ||
+-          strcasecmp(entitystr, "list") == 0) {
++          !strcasecmp(entitystr, "help") ||
++          !strcasecmp(entitystr, "list")) {
+               print_valstr_2col(entity_id_vals, "Entity IDs", -1);
+               return 0;
+       }
+@@ -4654,7 +4655,7 @@ ipmi_sdr_print_entity(struct ipmi_intf *intf, char 
*entitystr)
+ 
+                       /* now try string input */
+                       for (i = 0; entity_id_vals[i].str; i++) {
+-                              if (strcasecmp(entitystr, 
entity_id_vals[i].str) == 0) {
++                              if (!strcasecmp(entitystr, 
entity_id_vals[i].str)) {
+                                       entity.id = entity_id_vals[i].val;
+                                       entity.instance = 0x7f;
+                                       j=1;
diff -Nru ipmitool-1.8.19/debian/patches/series 
ipmitool-1.8.19/debian/patches/series
--- ipmitool-1.8.19/debian/patches/series       2024-05-17 20:26:20.000000000 
+0800
+++ ipmitool-1.8.19/debian/patches/series       2024-11-02 14:41:15.000000000 
+0800
@@ -5,3 +5,7 @@
 0010-utf8.patch
 0110-unpdate_IANA_URL.patch
 0115-hurd_PATH_MAX.patch
+0800-fix-buffer-overrun.patch
+0801-fix-lan-print-fails-on-unsupported-parameters.patch
+0802-fix-temp-read-parameters.patch
+0803-fix-sdr-hex-value.patch

Reply via email to