- Fixup formatting of invalid VPD pages (bnc#884779) Add: sg3_utils-Fixup-formatting-of-invalid-VPD-page-0x83.patch - sg_inq: Do not export long identifiers (bnc#884779) Add: sg3_utils-Do-not-export-long-identifiers.patch OBS-URL: https://build.opensuse.org/request/show/247421 OBS-URL: https://build.opensuse.org/package/show/Base:System/sg3_utils?expand=0&rev=44
91 lines
3.5 KiB
Diff
91 lines
3.5 KiB
Diff
From c76bfccf5497b11644425e2020f3b9b1bad59142 Mon Sep 17 00:00:00 2001
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
Date: Wed, 3 Sep 2014 15:26:42 +0200
|
|
Subject: [PATCH 1/2] Fixup formatting of invalid VPD page 0x83
|
|
|
|
Some target present invalid VPD page 0x83 descriptors.
|
|
This patch fixes up sg_inq and sg_vpd to skip those descriptors.
|
|
|
|
References: bnc#884779
|
|
|
|
Signed-of-by: Hannes Reinecke <hare@suse.de>
|
|
---
|
|
src/sg_inq.c | 12 +++++++++++-
|
|
src/sg_vpd.c | 16 +++++++++++++++-
|
|
2 files changed, 26 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/sg_inq.c b/src/sg_inq.c
|
|
index 473d212..a78960f 100644
|
|
--- a/src/sg_inq.c
|
|
+++ b/src/sg_inq.c
|
|
@@ -1512,7 +1512,7 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
|
|
switch (desig_type) {
|
|
case 0: /* vendor specific */
|
|
k = 0;
|
|
- if ((1 == c_set) || (2 == c_set)) { /* ASCII or UTF-8 */
|
|
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
|
|
for (k = 0; (k < i_len) && isprint(ip[k]); ++k)
|
|
;
|
|
if (k >= i_len)
|
|
@@ -1965,6 +1965,16 @@ export_dev_ids(unsigned char * buff, int len, int verbose)
|
|
}
|
|
break;
|
|
}
|
|
+ if (strncmp((const char *)ip, "eui.", 4) ||
|
|
+ strncmp((const char *)ip, "naa.", 4) ||
|
|
+ strncmp((const char *)ip, "iqn.", 4)) {
|
|
+ if (verbose) {
|
|
+ pr2serr(" << expected name string prefix>>\n");
|
|
+ dStrHexErr((const char *)ip, i_len, -1);
|
|
+ }
|
|
+ break;
|
|
+ }
|
|
+
|
|
printf("SCSI_IDENT_%s_NAME=%.*s\n", assoc_str, i_len,
|
|
(const char *)ip);
|
|
break;
|
|
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
|
|
index a69b3ec..2f97e94 100644
|
|
--- a/src/sg_vpd.c
|
|
+++ b/src/sg_vpd.c
|
|
@@ -1115,6 +1115,13 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
|
|
dStrHexErr((const char *)ip, i_len, 0);
|
|
break;
|
|
}
|
|
+ if (strncmp((const char *)ip, "eui.", 4) ||
|
|
+ strncmp((const char *)ip, "naa.", 4) ||
|
|
+ strncmp((const char *)ip, "iqn.", 4)) {
|
|
+ pr2serr(" << expected name string prefix>>\n");
|
|
+ dStrHexErr((const char *)ip, i_len, -1);
|
|
+ break;
|
|
+ }
|
|
/* does %s print out UTF-8 ok??
|
|
* Seems to depend on the locale. Looks ok here with my
|
|
* locale setting: en_AU.UTF-8
|
|
@@ -1162,7 +1169,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
|
|
switch (desig_type) {
|
|
case 0: /* vendor specific */
|
|
k = 0;
|
|
- if ((1 == c_set) || (2 == c_set)) { /* ASCII or UTF-8 */
|
|
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
|
|
for (k = 0; (k < i_len) && isprint(ip[k]); ++k)
|
|
;
|
|
if (k >= i_len)
|
|
@@ -1405,6 +1412,13 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
|
|
dStrHexErr((const char *)ip, i_len, 0);
|
|
break;
|
|
}
|
|
+ if (strncmp((const char *)ip, "eui.", 4) ||
|
|
+ strncmp((const char *)ip, "naa.", 4) ||
|
|
+ strncmp((const char *)ip, "iqn.", 4)) {
|
|
+ pr2serr(" << expected name string prefix>>\n");
|
|
+ dStrHexErr((const char *)ip, i_len, -1);
|
|
+ break;
|
|
+ }
|
|
printf(" SCSI name string:\n");
|
|
/* does %s print out UTF-8 ok??
|
|
* Seems to depend on the locale. Looks ok here with my
|
|
--
|
|
1.8.4.5
|
|
|