Bug 1596 - Option parser does not permit a double-quote character to occur in option values
Summary: Option parser does not permit a double-quote character to occur in option values
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 5.2p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords: low-hanging-fruit
Depends on:
Blocks: V_8_7
  Show dependency treegraph
 
Reported: 2009-05-08 06:36 AEST by M. J. Fromberger
Modified: 2022-02-25 13:55 AEDT (History)
2 users (show)

See Also:


Attachments
teach strdelim a set of escapes (1.13 KB, patch)
2017-08-25 13:52 AEST, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description M. J. Fromberger 2009-05-08 06:36:21 AEST
There is no apparent way to give the ssh command line tool an option value, either on the command line or in the ssh_config file, which includes a double-quote (") character (ASCII 34).  Neither doubling the quotation mark nor escaping it with a backslash seem to work.  The manual pages do not describe any other escape syntax.  Either an escape mechanism should be added, or (if one already exists) the documentation should be updated to describe it clearly.

Background:  On some systems (in my particular case, it's MacOS 10.5), it is possible for a user's login name to contain a double-quotation mark character.  There does not seem to be any way to provide a username of this kind to the command line tool, either via the configuration file or using the command-line "-o User=xxx" syntax.

If no escape mechanism exists for this case, I would recommend using doubling to denote internal quotes.  This avoids the need to also quote a separate escape character, and should not disturb existing configuration files.
Comment 1 Damien Miller 2009-10-06 15:42:31 AEDT
I think the correct approach for this would be to adapt sftp.c:makeargv() for use in servconf.c/readconf.c. These would need to abandon strdelim() and pass around an argc/argv and a current arg offset. This would have the added benefit of making argument parsing behave in a much more shell-like manner in the client and server configs.
Comment 2 Damien Miller 2010-08-03 15:41:02 AEST
We are freezing for the OpenSSH 5.6 release. Retargetting these bugs to the next release.
Comment 3 Damien Miller 2010-08-03 15:42:46 AEST
Targetting OpenSSH 5.7
Comment 4 Damien Miller 2011-01-24 12:30:51 AEDT
Retarget unclosed bugs from 5.7=>5.8
Comment 5 Damien Miller 2011-09-06 10:34:20 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 6 Damien Miller 2011-09-06 10:36:32 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 7 Damien Miller 2011-09-06 10:39:08 AEST
Retarget unresolved bugs/features to 6.0 release

(try again - bugzilla's "change several" isn't)
Comment 8 Damien Miller 2012-02-24 10:34:29 AEDT
Retarget from 6.0 to 6.1
Comment 9 Damien Miller 2012-02-24 10:38:08 AEDT
Retarget 6.0 => 6.1
Comment 10 Damien Miller 2012-09-07 11:38:18 AEST
Retarget uncompleted bugs from 6.1 => 6.2
Comment 11 Damien Miller 2012-09-07 11:40:44 AEST
Retarget bugs from 6.1 => 6.2
Comment 12 Damien Miller 2013-03-08 10:24:10 AEDT
retarget to openssh-6.3
Comment 13 Damien Miller 2013-07-25 12:18:05 AEST
Retarget to openssh-6.4
Comment 14 Damien Miller 2013-07-25 12:21:04 AEST
Retarget 6.3 -> 6.4
Comment 15 Damien Miller 2014-02-06 10:18:12 AEDT
Retarget incomplete bugs / feature requests to 6.6 release
Comment 16 Damien Miller 2014-02-06 10:20:23 AEDT
Retarget incomplete bugs / feature requests to 6.6 release
Comment 17 Damien Miller 2014-04-12 14:48:29 AEST
Retarget to 6.7 release, since 6.6 was mostly bugfixing.
Comment 18 Damien Miller 2014-04-12 14:54:35 AEST
Remove from 6.6 tracking bug
Comment 19 Damien Miller 2014-08-30 04:39:01 AEST
Retarget incomplete bugs to 6.8 release.
Comment 20 Damien Miller 2014-08-30 04:39:45 AEST
These bugs are no longer targeted at the imminent 6.7 release
Comment 21 Damien Miller 2015-03-03 07:59:39 AEDT
OpenSSH 6.8 is approaching release and closed for major work. Retarget these bugs for the next release.
Comment 22 Damien Miller 2015-03-03 08:01:18 AEDT
Retarget to 6.9
Comment 23 Damien Miller 2015-05-25 10:05:25 AEST
auth2-pubkey.c's split_argv() would be better choice than sftp.c:makeargv(), as the latter has a bunch of goop to deal with glob characters that isn't relevant to argument parsing.

Another option is a more drastic replacement of the config language, which has been discussed a little.
Comment 24 Damien Miller 2015-08-11 22:59:24 AEST
Retarget pending bugs to openssh-7.1
Comment 25 Damien Miller 2016-02-26 14:44:30 AEDT
Retarget to openssh-7.3
Comment 26 Damien Miller 2016-02-26 14:47:30 AEDT
Retarget to openssh-7.3
Comment 27 Damien Miller 2016-07-22 14:10:53 AEST
retarget unfinished bugs to next release
Comment 28 Damien Miller 2016-07-22 14:14:39 AEST
retarget unfinished bugs to next release
Comment 29 Damien Miller 2016-07-22 14:15:48 AEST
retarget unfinished bugs to next release
Comment 30 Damien Miller 2016-07-22 14:17:11 AEST
retarget unfinished bugs to next release
Comment 31 Damien Miller 2016-12-16 14:31:08 AEDT
OpenSSH 7.4 release is closing; punt the bugs to 7.5
Comment 32 Damien Miller 2017-06-30 13:43:18 AEST
Move incomplete bugs to openssh-7.6 target since 7.5 shipped a while back.

To calibrate expectations, there's little chance all of these are going to make 7.6.
Comment 33 Damien Miller 2017-06-30 13:44:24 AEST
remove 7.5 target
Comment 34 Damien Miller 2017-08-25 13:52:29 AEST
Created attachment 3038 [details]
teach strdelim a set of escapes

This teaches misc.c:strdelim() a few escape sequences that can be used in quoted strings. The sequences aren't accepted elsewhere.

I'm unsure of whether this will break any existing configurations, but I can't think of many cases where '\' could appear in existing strings.
Comment 35 Darren Tucker 2017-08-25 13:59:20 AEST
(In reply to Damien Miller from comment #34)
[...]
> I'm unsure of whether this will break any existing configurations,
> but I can't think of many cases where '\' could appear in existing
> strings.

I can think of one example: Windows domain\user notation, although I don't know if that would show up here.
Comment 36 Damien Miller 2018-03-02 14:34:33 AEDT
This has been committed and will be in OpenSSH 7.7

commit 713d9cb510e0e7759398716cbe6dcf43e574be71 (HEAD -> master)
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Fri Mar 2 03:02:11 2018 +0000

    upstream: Allow escaped quotes \" and \' in ssh_config and
    
    sshd_config quotes option strings. bz#1596 ok markus@
    
    OpenBSD-Commit-ID: dd3a29fc2dc905e8780198e5a6a30b096de1a1cb
Comment 37 Damien Miller 2018-03-18 17:09:40 AEDT
This attempt to implement escaped quotes caused regressions in existing configurations. I'll try again after the 7.7 release.
Comment 38 Damien Miller 2018-04-06 13:12:17 AEST
Move to OpenSSH 7.8 tracking bug
Comment 39 Damien Miller 2018-08-10 11:37:56 AEST
Retarget remaining bugs planned for 7.8 release to 7.9
Comment 40 Damien Miller 2018-08-10 11:38:25 AEST
Retarget remaining bugs planned for 7.8 release to 7.9
Comment 41 Damien Miller 2018-10-19 17:13:41 AEDT
Retarget unfinished bugs to OpenSSH 8.0
Comment 42 Damien Miller 2018-10-19 17:14:47 AEDT
Retarget unfinished bugs to OpenSSH 8.0
Comment 43 Damien Miller 2018-10-19 17:15:51 AEDT
Retarget unfinished bugs to OpenSSH 8.0
Comment 44 Damien Miller 2019-04-03 10:10:31 AEDT
Retarget outstanding bugs at next release
Comment 45 Damien Miller 2019-10-09 15:07:25 AEDT
Retarget these bugs to 8.2 release
Comment 46 Damien Miller 2020-02-04 11:44:20 AEDT
Prepare for 8.2 release; retarget bugs
Comment 47 Damien Miller 2020-05-08 13:39:19 AEST
Retarget bugs to 8.4 release
Comment 48 Damien Miller 2021-03-04 09:47:00 AEDT
retarget to 8.6
Comment 49 Damien Miller 2021-04-23 14:50:10 AEST
retarget after 8.6p1 release
Comment 50 Damien Miller 2021-07-02 14:52:42 AEST
sshd_config got a new string tokeniser in commit a10f929d
and ssh_config got the same treatment in commit ea9e45c89

Both support quoted strings, quoted space and quoted quotes in strings.
Comment 51 Damien Miller 2022-02-25 13:55:22 AEDT
closing bugs resolved before the openssh-8.9 release