Bug 1261

Summary: Timed out command through ControlMaster yields 0 return value.
Product: Portable OpenSSH Reporter: Frederik Holljen <frekko>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm
Priority: P2    
Version: 4.4p1   
Hardware: ix86   
OS: Linux   
Bug Depends on:    
Bug Blocks: 1289    
Attachments:
Description Flags
don't return success when master exits unexpectedly none

Description Frederik Holljen 2006-11-13 21:32:52 AEDT
Start a ControlMaster to some server like this:
ssh -xo ControlMaster=yes -o ServerAliveInterval=1 -o ServerAliveCountMax=1 10.0.0.21 "while [ 1 ]; do sleep 10; done" 

Then start some other command through the ControlMaster like this:
ssh -xo ControlMaster=no -o ServerAliveInterval=1 -o ServerAliveCountMax=1 10.0.0.21  "while [ 1 ]; do sleep 10; done"

Now pull the plug on the server (10.0.0.21 in this case).
Both clients quit after one second. However, the controlmaster client will exit with exit status 255 while the other client exits with exitv status 0. 

If I understand the man page correctly they should both have exited with exit status 255.
Comment 1 Damien Miller 2007-01-22 13:45:13 AEDT
Created attachment 1229 [details]
don't return success when master exits unexpectedly

Thanks - this is a bug in ssh. It does not initialise its return value when acting as a ControlMaster client and the master process exits unexpecedly. The attached patch makes a control client return 255 when it does not receive an explicit return value from the master.
Comment 2 Damien Miller 2007-06-12 21:11:29 AEST
fix has been committed and will be in openssh-4.7 - thanks!
Comment 3 Damien Miller 2008-04-04 09:57:16 AEDT
Close resolved bugs after release.