openssh-2.9p2, auth2.c

Hans Werner Strube strube at physik3.gwdg.de
Fri Sep 28 18:46:13 EST 2001


Even with option "HostbasedUsesNameFromPacketOnly yes", the trailing
dot in chost should be stripped before auth_rhosts2() is called from
hostbased_key_allowed().

 Hans Werner Strube          strube at physik3.gwdg.de
 Drittes Physikalisches Institut,  Univ. Goettingen
 Buergerstr. 42-44,   D-37073 Goettingen,   Germany

Suggested change:
*** auth2.c.ORI	Wed Apr 25 14:44:15 2001
--- auth2.c	Fri Sep 28 10:27:34 2001
***************
*** 801,815 ****
  	debug2("userauth_hostbased: chost %s resolvedname %s ipaddr %s",
  	    chost, resolvedname, ipaddr);
  
  	if (options.hostbased_uses_name_from_packet_only) {
  		if (auth_rhosts2(pw, cuser, chost, chost) == 0)
  			return 0;
  		lookup = chost;
  	} else {
- 		if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') {
- 			debug2("stripping trailing dot from chost %s", chost);
- 			chost[len - 1] = '\0';
- 		}
  		if (strcasecmp(resolvedname, chost) != 0)
  			log("userauth_hostbased mismatch: "
  			    "client sends %s, but we resolve %s to %s",
--- 801,816 ----
  	debug2("userauth_hostbased: chost %s resolvedname %s ipaddr %s",
  	    chost, resolvedname, ipaddr);
  
+ 	if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') {
+ 		debug2("stripping trailing dot from chost %s", chost);
+ 		chost[len - 1] = '\0';
+ 	}
+ 
  	if (options.hostbased_uses_name_from_packet_only) {
  		if (auth_rhosts2(pw, cuser, chost, chost) == 0)
  			return 0;
  		lookup = chost;
  	} else {
  		if (strcasecmp(resolvedname, chost) != 0)
  			log("userauth_hostbased mismatch: "
  			    "client sends %s, but we resolve %s to %s",



More information about the openssh-unix-dev mailing list