dax: Fix potentially slow logins

Noticed entries like

    [2014-04-25 12:15:45 +0100] 3085  handle_request: <IP ADDR> /login/
    (POST), 19645ms

in the dax/access.log. Notice the time it took to login, nearly 20
seconds!

Site and server were idle at the time, no load. The problem was caused
by the reverse DNS lookup we do to translate the client IP address into
a hostname. We store both the IP address and hostname (if there is one)
of the requesting client in the utmp table. This is used in the
'Last login' line we display. Also having both the IP address _and_
hostname provides a better audit trail.

Normally this should only take a fraction of a second. However in this
case we were getting a 2(SERVFAIL) after a timeout. Likely something
misconfigured at the client end. If there was just no PTR record then
we'd get a 3(NXDOMAIN) pretty quickly.

Seeing as there is no need to delay the login just to get the hostname,
we can do the IP->hostname lookup in a thread which will do the lookup
and update the utmp table accordingly based on the clients session id.

We move the hostname lookup out of log_login() and into a thread routine
log_utmp_host() which is created from log_login. This allows the login to
complete right away and the utmp table is updated asynchronously.

Signed-off-by: Andrew Clayton <andrew@dnsandmx.com>