summaryrefslogtreecommitdiffstats
path: root/misc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2024-10-24 05:14:37 +0200
committerDamien Miller <djm@mindrot.org>2024-10-24 05:28:40 +0200
commit94cdfebec852a2429c008cc2a55f8e4183f36972 (patch)
tree6b439746e54c294b0da3effc84e0e1533045f369 /misc.c
parentupstream: Remove sshd logfile in start_sshd (diff)
downloadopenssh-94cdfebec852a2429c008cc2a55f8e4183f36972.tar.xz
openssh-94cdfebec852a2429c008cc2a55f8e4183f36972.zip
upstream: relax valid_domain() checks to allow an underscore as the
first character. ok deraadt@ OpenBSD-Commit-ID: 3f8be6d32496e5596dd8b14e19cb067ddd7969ef
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index 1b4b55c50..dd0bd032a 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.197 2024/09/25 01:24:04 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.198 2024/10/24 03:14:37 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -2406,7 +2406,8 @@ valid_domain(char *name, int makelower, const char **errstr)
strlcpy(errbuf, "empty domain name", sizeof(errbuf));
goto bad;
}
- if (!isalpha((u_char)name[0]) && !isdigit((u_char)name[0])) {
+ if (!isalpha((u_char)name[0]) && !isdigit((u_char)name[0]) &&
+ name[0] != '_' /* technically invalid, but common */) {
snprintf(errbuf, sizeof(errbuf), "domain name \"%.100s\" "
"starts with invalid character", name);
goto bad;