Accepting request 508366 from home:trenn:branches:systemsmanagement

- Update to latest git HEAD revision of 1.8.18 version
  commit ecb4cfbff855bb24099f2a80a6dd558518702c7d
All these patches are now included in one big revision (1.8.18) to
HEAD patch:
D    0001-fix-typo.patch
D    0002-added-microTCA-major-version.patch
D    0003-replaced-removed-defines-which-are-already-present-i.patch
D    0004-fix-typo.patch
D    0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch
D    0007-ID-461-Make-compiler-happier-about-changes-related-t.patch
D    0008-ID-474-Compile-fix-on-nonlinux-systems.patch
D    0009-Add-bootstrap-support-for-Mac.patch
D    0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch
D    0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch
D    0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch
D    0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch
This is the big revision (1.8.18) to HEAD patch:
A    ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch
- Note: the tarball has been generated with git archive from the git
  repo. It slightly differs (.gitignore and configure.ac) from what
  was in osc before. No idea why, but the change is tiny and does not matter.

OBS-URL: https://build.opensuse.org/request/show/508366
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ipmitool?expand=0&rev=44
This commit is contained in:
Thomas Renninger 2017-07-05 14:54:27 +00:00 committed by Git OBS Bridge
parent e423efaf32
commit 3db071d177
18 changed files with 696 additions and 754 deletions

View File

