summaryrefslogtreecommitdiffstats
path: root/src/util/valid_hostname.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:42:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:42:27 +0000
commit95f5f6d1c3aec1cb62525f5162e71a4157aca717 (patch)
tree8633546094df32b27d719c7578537e6062aa52e3 /src/util/valid_hostname.c
parentReleasing progress-linux version 3.8.6-1~progress7.99u1. (diff)
downloadpostfix-95f5f6d1c3aec1cb62525f5162e71a4157aca717.tar.xz
postfix-95f5f6d1c3aec1cb62525f5162e71a4157aca717.zip
Merging upstream version 3.9.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/util/valid_hostname.c')
-rw-r--r--src/util/valid_hostname.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/util/valid_hostname.c b/src/util/valid_hostname.c
index 8b234c4..457d1f1 100644
--- a/src/util/valid_hostname.c
+++ b/src/util/valid_hostname.c
@@ -6,9 +6,9 @@
/* SYNOPSIS
/* #include <valid_hostname.h>
/*
-/* int valid_hostname(name, gripe)
+/* int valid_hostname(name, flags)
/* const char *name;
-/* int gripe;
+/* int flags;
/*
/* int valid_hostaddr(addr, gripe)
/* const char *addr;
@@ -32,6 +32,10 @@
/* dots, no leading or trailing dots or hyphens, no labels
/* longer than VALID_LABEL_LEN characters, and it should not
/* be all numeric.
+/* The flags argument is the bit-wise or of zero or more of
+/* DO_GRIPE or DO_WILDCARD (the latter allows the "*." name
+/* prefix, which is rare but valid in some DNS responses and
+/* queries).
/*
/* valid_hostaddr() requires that the input is a valid string
/* representation of an IPv4 or IPv6 network address as
@@ -403,8 +407,9 @@ int main(int unused_argc, char **argv)
while (vstring_fgets_nonl(buffer, VSTREAM_IN)) {
msg_info("testing: \"%s\"", vstring_str(buffer));
- valid_hostname(vstring_str(buffer), DO_GRIPE);
- valid_hostaddr(vstring_str(buffer), DO_GRIPE);
+ valid_hostname(vstring_str(buffer), DO_GRIPE | DO_WILDCARD);
+ if (strchr(vstring_str(buffer), '*') == 0)
+ valid_hostaddr(vstring_str(buffer), DO_GRIPE);
}
exit(0);
}