qemu-e2k/nbd
Eric Blake e68c35cfb8 nbd/server: Refactor zero-length option check
Consolidate the response for a non-zero-length option payload
into a new function, nbd_reject_length().  This check will
also be used when introducing support for structured replies.

Note that STARTTLS response differs based on time: if the connection
is still unencrypted, we set fatal to true (a client that can't
request TLS correctly may still think that we are ready to start
the TLS handshake, so we must disconnect); while if the connection
is already encrypted, the client is sending a bogus request but
is no longer at risk of being confused by continuing the connection.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171027104037.8319-7-eblake@redhat.com>
[eblake: correct return value on STARTTLS]
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
2017-10-30 21:47:18 +01:00
..
Makefile.objs nbd: Split nbd.c 2016-01-15 18:58:02 +01:00
client.c nbd: Move nbd_errno_to_system_errno() to public header 2017-10-30 21:07:21 +01:00
common.c nbd: Expose constants and structs for structured read 2017-10-30 21:07:21 +01:00
nbd-internal.h nbd: Expose constants and structs for structured read 2017-10-30 21:07:21 +01:00
server.c nbd/server: Refactor zero-length option check 2017-10-30 21:47:18 +01:00
trace-events nbd: Move nbd_errno_to_system_errno() to public header 2017-10-30 21:07:21 +01:00