summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2024-10-24 03:14:38 +0000
committerDamien Miller <djm@cvs.openbsd.org>2024-10-24 03:14:38 +0000
commit3d7162d0f8db1bc9d3ec5e321c53c59211449aad (patch)
tree00596b66404fa6527e0e427d9bd9195a47196a76
parentb6656ea1ea80ae27b43df3dbce36726de396c955 (diff)
relax valid_domain() checks to allow an underscore as the first
character. ok deraadt@
-rw-r--r--usr.bin/ssh/misc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index a7b5b95d17c..c547ea944df 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/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.
@@ -2299,7 +2299,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;