]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.9-20111113
authorWietse Venema <wietse@porcupine.org>
Sun, 13 Nov 2011 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:37:35 +0000 (06:37 +0000)
15 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/html/postconf.1.html
postfix/makedefs
postfix/man/man1/postconf.1
postfix/src/global/mail_version.h
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf.c
postfix/src/postconf/test1.ref [new file with mode: 0644]
postfix/src/postconf/test2.ref [new file with mode: 0644]
postfix/src/postconf/test3.ref [new file with mode: 0644]
postfix/src/postconf/test4.ref [new file with mode: 0644]
postfix/src/postconf/test5.ref [new file with mode: 0644]
postfix/src/util/sys_defs.h

index 2ad3e9ed094893b751321cfff495d2a8da6664e0..13ef279d8e6eeb5a1f583654a5ede3fc775d5eaf 100644 (file)
@@ -17069,3 +17069,9 @@ Apologies for any names omitted.
        main.cf and master.cf parameter names (i.e. parameters that
        aren't used anywhere), and it finally displays user-defined
        main.cf parameters that *are* used.  File: postconf/postconf.c.
+
+20111113
+
+       Cleanup: documented the postconf algorithms and their
+       limitations, and added regression tests to speed up future
+       development. File: postconf/postconf.c
index 58344f35303d3ea751af525b718037f14c83b04f..101b24f4b014f5213746490896a606c64d444086 100644 (file)
@@ -14,6 +14,30 @@ specifies the release date of a stable release or snapshot release.
 If you upgrade from Postfix 2.7 or earlier, read RELEASE_NOTES-2.8
 before proceeding.
 
+Incompatible changes with snapshot 20111113
+===========================================
+
+The postconf command now logs warnings about unused "name=value"
+entries in main.cf, and about unused "-o name=value" entries in
+master.cf. Such entries are the result of feature creep in Postfix,
+and of mis-typed names. Once the configurations are cleaned up,
+Postfix configuration changes will be more robust.
+
+Major changes with snapshot 20111113
+====================================
+
+postconf support to warn about unused "name=value" entries in
+main.cf, and about unused "-o name=value" entries in master.cf.
+This should help to eliminate common errors with mis-typed names.
+
+The only known limitation is lack of support for per-service parameter
+name spaces in master.cf, meaning that "-o user-defined-name=value"
+always results in an "unused parameter" warning.
+
+This completes an effort that expanded postconf.c by 553 lines of
+code that were designed, written, tested and documented (in 250
+lines) at the cost of 31 person-hours, spread out over 7 days.
+
 Major changes with snapshot 20111108
 ====================================
 
index 0fdcb5beaf69cef125b8eb2613a399bce9d4c6ba..aa9f7c5b267b0e367bb166eaa9700f5708fa01fd 100644 (file)
@@ -6,12 +6,9 @@ Wish list:
 
        Things to do after the stable release:
 
-       postconf: legitimize spontaneous_name=value if it is
-       referenced as legitimate_name=$spontaneous_name in main.cf
-       or master.cf, and warn about spontaneous_name=value that
-       have no legitimizing reference. Use mac_expand callback
-       to identidy references, and add mac_expand option to always
-       expand a conditional macro's right-hand side.
+       postconf: add test cases for unused name=value entries in
+       main.cf and master.cf; add support for per-service parameter
+       name spaces in master.cf.
 
        TLS_README has the priorities reversed. The section about
        SMTP client settings begins with an exposition about client
index 5510507dacf78814d64fb6d871374426cd61820b..b2ce99e84f176098acf4a39978a730b39cc96d7e 100644 (file)
@@ -269,23 +269,29 @@ POSTCONF(1)                                                        POSTCONF(1)
 <b>DIAGNOSTICS</b>
        Problems are reported to the standard error stream.
 
+<b>BUGS</b>
+       There  currently  is  no support for per-service parameter
+       name spaces in  <a href="master.5.html">master.cf</a>.   This  means  that  "-o  user-
+       defined-name=value"  always  results in an "unused parame-
+       ter" warning.
+
 <b>ENVIRONMENT</b>
        <b>MAIL_CONFIG</b>
               Directory with Postfix configuration files.
 
 <b>CONFIGURATION PARAMETERS</b>
-       The  following  <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
+       The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are  especially  relevant
        to this program.
 
-       The text below provides  only  a  parameter  summary.  See
+       The  text  below  provides  only  a parameter summary. See
        <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including examples.
 
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The  default  location  of  the Postfix <a href="postconf.5.html">main.cf</a> and
+              The default location of  the  Postfix  <a href="postconf.5.html">main.cf</a>  and
               <a href="master.5.html">master.cf</a> configuration files.
 
        <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> (empty)</b>
-              Pathname of a configuration file with  bounce  mes-
+              Pathname  of  a configuration file with bounce mes-
               sage templates.
 
 <b>FILES</b>
@@ -299,7 +305,7 @@ POSTCONF(1)                                                        POSTCONF(1)
        <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
index 0f83e7275bc4a4a86eab44b75562c290bef28fd9..02fd05dff98bd6d1cb90e353ee1420eff44d2266 100644 (file)
@@ -44,6 +44,8 @@
 #      Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE support.
 #      By default, KQUEUE support is compiled in on platforms that
 #      are known to support it.
+# .IP \fB-DNO_NIS\fR
+#      Do not build with NIS or NISPLUS support.
 # .IP \fB-DNO_PCRE\fR
 #      Do not build with PCRE support.
 #      By default, PCRE support is compiled in when the \fBpcre-config\fR
index 7f6f5794bb247fd60fd128cf69f62017d1f4e6e8..b86bd9df51afdae6f5c9786a99463c263e6aa062 100644 (file)
@@ -226,6 +226,13 @@ This feature is available with Postfix 2.6 and later.
 .ad
 .fi
 Problems are reported to the standard error stream.
+.SH BUGS
+.ad
+.fi
+There currently is no support for per-service parameter
+name spaces in master.cf.  This means that "-o
+user-defined-name=value" always results in an "unused
+parameter" warning.
 .SH "ENVIRONMENT"
 .na
 .nf
index abe6e08103163d79fb0ceb01dccabdab173ba70b..e0be76baac8390fed1e408b1047d8620665f44bc 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20111112"
+#define MAIL_RELEASE_DATE      "20111113"
 #define MAIL_VERSION_NUMBER    "2.9"
 
 #ifdef SNAPSHOT
index 48598e8167ef18eea704cb81f09e34c6bdcf9c4e..64b4b823ed2a0c0df45fb76e6143a32836cc3ba2 100644 (file)
@@ -10,6 +10,7 @@ MAKES = bool_table.h bool_vars.h int_table.h int_vars.h str_table.h \
        str_vars.h time_table.h time_vars.h raw_table.h raw_vars.h \
        nint_table.h nint_vars.h nbool_table.h nbool_vars.h long_table.h \
        long_vars.h
+TEST_TMP= main.cf master.cf
 DUMMIES        = makes_dummy # for "make -j"
 PROG   = postconf
 SAMPLES        = ../../conf/main.cf.default
@@ -35,7 +36,7 @@ Makefile: Makefile.in
 
 test:  $(TESTPROG)
 
-tests:
+tests: test1 test2 test3 test4 test5
 
 root_tests:
 
@@ -50,6 +51,71 @@ makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c
        $(AWK) -f extract.awk ../*/*.c | $(SHELL)
        touch makes_dummy
 
+
+# Define two parameters with smtpd_restriction_classes. One will be ignored.
+
+test1: $(PROG) test1.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       echo smtpd_restriction_classes = foo bar >> main.cf
+       echo foo = yes >> main.cf
+       ./$(PROG) -nc . >test1.tmp 2>&1
+       diff test1.ref test1.tmp
+       rm -f main.cf master.cf test1.tmp
+
+# Define two unused parameters. Expect two warnings.
+
+test2: $(PROG) test2.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       echo restriction_classes = foo bar >> main.cf
+       echo foo = yes >> main.cf
+       ./$(PROG) -nc . >test2.tmp 2>&1
+       diff test2.ref test2.tmp
+       rm -f main.cf master.cf test2.tmp
+
+# Define one parameter in main,cf, validate it with main.cf.
+
+test3: $(PROG) test3.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       ./$(PROG) -nc . >test_base.tmp 2>&1
+       echo foo = yes >> main.cf
+       echo 'bar = $$foo' >> main.cf
+       echo 'always_bcc = $$bar' >> main.cf
+       ./$(PROG) -nc . >test3.tmp 2>&1
+       diff test3.ref test3.tmp
+       rm -f main.cf master.cf test3.tmp
+
+# Define one parameter in main.cf, validate it with master.cf.
+
+test4: $(PROG) test4.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       ./$(PROG) -nc . >test_base.tmp 2>&1
+       echo foo = yes >> main.cf
+       echo 'bar = $$foo' >> main.cf
+       echo smtpd 1 2 3 4 5 6 7 >> master.cf
+       echo ' -o always_bcc=$$bar' >> master.cf
+       ./$(PROG) -nc . >test4.tmp 2>&1
+       diff test4.ref test4.tmp
+       rm -f main.cf master.cf test4.tmp
+
+# Define one user-defined parameter with name=value in master.cf,
+# validate it with known_parameter=$name in master.cf.  Currently,
+# user-defined parameter definitions in master.cf are not recognized
+# as definitions, and result in an "unused parameter" warning.
+
+test5: $(PROG) test5.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       ./$(PROG) -nc . >test_base.tmp 2>&1
+       echo smtpd 1 2 3 4 5 6 7 >> master.cf
+       echo ' -o bar=yes -o always_bcc=$$bar -o' >> master.cf
+       ./$(PROG) -nc . >test5.tmp 2>&1
+       diff test5.ref test5.tmp
+       rm -f main.cf master.cf test5.tmp
+
 printfck: $(OBJS) $(PROG)
        rm -rf printfck
        mkdir printfck
@@ -62,7 +128,8 @@ lint:
        lint $(DEFS) $(SRCS) $(LINTFIX)
 
 clean:
-       rm -f *.o *core $(PROG) $(TESTPROG) junk $(MAKES) $(AUTOS) $(DUMMIES)
+       rm -f *.o *core $(PROG) $(TESTPROG) junk $(MAKES) $(AUTOS) $(DUMMIES) \
+       $(TEST_TMP) *.tmp
        rm -rf printfck
 
 tidy:  clean
index c3eb755117d80ff1d8866d389a22f0215131fb29..e22f63e4f55d3f519e14b8d114fbea39eb4bffb4 100644 (file)
 /*     This feature is available with Postfix 2.6 and later.
 /* DIAGNOSTICS
 /*     Problems are reported to the standard error stream.
+/* BUGS
+/*     There currently is no support for per-service parameter
+/*     name spaces in master.cf.  This means that "-o
+/*     user-defined-name=value" always results in an "unused
+/*     parameter" warning.
 /* ENVIRONMENT
 /* .ad
 /* .fi
 
  /*
   * Lookup table for in-core parameter info.
+  * 
+  * XXX Change the value pointers from table indices into pointers to parameter
+  * objects with print methods.
   */
 HTABLE *param_table;
 
  /*
   * Lookup table for master.cf info.
+  * 
+  * XXX Replace by data structures with per-entry hashes for "-o name=value", so
+  * that we can properly handle of definitions and uses in per-service name
+  * spaces.
   */
 static ARGV **master_table;
 
  /*
-  * Declarations generated by scanning actual C source files.
+  * Support for built-in parameters: declarations generated by scanning
+  * actual C source files.
   */
 #include "time_vars.h"
 #include "bool_vars.h"
@@ -355,12 +368,13 @@ static ARGV **master_table;
 #include "long_vars.h"
 
  /*
-  * Manually extracted.
+  * Support for built-in parameters: manually extracted.
   */
 #include "install_vars.h"
 
  /*
-  * Lookup tables generated by scanning actual C source files.
+  * Support for built-in parameters: lookup tables generated by scanning
+  * actual C source files.
   */
 static const CONFIG_TIME_TABLE time_table[] = {
 #include "time_table.h"
@@ -412,19 +426,36 @@ typedef struct {
 } STRING_NV;
 
  /*
-  * Support for parameters whose postfix-defined names are derived from
-  * master.cf service names. These parameters have default values that are
-  * defined by built-in parameters.
+  * Service-defined parameter names are created by appending postfix-defined
+  * suffixes to master.cf service names. These parameters have default values
+  * that are defined by built-in parameters.
   */
 static STRING_NV *serv_param_table;
 static ssize_t serv_param_tablen;
 
  /*
-  * Support for parameters whose user-defined names are specified in main.cf
-  * with smtpd_restriction_classes, and for user-defined parameters whose
-  * "name=value" appears in main.cf and whose $name appears in the value of
-  * in master.cf "-o name=value" entries, or in main.cf "name=value" entries
-  * for known parameters.
+  * Support for user-defined parameters.
+  * 
+  * There are three categories of known parameters: built-in, service-defined
+  * (see previous comment), and valid user-defined. In addition there are
+  * multiple name spaces: the global main.cf name space, and the per-service
+  * name space of each master.cf entry.
+  * 
+  * There are two categories of valid user-defined parameters:
+  * 
+  * - Parameters whose name appears in the value of smtpd_restriction_classes in
+  * main.cf, and whose name has a "name=value" entry in main.cf (todo:
+  * support for creating names with "-o smtpd_restriction_classes=name"
+  * within a master.cf per-service name space).
+  * 
+  * - Parameters whose $name (macro expansion) appears in the value of a
+  * "name=value" entry in main.cf or master.cf of a "known" parameter, and
+  * whose name has a "name=value" entry in main.cf (todo: master.cf).
+  * 
+  * All other user-defined parameters are invalid. We currently log a warning
+  * for "name=value" entries in main.cf or master.cf whose $name does not
+  * appear in the value of a main.cf or master.cf "name=value" entry of a
+  * "known" parameter.
   */
 static char **user_param_table;
 static ssize_t user_param_tablen;
@@ -776,8 +807,8 @@ static void read_master(void)
      * We can't use the master_ent routines in their current form. They
      * convert everything to internal form, and they skip disabled services.
      * We need to be able to show default fields as "-", and we need to know
-     * about all service names so that we can generate dynamic parameter
-     * names (transport-dependent etc.).
+     * about all service names so that we can generate service-dependent
+     * parameter names (transport-dependent etc.).
      */
 #define MASTER_BLANKS  " \t\r\n"               /* XXX */
 #define MASTER_FIELD_COUNT 8                   /* XXX */
@@ -826,21 +857,24 @@ static void add_service_parameter(const char *service, const char *suffix,
                                          const char *defparam)
 {
     STRING_NV *sp;
+    char   *name = concatenate(service, suffix, (char *) 0);
 
     /*
-     * Skip service parameter names that have explicit built-in definitions.
-     * This happens with message delivery transports that have a non-default
+     * Skip service parameter names that have built-in definitions. This
+     * happens with message delivery transports that have a non-default
      * per-destination concurrency or recipient limit, such as local(8).
-     * 
-     * XXX Skip parameters that are already in the param_table hash.
      */
-    serv_param_table = (STRING_NV *)
-       myrealloc((char *) serv_param_table,
-                 (serv_param_tablen + 1) * sizeof(*serv_param_table));
-    sp = serv_param_table + serv_param_tablen;
-    sp->name = concatenate(service, suffix, (char *) 0);
-    sp->value = defparam;
-    serv_param_tablen += 1;
+    if (htable_locate(param_table, name) != 0) {
+       myfree(name);
+    } else {
+       serv_param_table = (STRING_NV *)
+           myrealloc((char *) serv_param_table,
+                     (serv_param_tablen + 1) * sizeof(*serv_param_table));
+       sp = serv_param_table + serv_param_tablen;
+       sp->name = concatenate(service, suffix, (char *) 0);
+       sp->value = defparam;
+       serv_param_tablen += 1;
+    }
 }
 
 /* add_service_parameters - add all service parameters with defaults */
@@ -943,12 +977,14 @@ static void add_user_parameter(const char *name)
 {
     /* XXX Merge this with check_parameter_value() */
     user_param_table = (char **)
-       myrealloc((char *) user_param_table,
-                 (user_param_tablen + 1) * sizeof(*user_param_table));
+    myrealloc((char *) user_param_table,
+             (user_param_tablen + 1) * sizeof(*user_param_table));
     user_param_table[user_param_tablen] = mystrdup(name);
     user_param_tablen += 1;
 }
 
+/* scan_user_parameter_value - extract macro names from parameter value */
+
 #ifdef MAC_EXP_FLAG_SCAN
 #define NO_SCAN_RESULT ((VSTRING *) 0)
 #define NO_SCAN_FILTER ((char *) 0)
@@ -973,17 +1009,19 @@ static const char *check_user_parameter(const char *mac_name,
 
     /*
      * Promote only user-defined parameters with an explicit "name=value"
-     * main.cf definition. Do not promote parameters whose name appears only
-     * as a macro expansion; this is how Postfix implements backwards
-     * compatibility after a feature name change.
+     * definition in main.cf (todo: master.cf). Do not promote parameters
+     * whose name appears only as a macro expansion; this is how Postfix
+     * implements backwards compatibility after a feature name change.
      * 
-     * XXX Skip parameters that are already in the param_table hash.
+     * Skip parameters that are already in the param_table hash.
      */
-    mac_value = mail_conf_lookup(mac_name);
-    if (mac_value != 0) {
-       add_user_parameter(mac_name);
-       /* Promote parameter names recursively. */
-       scan_user_parameter_value(mac_value);
+    if (htable_locate(param_table, mac_name) == 0) {
+       mac_value = mail_conf_lookup(mac_name);
+       if (mac_value != 0) {
+           add_user_parameter(mac_name);
+           /* Promote parameter names recursively. */
+           scan_user_parameter_value(mac_value);
+       }
     }
     return (0);
 }
@@ -1016,6 +1054,11 @@ static void add_user_parameters(void)
     /*
      * Add parameters whose names are defined with smtpd_restriction_classes,
      * but only if they have a "name=value" entry in main.cf.
+     * 
+     * XXX It is possible that a user-defined parameter is defined in master.cf
+     * with "-o smtpd_restriction_classes=name -o name=value". To handle this
+     * we need to give each master.cf entry its own name space. Until then,
+     * we may log false warnings for unused "-o name=value" entries.
      */
     if ((class_list = mail_conf_lookup_eval(VAR_REST_CLASSES)) != 0) {
        cp = saved_class_list = mystrdup(class_list);
@@ -1043,7 +1086,9 @@ static void add_user_parameters(void)
      * 
      * XXX It is possible that a user-defined parameter is defined in master.cf
      * with "-o name1=value1" and then used in a "-o name2=$name1" macro
-     * expansion in that same master.cf entry.
+     * expansion in that same master.cf entry. To handle this we need to give
+     * each master.cf entry its own name space. Until then, we may log false
+     * warnings for unused "-o name=value" entries.
      */
     for (argvp = master_table; (argv = *argvp) != 0; argvp++) {
        for (field = MASTER_FIELD_COUNT; argv->argv[field] != 0; field++) {
@@ -1776,8 +1821,11 @@ static void flag_unused_master_parameters(void)
      * output.
      * 
      * XXX It is possible that a user-defined parameter is defined in master.cf
-     * with "-o name1=value1" and then used in a "-o name2=$name1" macro
-     * expansion in that same master.cf entry.
+     * with "-o smtpd_restriction_classes=name", or with "-o name1=value1"
+     * and then used in a "-o name2=$name1" macro expansion in that same
+     * master.cf entry. To handle this we need to give each master.cf entry
+     * its own name space. Until then, we may log false warnings for unused
+     * "-o name=value" entries.
      */
     for (argvp = master_table; (argv = *argvp) != 0; argvp++) {
        for (field = MASTER_FIELD_COUNT; argv->argv[field] != 0; field++) {
@@ -2012,8 +2060,8 @@ int     main(int argc, char **argv)
 
        /*
         * Flag unused parameters. This makes no sense with "postconf -d",
-        * because that ignores all the user-specified parameter values that
-        * may contain macro expansions with user-defined parameter names.
+        * because that ignores all the user-specified parameters and
+        * user-specified macro expansions in main.cf.
         */
 #ifdef MAC_EXP_FLAG_SCAN
        if ((cmd_mode & SHOW_DEFS) == 0) {
diff --git a/postfix/src/postconf/test1.ref b/postfix/src/postconf/test1.ref
new file mode 100644 (file)
index 0000000..8827715
--- /dev/null
@@ -0,0 +1,3 @@
+config_directory = .
+foo = yes
+smtpd_restriction_classes = foo bar
diff --git a/postfix/src/postconf/test2.ref b/postfix/src/postconf/test2.ref
new file mode 100644 (file)
index 0000000..49af249
--- /dev/null
@@ -0,0 +1,3 @@
+config_directory = .
+./postconf: warning: ./main.cf: unused parameter: restriction_classes=foo bar
+./postconf: warning: ./main.cf: unused parameter: foo=yes
diff --git a/postfix/src/postconf/test3.ref b/postfix/src/postconf/test3.ref
new file mode 100644 (file)
index 0000000..bdeff73
--- /dev/null
@@ -0,0 +1,4 @@
+always_bcc = $bar
+bar = $foo
+config_directory = .
+foo = yes
diff --git a/postfix/src/postconf/test4.ref b/postfix/src/postconf/test4.ref
new file mode 100644 (file)
index 0000000..6ec1913
--- /dev/null
@@ -0,0 +1,3 @@
+bar = $foo
+config_directory = .
+foo = yes
diff --git a/postfix/src/postconf/test5.ref b/postfix/src/postconf/test5.ref
new file mode 100644 (file)
index 0000000..3c853ff
--- /dev/null
@@ -0,0 +1,2 @@
+config_directory = .
+./postconf: warning: ./master.cf: unused parameter: bar=yes
index 764f3c10bda44200115e980d159d461bc8e31555..7bf81f7c347105edf965ceca4f956fa5c3ff8ec6 100644 (file)
@@ -287,7 +287,9 @@ extern int opterr;
 extern int h_errno;
 
 #define MISSING_STRFTIME_E
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
 #define USE_STATFS
@@ -327,7 +329,9 @@ extern int optind;                  /* XXX use <getopt.h> */
 extern char *optarg;                   /* XXX use <getopt.h> */
 extern int opterr;                     /* XXX use <getopt.h> */
 
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
 #define USE_STATFS
@@ -372,7 +376,9 @@ extern int optind;
 extern char *optarg;
 extern int opterr;
 
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
 #define USE_STATFS
@@ -412,8 +418,10 @@ extern int opterr;
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
 #define HAS_NISPLUS
+#endif
 #define USE_SYS_SOCKIO_H               /* Solaris 2.5, changed sys/ioctl.h */
 #define GETTIMEOFDAY(t)        gettimeofday(t)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
@@ -490,7 +498,9 @@ extern int opterr;
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define USE_SYS_SOCKIO_H
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
@@ -519,8 +529,9 @@ extern int opterr;
 #define HAS_DBM
 #define DEF_DB_TYPE     "dbm"
 #define ALIAS_DB_MAP    "dbm:/etc/mail/aliases"
-/* Uncomment the following line if you have NIS package installed
+#ifndef NO_NIS
 #define HAS_NIS */
+#endif
 #define USE_SYS_SOCKIO_H
 #define GETTIMEOFDAY(t) gettimeofday(t,NULL)
 #define ROOT_PATH       "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
@@ -561,7 +572,9 @@ extern int opterr;
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define HAS_SA_LEN
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
@@ -613,7 +626,9 @@ extern int opterr;
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define HAS_SA_LEN
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define RESOLVE_H_NEEDS_STDIO_H
@@ -657,7 +672,9 @@ extern int initgroups(const char *, int);
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define HAS_SA_LEN
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define RESOLVE_H_NEEDS_STDIO_H
@@ -697,7 +714,9 @@ extern int initgroups(const char *, int);
 #define HAS_DBM
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define USE_SYS_SOCKIO_H               /* XXX check */
 #define GETTIMEOFDAY(t)        gettimeofday(t)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/bsd"
@@ -739,7 +758,9 @@ extern int initgroups(const char *, int);
 #define HAS_DB
 #define DEF_DB_TYPE    "hash"
 #define ALIAS_DB_MAP   "hash:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin"
 #define FIONREAD_IN_TERMIOS_H
@@ -814,7 +835,9 @@ extern int initgroups(const char *, int);
 #define HAS_DB
 #define DEF_DB_TYPE    "hash"
 #define ALIAS_DB_MAP   "hash:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin"
 #define FIONREAD_IN_TERMIOS_H          /* maybe unnecessary */
@@ -846,7 +869,9 @@ extern int initgroups(const char *, int);
 #define HAS_DB
 #define DEF_DB_TYPE    "hash"
 #define ALIAS_DB_MAP   "hash:/etc/aliases"
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin"
 #define FIONREAD_IN_TERMIOS_H
@@ -912,7 +937,9 @@ extern int initgroups(const char *, int);
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
 #define ROOT_PATH      "/usr/bin:/sbin:/usr/sbin"
 #define MISSING_SETENV
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define _PATH_BSHELL   "/bin/sh"
 #define _PATH_MAILDIR  "/var/mail"
@@ -949,7 +976,9 @@ extern int h_errno;                 /* <netdb.h> imports too much stuff */
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
 #define ROOT_PATH      "/usr/bin:/sbin:/usr/sbin"
 #define MISSING_SETENV
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define _PATH_BSHELL   "/bin/sh"
 #define _PATH_MAILDIR  "/var/mail"
@@ -982,7 +1011,9 @@ extern int h_errno;                        /* <netdb.h> imports too much stuff */
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FCNTL
 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
 #define HAS_FSYNC
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define MISSING_SETENV
 #define MISSING_RLIMIT_FSIZE
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
@@ -1025,7 +1056,9 @@ extern int h_errno;
 #define HAVE_SYS_DIR_H
 #define STATFS_IN_SYS_VFS_H
 #define HAS_FSYNC
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define HAS_NETINFO
 #define MISSING_SETENV_PUTENV
 #define MISSING_MKFIFO
@@ -1078,7 +1111,9 @@ typedef unsigned short mode_t;
 #define HAVE_SYS_DIR_H
 #define STATFS_IN_SYS_VFS_H
 #define HAS_FSYNC
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define HAS_NETINFO
 #define MISSING_SETENV_PUTENV
 #define MISSING_MKFIFO
@@ -1140,7 +1175,9 @@ extern int optind;                        /* XXX use <getopt.h> */
 extern char *optarg;                   /* XXX use <getopt.h> */
 extern int opterr;                     /* XXX use <getopt.h> */
 
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t) gettimeofday(t)
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
 #define USE_STATVFS
@@ -1198,7 +1235,9 @@ extern int h_errno;
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
 #define DBM_NO_TRAILING_NULL
+#ifndef NO_NIS
 #define HAS_NIS
+#endif
 #define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
 #define ROOT_PATH      "/bin:/etc:/usr/bin:/tcb/bin"
 #define USE_STATVFS