summaryrefslogtreecommitdiff
path: root/auth2-hostbased.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-07-17 18:57:19 +1000
committerDamien Miller <djm@mindrot.org>2008-07-17 18:57:19 +1000
commita1d03a50692a2edbe5a6e1e652c5a12e1de07721 (patch)
tree08f386af759386aa817efcdb0f794ee948a1366d /auth2-hostbased.c
parent7ba0ca7f6fa0c517822051412cf9f0e7b35304d4 (diff)
- djm@cvs.openbsd.org 2008/07/17 08:51:07
[auth2-hostbased.c] strip trailing '.' from hostname when HostbasedUsesNameFromPacketOnly=yes report and patch from res AT qoxp.net (bz#1200); ok markus@
Diffstat (limited to 'auth2-hostbased.c')
-rw-r--r--auth2-hostbased.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index 663dec5d9..041051c53 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-hostbased.c,v 1.11 2006/08/03 03:34:41 deraadt Exp $ */ 1/* $OpenBSD: auth2-hostbased.c,v 1.12 2008/07/17 08:51:07 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -151,15 +151,16 @@ hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
151 debug2("userauth_hostbased: chost %s resolvedname %s ipaddr %s", 151 debug2("userauth_hostbased: chost %s resolvedname %s ipaddr %s",
152 chost, resolvedname, ipaddr); 152 chost, resolvedname, ipaddr);
153 153
154 if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') {
155 debug2("stripping trailing dot from chost %s", chost);
156 chost[len - 1] = '\0';
157 }
158
154 if (options.hostbased_uses_name_from_packet_only) { 159 if (options.hostbased_uses_name_from_packet_only) {
155 if (auth_rhosts2(pw, cuser, chost, chost) == 0) 160 if (auth_rhosts2(pw, cuser, chost, chost) == 0)
156 return 0; 161 return 0;
157 lookup = chost; 162 lookup = chost;
158 } else { 163 } else {
159 if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') {
160 debug2("stripping trailing dot from chost %s", chost);
161 chost[len - 1] = '\0';
162 }
163 if (strcasecmp(resolvedname, chost) != 0) 164 if (strcasecmp(resolvedname, chost) != 0)
164 logit("userauth_hostbased mismatch: " 165 logit("userauth_hostbased mismatch: "
165 "client sends %s, but we resolve %s to %s", 166 "client sends %s, but we resolve %s to %s",