]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Set default hostname to '*' rather than leaving it empty
authorneilbrown <neilbrown>
Tue, 20 Dec 2005 00:55:47 +0000 (00:55 +0000)
committerneilbrown <neilbrown>
Tue, 20 Dec 2005 00:55:47 +0000 (00:55 +0000)
ChangeLog
support/nfs/exports.c

index b83742c2ef22d7142bcc7ad1684d498605bccd70..068b673408a3d216ddb9725a8b2c037ae5b920e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-20 NeilBrown <neilb@suse.de>
+       support/nfs/exports.c(getexportent): is a null host name is given,
+       replace it with '*' so we have a non-empty host name for messages
+       etc.
+
 2005-12-20 Kevin Coffman <kwc@citi.umich.edu>
        utils/gssd/gssd_proc.c(create_auth_rpc_client): Use service
          portion of clp->servicename rather than hard-coding "nfs". 
 2005-12-20 Kevin Coffman <kwc@citi.umich.edu>
        utils/gssd/gssd_proc.c(create_auth_rpc_client): Use service
          portion of clp->servicename rather than hard-coding "nfs". 
index 1048c8074514dfe0167400f07cd7663b2d5cd2f5..d0f63b0cf556bb75e0433a31f33bd501fe1c9178 100644 (file)
@@ -67,7 +67,7 @@ struct exportent *
 getexportent(int fromkernel, int fromexports)
 {
        static struct exportent ee;
 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;
        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';
        /* Check for default client */
        if (ok == 0)
                exp[0] = '\0';
+
+       hostname = exp;
        if ((opt = strchr(exp, '(')) != NULL) {
        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);
                        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");
                *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);
        }
        } 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;
        }
                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)
        ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
 
        if (parseopts(opt, &ee, fromexports) < 0)