From e7e8d0d1415437dcff2c663a2db661bfa50c6991baed0088a02e5bc53b4dbe8d Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Tue, 28 Mar 2017 16:43:34 +0000 Subject: [PATCH] - Update to latest git HEAD version adding quite some fixes (fate##321578) * Add: 0001-fix-typo.patch 0002-added-microTCA-major-version.patch 0003-replaced-removed-defines-which-are-already-present-i.patch 0004-fix-typo.patch 0005-fix-typo.patch 0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch 0007-ID-461-Make-compiler-happier-about-changes-related-t.patch 0008-ID-474-Compile-fix-on-nonlinux-systems.patch 0009-Add-bootstrap-support-for-Mac.patch 0010-Prevent-autoreconf-from-complaining-about-missing-NE.patch 0011-Add-git-hash-and-dirty-mark-to-ipmitool-version.patch 0012-Add-some-more-configure-build-editor-byproducts-to-..patch 0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch 0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch 0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch 0016-Make-git-revision-more-descriptive.patch 0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ipmitool?expand=0&rev=40 --- 0001-fix-typo.patch | 26 ++++ 0002-added-microTCA-major-version.patch | 25 ++++ ...-defines-which-are-already-present-i.patch | 43 ++++++ 0004-fix-typo.patch | 34 +++++ ....1-compatibility-error-storage-size-.patch | 104 +++++++++++++ ...iler-happier-about-changes-related-t.patch | 36 +++++ ...-474-Compile-fix-on-nonlinux-systems.patch | 30 ++++ 0009-Add-bootstrap-support-for-Mac.patch | 30 ++++ ...nalyzer-Fixed-decoding-of-FRU-fields.patch | 141 ++++++++++++++++++ ...r-fix-processing-of-custom-mfg.-fiel.patch | 69 +++++++++ ...ecoding-of-non-text-data-in-get_fru_.patch | 121 +++++++++++++++ ...ool-coredumps-in-EVP_CIPHER_CTX_init.patch | 53 +++++++ ipmitool.changes | 24 +++ ipmitool.spec | 35 ++++- 14 files changed, 767 insertions(+), 4 deletions(-) create mode 100644 0001-fix-typo.patch create mode 100644 0002-added-microTCA-major-version.patch create mode 100644 0003-replaced-removed-defines-which-are-already-present-i.patch create mode 100644 0004-fix-typo.patch create mode 100644 0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch create mode 100644 0007-ID-461-Make-compiler-happier-about-changes-related-t.patch create mode 100644 0008-ID-474-Compile-fix-on-nonlinux-systems.patch create mode 100644 0009-Add-bootstrap-support-for-Mac.patch create mode 100644 0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch create mode 100644 0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch create mode 100644 0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch create mode 100644 0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch diff --git a/0001-fix-typo.patch b/0001-fix-typo.patch new file mode 100644 index 0000000..760b312 --- /dev/null +++ b/0001-fix-typo.patch @@ -0,0 +1,26 @@ +From c6cd49ea37da24d6e0a445845d0e63f2d2256418 Mon Sep 17 00:00:00 2001 +From: Bjoern Spruck +Date: Thu, 1 Sep 2016 11:26:44 +0200 +Subject: [PATCH 01/17] fix typo + +Signed-off-by: Bjoern Spruck +--- + 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 + diff --git a/0002-added-microTCA-major-version.patch b/0002-added-microTCA-major-version.patch new file mode 100644 index 0000000..5c8c480 --- /dev/null +++ b/0002-added-microTCA-major-version.patch @@ -0,0 +1,25 @@ +From 3f7e82a6b4883d49d9836978cfc66c6a9ad63cf4 Mon Sep 17 00:00:00 2001 +From: Bjoern Spruck +Date: Thu, 1 Sep 2016 11:27:10 +0200 +Subject: [PATCH 02/17] added microTCA major version + +Signed-off-by: Bjoern Spruck +--- + 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 + diff --git a/0003-replaced-removed-defines-which-are-already-present-i.patch b/0003-replaced-removed-defines-which-are-already-present-i.patch new file mode 100644 index 0000000..ac40204 --- /dev/null +++ b/0003-replaced-removed-defines-which-are-already-present-i.patch @@ -0,0 +1,43 @@ +From 89cffb984b4dee8edc1740a9837876a2164f8b73 Mon Sep 17 00:00:00 2001 +From: Bjoern Spruck +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 +--- + 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 + #include + +-#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 + diff --git a/0004-fix-typo.patch b/0004-fix-typo.patch new file mode 100644 index 0000000..1e7a825 --- /dev/null +++ b/0004-fix-typo.patch @@ -0,0 +1,34 @@ +From 2cc196d5187657a666787c3c604a614afe6ec74a Mon Sep 17 00:00:00 2001 +From: Bjoern Spruck +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 + diff --git a/0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch b/0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch new file mode 100644 index 0000000..23c6cc9 --- /dev/null +++ b/0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch @@ -0,0 +1,104 @@ +From b57487e360916ab3eaa50aa6d021c73b6337a4a0 Mon Sep 17 00:00:00 2001 +From: Dennis Schridde +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 + diff --git a/0007-ID-461-Make-compiler-happier-about-changes-related-t.patch b/0007-ID-461-Make-compiler-happier-about-changes-related-t.patch new file mode 100644 index 0000000..e047b48 --- /dev/null +++ b/0007-ID-461-Make-compiler-happier-about-changes-related-t.patch @@ -0,0 +1,36 @@ +From 77fe5635037ebaf411cae46cf5045ca819b5c145 Mon Sep 17 00:00:00 2001 +From: Zdenek Styblik +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 + diff --git a/0008-ID-474-Compile-fix-on-nonlinux-systems.patch b/0008-ID-474-Compile-fix-on-nonlinux-systems.patch new file mode 100644 index 0000000..bc064b2 --- /dev/null +++ b/0008-ID-474-Compile-fix-on-nonlinux-systems.patch @@ -0,0 +1,30 @@ +From 5db314f694f75c575cd7c9ffe9ee57aaf3a88866 Mon Sep 17 00:00:00 2001 +From: Leonid Nevecherya +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 . +--- + 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 ++#ifdef HAVE_MALLOC_H ++# include ++#else ++# include ++#endif + #include + + #include +-- +1.8.5.6 + diff --git a/0009-Add-bootstrap-support-for-Mac.patch b/0009-Add-bootstrap-support-for-Mac.patch new file mode 100644 index 0000000..2a04ff5 --- /dev/null +++ b/0009-Add-bootstrap-support-for-Mac.patch @@ -0,0 +1,30 @@ +From e45dc6234bf887fa8356684c13f2468c3041c542 Mon Sep 17 00:00:00 2001 +From: Sergey Kleymenov +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 diff --git a/0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch b/0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch new file mode 100644 index 0000000..ee76683 --- /dev/null +++ b/0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch @@ -0,0 +1,141 @@ +From 840f5730831b0d7cdb976b07e6c9c1aafc86f978 Mon Sep 17 00:00:00 2001 +From: Alexander Amelkin +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 + #include + #include ++#include + + #include + #include +@@ -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 + diff --git a/0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch b/0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch new file mode 100644 index 0000000..5d35a1f --- /dev/null +++ b/0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch @@ -0,0 +1,69 @@ +From 7b0302cef5b7f22bd707f0d07c4098d7a6c57aa6 Mon Sep 17 00:00:00 2001 +From: Alexander Amelkin +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 + diff --git a/0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch b/0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch new file mode 100644 index 0000000..246b5e0 --- /dev/null +++ b/0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch @@ -0,0 +1,121 @@ +From 497f7767cd8e80ad67d08680ae165271441017fc Mon Sep 17 00:00:00 2001 +From: Alexander Amelkin +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> ((k % 2) ? 0 : 4)) & 0x0f)]; + str[k] = '\0'; + break; + + case 2: /* 6-bit ASCII */ +- for (i=j=0; i 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 + diff --git a/0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch b/0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch new file mode 100644 index 0000000..9a8b417 --- /dev/null +++ b/0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch @@ -0,0 +1,53 @@ +From f004b4b7197fc83e7d47ec8cbcaefffa9a922717 Mon Sep 17 00:00:00 2001 +From: Zdenek Styblik +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 + diff --git a/ipmitool.changes b/ipmitool.changes index feecbaa..d3aa40e 100644 --- a/ipmitool.changes +++ b/ipmitool.changes @@ -1,3 +1,27 @@ +------------------------------------------------------------------- +Tue Mar 28 16:41:02 UTC 2017 - trenn@suse.de + +- Update to latest git HEAD version adding quite some fixes (fate##321578) +* Add: +0001-fix-typo.patch +0002-added-microTCA-major-version.patch +0003-replaced-removed-defines-which-are-already-present-i.patch +0004-fix-typo.patch +0005-fix-typo.patch +0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch +0007-ID-461-Make-compiler-happier-about-changes-related-t.patch +0008-ID-474-Compile-fix-on-nonlinux-systems.patch +0009-Add-bootstrap-support-for-Mac.patch +0010-Prevent-autoreconf-from-complaining-about-missing-NE.patch +0011-Add-git-hash-and-dirty-mark-to-ipmitool-version.patch +0012-Add-some-more-configure-build-editor-byproducts-to-..patch +0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch +0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch +0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch +0016-Make-git-revision-more-descriptive.patch +0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch + + ------------------------------------------------------------------- Wed Jan 25 12:23:27 UTC 2017 - felix.gerling@suse.com diff --git a/ipmitool.spec b/ipmitool.spec index e21a402..5ad1d78 100644 --- a/ipmitool.spec +++ b/ipmitool.spec @@ -32,10 +32,24 @@ Release: 0 Source: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2 Source1: ipmievd.service Source2: ipmievd.sysconf -Patch3: fwum_enhance_output.patch -Patch6: fix_file_permissions.patch -Patch8: several_more_compile_fixes.patch -Patch9: ipmitool_adjust_suse.paths +Patch1: 0001-fix-typo.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 +Patch101: fix_file_permissions.patch +Patch102: several_more_compile_fixes.patch +Patch103: ipmitool_adjust_suse.paths + BuildRoot: %{_tmppath}/%{name}-%{version}-build # bmc-snmp-proxy needs /usr/sbin/snmpd @@ -63,10 +77,23 @@ and setting LAN configuration, and chassis power control. %prep %setup -q +%patch1 -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 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 %build touch INSTALL NEWS