Skip to content

Commit e52b904

Browse files
logostmartinkpetersen
authored andcommitted
scsi: target: iscsi: Allow AuthMethod=None
Allow negotiating AuthMethod=None at CSG=0 (Security Negotiation) when authentication is not required. That is required by the CHAP test in Windows HLK. 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 1e57338 commit e52b904

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

drivers/target/iscsi/iscsi_target_login.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static int iscsi_login_zero_tsih_s2(
341341
{
342342
struct iscsi_node_attrib *na;
343343
struct iscsit_session *sess = conn->sess;
344+
struct iscsi_param *param;
344345
bool iser = false;
345346

346347
sess->tpg = conn->tpg;
@@ -374,6 +375,18 @@ static int iscsi_login_zero_tsih_s2(
374375

375376
na = iscsit_tpg_get_node_attrib(sess);
376377

378+
/*
379+
* If ACL allows non-authorized access in TPG with CHAP,
380+
* then set None to AuthMethod.
381+
*/
382+
param = iscsi_find_param_from_key(AUTHMETHOD, conn->param_list);
383+
if (param && !strstr(param->value, NONE)) {
384+
if (!iscsi_conn_auth_required(conn))
385+
if (iscsi_change_param_sprintf(conn, "AuthMethod=%s",
386+
NONE))
387+
return -1;
388+
}
389+
377390
/*
378391
* Need to send TargetPortalGroupTag back in first login response
379392
* on any iSCSI connection where the Initiator provides TargetName.

drivers/target/iscsi/iscsi_target_nego.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ static int iscsi_target_do_authentication(
814814
return 0;
815815
}
816816

817-
static bool iscsi_conn_auth_required(struct iscsit_conn *conn)
817+
bool iscsi_conn_auth_required(struct iscsit_conn *conn)
818818
{
819819
struct iscsi_node_acl *nacl;
820820
struct se_node_acl *se_nacl;

drivers/target/iscsi/iscsi_target_nego.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ extern int iscsi_target_locate_portal(struct iscsi_np *, struct iscsit_conn *,
2222
extern int iscsi_target_start_negotiation(
2323
struct iscsi_login *, struct iscsit_conn *);
2424
extern void iscsi_target_nego_release(struct iscsit_conn *);
25-
25+
extern bool iscsi_conn_auth_required(struct iscsit_conn *conn);
2626
#endif /* ISCSI_TARGET_NEGO_H */

0 commit comments

Comments
 (0)