Bug 2814 - Connection error should report failure instead of success
Summary: Connection error should report failure instead of success
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 7.6p1
Hardware: All Linux
: P5 minor
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_7_7
  Show dependency treegraph
 
Reported: 2017-12-20 05:38 AEDT by Mike Manning
Modified: 2018-04-06 12:26 AEST (History)
2 users (show)

See Also:


Attachments
Suggested diff (464 bytes, patch)
2017-12-20 05:38 AEDT, Mike Manning
no flags Details | Diff
revised diff (2.21 KB, patch)
2018-01-05 13:27 AEDT, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.