Module Name: src
Committed By: dholland
Date: Tue Jun 10 17:19:00 UTC 2014
Modified Files:
src/usr.sbin/ypbind: ypbind.c
Log Message:
Don't rake up the default domain until after processing arguments.
Processing arguments just sets flags -- may as well do it first, and
this way detection of silly errors isn't contingent on having things
fully configured and operating.
To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 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.93 src/usr.sbin/ypbind/ypbind.c:1.94
--- src/usr.sbin/ypbind/ypbind.c:1.93 Tue Jun 10 17:18:45 2014
+++ src/usr.sbin/ypbind/ypbind.c Tue Jun 10 17:19:00 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ypbind.c,v 1.93 2014/06/10 17:18:45 dholland Exp $ */
+/* $NetBSD: ypbind.c,v 1.94 2014/06/10 17:19:00 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.93 2014/06/10 17:18:45 dholland Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.94 2014/06/10 17:19:00 dholland Exp $");
#endif
#include <sys/types.h>
@@ -1190,14 +1190,8 @@ main(int argc, char *argv[])
char *domainname;
setprogname(argv[0]);
- (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);
default_ypbindmode = YPBIND_DIRECT;
-
while (--argc) {
++argv;
if (!strcmp("-insecure", *argv)) {
@@ -1219,6 +1213,12 @@ main(int argc, char *argv[])
}
}
+ (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);
+
/* initialise syslog */
openlog("ypbind", LOG_PERROR | LOG_PID, LOG_DAEMON);