Module Name: src
Committed By: dholland
Date: Tue May 24 06:57:04 UTC 2011
Modified Files:
src/usr.sbin/ypbind: ypbind.c
Log Message:
Check that the domain name is valid up front, instead of doing it
after opening sockets and registering services and whatnot.
To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/ypbind/ypbind.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/ypbind/ypbind.c
diff -u src/usr.sbin/ypbind/ypbind.c:1.69 src/usr.sbin/ypbind/ypbind.c:1.70
--- src/usr.sbin/ypbind/ypbind.c:1.69 Tue May 24 06:56:48 2011
+++ src/usr.sbin/ypbind/ypbind.c Tue May 24 06:57:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ypbind.c,v 1.69 2011/05/24 06:56:48 dholland Exp $ */
+/* $NetBSD: ypbind.c,v 1.70 2011/05/24 06:57:04 dholland Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <[email protected]>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef LINT
-__RCSID("$NetBSD: ypbind.c,v 1.69 2011/05/24 06:56:48 dholland Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.70 2011/05/24 06:57:04 dholland Exp $");
#endif
#include <sys/types.h>
@@ -1060,6 +1060,8 @@
(void)yp_get_default_domain(&domainname);
if (domainname[0] == '\0')
errx(1, "Domainname not set. Aborting.");
+ if (_yp_invalid_domain(domainname))
+ errx(1, "Invalid domainname: %s", domainname);
/*
* Per traditional ypbind(8) semantics, if a ypservers
@@ -1145,9 +1147,6 @@
rmtcr.xdr_results = xdr_bool;
rmtcr.results_ptr = (caddr_t)(void *)&rmtcr_outval;
- if (_yp_invalid_domain(domainname))
- errx(1, "bad domainname: %s", domainname);
-
/* blow away old bindings in BINDINGDIR */
if (purge_bindingdir(BINDINGDIR) < 0)
errx(1, "unable to purge old bindings from %s", BINDINGDIR);