ssh: Be more paranoid with host/domain names coming from the
never write a name with bad characters to a known_hosts file.
replace recently-added valid_domain() check for hostnames going to
known_hosts with a more relaxed check for bad characters.
Obtained from: OpenSSH-portable commit 445363433ba2
Obtained from: OpenSSH-portable commit 3cae9f92a318
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 2e828220579e3ada74ed0613871ec6ec61d669ba)
(cherry picked from commit 6ad91c17b0555f0d28377f66fb9f7c8b4cee2b06)