Prevent rDNS spoofing and refuse long hostnames

Finish the thing I thought I finished

Enforce limits on host and ident length

It's somewhat more performant without the if test in both situations, when it passes and when it fails

Fix that magic number

Handle exception thrown by gethostbyname

Remove newline and fix import order