Expansion of hostname

Shun-ichi GOTO gotoh at taiyo.co.jp
Fri Feb 8 20:00:26 EST 2002


# This issue is also related to
# Subject: Re: [openssh-dev]: disable ProxyCommand from being used?

On reading ~/.ssh/config file, host name which is specified by command
line and check with 'Host' line, is constant for the whole of reading.

If this host name is expanded by 'HostName' option value, it's worth for
making config file simple and usefull 'Host' can be used as alias to
'HostName' value, I think.

For example:

-----begin-----
# options only for foo.some.net
Host foo
  Protorol 1
  HostName foo.some.net

# options only for bar.some.net
Host bar
  Protocol 2
  HostName foo.some.net

# options for ALL OF *.some.net hosts including
#  both foo.some.net and bar.some.net
Host *.some.net
  ForwardAgent yes
----- end -----

Following patch does this behaviour.


--- readconf.c	7 Nov 2001 01:18:31 -0000	1.1.1.2
+++ readconf.c	8 Feb 2002 08:04:10 -0000
@@ -720,8 +720,9 @@ 	default:
 	linenum = 0;
 	while (fgets(line, sizeof(line), f)) {
 		/* Update line number counter. */
+		const char *hostname = (options->hostname)? options->hostname: host;
 		linenum++;
-		if (process_config_line(options, host, line, filename, linenum, &active) != 0)
+		if (process_config_line(options, hostname, line, filename, linenum, &active) != 0)
 			bad_options++;
 	}
 	fclose(f);



Is this behaviour acceptable?

--- Regards,
 Shun-ichi Goto  <gotoh at taiyo.co.jp>
   R&D Group, TAIYO Corp., Tokyo, JAPAN



More information about the openssh-unix-dev mailing list