Bug 2889

Summary: Use of -o ControlPath=<socket> -O check requires bogus string as part of host's name?
Product: Portable OpenSSH Reporter: slm <mindrot>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WONTFIX    
Severity: minor CC: djm
Priority: P5    
Version: 6.9p1   
Hardware: 68k   
OS: Mac OS X   

Description slm 2018-07-31 09:45:40 AEST
I'm a mod on the Stackexchange site for Unix & Linux and someone recently posted this question there: https://unix.stackexchange.com/questions/459450/how-to-exit-openssh-control-master-process-without-using-lsof-or-fuser. 

I answered this question but noticed that the solution seemed like a bug.

If I tried to check on the status of a control master like this, it failed:

```
$ ssh -o ControlPath=~/.ssh/master-57db26a0499dfd881986e23a2e4dd5c5c63e26c2 -O check
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
```

But if I provide it a bogus argument, such as, 'blah' it works as expected:

```
ssh -o ControlPath=~/.ssh/master-c0c363c21c2ab6e5754aad2eb0f73b87e8501565 -O check blah
Master running (pid=14595)
#
```
Comment 1 Damien Miller 2018-08-10 10:25:19 AEST
Yes - this is intentional.

ControlPath may contain %-expansions that need a hostname to expand fully.

We could conceivably check to see whether ControlPath actually needs this and make the hostname optional but 1) ControlPaths that use %h are common and 2) I'd rather not make the argument parsing code more of a maze than it already is.
Comment 2 slm 2018-08-11 05:37:47 AEST
OK, I can buy that. I'll update the question w/ your justification for those that may stumble upon this on the Internet. Thanks for getting back and clarifying.

-Sam
Comment 3 Damien Miller 2021-04-23 14:53:09 AEST
closing resolved bugs as of 8.6p1 release