Do not append dommainname when to "localhost".
Convert bogus strncat() - no pre-zeroed buffer - to strlcat().