File open-iscsi-fix-sysfs-get-value-null of Package open-iscsi

Handle nulls from sysfs, for recent kernels.

Sysfs in recent kernels returns "(null)" instead of "<NULL>",
handle that. Such "(null)" strings from sysfs as mapped to
NULL values.

Lack of this check, caused a non-existant password to be read as
"(null)" and treated as a valid and present password, and so,
AuthMethod=CHAP was used for a relogin.

References: bnc #683249,656119
---
 usr/iscsi_sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/usr/iscsi_sysfs.c
===================================================================
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -41,7 +41,6 @@
 #define ISCSI_SESSION_DIR	"/sys/class/iscsi_session"
 #define ISCSI_HOST_DIR		"/sys/class/iscsi_host"
 
-#define ISCSI_SYSFS_INVALID_VALUE	"<NULL>"
 #define ISCSI_SESSION_SUBSYS		"iscsi_session"
 #define ISCSI_CONN_SUBSYS		"iscsi_connection"
 #define ISCSI_HOST_SUBSYS		"iscsi_host"
@@ -85,7 +84,8 @@ static int iscsi_sysfs_get_param(char *i
 		return EIO;
 	}
 
-	if (!strncmp(sysfs_value, ISCSI_SYSFS_INVALID_VALUE, 6))
+	if (!strncmp(sysfs_value, "<NULL>", 6) ||
+		!strncmp(sysfs_value, "(null)", 6))
 		return ENODATA;
 
 	sscanf(sysfs_value, format, ret_value);
openSUSE Build Service is sponsored by