nbd-server: check the right socket variable for an invalid value

The previous check referred to a variable which was used only for
initializing the fd set and wasn't meaningful in the context of the
invalidity check.

Signed-off-by: Tuomas Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: narrow the scope of a function-local variable

It's better to keep variables strictly inside their usage scope than in
more wider scope to avoid unintentional variable shadowing and leaking.

Signed-off-by: Tuomas Räsänen <tuomasjjrasanen@tjjr.fi>
Clarify that we're using tests which expect the serial test protocol

Automake changed its defaults from using the serial protocol to using
the parallel protocol sometime between 1.11 and 1.13.

Our test suite makes a few assumptions which are valid for the serial
protocol, but not for the parallel protocol, which makes the test suite
fail with 1.13. As such, explicitly state that we want the serial
protocol so that things don't break with recent versions of automake.

A proper fix would be to make the test suite work with the parallel
protocol, but that's a lot more work than we have time for right now.
nbd-server: handle modern-style negotiation in a child process

Previously, the modern style negotiation was carried out in the root
server (listener) process before forking the actual client handler. This
made it possible for a malfunctioning or evil client to terminate the
root process simply by querying a non-existent export or aborting in the
middle of the negotation process (caused SIGPIPE in the server).

This commit moves the negotiation process to the child to keep the root
process up and running no matter what happens during the negotiation.

See http://sourceforge.net/mailarchive/message.php?msg_id=30410146

Signed-off-by: Tuomas Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: rename handle_connection() -> handle_oldstyle_connection()

The new name describes better the actual usage.

Remove also the fourth parameter, CLIENT*, which was always NULL.

Signed-off-by: Tuomas Räsänen <tuomasjjrasanen@tjjr.fi>