X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Fexports.c;h=d0f63b0cf556bb75e0433a31f33bd501fe1c9178;hp=c46c7a99655b921f24855e1bee13f2f306742f77;hb=025a0c58ed9043d231672a22232c438f29511ca0;hpb=9c8dfab04dcf5f5067061703d6cd08ee408eec8f diff --git a/support/nfs/exports.c b/support/nfs/exports.c index c46c7a9..d0f63b0 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -67,7 +67,7 @@ struct exportent * getexportent(int fromkernel, int fromexports) { static struct exportent ee; - char exp[512]; + char exp[512], *hostname; char rpath[MAXPATHLEN+1]; char *opt, *sp; int ok; @@ -113,9 +113,13 @@ getexportent(int fromkernel, int fromexports) /* Check for default client */ if (ok == 0) exp[0] = '\0'; + + hostname = exp; if ((opt = strchr(exp, '(')) != NULL) { - if (opt == exp) + if (opt == exp) { xlog(L_WARNING, "No host name given with %s %s, suggest *%s to avoid warning", ee.e_path, exp, exp); + hostname = "*"; + } *opt++ = '\0'; if (!(sp = strchr(opt, ')')) || sp[1] != '\0') { syntaxerr("bad option list"); @@ -126,12 +130,12 @@ getexportent(int fromkernel, int fromexports) } else { xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp); } - if (strlen(exp) >= sizeof(ee.e_hostname)) { + if (strlen(hostname) >= sizeof(ee.e_hostname)) { syntaxerr("client name too long"); export_errno = EINVAL; return NULL; } - strncpy(ee.e_hostname, exp, sizeof (ee.e_hostname) - 1); + strncpy(ee.e_hostname, hostname, sizeof (ee.e_hostname) - 1); ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0'; if (parseopts(opt, &ee, fromexports) < 0) @@ -185,6 +189,8 @@ putexportent(struct exportent *ep) "no_" : ""); fprintf(fp, "%ssecure_locks,", (ep->e_flags & NFSEXP_NOAUTHNLM)? "in" : ""); + fprintf(fp, "%sacl,", (ep->e_flags & NFSEXP_NOACL)? + "no_" : ""); if (ep->e_flags & NFSEXP_FSID) { fprintf(fp, "fsid=%d,", ep->e_fsid); } @@ -374,6 +380,10 @@ parseopts(char *cp, struct exportent *ep, int warn) ep->e_flags &= ~NFSEXP_NOAUTHNLM; else if (strcmp(opt, "insecure_locks") == 0) ep->e_flags |= NFSEXP_NOAUTHNLM; + else if (strcmp(opt, "acl") == 0) + ep->e_flags &= ~NFSEXP_NOACL; + else if (strcmp(opt, "no_acl") == 0) + ep->e_flags |= NFSEXP_NOACL; else if (strncmp(opt, "mapping=", 8) == 0) ep->e_maptype = parsemaptype(opt+8); else if (strcmp(opt, "map_identity") == 0) /* old style */ @@ -442,7 +452,7 @@ bad_option: ep->e_nsqgids = nsqgids; out: - if (warn && !had_sync_opt) + 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",