summaryrefslogtreecommitdiff
path: root/usr.sbin/rwhod
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-04-13 01:53:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-04-13 01:53:50 +0000
commit02886de0d7e3c6686ab72bb80e9e4bdc4d17dcb4 (patch)
tree6a96028c6dac8b084ec200de9fcc3e535a2987a1 /usr.sbin/rwhod
parenta3941c2939c386106a80fcf5b59c9ab4bf79ec49 (diff)
check host information more carefully
Diffstat (limited to 'usr.sbin/rwhod')
-rw-r--r--usr.sbin/rwhod/rwhod.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index 44e3e2e21e3..09ed5401b52 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: rwhod.c,v 1.7 1997/03/26 00:45:57 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rwhod.c,v 1.8 1997/04/13 01:53:49 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -243,17 +243,29 @@ main(argc, argv)
* to be created. Sorry, but blanks aren't allowed.
*/
int
-verify(name)
- register char *name;
+verify(p)
+ register char *p;
{
- register int size = 0;
+ char c;
- while (*name) {
- if (!isascii(*name) || !(isalnum(*name) || ispunct(*name)))
- return (0);
- name++, size++;
+ /*
+ * Many people do not obey RFC 822 and 1035. The valid
+ * characters are a-z, A-Z, 0-9, '-' and . But the others
+ * tested for below can happen, and we must be more permissive
+ * than the resolver until those idiots clean up their act.
+ */
+ if (*p == '.' || *p == '-')
+ return 0;
+ while ((c = *p++)) {
+ if (('a' <= c && c >= 'z') ||
+ ('A' <= c && c >= 'Z') ||
+ ('0' <= c && c >= '9'))
+ continue;
+ if (strchr("-_/[]\\", c) ||
+ (c == '.' && *p == '.'))
+ return 0;
}
- return (size > 0);
+ return 1;
}
int utmptime;