ssh config Host case insensitive

Ike Devolder ike.devolder at gmail.com
Tue Feb 4 19:17:47 EST 2014


On Tue, Feb 04, 2014 at 08:07:20AM +1100, Damien Miller wrote:
> On Mon, 3 Feb 2014, Ike Devolder wrote:
> 
> > Hi,
> > 
> > There seems to be an issue where a case sensitive Host entry is no
> > longer working after update to openssh 6.5
> > 
> > example entry: (was working before update)
> > Host MyHost
> > 	Hostname 192.168.0.1
> > 	Port 1234
> > 	User root
> > 	IdentityFile ~/.ssh/id_rsa
> > 
> > When issuing "ssh MyHost" the outcome is now:
> > ssh: Could not resolve hostname myhost: Name or service not known
> > 
> > When the above entry is changed to:
> > Host myhost, the connection works fine again.
> 
> This should fix it:
> 
> Index: ssh.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/ssh.c,v
> retrieving revision 1.398
> diff -u -p -r1.398 ssh.c
> --- ssh.c	31 Jan 2014 16:39:19 -0000	1.398
> +++ ssh.c	3 Feb 2014 21:05:40 -0000
> @@ -752,7 +752,6 @@ main(int ac, char **av)
>  	if (!host)
>  		usage();
>  
> -	lowercase(host);
>  	host_arg = xstrdup(host);
>  
>  	OpenSSL_add_all_algorithms();
> @@ -882,6 +881,7 @@ main(int ac, char **av)
>  	}
>  
>  	/* If canonicalization requested then try to apply it */
> +	lowercase(host);
>  	if (options.canonicalize_hostname != SSH_CANONICALISE_NO)
>  		addrs = resolve_canonicalize(&host, options.port);
>  	/*

So it was kinda intentional ?

on my 6.5p1 the patch fails
patch -Np0 -i ../../fix-mixed-upper-lower-case-host.patch 
patching file ssh.c
Hunk #1 FAILED at 752.
Hunk #2 FAILED at 882.
2 out of 2 hunks FAILED -- saving rejects to file ssh.c.rej

probably due to the 'older' version of ssh.c following applies on 6.5p1

--- ssh.c.orig	2014-02-04 08:40:18.866715480 +0100
+++ ssh.c	2014-02-04 08:43:22.931826364 +0100
@@ -780,7 +780,6 @@
 	if (!host)
 		usage();
 
-	lowercase(host);
 	host_arg = xstrdup(host);
 
 	OpenSSL_add_all_algorithms();
@@ -914,6 +913,7 @@
 	}
 
 	/* If canonicalization requested then try to apply it */
+	lowercase(host);
 	if (options.canonicalize_hostname != SSH_CANONICALISE_NO)
 		addrs = resolve_canonicalize(&host, options.port);
 	/*

I have checked and the configuration as given in my example works again.

Thank you very much for such quick answer :)

-- 
Ike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20140204/8534da8e/attachment.bin>


More information about the openssh-unix-dev mailing list