Ralf S. Engelschall
2000-Jul-13 08:26 UTC
[PATCH] OpenSSH 2.1.1pl3 (portable), readconf.c and strsep(3)
The latest changes (replacing strtok with strsep) in OpenSSH's readconf.c broke many ~/.ssh/config files. Actually those which uses more than one whitespace character to separate keyword and value. For instance my ~/.ssh/config file reads: | BatchMode no | Compression yes | CompressionLevel 3 | FallBackToRsh no | UsePrivilegedPort no | ForwardX11 no | KeepAlive yes | StrictHostKeyChecking no | ... And now I got errors like this: | /u/rse/.ssh/config line 1: Missing yes/no argument. The problem is that strsep(1) explicitly supports empty fields (= the field between two whitespace characters) and so doesn't automatically handle config files as above. Old config files with the "key = value" syntax are also broken, because " = " are in OpenSSH's current parsing three whitespace characters. I solved the problem by skipping additional whitespace characters between the keyword and the value with the following patch (against readconf.c from OpenSSH 2.1.1pl3): --- readconf.c.orig Wed Jul 12 01:45:27 2000 +++ readconf.c Thu Jul 13 10:11:36 2000 @@ -248,6 +248,7 @@ /* Get the keyword. (Each line is supposed to begin with a keyword). */ keyword = strsep(&s, WHITESPACE); + s += strspn(s, WHITESPACE); opcode = parse_token(keyword, filename, linenum); switch (opcode) { This made all of our ~/.ssh/config files working again. Yours, Ralf S. Engelschall rse at engelschall.com www.engelschall.com
Gary E. Miller
2000-Jul-14 00:27 UTC
[PATCH] OpenSSH 2.1.1pl3 (portable), readconf.c and strsep(3)x
Yo All! SCO 5 does not even have an strsep(). You have to steal a copy from somewhere else. Otherwise still hacking at an SCO 5 port... RGDS GARY On Thu, 13 Jul 2000, Ralf S. Engelschall wrote:> The latest changes (replacing strtok with strsep) in OpenSSH's readconf.c > broke many ~/.ssh/config files. Actually those which uses more than one > whitespace character to separate keyword and value.RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 20340 Empire Ave, Suite E-3, Bend, OR 97701 gem at rellim.com Tel:+1(541)382-8588 Fax: +1(541)382-8676
Damien Miller
2000-Jul-14 03:31 UTC
[PATCH] OpenSSH 2.1.1pl3 (portable), readconf.c and strsep(3)x
On Thu, 13 Jul 2000, Gary E. Miller wrote:> Yo All! > > SCO 5 does not even have an strsep(). You have to steal a copy > from somewhere else.There is a replacement in the portable version. -d -- | "Bombay is 250ms from New York in the new world order" - Alan Cox | Damien Miller - http://www.mindrot.org/ | Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)