| Summary: | ssh: Could not resolve hostname nohost: Success | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Petr Lautrbach <plautrba> |
| Component: | ssh | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | CLOSED FIXED | ||
| Severity: | enhancement | CC: | djm, dtucker |
| Priority: | P5 | ||
| Version: | 6.2p1 | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Bug Depends on: | |||
| Bug Blocks: | 2076 | ||
Using the suggested patch, the message changes to: $ ssh nohost ssh: Could not resolve hostname nohost: System error seems reasonable to me. applied - will be in 6.3. Thanks! closing resolved bugs as of 8.6p1 release |
When the resolver is not configured properly, ssh shows a "Success" error message: /etc/nsswitch.conf: hosts: files dns xyz $ ssh nohost ssh: Could not resolve hostname nohost: Success The message "Success" doesn't make sense given that it's in fact a system error. It's an issue of ssh_gai_strerror() which can't handle a situation when getaddrinfo() returns EAI_SYSTEM but errno is not set/is set to 0. A potential fix: --- a/misc.c +++ b/misc.c @@ -127,7 +127,7 @@ unset_nonblock(int fd) const char * ssh_gai_strerror(int gaierr) { - if (gaierr == EAI_SYSTEM) + if (gaierr == EAI_SYSTEM && errno != 0) return strerror(errno); return gai_strerror(gaierr); }