Bug 2814

Summary: Connection error should report failure instead of success
Product: Portable OpenSSH Reporter: Mike Manning <mvrmanning>
Component: sshAssignee: Damien Miller <djm>
Status: CLOSED FIXED    
Severity: minor CC: djm, dtucker
Priority: P5    
Version: 7.6p1   
Hardware: All   
OS: Linux   
Bug Depends on:    
Bug Blocks: 2782    
Attachments:
Description Flags
Suggested diff
none
revised diff dtucker: ok+

Description Mike Manning 2017-12-20 05:38:32 AEDT
Created attachment 3106 [details]
Suggested diff

When the connection fails, the error handling reports success if no errno
was provided, as this defaults to 0 (Success). As this can never be the  
case when an error occurs, instead the output should show a failure.
  
Forced example:
ssh -6 -b 10.0.0.3 vyatta@2000::4
getaddrinfo: 10.0.0.3: Address family for hostname not supported
ssh: connect to host 2000::4 port 22: Success
Comment 1 Damien Miller 2018-01-05 13:27:35 AEDT
Created attachment 3108 [details]
revised diff

Try a bit harder to preserve errno, but print something less wrong if errno==0
Comment 2 Damien Miller 2018-02-23 13:45:30 AEDT
oops, I committed this a while back:

commit 7c77991f5de5d8475cbeb7cbb06d0c7d1611d7bb
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Tue Jan 23 05:17:04 2018 +0000

    upstream commit
    
    try harder to preserve errno during
    ssh_connect_direct() to make the final error message possibly accurate;
    bz#2814, ok dtucker@
    
    OpenBSD-Commit-ID: 57de882cb47381c319b04499fef845dd0c2b46ca
Comment 3 Damien Miller 2018-04-06 12:26:50 AEST
Close all resolved bugs after release of OpenSSH 7.7.