X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Fexports.c;h=e6de71aebfbce484e4c5aae3bf99b87c979408ea;hp=7194c08e20b20652196565fbefc859470b8ac510;hb=f8d5dd05dd28fe122832b229c5298d254eb4b581;hpb=e873a11144f5cbfa6b54a3b2eb3af131cbd5ebbd diff --git a/support/nfs/exports.c b/support/nfs/exports.c index 7194c08..e6de71a 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -14,7 +14,9 @@ * as is, with no warranty expressed or implied. */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif #include #include @@ -67,7 +69,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 +115,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 +132,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)