Proposed Client-Server interaction
==================================

Requirements and Limitations
----------------------------
- The front end must be able to efficiently read exactly enough bytes to
  get the entire header and leave all of the following data unread.  No
  seeks are possible.
- None of the command arguments may contain NULs, but they may contain
  any other data.
- Some commands need to send and receive arbitrary length binary data.
- It should not be possible to create a memory overuse through over
  large data in the protocol.
- The command header data (command name, etc) will be small (typically
  less than 1K).  In fact, it will almost always be smaller than 256
  bytes, but that is not guaranteed.

Command Header
--------------
Size	Type	Description
1	int	Protocol number (always 3)
2	int	Command header length
                (number of bytes between this length and the end of arguments)
varies	zstring	Command name
varies	zstring	Domain name
varies	zstring	Virtual user name
varies	zstring	Pass phrase
1	int	Argument count
varies	zstring	Command arguments

The command name, domain name, and pass phrase are passed to an
authenticating shim which executes the command only if authentication
succeeds.  The command arguments are passed on the command line to the
command module after authentication, and the command data following the
arguments is passed on standard input.  This data will be used, for
example, for the autoresponse message.

Response
--------
Size	Type	Description
1	int	Response code: one of the following
		0: OK -- operation succeeded
		1: Bad -- error in format or syntax
		2: Autherr -- authentication failed
		3: Error -- operation failed
varies	zstring	Response message
varies	N/A	Response data (optional)

Data types
----------
A "zstring" is a NUL terminated string

The command header is limited to 64K in length, primarily to limit the
possibility of attacks causing excessive memory allocation.

All integers are unsigned, sent MSB first.
