]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/exports.c
Remove warning if neither 'sync' or 'async' present.
[nfs-utils.git] / support / nfs / exports.c
index d0f63b0cf556bb75e0433a31f33bd501fe1c9178..2d3178171c2ae729f8ad4e967e3f51e3e8d5e26c 100644 (file)
@@ -14,7 +14,9 @@
  *             as is, with no warranty expressed or implied.
  */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <sys/param.h>
 #include <stdlib.h>
@@ -87,8 +89,8 @@ getexportent(int fromkernel, int fromexports)
                ee.e_flags &= ~NFSEXP_GATHERED_WRITES;
        }
        ee.e_maptype = CLE_MAP_IDENT;
-       ee.e_anonuid = -2;
-       ee.e_anongid = -2;
+       ee.e_anonuid = 65534;
+       ee.e_anongid = 65534;
        ee.e_squids = NULL;
        ee.e_sqgids = NULL;
        ee.e_mountpoint = NULL;
@@ -165,7 +167,7 @@ putexportent(struct exportent *ep)
 
        fp = efp->x_fp;
        for (i=0; esc[i]; i++)
-               if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\'|| isspace(esc[i]))
+               if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\' || esc[i] == '#' || isspace(esc[i]))
                        fprintf(fp, "\\%03o", esc[i]);
                else
                        fprintf(fp, "%c", esc[i]);
@@ -269,8 +271,8 @@ mkexportent(char *hname, char *path, char *options)
 
        ee.e_flags = EXPORT_DEFAULT_FLAGS;
        ee.e_maptype = CLE_MAP_IDENT;
-       ee.e_anonuid = -2;
-       ee.e_anongid = -2;
+       ee.e_anonuid = 65534;
+       ee.e_anongid = 65534;
        ee.e_squids = NULL;
        ee.e_sqgids = NULL;
        ee.e_mountpoint = NULL;
@@ -310,7 +312,7 @@ updateexportent(struct exportent *eep, char *options)
 static int
 parseopts(char *cp, struct exportent *ep, int warn)
 {
-       int     had_sync_opt = 0;
+       int     had_subtree_opt = 0;
        char    *flname = efname?efname:"command line";
        int     flline = efp?efp->x_line:0;
 
@@ -342,13 +344,11 @@ parseopts(char *cp, struct exportent *ep, int warn)
                        ep->e_flags &= ~NFSEXP_INSECURE_PORT;
                else if (!strcmp(opt, "insecure"))
                        ep->e_flags |= NFSEXP_INSECURE_PORT;
-               else if (!strcmp(opt, "sync")) {
-                       had_sync_opt = 1;
+               else if (!strcmp(opt, "sync"))
                        ep->e_flags &= ~NFSEXP_ASYNC;
-               } else if (!strcmp(opt, "async")) {
-                       had_sync_opt = 1;
+               else if (!strcmp(opt, "async"))
                        ep->e_flags |= NFSEXP_ASYNC;
-               else if (!strcmp(opt, "nohide"))
+               else if (!strcmp(opt, "nohide"))
                        ep->e_flags |= NFSEXP_NOHIDE;
                else if (!strcmp(opt, "hide"))
                        ep->e_flags &= ~NFSEXP_NOHIDE;
@@ -368,11 +368,13 @@ parseopts(char *cp, struct exportent *ep, int warn)
                        ep->e_flags |= NFSEXP_ALLSQUASH;
                else if (strcmp(opt, "no_all_squash") == 0)
                        ep->e_flags &= ~NFSEXP_ALLSQUASH;
-               else if (strcmp(opt, "subtree_check") == 0)
+               else if (strcmp(opt, "subtree_check") == 0) {
+                       had_subtree_opt = 1;
                        ep->e_flags &= ~NFSEXP_NOSUBTREECHECK;
-               else if (strcmp(opt, "no_subtree_check") == 0)
+               } else if (strcmp(opt, "no_subtree_check") == 0) {
+                       had_subtree_opt = 1;
                        ep->e_flags |= NFSEXP_NOSUBTREECHECK;
-               else if (strcmp(opt, "auth_nlm") == 0)
+               else if (strcmp(opt, "auth_nlm") == 0)
                        ep->e_flags &= ~NFSEXP_NOAUTHNLM;
                else if (strcmp(opt, "no_auth_nlm") == 0)
                        ep->e_flags |= NFSEXP_NOAUTHNLM;
@@ -452,10 +454,10 @@ bad_option:
        ep->e_nsqgids = nsqgids;
 
 out:
-       if (warn && !had_sync_opt && !(ep->e_flags & NFSEXP_READONLY))
-               xlog(L_WARNING, "%s [%d]: No 'sync' or 'async' option specified for export \"%s:%s\".\n"
-                               "  Assuming default behaviour ('sync').\n"
-                               "  NOTE: this default has changed from previous versions\n",
+       if (warn && !had_subtree_opt)
+               xlog(L_WARNING, "%s [%d]: Neither 'subtree_check' or 'no_subtree_check' specified for export \"%s:%s\".\n"
+                               "  Assuming default behaviour ('subtree_check').\n"
+                               "  NOTE: this default will change with nfs-utils version 1.1.0\n",
 
                                flname, flline,
                                ep->e_hostname, ep->e_path);