From 017cbe4aaac40cd14a1eca02df1c4880ec11e272 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Tue, 11 Feb 2014 10:58:32 +0000 Subject: [PATCH] Empty data segment during Login Phase is rather unlikely, but it's not, by itself, a protocol error. This fixes interoperability with OpenBSD initiator. Sponsored by: The FreeBSD Foundation --- usr.sbin/ctld/discovery.c | 3 --- usr.sbin/ctld/keys.c | 2 +- usr.sbin/ctld/login.c | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/usr.sbin/ctld/discovery.c b/usr.sbin/ctld/discovery.c index bef7da69bbb0..f5727bd14f62 100644 --- a/usr.sbin/ctld/discovery.c +++ b/usr.sbin/ctld/discovery.c @@ -61,9 +61,6 @@ text_receive(struct connection *conn) */ if ((bhstr->bhstr_flags & BHSTR_FLAGS_CONTINUE) != 0) log_errx(1, "received Text PDU with unsupported \"C\" flag"); - if (request->pdu_data_len == 0) - log_errx(1, "received Text PDU with empty data segment"); - if (ntohl(bhstr->bhstr_cmdsn) < conn->conn_cmdsn) { log_errx(1, "received Text PDU with decreasing CmdSN: " "was %d, is %d", conn->conn_cmdsn, ntohl(bhstr->bhstr_cmdsn)); diff --git a/usr.sbin/ctld/keys.c b/usr.sbin/ctld/keys.c index 0ea4aa0ae3bd..1474bd3fbb8c 100644 --- a/usr.sbin/ctld/keys.c +++ b/usr.sbin/ctld/keys.c @@ -64,7 +64,7 @@ keys_load(struct keys *keys, const struct pdu *pdu) size_t pair_len; if (pdu->pdu_data_len == 0) - log_errx(1, "protocol error: empty data segment"); + return; if (pdu->pdu_data[pdu->pdu_data_len - 1] != '\0') log_errx(1, "protocol error: key not NULL-terminated\n"); diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index b528fc0feaeb..758138f1a8d8 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -128,10 +128,6 @@ login_receive(struct connection *conn, bool initial) log_errx(1, "received Login PDU with unsupported " "Version-min 0x%x", bhslr->bhslr_version_min); } - if (request->pdu_data_len == 0) { - login_send_error(request, 0x02, 0x00); - log_errx(1, "received Login PDU with empty data segment"); - } if (ntohl(bhslr->bhslr_cmdsn) < conn->conn_cmdsn) { login_send_error(request, 0x02, 0x05); log_errx(1, "received Login PDU with decreasing CmdSN: "