Skip to content

Commit 292cef5

Browse files
logostmartinkpetersen
authored andcommitted
scsi: target: iscsi: Do not require target authentication
RFC7143 states that Initiator decides what type of authentication to use: The initiator MUST continue with: CHAP_N=<N> CHAP_R=<R> or, if it requires target authentication, with: CHAP_N=<N> CHAP_R=<R> CHAP_I=<I> CHAP_C=<C> Allow one way authentication if mutual authentication is configured. That passes some tests from Windows HLK for Mutual CHAP with iSNS. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Dmitry Bogdanov <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e52b904 commit 292cef5

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

drivers/target/iscsi/iscsi_target_auth.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,13 @@ static int chap_server_compute_hash(
416416
/*
417417
* Get CHAP_I.
418418
*/
419-
if (extract_param(nr_in_ptr, "CHAP_I", 10, identifier, &type) < 0) {
419+
ret = extract_param(nr_in_ptr, "CHAP_I", 10, identifier, &type);
420+
if (ret == -ENOENT) {
421+
pr_debug("Could not find CHAP_I. Initiator uses One way authentication.\n");
422+
auth_ret = 0;
423+
goto out;
424+
}
425+
if (ret < 0) {
420426
pr_err("Could not find CHAP_I.\n");
421427
goto out;
422428
}

drivers/target/iscsi/iscsi_target_nego.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ int extract_param(
6262
int len;
6363

6464
if (!in_buf || !pattern || !out_buf || !type)
65-
return -1;
65+
return -EINVAL;
6666

6767
ptr = strstr(in_buf, pattern);
6868
if (!ptr)
69-
return -1;
69+
return -ENOENT;
7070

7171
ptr = strstr(ptr, "=");
7272
if (!ptr)
73-
return -1;
73+
return -EINVAL;
7474

7575
ptr += 1;
7676
if (*ptr == '0' && (*(ptr+1) == 'x' || *(ptr+1) == 'X')) {
@@ -84,12 +84,12 @@ int extract_param(
8484

8585
len = strlen_semi(ptr);
8686
if (len < 0)
87-
return -1;
87+
return -EINVAL;
8888

8989
if (len >= max_length) {
9090
pr_err("Length of input: %d exceeds max_length:"
9191
" %d\n", len, max_length);
92-
return -1;
92+
return -EINVAL;
9393
}
9494
memcpy(out_buf, ptr, len);
9595
out_buf[len] = '\0';

0 commit comments

Comments
 (0)