@ -1,26 +0,0 @@
From c6cd49ea37da24d6e0a445845d0e63f2d2256418 Mon Sep 17 00:00:00 2001
From: Bjoern Spruck <bspruck@uni-mainz.de>
Date: Thu, 1 Sep 2016 11:26:44 +0200
Subject: [PATCH 01/17] fix typo
Signed-off-by: Bjoern Spruck <bspruck@uni-mainz.de>
---
include/ipmitool/ipmi_sel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/ipmitool/ipmi_sel.h b/include/ipmitool/ipmi_sel.h
index 1c325db..ab8eaa9 100644
--- a/include/ipmitool/ipmi_sel.h
+++ b/include/ipmitool/ipmi_sel.h
@@ -580,7 +580,7 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
{ 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
- /* PICNG Moduke Hot Swap */
+ /* PICMG Module Hot Swap */
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
{ 0xF2, 0x02, 0xff, "Quiesced" },
--
1.8.5.6

View File

@ -1,25 +0,0 @@
From 3f7e82a6b4883d49d9836978cfc66c6a9ad63cf4 Mon Sep 17 00:00:00 2001
From: Bjoern Spruck <bspruck@uni-mainz.de>
Date: Thu, 1 Sep 2016 11:27:10 +0200
Subject: [PATCH 02/17] added microTCA major version
Signed-off-by: Bjoern Spruck <bspruck@uni-mainz.de>
---
include/ipmitool/ipmi_picmg.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/ipmitool/ipmi_picmg.h b/include/ipmitool/ipmi_picmg.h
index 3d70454..0bcbd93 100644
--- a/include/ipmitool/ipmi_picmg.h
+++ b/include/ipmitool/ipmi_picmg.h
@@ -12,6 +12,7 @@
#define PICMG_CPCI_MAJOR_VERSION 1
#define PICMG_ATCA_MAJOR_VERSION 2
#define PICMG_AMC_MAJOR_VERSION 4
+#define PICMG_UTCA_MAJOR_VERSION 5
/* PICMG commands */
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
--
1.8.5.6

View File

@ -1,43 +0,0 @@
From 89cffb984b4dee8edc1740a9837876a2164f8b73 Mon Sep 17 00:00:00 2001
From: Bjoern Spruck <bspruck@uni-mainz.de>
Date: Thu, 1 Sep 2016 11:27:38 +0200
Subject: [PATCH 03/17] replaced/removed defines which are already present in
ipmi_picmg.h
Signed-off-by: Bjoern Spruck <bspruck@uni-mainz.de>
---
lib/ipmi_picmg.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c
index c7d9c8e..2166cbe 100644
--- a/lib/ipmi_picmg.c
+++ b/lib/ipmi_picmg.c
@@ -37,11 +37,6 @@
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/log.h>
-#define PICMG_EXTENSION_ATCA_MAJOR_VERSION 2
-#define PICMG_EXTENSION_AMC0_MAJOR_VERSION 4
-#define PICMG_EXTENSION_UTCA_MAJOR_VERSION 5
-
-
#define PICMG_EKEY_MODE_QUERY 0
#define PICMG_EKEY_MODE_PRINT_ALL 1
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
@@ -2367,9 +2362,9 @@ picmg_discover(struct ipmi_intf *intf) {
} else if (rsp->data[0] != 0) {
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
rsp->data[0]);
- } else if ((rsp->data[1] & 0x0F) != PICMG_EXTENSION_ATCA_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_AMC0_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_UTCA_MAJOR_VERSION) {
+ } else if ((rsp->data[1] & 0x0F) != PICMG_ATCA_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_AMC_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_UTCA_MAJOR_VERSION) {
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
} else {
--
1.8.5.6

View File

@ -1,34 +0,0 @@
From 2cc196d5187657a666787c3c604a614afe6ec74a Mon Sep 17 00:00:00 2001
From: Bjoern Spruck <bspruck@uni-mainz.de>
Date: Tue, 6 Sep 2016 16:31:11 +0200
Subject: [PATCH 04/17] fix typo
---
include/ipmitool/ipmi_sel.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/ipmitool/ipmi_sel.h b/include/ipmitool/ipmi_sel.h
index ab8eaa9..a6a2a42 100644
--- a/include/ipmitool/ipmi_sel.h
+++ b/include/ipmitool/ipmi_sel.h
@@ -579,7 +579,7 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
{ 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
- { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
+ { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMB-B enabled" },
/* PICMG Module Hot Swap */
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
@@ -599,7 +599,7 @@ static const struct ipmi_event_sensor_types vita_sensor_event_types[] = {
{ 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
{ 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
- { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" },
+ { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMB-B enabled" },
/* VITA FRU Temperature */
{ 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
{ 0xF3, 0x01, 0xff, "At or below Lower Critical" },
--
1.8.5.6

View File

@ -1,104 +0,0 @@
From b57487e360916ab3eaa50aa6d021c73b6337a4a0 Mon Sep 17 00:00:00 2001
From: Dennis Schridde <dennis.schridde@uni-heidelberg.de>
Date: Wed, 30 Nov 2016 17:33:00 +0100
Subject: [PATCH 06/17] ID:461 - OpenSSL 1.1 compatibility - "error: storage
size of 'ctx' isn't known"
In OpenSSL 1.1 EVP_CIPHER_CTX became opaque, cf. `man 3ssl EVP_EncryptInit`
Fixes: ID:461
---
src/plugins/lanplus/lanplus_crypt_impl.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
index d5fac37..3c0df23 100644
--- a/src/plugins/lanplus/lanplus_crypt_impl.c
+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
@@ -164,10 +164,10 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
+ EVP_CIPHER_CTX* ctx;
+ EVP_CIPHER_CTX_init(ctx);
+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
*bytes_written = 0;
@@ -191,7 +191,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
- if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
+ if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
{
/* Error */
*bytes_written = 0;
@@ -201,7 +201,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
{
uint32_t tmplen;
- if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
+ if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
{
*bytes_written = 0;
return; /* Error */
@@ -210,7 +210,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
{
/* Success */
*bytes_written += tmplen;
- EVP_CIPHER_CTX_cleanup(&ctx);
+ EVP_CIPHER_CTX_cleanup(ctx);
}
}
}
@@ -239,10 +239,10 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
+ EVP_CIPHER_CTX* ctx;
+ EVP_CIPHER_CTX_init(ctx);
+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
if (verbose >= 5)
@@ -266,7 +266,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
- if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
+ if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
{
/* Error */
lprintf(LOG_DEBUG, "ERROR: decrypt update failed");
@@ -277,7 +277,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
{
uint32_t tmplen;
- if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
+ if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
{
char buffer[1000];
ERR_error_string(ERR_get_error(), buffer);
@@ -290,7 +290,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
{
/* Success */
*bytes_written += tmplen;
- EVP_CIPHER_CTX_cleanup(&ctx);
+ EVP_CIPHER_CTX_cleanup(ctx);
}
}
--
1.8.5.6

View File

@ -1,36 +0,0 @@
From 77fe5635037ebaf411cae46cf5045ca819b5c145 Mon Sep 17 00:00:00 2001
From: Zdenek Styblik <stybla@turnovfree.net>
Date: Sun, 15 Jan 2017 15:11:25 +0100
Subject: [PATCH 07/17] ID:461 - Make compiler happier about changes related to
OpenSSL 1.1
Complaint was that ctx isn't initialized.
---
src/plugins/lanplus/lanplus_crypt_impl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
index 3c0df23..d12d0e3 100644
--- a/src/plugins/lanplus/lanplus_crypt_impl.c
+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
@@ -164,7 +164,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX* ctx;
+ EVP_CIPHER_CTX *ctx = NULL;
EVP_CIPHER_CTX_init(ctx);
EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
EVP_CIPHER_CTX_set_padding(ctx, 0);
@@ -239,7 +239,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX* ctx;
+ EVP_CIPHER_CTX *ctx = NULL;
EVP_CIPHER_CTX_init(ctx);
EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
EVP_CIPHER_CTX_set_padding(ctx, 0);
--
1.8.5.6

View File

@ -1,30 +0,0 @@
From 5db314f694f75c575cd7c9ffe9ee57aaf3a88866 Mon Sep 17 00:00:00 2001
From: Leonid Nevecherya <nevecherya@gmail.com>
Date: Tue, 17 Jan 2017 11:00:37 +0300
Subject: [PATCH 08/17] ID:474 - Compile fix on nonlinux systems
This patch fixes compilation on systems without a separate <malloc.h>.
---
lib/ipmi_cfgp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/ipmi_cfgp.c b/lib/ipmi_cfgp.c
index b8af80d..dfc4743 100644
--- a/lib/ipmi_cfgp.c
+++ b/lib/ipmi_cfgp.c
@@ -30,7 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <malloc.h>
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
+#else
+# include <stdlib.h>
+#endif
#include <string.h>
#include <ipmitool/helper.h>
--
1.8.5.6

View File

@ -1,30 +0,0 @@
From e45dc6234bf887fa8356684c13f2468c3041c542 Mon Sep 17 00:00:00 2001
From: Sergey Kleymenov <sergeykleymenov@gmail.com>
Date: Thu, 19 Mar 2015 08:31:53 +0300
Subject: [PATCH 09/17] Add bootstrap support for Mac
---
bootstrap | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: ipmitool-1.8.18/bootstrap
===================================================================
--- ipmitool-1.8.18.orig/bootstrap 2017-03-28 18:26:08.841325593 +0200
+++ ipmitool-1.8.18/bootstrap 2017-03-28 18:32:36.955472419 +0200
@@ -31,7 +31,15 @@
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
aclocal
-libtoolize --automake --copy
+
+case `uname` in
+ Darwin*)
+ glibtoolize --automake --copy
+ ;;
+ *)
+ libtoolize --automake --copy
+ ;;
+esac
autoheader
automake --foreign --add-missing --copy

View File

@ -1,141 +0,0 @@
From 840f5730831b0d7cdb976b07e6c9c1aafc86f978 Mon Sep 17 00:00:00 2001
From: Alexander Amelkin <alexander@amelkin.msk.ru>
Date: Mon, 23 Jan 2017 12:47:35 +0300
Subject: [PATCH 13/17] ID:478 - ekanalyzer: Fixed decoding of FRU fields
Got rid of the field decoding code that was only capable of
processing ASCII and binary fields, and switched to using
get_fru_area_str() that can also decode BCDplus and 6-bit ASCII
and maybe will eventually be enabled to decode Unicode text
as well.
This is the first step to completely get rid of the completely
awfully written FRU data decoding functionality of ekanalyzer
that essentially duplicates that of ipmi_fru.c module.
---
include/ipmitool/ipmi_fru.h | 1 +
lib/ipmi_ekanalyzer.c | 50 ++++++++++++++++++++++++---------------------
2 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/include/ipmitool/ipmi_fru.h b/include/ipmitool/ipmi_fru.h
index 65696ba..d03abfc 100644
--- a/include/ipmitool/ipmi_fru.h
+++ b/include/ipmitool/ipmi_fru.h
@@ -614,5 +614,6 @@ typedef struct ipmi_fru_bloc {
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);
+char *get_fru_area_str(uint8_t *data, uint32_t *offset);
#endif /* IPMI_FRU_H */
diff --git a/lib/ipmi_ekanalyzer.c b/lib/ipmi_ekanalyzer.c
index 7a6c63d..35aa850 100644
--- a/lib/ipmi_ekanalyzer.c
+++ b/lib/ipmi_ekanalyzer.c
@@ -37,6 +37,7 @@
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_strings.h>
+#include <ipmitool/ipmi_fru.h>
#include <stdlib.h>
#include <string.h>
@@ -2702,6 +2703,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
file_offset = ftell(input_file);
+ /*
+ * TODO: This whole file's code is extremely dirty and wicked.
+ * Must eventually switch to using ipmi_fru.c code or some
+ * specialized FRU library.
+ */
+
/* Board length*/
ret = fread(&len, 1, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
@@ -2717,14 +2724,15 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
goto out;
}
if (strncmp(board_type, "Custom", 6 ) != 0) {
- unsigned char *data;
+ unsigned char *data, *str;
unsigned int i = 0;
- data = malloc(size_board);
+ data = malloc(size_board + 1); /* Make room for type/length field */
if (data == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return (size_t)(-1);
}
- ret = fread(data, size_board, 1, input_file);
+ data[0] = len; /* Save the type/length byte in 'data' */
+ ret = fread(data + 1, size_board, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
lprintf(LOG_ERR, "Invalid board type size!");
free(data);
@@ -2733,17 +2741,11 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
printf("%s type: 0x%02x\n", board_type, len);
printf("%s: ", board_type);
- for (i = 0; i < size_board; i++) {
- if ((len & TYPE_CODE) == TYPE_CODE) {
- printf("%c", data[i]);
- } else {
- /* other than language code (binary, BCD,
- * ASCII 6 bit...) is not supported
- */
- printf("%02x", data[i]);
- }
- }
- printf("\n");
+ i = 0;
+ str = (unsigned char *)get_fru_area_str(data, &i);
+ printf("%s\n", str);
+ free(str);
+ str = NULL;
free(data);
data = NULL;
(*board_length) -= size_board;
@@ -2772,14 +2774,15 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
printf("Additional Custom Mfg. length: 0x%02x\n", len);
if ((size_board > 0) && (size_board < (*board_length))) {
- unsigned char * additional_data = NULL;
+ unsigned char *additional_data, *str;
unsigned int i = 0;
- additional_data = malloc(size_board);
+ additional_data = malloc(size_board + 1); /* Make room for type/length field */
if (additional_data == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return (size_t)(-1);
}
- ret = fread(additional_data, size_board, 1, input_file);
+ additional_data[0] = len;
+ ret = fread(additional_data + 1, size_board, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
lprintf(LOG_ERR, "Invalid Additional Data!");
if (additional_data != NULL) {
@@ -2788,14 +2791,15 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
goto out;
}
- printf("Additional Custom Mfg. Data: %02x",
- additional_data[0]);
- for (i = 1; i < size_board; i++) {
- printf("-%02x", additional_data[i]);
- }
- printf("\n");
+ printf("Additional Custom Mfg. Data: ");
+ i = 0;
+ str = (unsigned char *)get_fru_area_str(additional_data, &i);
+ printf("%s\n", str);
+ free(str);
+ str = NULL;
free(additional_data);
additional_data = NULL;
+
(*board_length) -= size_board;
}
else {
--
1.8.5.6

View File

@ -1,69 +0,0 @@
From 7b0302cef5b7f22bd707f0d07c4098d7a6c57aa6 Mon Sep 17 00:00:00 2001
From: Alexander Amelkin <alexander@amelkin.msk.ru>
Date: Tue, 24 Jan 2017 14:09:57 +0300
Subject: [PATCH 14/17] ID:479 - ekanalyzer: fix processing of custom mfg.
fields
Ekanalyzer was not reading the type/length byte for the 2nd and
subsequent custom fields. Also the message it displayed when
lacked data for custom fields was very relaxing and incorrect.
---
lib/ipmi_ekanalyzer.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/lib/ipmi_ekanalyzer.c b/lib/ipmi_ekanalyzer.c
index 35aa850..f6d8b90 100644
--- a/lib/ipmi_ekanalyzer.c
+++ b/lib/ipmi_ekanalyzer.c
@@ -2697,6 +2697,7 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
int ret = 0;
unsigned char len = 0;
unsigned int size_board = 0;
+ int custom_fields = 0;
if (input_file == NULL || board_type == NULL
|| board_length == NULL) {
return (size_t)(-1);
@@ -2758,7 +2759,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
/* take the rest of data in the area minus 1 byte of
* checksum
*/
- printf("Additional Custom Mfg. length: 0x%02x\n", len);
+ if (custom_fields) {
+ printf("End of Custom Mfg. fields (0x%02x)\n", len);
+ } else {
+ printf("No Additional Custom Mfg. fields (0x%02x)\n", len);
+ }
+
padding = (*board_length) - 1;
if ((padding > 0) && (!feof(input_file))) {
printf("Unused space: %d (bytes)\n", padding);
@@ -2772,6 +2778,7 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
printf("Checksum: 0x%02x\n", checksum);
goto out;
}
+ custom_fields++;
printf("Additional Custom Mfg. length: 0x%02x\n", len);
if ((size_board > 0) && (size_board < (*board_length))) {
unsigned char *additional_data, *str;
@@ -2801,9 +2808,17 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
additional_data = NULL;
(*board_length) -= size_board;
+ ret = fread(&len, 1, 1, input_file);
+ if ((ret != 1) || ferror(input_file)) {
+ lprintf(LOG_ERR, "Invalid Length!");
+ goto out;
+ }
+ (*board_length)--;
+ size_board = (len & 0x3f);
}
else {
- printf("No Additional Custom Mfg. %d\n", *board_length);
+ printf("ERROR: File has insufficient data (%d bytes) for the "
+ "Additional Custom Mfg. field\n", *board_length);
goto out;
}
}
--
1.8.5.6

View File

@ -1,121 +0,0 @@
From 497f7767cd8e80ad67d08680ae165271441017fc Mon Sep 17 00:00:00 2001
From: Alexander Amelkin <alexander@amelkin.msk.ru>
Date: Thu, 2 Feb 2017 15:25:44 +0300
Subject: [PATCH 15/17] ID:477 - fru: Fix decoding of non-text data in
get_fru_area_str()
The get_fru_area_str() function is used to decode FRU area
fields into text. Areas may be encoded as text, binary,
BCDplus or 6-bit ASCII. Decoding of 6-bit ASCII and BCDplus
was broken. There was an error in the formulas used to
calculate the resulting string length, plus the decoding
formulas for BCDplus was wrong.
For BCDplus the resulting length was considered equal
the encoded data length, while in fact it's twice as big.
Only one character instead of two was being extracted from
a single input byte while two nibbles must have been taken
into account.
For 6-bit ASCII rounding of 3 to 4 bytes conversion was done
improperly adding 2 to the original length instead of the
result of multiplication.
---
lib/ipmi_fru.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c
index cf00eff..42c1f19 100644
--- a/lib/ipmi_fru.c
+++ b/lib/ipmi_fru.c
@@ -107,7 +107,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
{
static const char bcd_plus[] = "0123456789 -.:,_";
char * str;
- int len, off, size, i, j, k, typecode;
+ int len, off, size, i, j, k, typecode, char_idx;
union {
uint32_t bits;
char chars[4];
@@ -126,15 +126,15 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
switch (typecode) {
case 0: /* 00b: binary/unspecified */
- /* hex dump -> 2x length */
- size = (len*2);
+ case 1: /* 01b: BCD plus */
+ /* hex dump or BCD -> 2x length */
+ size = (len * 2);
break;
case 2: /* 10b: 6-bit ASCII */
/* 4 chars per group of 1-3 bytes */
- size = ((((len+2)*4)/3) & ~3);
+ size = (((len * 4 + 2) / 3) & ~3);
break;
case 3: /* 11b: 8-bit ASCII */
- case 1: /* 01b: BCD plus */
/* no length adjustment */
size = len;
break;
@@ -149,7 +149,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
return NULL;
memset(str, 0, size+1);
- if (len == 0) {
+ if (size == 0) {
str[0] = '\0';
*offset = off;
return str;
@@ -157,30 +157,30 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
switch (typecode) {
case 0: /* Binary */
- strncpy(str, buf2str(&data[off], len), len*2);
+ strncpy(str, buf2str(&data[off], len), size);
break;
case 1: /* BCD plus */
- for (k=0; k<len; k++)
- str[k] = bcd_plus[(data[off+k] & 0x0f)];
+ for (k = 0; k < size; k++)
+ str[k] = bcd_plus[((data[off + k / 2] >> ((k % 2) ? 0 : 4)) & 0x0f)];
str[k] = '\0';
break;
case 2: /* 6-bit ASCII */
- for (i=j=0; i<len; i+=3) {
+ for (i = j = 0; i < len; i += 3) {
u.bits = 0;
- k = ((len-i) < 3 ? (len-i) : 3);
+ k = ((len - i) < 3 ? (len - i) : 3);
#if WORDS_BIGENDIAN
u.chars[3] = data[off+i];
u.chars[2] = (k > 1 ? data[off+i+1] : 0);
u.chars[1] = (k > 2 ? data[off+i+2] : 0);
-#define CHAR_IDX 3
+ char_idx = 3;
#else
memcpy((void *)&u.bits, &data[off+i], k);
-#define CHAR_IDX 0
+ char_idx = 0;
#endif
for (k=0; k<4; k++) {
- str[j++] = ((u.chars[CHAR_IDX] & 0x3f) + 0x20);
+ str[j++] = ((u.chars[char_idx] & 0x3f) + 0x20);
u.bits >>= 6;
}
}
@@ -188,8 +188,8 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
break;
case 3:
- memcpy(str, &data[off], len);
- str[len] = '\0';
+ memcpy(str, &data[off], size);
+ str[size] = '\0';
break;
}
--
1.8.5.6

View File

@ -1,53 +0,0 @@
From f004b4b7197fc83e7d47ec8cbcaefffa9a922717 Mon Sep 17 00:00:00 2001
From: Zdenek Styblik <stybla@turnovfree.net>
Date: Sun, 12 Mar 2017 14:00:35 +0100
Subject: [PATCH 17/17] ID:480 - ipmitool coredumps in EVP_CIPHER_CTX_init
IPMI tool coredumps due to changes introduced in ID:461. This shouldn't be
surprise as a NULL pointer is passed to init. Commit addresses this issue by
calling EVP_CIPHER_CTX_new() instead of EVP_CIPHER_CTX_init(), which is
deprecated, and by checking return value of call to former function.
---
src/plugins/lanplus/lanplus_crypt_impl.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
index d12d0e3..0e330c1 100644
--- a/src/plugins/lanplus/lanplus_crypt_impl.c
+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
@@ -165,10 +165,13 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
uint32_t * bytes_written)
{
EVP_CIPHER_CTX *ctx = NULL;
- EVP_CIPHER_CTX_init(ctx);
+ ctx = EVP_CIPHER_CTX_new();
+ if (ctx == NULL) {
+ *bytes_written = 0;
+ return;
+ }
EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
EVP_CIPHER_CTX_set_padding(ctx, 0);
-
*bytes_written = 0;
@@ -240,11 +243,14 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
uint32_t * bytes_written)
{
EVP_CIPHER_CTX *ctx = NULL;
- EVP_CIPHER_CTX_init(ctx);
+ ctx = EVP_CIPHER_CTX_new();
+ if (ctx == NULL) {
+ *bytes_written = 0;
+ return;
+ }
EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
EVP_CIPHER_CTX_set_padding(ctx, 0);
-
if (verbose >= 5)
{
printbuf(iv, 16, "decrypting with this IV");
--
1.8.5.6

View File

@ -2,11 +2,11 @@ Signed-off-by: Thomas Renninger <trenn@suse.com>
bsc#948540 bsc#948540
Index: ipmitool-1.8.15/lib/hpm2.c Index: ipmitool-1.8.18/lib/hpm2.c
=================================================================== ===================================================================
--- ipmitool-1.8.15.orig/lib/hpm2.c 2015-11-24 14:07:57.250760494 +0100 --- ipmitool-1.8.18.orig/lib/hpm2.c 2016-10-08 10:17:55.000000000 +0200
+++ ipmitool-1.8.15/lib/hpm2.c 2015-11-24 14:09:02.590470690 +0100 +++ ipmitool-1.8.18/lib/hpm2.c 2017-07-05 16:04:42.438268644 +0200
@@ -93,7 +93,7 @@ int hpm2_get_capabilities(struct ipmi_in @@ -99,7 +99,7 @@ int hpm2_get_capabilities(struct ipmi_in
lprintf(LOG_DEBUG, "IPM Controller is not HPM.2 compatible"); lprintf(LOG_DEBUG, "IPM Controller is not HPM.2 compatible");
return rsp->ccode; return rsp->ccode;
} else if (rsp->ccode) { } else if (rsp->ccode) {

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:0c1ba3b1555edefb7c32ae8cd6a3e04322056bc087918f07189eeedfc8b81e01 oid sha256:2238d8e6ab9340165918e65e04bfee4b5070635d8821d7c13d3a7aaeb9f25c29
size 795278 size 486341

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Wed Jul 5 14:07:41 UTC 2017 - trenn@suse.de
- Update to latest git HEAD revision of 1.8.18 version
commit ecb4cfbff855bb24099f2a80a6dd558518702c7d
All these patches are now included in one big revision (1.8.18) to
HEAD patch:
D 0001-fix-typo.patch
D 0002-added-microTCA-major-version.patch
D 0003-replaced-removed-defines-which-are-already-present-i.patch
D 0004-fix-typo.patch
D 0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch
D 0007-ID-461-Make-compiler-happier-about-changes-related-t.patch
D 0008-ID-474-Compile-fix-on-nonlinux-systems.patch
D 0009-Add-bootstrap-support-for-Mac.patch
D 0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch
D 0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch
D 0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch
D 0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch
This is the big revision (1.8.18) to HEAD patch:
A ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch
- Note: the tarball has been generated with git archive from the git
repo. It slightly differs (.gitignore and configure.ac) from what
was in osc before. No idea why, but the change is tiny and does not matter.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 28 15:22:39 UTC 2017 - trenn@suse.de Fri Apr 28 15:22:39 UTC 2017 - trenn@suse.de

View File

@ -32,18 +32,7 @@ Release: 0
Source: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2 Source: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2
Source1: ipmievd.service Source1: ipmievd.service
Source2: ipmievd.sysconf Source2: ipmievd.sysconf
Patch1: 0001-fix-typo.patch Patch0: ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch
Patch2: 0002-added-microTCA-major-version.patch
Patch3: 0003-replaced-removed-defines-which-are-already-present-i.patch
Patch4: 0004-fix-typo.patch
Patch5: 0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch
Patch6: 0007-ID-461-Make-compiler-happier-about-changes-related-t.patch
Patch7: 0008-ID-474-Compile-fix-on-nonlinux-systems.patch
Patch8: 0009-Add-bootstrap-support-for-Mac.patch
Patch9: 0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch
Patch10: 0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch
Patch11: 0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch
Patch12: 0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch
Patch100: fwum_enhance_output.patch Patch100: fwum_enhance_output.patch
Patch101: fix_file_permissions.patch Patch101: fix_file_permissions.patch
@ -78,18 +67,7 @@ and setting LAN configuration, and chassis power control.
%prep %prep
%setup -q %setup -q
%patch1 -p1 %patch0 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch100 -p1 %patch100 -p1
%patch101 -p1 %patch101 -p1

View File

@ -0,0 +1,649 @@
diff --git a/.gitignore b/.gitignore
index 5b8cb0a..58ca89e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,30 @@
+.deps
+.libs
+*.o
+*.lo
+*.la
+*.*~
+Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
+config.h
config.h.in
+config.log
+config.status
config.sub
configure
depcomp
install-sh
ltmain.sh
+libtool
missing
+stamp-h1
+control/ipmitool.spec
+control/pkginfo
+control/prototype
+control/rpmmacros
+src/ipmievd
+src/ipmitool
diff --git a/bootstrap b/bootstrap
index 6347427..c38b12b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -31,7 +31,15 @@
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
aclocal
-libtoolize --automake --copy
+
+case `uname` in
+ Darwin*)
+ glibtoolize --automake --copy
+ ;;
+ *)
+ libtoolize --automake --copy
+ ;;
+esac
autoheader
automake --foreign --add-missing --copy
diff --git a/configure.ac b/configure.ac
index 88232a6..ad1657d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,11 @@
dnl
dnl autoconf for ipmitool
dnl
-AC_INIT([ipmitool], [1.8.18-csv])
+m4_define([git_suffix], m4_esyscmd_s(./csv-revision))
+AC_INIT([ipmitool], [1.8.18git_suffix])
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.50)
AC_SUBST(ac_configure_args)
diff --git a/csv-revision b/csv-revision
new file mode 100755
index 0000000..289c133
--- /dev/null
+++ b/csv-revision
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+git describe --first-parent --tags 2>/dev/null | (
+ IFS=- read tag rev hash
+ if [ $? ] && [ -n "$rev" ]; then
+ echo .$rev.$hash
+ elif [ -d .git ]; then
+ echo .0.gsnapshot
+ fi
+)
diff --git a/include/ipmitool/ipmi_fru.h b/include/ipmitool/ipmi_fru.h
index 65696ba..d03abfc 100644
--- a/include/ipmitool/ipmi_fru.h
+++ b/include/ipmitool/ipmi_fru.h
@@ -614,5 +614,6 @@ typedef struct ipmi_fru_bloc {
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);
+char *get_fru_area_str(uint8_t *data, uint32_t *offset);
#endif /* IPMI_FRU_H */
diff --git a/include/ipmitool/ipmi_picmg.h b/include/ipmitool/ipmi_picmg.h
index 3d70454..0bcbd93 100644
--- a/include/ipmitool/ipmi_picmg.h
+++ b/include/ipmitool/ipmi_picmg.h
@@ -12,6 +12,7 @@
#define PICMG_CPCI_MAJOR_VERSION 1
#define PICMG_ATCA_MAJOR_VERSION 2
#define PICMG_AMC_MAJOR_VERSION 4
+#define PICMG_UTCA_MAJOR_VERSION 5
/* PICMG commands */
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
diff --git a/include/ipmitool/ipmi_sel.h b/include/ipmitool/ipmi_sel.h
index 1c325db..a6a2a42 100644
--- a/include/ipmitool/ipmi_sel.h
+++ b/include/ipmitool/ipmi_sel.h
@@ -579,8 +579,8 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
{ 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
- { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
- /* PICNG Moduke Hot Swap */
+ { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMB-B enabled" },
+ /* PICMG Module Hot Swap */
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
{ 0xF2, 0x02, 0xff, "Quiesced" },
@@ -599,7 +599,7 @@ static const struct ipmi_event_sensor_types vita_sensor_event_types[] = {
{ 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
{ 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
{ 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
- { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" },
+ { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMB-B enabled" },
/* VITA FRU Temperature */
{ 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
{ 0xF3, 0x01, 0xff, "At or below Lower Critical" },
diff --git a/lib/ipmi_cfgp.c b/lib/ipmi_cfgp.c
index b8af80d..dfc4743 100644
--- a/lib/ipmi_cfgp.c
+++ b/lib/ipmi_cfgp.c
@@ -30,7 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <malloc.h>
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
+#else
+# include <stdlib.h>
+#endif
#include <string.h>
#include <ipmitool/helper.h>
diff --git a/lib/ipmi_ekanalyzer.c b/lib/ipmi_ekanalyzer.c
index 7a6c63d..f6d8b90 100644
--- a/lib/ipmi_ekanalyzer.c
+++ b/lib/ipmi_ekanalyzer.c
@@ -37,6 +37,7 @@
#include <ipmitool/log.h>
#include <ipmitool/helper.h>
#include <ipmitool/ipmi_strings.h>
+#include <ipmitool/ipmi_fru.h>
#include <stdlib.h>
#include <string.h>
@@ -2696,12 +2697,19 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
int ret = 0;
unsigned char len = 0;
unsigned int size_board = 0;
+ int custom_fields = 0;
if (input_file == NULL || board_type == NULL
|| board_length == NULL) {
return (size_t)(-1);
}
file_offset = ftell(input_file);
+ /*
+ * TODO: This whole file's code is extremely dirty and wicked.
+ * Must eventually switch to using ipmi_fru.c code or some
+ * specialized FRU library.
+ */
+
/* Board length*/
ret = fread(&len, 1, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
@@ -2717,14 +2725,15 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
goto out;
}
if (strncmp(board_type, "Custom", 6 ) != 0) {
- unsigned char *data;
+ unsigned char *data, *str;
unsigned int i = 0;
- data = malloc(size_board);
+ data = malloc(size_board + 1); /* Make room for type/length field */
if (data == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return (size_t)(-1);
}
- ret = fread(data, size_board, 1, input_file);
+ data[0] = len; /* Save the type/length byte in 'data' */
+ ret = fread(data + 1, size_board, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
lprintf(LOG_ERR, "Invalid board type size!");
free(data);
@@ -2733,17 +2742,11 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
printf("%s type: 0x%02x\n", board_type, len);
printf("%s: ", board_type);
- for (i = 0; i < size_board; i++) {
- if ((len & TYPE_CODE) == TYPE_CODE) {
- printf("%c", data[i]);
- } else {
- /* other than language code (binary, BCD,
- * ASCII 6 bit...) is not supported
- */
- printf("%02x", data[i]);
- }
- }
- printf("\n");
+ i = 0;
+ str = (unsigned char *)get_fru_area_str(data, &i);
+ printf("%s\n", str);
+ free(str);
+ str = NULL;
free(data);
data = NULL;
(*board_length) -= size_board;
@@ -2756,7 +2759,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
/* take the rest of data in the area minus 1 byte of
* checksum
*/
- printf("Additional Custom Mfg. length: 0x%02x\n", len);
+ if (custom_fields) {
+ printf("End of Custom Mfg. fields (0x%02x)\n", len);
+ } else {
+ printf("No Additional Custom Mfg. fields (0x%02x)\n", len);
+ }
+
padding = (*board_length) - 1;
if ((padding > 0) && (!feof(input_file))) {
printf("Unused space: %d (bytes)\n", padding);
@@ -2770,16 +2778,18 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
printf("Checksum: 0x%02x\n", checksum);
goto out;
}
+ custom_fields++;
printf("Additional Custom Mfg. length: 0x%02x\n", len);
if ((size_board > 0) && (size_board < (*board_length))) {
- unsigned char * additional_data = NULL;
+ unsigned char *additional_data, *str;
unsigned int i = 0;
- additional_data = malloc(size_board);
+ additional_data = malloc(size_board + 1); /* Make room for type/length field */
if (additional_data == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
return (size_t)(-1);
}
- ret = fread(additional_data, size_board, 1, input_file);
+ additional_data[0] = len;
+ ret = fread(additional_data + 1, size_board, 1, input_file);
if ((ret != 1) || ferror(input_file)) {
lprintf(LOG_ERR, "Invalid Additional Data!");
if (additional_data != NULL) {
@@ -2788,18 +2798,27 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
}
goto out;
}
- printf("Additional Custom Mfg. Data: %02x",
- additional_data[0]);
- for (i = 1; i < size_board; i++) {
- printf("-%02x", additional_data[i]);
- }
- printf("\n");
+ printf("Additional Custom Mfg. Data: ");
+ i = 0;
+ str = (unsigned char *)get_fru_area_str(additional_data, &i);
+ printf("%s\n", str);
+ free(str);
+ str = NULL;
free(additional_data);
additional_data = NULL;
+
(*board_length) -= size_board;
+ ret = fread(&len, 1, 1, input_file);
+ if ((ret != 1) || ferror(input_file)) {
+ lprintf(LOG_ERR, "Invalid Length!");
+ goto out;
+ }
+ (*board_length)--;
+ size_board = (len & 0x3f);
}
else {
- printf("No Additional Custom Mfg. %d\n", *board_length);
+ printf("ERROR: File has insufficient data (%d bytes) for the "
+ "Additional Custom Mfg. field\n", *board_length);
goto out;
}
}
diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c
index cf00eff..42c1f19 100644
--- a/lib/ipmi_fru.c
+++ b/lib/ipmi_fru.c
@@ -107,7 +107,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
{
static const char bcd_plus[] = "0123456789 -.:,_";
char * str;
- int len, off, size, i, j, k, typecode;
+ int len, off, size, i, j, k, typecode, char_idx;
union {
uint32_t bits;
char chars[4];
@@ -126,15 +126,15 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
switch (typecode) {
case 0: /* 00b: binary/unspecified */
- /* hex dump -> 2x length */
- size = (len*2);
+ case 1: /* 01b: BCD plus */
+ /* hex dump or BCD -> 2x length */
+ size = (len * 2);
break;
case 2: /* 10b: 6-bit ASCII */
/* 4 chars per group of 1-3 bytes */
- size = ((((len+2)*4)/3) & ~3);
+ size = (((len * 4 + 2) / 3) & ~3);
break;
case 3: /* 11b: 8-bit ASCII */
- case 1: /* 01b: BCD plus */
/* no length adjustment */
size = len;
break;
@@ -149,7 +149,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
return NULL;
memset(str, 0, size+1);
- if (len == 0) {
+ if (size == 0) {
str[0] = '\0';
*offset = off;
return str;
@@ -157,30 +157,30 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
switch (typecode) {
case 0: /* Binary */
- strncpy(str, buf2str(&data[off], len), len*2);
+ strncpy(str, buf2str(&data[off], len), size);
break;
case 1: /* BCD plus */
- for (k=0; k<len; k++)
- str[k] = bcd_plus[(data[off+k] & 0x0f)];
+ for (k = 0; k < size; k++)
+ str[k] = bcd_plus[((data[off + k / 2] >> ((k % 2) ? 0 : 4)) & 0x0f)];
str[k] = '\0';
break;
case 2: /* 6-bit ASCII */
- for (i=j=0; i<len; i+=3) {
+ for (i = j = 0; i < len; i += 3) {
u.bits = 0;
- k = ((len-i) < 3 ? (len-i) : 3);
+ k = ((len - i) < 3 ? (len - i) : 3);
#if WORDS_BIGENDIAN
u.chars[3] = data[off+i];
u.chars[2] = (k > 1 ? data[off+i+1] : 0);
u.chars[1] = (k > 2 ? data[off+i+2] : 0);
-#define CHAR_IDX 3
+ char_idx = 3;
#else
memcpy((void *)&u.bits, &data[off+i], k);
-#define CHAR_IDX 0
+ char_idx = 0;
#endif
for (k=0; k<4; k++) {
- str[j++] = ((u.chars[CHAR_IDX] & 0x3f) + 0x20);
+ str[j++] = ((u.chars[char_idx] & 0x3f) + 0x20);
u.bits >>= 6;
}
}
@@ -188,8 +188,8 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
break;
case 3:
- memcpy(str, &data[off], len);
- str[len] = '\0';
+ memcpy(str, &data[off], size);
+ str[size] = '\0';
break;
}
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c
index c7d9c8e..2166cbe 100644
--- a/lib/ipmi_picmg.c
+++ b/lib/ipmi_picmg.c
@@ -37,11 +37,6 @@
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/log.h>
-#define PICMG_EXTENSION_ATCA_MAJOR_VERSION 2
-#define PICMG_EXTENSION_AMC0_MAJOR_VERSION 4
-#define PICMG_EXTENSION_UTCA_MAJOR_VERSION 5
-
-
#define PICMG_EKEY_MODE_QUERY 0
#define PICMG_EKEY_MODE_PRINT_ALL 1
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
@@ -2367,9 +2362,9 @@ picmg_discover(struct ipmi_intf *intf) {
} else if (rsp->data[0] != 0) {
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
rsp->data[0]);
- } else if ((rsp->data[1] & 0x0F) != PICMG_EXTENSION_ATCA_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_AMC0_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_UTCA_MAJOR_VERSION) {
+ } else if ((rsp->data[1] & 0x0F) != PICMG_ATCA_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_AMC_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_UTCA_MAJOR_VERSION) {
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
} else {
diff --git a/lib/ipmi_sdr.c b/lib/ipmi_sdr.c
index 2a9cbe3..167c252 100644
--- a/lib/ipmi_sdr.c
+++ b/lib/ipmi_sdr.c
@@ -4217,7 +4217,7 @@ ipmi_sdr_get_info(struct ipmi_intf *intf,
* returns pointer to static buffer
*/
static char *
-ipmi_sdr_timestamp(uint32_t stamp)
+ipmi_sdr_timestamp(time_t stamp)
{
static char tbuf[40];
time_t s = (time_t) stamp;
@@ -4240,7 +4240,7 @@ ipmi_sdr_timestamp(uint32_t stamp)
int
ipmi_sdr_print_info(struct ipmi_intf *intf)
{
- uint32_t timestamp;
+ time_t timestamp;
uint16_t free_space;
struct get_sdr_repository_info_rsp sdr_repository_info;
@@ -4274,21 +4274,51 @@ ipmi_sdr_print_info(struct ipmi_intf *intf)
break;
}
- timestamp =
- (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
- (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
- (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
- sdr_repository_info.most_recent_addition_timestamp[0];
- printf("Most recent Addition : %s\n",
- ipmi_sdr_timestamp(timestamp));
-
- timestamp =
- (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
- (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
- (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
- sdr_repository_info.most_recent_erase_timestamp[0];
- printf("Most recent Erase : %s\n",
- ipmi_sdr_timestamp(timestamp));
+ if(sdr_repository_info.delete_sdr_supported && sdr_repository_info.partial_add_sdr_supported)
+ {
+ timestamp =
+ (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
+ (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
+ (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
+ sdr_repository_info.most_recent_addition_timestamp[0];
+ printf("Most recent Addition : %s\n",
+ ipmi_sdr_timestamp(timestamp));
+
+ timestamp =
+ (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
+ (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
+ (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
+ sdr_repository_info.most_recent_erase_timestamp[0];
+ printf("Most recent Erase : %s\n",
+ ipmi_sdr_timestamp(timestamp));
+ }
+ else if (sdr_repository_info.partial_add_sdr_supported)
+ {
+ timestamp =
+ (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
+ (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
+ (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
+ sdr_repository_info.most_recent_addition_timestamp[0];
+ printf("Most recent Addition : %s\n",
+ ipmi_sdr_timestamp(timestamp));
+ printf("Most recent Erase : NA\n");
+ }
+ else if(sdr_repository_info.delete_sdr_supported)
+ {
+ printf("Most recent Addition : NA\n");
+ timestamp =
+ (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
+ (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
+ (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
+ sdr_repository_info.most_recent_erase_timestamp[0];
+ printf("Most recent Erase : %s\n",
+ ipmi_sdr_timestamp(timestamp));
+ }
+ else
+ {
+ printf("Most recent Addition : NA\n");
+ printf("Most recent Erase : NA\n");
+ }
printf("SDR overflow : %s\n",
(sdr_repository_info.overflow_flag ? "yes" : "no"));
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
index d5fac37..9652a5e 100644
--- a/src/plugins/lanplus/lanplus_crypt_impl.c
+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
@@ -164,11 +164,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
-
+ EVP_CIPHER_CTX *ctx = NULL;
*bytes_written = 0;
@@ -182,6 +178,14 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
printbuf(input, input_length, "encrypting this data");
}
+ ctx = EVP_CIPHER_CTX_new();
+ if (ctx == NULL) {
+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
+ return;
+ }
+ EVP_CIPHER_CTX_init(ctx);
+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
/*
* The default implementation adds a whole block of padding if the input
@@ -191,28 +195,28 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
- if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
+ if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
{
/* Error */
*bytes_written = 0;
- return;
}
else
{
uint32_t tmplen;
- if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
+ if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
{
+ /* Error */
*bytes_written = 0;
- return; /* Error */
}
else
{
/* Success */
*bytes_written += tmplen;
- EVP_CIPHER_CTX_cleanup(&ctx);
}
}
+ /* performs cleanup and free */
+ EVP_CIPHER_CTX_free(ctx);
}
@@ -239,11 +243,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
uint8_t * output,
uint32_t * bytes_written)
{
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
-
+ EVP_CIPHER_CTX *ctx = NULL;
if (verbose >= 5)
{
@@ -252,12 +252,20 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
printbuf(input, input_length, "decrypting this data");
}
-
*bytes_written = 0;
if (input_length == 0)
return;
+ ctx = EVP_CIPHER_CTX_new();
+ if (ctx == NULL) {
+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
+ return;
+ }
+ EVP_CIPHER_CTX_init(ctx);
+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
+
/*
* The default implementation adds a whole block of padding if the input
* data is perfectly aligned. We would like to keep that from happening.
@@ -266,33 +274,33 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
- if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
+ if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
{
/* Error */
lprintf(LOG_DEBUG, "ERROR: decrypt update failed");
*bytes_written = 0;
- return;
}
else
{
uint32_t tmplen;
- if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
+ if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
{
+ /* Error */
char buffer[1000];
ERR_error_string(ERR_get_error(), buffer);
lprintf(LOG_DEBUG, "the ERR error %s", buffer);
lprintf(LOG_DEBUG, "ERROR: decrypt final failed");
*bytes_written = 0;
- return; /* Error */
}
else
{
/* Success */
*bytes_written += tmplen;
- EVP_CIPHER_CTX_cleanup(&ctx);
}
}
+ /* performs cleanup and free */
+ EVP_CIPHER_CTX_free(ctx);
if (verbose >= 5)
{

View File

@ -4,11 +4,11 @@ Changes partly very old and not possible to find the original author.
Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Thomas Renninger <trenn@suse.de>
Index: ipmitool-1.8.17/lib/ipmi_ekanalyzer.c Index: ipmitool-1.8.18/lib/ipmi_ekanalyzer.c
=================================================================== ===================================================================
--- ipmitool-1.8.17.orig/lib/ipmi_ekanalyzer.c 2016-05-01 10:03:39.000000000 +0200 --- ipmitool-1.8.18.orig/lib/ipmi_ekanalyzer.c 2017-07-05 16:04:30.733605009 +0200
+++ ipmitool-1.8.17/lib/ipmi_ekanalyzer.c 2016-05-03 14:09:46.242458958 +0200 +++ ipmitool-1.8.18/lib/ipmi_ekanalyzer.c 2017-07-05 16:04:33.905784815 +0200
@@ -3980,7 +3980,7 @@ ipmi_ek_display_clock_config_record(stru @@ -4010,7 +4010,7 @@ ipmi_ek_display_clock_config_record(stru
(feature & 1) ? "Source" : "Receiver"); (feature & 1) ? "Source" : "Receiver");
printf("\tFamily: 0x%02x - AccLVL: 0x%02x\n", printf("\tFamily: 0x%02x - AccLVL: 0x%02x\n",
family, accuracy); family, accuracy);
@ -17,11 +17,11 @@ Index: ipmitool-1.8.17/lib/ipmi_ekanalyzer.c
freq, min_freq, max_freq); freq, min_freq, max_freq);
} }
printf("\n"); printf("\n");
Index: ipmitool-1.8.17/lib/ipmi_picmg.c Index: ipmitool-1.8.18/lib/ipmi_picmg.c
=================================================================== ===================================================================
--- ipmitool-1.8.17.orig/lib/ipmi_picmg.c 2016-05-01 10:03:39.000000000 +0200 --- ipmitool-1.8.18.orig/lib/ipmi_picmg.c 2017-07-05 16:04:30.737605232 +0200
+++ ipmitool-1.8.17/lib/ipmi_picmg.c 2016-05-03 14:09:46.250459411 +0200 +++ ipmitool-1.8.18/lib/ipmi_picmg.c 2017-07-05 16:04:33.905784815 +0200
@@ -855,7 +855,7 @@ ipmi_picmg_portstate_get(struct ipmi_int @@ -850,7 +850,7 @@ ipmi_picmg_portstate_get(struct ipmi_int
} }
else if (d->type >= 0x06 && d->type <= 0xef) else if (d->type >= 0x06 && d->type <= 0xef)
{ {
@ -30,7 +30,7 @@ Index: ipmitool-1.8.17/lib/ipmi_picmg.c
} }
else if (d->type >= 0xf0 && d->type <= 0xfe) else if (d->type >= 0xf0 && d->type <= 0xfe)
{ {
@@ -1707,7 +1707,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * in @@ -1702,7 +1702,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * in
oemval2str( rsp->data[3], rsp->data[4], oemval2str( rsp->data[3], rsp->data[4],
picmg_clk_accuracy_vals)); picmg_clk_accuracy_vals));
@ -39,10 +39,10 @@ Index: ipmitool-1.8.17/lib/ipmi_picmg.c
} }
} }
} }
Index: ipmitool-1.8.17/lib/ipmi_sdr.c Index: ipmitool-1.8.18/lib/ipmi_sdr.c
=================================================================== ===================================================================
--- ipmitool-1.8.17.orig/lib/ipmi_sdr.c 2016-05-01 10:03:39.000000000 +0200 --- ipmitool-1.8.18.orig/lib/ipmi_sdr.c 2017-07-05 16:04:30.741605453 +0200
+++ ipmitool-1.8.17/lib/ipmi_sdr.c 2016-05-03 14:09:46.258459865 +0200 +++ ipmitool-1.8.18/lib/ipmi_sdr.c 2017-07-05 16:04:33.909785056 +0200
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include <ipmitool/ipmi_entity.h> #include <ipmitool/ipmi_entity.h>
#include <ipmitool/ipmi_constants.h> #include <ipmitool/ipmi_constants.h>