From 1433fd94d3e65b578477f75677d84cd3d2c7fde2 Mon Sep 17 00:00:00 2001 From: gilles Date: Wed, 6 May 2015 08:37:47 +0000 Subject: [PATCH] use res_hnok() to valid domain part in valid_domain() ok eric@ --- usr.sbin/smtpd/util.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 419a6aa6ba6..56451c5cf74 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.112 2015/01/20 17:37:54 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.113 2015/05/06 08:37:47 gilles Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -493,24 +493,8 @@ valid_domainpart(const char *s) return 0; } - -nextsub: - if (!isalnum((unsigned char)*s)) - return 0; - while (*(++s) != '\0') { - if (*s == '.') - break; - if (isalnum((unsigned char)*s) || *s == '-') - continue; - return 0; - } - if (s[-1] == '-') - return 0; - if (*s == '.') { - s++; - goto nextsub; - } - return 1; + + return res_hnok(s); } /* -- 2.20.1