Skip to content
  • Eric Blake's avatar
    e68c35cf
    nbd/server: Refactor zero-length option check · e68c35cf
    Eric Blake authored
    
    
    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: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20171027104037.8319-7-eblake@redhat.com>
    [eblake: correct return value on STARTTLS]
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    e68c35cf
    nbd/server: Refactor zero-length option check
    Eric Blake authored
    
    
    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: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20171027104037.8319-7-eblake@redhat.com>
    [eblake: correct return value on STARTTLS]
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Loading