Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ypbind Don't rake up the default domain until after...



details:   https://anonhg.NetBSD.org/src/rev/fcf91ba7b8d7
branches:  trunk
changeset: 329811:fcf91ba7b8d7
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Jun 10 17:19:00 2014 +0000

description:
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.

diffstat:

 usr.sbin/ypbind/ypbind.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (46 lines):

diff -r f5cfda0982b8 -r fcf91ba7b8d7 usr.sbin/ypbind/ypbind.c
--- a/usr.sbin/ypbind/ypbind.c  Tue Jun 10 17:18:45 2014 +0000
+++ b/usr.sbin/ypbind/ypbind.c  Tue Jun 10 17:19:00 2014 +0000
@@ -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 <deraadt%fsa.ca@localhost>
@@ -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 @@
        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 @@
                }
        }
 
+       (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);
 



Home | Main Index | Thread Index | Old Index