diff options
author | trasz <trasz@FreeBSD.org> | 2014-09-09 16:45:36 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-09-09 16:45:36 +0000 |
commit | 7fd1fb1a76aadeb024658f5ce1300d2c0c011e2d (patch) | |
tree | 181f69e295e60e8af1dbd144deedeacf9ff9a768 /usr.sbin | |
parent | 76b4ee1f43bb822285cd012d61cac051cc654f2d (diff) | |
download | FreeBSD-src-7fd1fb1a76aadeb024658f5ce1300d2c0c011e2d.zip FreeBSD-src-7fd1fb1a76aadeb024658f5ce1300d2c0c011e2d.tar.gz |
Fix ctld(8) to not forget to send TargetPortalGroupTag and TargetAlias
when the initiator skips security negotiation. This fixes interoperability
with Xtend SAN initiator.
PR: 193021
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ctld/login.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index ea4b054..5014cba 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -785,7 +785,8 @@ login_negotiate(struct connection *conn, struct pdu *request) struct pdu *response; struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; - int i; + char *portal_group_tag; + int i, rv; bool skipped_security; if (request == NULL) { @@ -806,6 +807,21 @@ login_negotiate(struct connection *conn, struct pdu *request) login_set_csg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); login_set_nsg(response, BHSLR_STAGE_FULL_FEATURE_PHASE); response_keys = keys_new(); + + if (skipped_security && + conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { + if (conn->conn_target->t_alias != NULL) + keys_add(response_keys, + "TargetAlias", conn->conn_target->t_alias); + rv = asprintf(&portal_group_tag, "%d", + conn->conn_portal->p_portal_group->pg_tag); + if (rv <= 0) + log_err(1, "asprintf"); + keys_add(response_keys, + "TargetPortalGroupTag", portal_group_tag); + free(portal_group_tag); + } + for (i = 0; i < KEYS_MAX; i++) { if (request_keys->keys_names[i] == NULL) break; @@ -1069,6 +1085,9 @@ login(struct connection *conn) response_keys = keys_new(); keys_add(response_keys, "AuthMethod", "CHAP"); if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { + if (conn->conn_target->t_alias != NULL) + keys_add(response_keys, + "TargetAlias", conn->conn_target->t_alias); rv = asprintf(&portal_group_tag, "%d", conn->conn_portal->p_portal_group->pg_tag); if (rv <= 0) @@ -1076,9 +1095,6 @@ login(struct connection *conn) keys_add(response_keys, "TargetPortalGroupTag", portal_group_tag); free(portal_group_tag); - if (conn->conn_target->t_alias != NULL) - keys_add(response_keys, - "TargetAlias", conn->conn_target->t_alias); } keys_save(response_keys, response); |