Bug 1162

Summary: Inappropriate sequence of syslog messages
Product: Portable OpenSSH Reporter: senthilkumar <senthilkumar_sen>
Component: sshdAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal    
Priority: P2    
Version: 4.2p1   
Hardware: Other   
OS: All   
Bug Depends on:    
Bug Blocks: 1155    
Attachments:
Description Flags
Patch to fix the Inappropriate sequence of log messages
none
Reorder log statement dtucker: ok+

Description senthilkumar 2006-02-24 16:08:14 AEDT
I came across Inappropriate sequence of syslog messages saying server is listening on desired port when the listen call fails.

Feb 24 12:41:38 ssh-165 sshd[2616]: Server listening on 0.0.0.0 port 1111.
Feb 24 12:41:38 ssh-165 sshd[2616]: fatal: listen: Socket operation on non-socket
Comment 1 senthilkumar 2006-02-24 16:14:11 AEDT
Created attachment 1080 [details]
Patch to fix the Inappropriate sequence of log messages

This behaviour also happens with bind() call and the attached patch fixes the problem.
Comment 2 Darren Tucker 2006-03-08 00:04:47 AEDT
Comment on attachment 1080 [details]
Patch to fix the Inappropriate sequence of log messages

>-                       debug("Bind to port %s on %s.", strport, ntop);

These things are only debugs and are intended to describe what it's about to try
(and thus the source of any immediately subsequent errors).

>-                       logit("Server listening on %s port %s.", ntop, strport);
>                        if (listen(listen_sock, SSH_LISTEN_BACKLOG) &lt; 0)
>                                fatal("listen: %.100s", strerror(errno));
>+                       else
>+                               logit("Server listening on %s port %s.", ntop, strport);

The problem with doing that is that if it fails you now don't know which of the ports that the listen failed on (remember, there can be more than one).
Comment 3 Damien Miller 2006-03-12 15:20:01 AEDT
Created attachment 1096 [details]
Reorder log statement

This is probably better, and simpler
Comment 4 Darren Tucker 2006-03-13 19:13:52 AEDT
Comment on attachment 1096 [details]
Reorder log statement

ok by me
Comment 5 Damien Miller 2006-03-13 19:18:06 AEDT
patch applied, will be in 4.4
Comment 6 Darren Tucker 2006-09-28 19:25:56 AEST
With the release of 4.4, we believe that this bug is now closed.  For information about the release please see http://www.openssh.com/txt/release-4.4 .