blob: 28c3f27900e52400a1ee2eeb493b5b4d4ae1d746 [file] [log] [blame]
From 28ea5c8521ee53cbb8c2294d5e2315a3a2951fee Mon Sep 17 00:00:00 2001
From: David Disseldorp <>
Date: Thu, 12 Sep 2019 11:55:45 +0200
Subject: [PATCH] scsi: target: compare full CHAP_A Algorithm strings
commit 9cef2a7955f2754257a7cddedec16edae7b587d0 upstream.
RFC 2307 states:
For CHAP [RFC1994], in the first step, the initiator MUST send:
Where A1,A2... are proposed algorithms, in order of preference.
For the Algorithm, as stated in [RFC1994], one value is required to
be implemented:
5 (CHAP with MD5)
LIO currently checks for this value by only comparing a single byte in
the tokenized Algorithm string, which means that any value starting with
a '5' (e.g. "55") is interpreted as "CHAP with MD5". Fix this by
comparing the entire tokenized string.
Reviewed-by: Lee Duncan <>
Reviewed-by: Mike Christie <>
Signed-off-by: David Disseldorp <>
Signed-off-by: Martin K. Petersen <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
index 51ddca2033e0..8fe9b12a07a4 100644
--- a/drivers/target/iscsi/iscsi_target_auth.c
+++ b/drivers/target/iscsi/iscsi_target_auth.c
@@ -70,7 +70,7 @@ static int chap_check_algorithm(const char *a_str)
if (!token)
goto out;
- if (!strncmp(token, "5", 1)) {
+ if (!strcmp(token, "5")) {
pr_debug("Selected MD5 Algorithm\n");