diff --git a/nfs-utils-1.3.1-exportfs-empty.patch b/nfs-utils-1.3.1-exportfs-empty.patch new file mode 100644 index 0000000..13dd4b2 --- /dev/null +++ b/nfs-utils-1.3.1-exportfs-empty.patch @@ -0,0 +1,110 @@ +commit e725def62c73b4aa269fefc4c0d96abb41927fcb +Author: Steve Dickson +Date: Mon Nov 17 13:17:20 2014 -0500 + + exportfs: Do not fail on empty exports file. + + Commit 076dd80 introduced a regression that causes + exportfs to fail when there is an empty /etc/exports + file. A empty /etc/exports file is valid and should + not cause exportfs to fail. + + Signed-off-by: Steve Dickson + Signed-off-by: Steve Dickson + +diff --git a/support/export/export.c b/support/export/export.c +index ce714d4..30a5b4a 100644 +--- a/support/export/export.c ++++ b/support/export/export.c +@@ -71,12 +71,13 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep) + * + */ + void +-export_read(char *fname) ++export_read(char *fname, int verbose) + { + struct exportent *eep; + nfs_export *exp; + + int volumes = 0; ++ int bad_entry = 0; + + setexportent(fname, "r"); + while ((eep = getexportent(0,1)) != NULL) { +@@ -85,13 +86,19 @@ export_read(char *fname) + exp = export_create(eep, 0); + if (exp) + volumes++; ++ else ++ bad_entry++; + } + else + warn_duplicated_exports(exp, eep); + } + endexportent(); +- if (volumes == 0) +- xlog(L_ERROR, "No file systems exported!"); ++ if (volumes == 0) { ++ if (bad_entry > 0) ++ xlog(L_ERROR, "No file systems exported!"); ++ else if (verbose) ++ xlog(L_WARNING, "No file systems exported!"); ++ } + } + + /** +diff --git a/support/include/exportfs.h b/support/include/exportfs.h +index 9021fae..3d89f12 100644 +--- a/support/include/exportfs.h ++++ b/support/include/exportfs.h +@@ -133,7 +133,7 @@ struct addrinfo * client_resolve(const struct sockaddr *sap); + int client_member(const char *client, + const char *name); + +-void export_read(char *fname); ++void export_read(char *fname, int verbose); + void export_reset(nfs_export *); + nfs_export * export_lookup(char *hname, char *path, int caconical); + nfs_export * export_find(const struct addrinfo *ai, +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index bdea12b..92fb9eb 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -47,7 +47,7 @@ static void error(nfs_export *exp, int err); + static void usage(const char *progname, int n); + static void validate_export(nfs_export *exp); + static int matchhostname(const char *hostname1, const char *hostname2); +-static void export_d_read(const char *dname); ++static void export_d_read(const char *dname, int verbose); + static void grab_lockfile(void); + static void release_lockfile(void); + +@@ -182,8 +182,8 @@ main(int argc, char **argv) + atexit(release_lockfile); + + if (f_export && ! f_ignore) { +- export_read(_PATH_EXPORTS); +- export_d_read(_PATH_EXPORTS_D); ++ export_read(_PATH_EXPORTS, f_verbose); ++ export_d_read(_PATH_EXPORTS_D, f_verbose); + } + if (f_export) { + if (f_all) +@@ -686,7 +686,7 @@ out: + /* Based on mnt_table_parse_dir() in + util-linux-ng/shlibs/mount/src/tab_parse.c */ + static void +-export_d_read(const char *dname) ++export_d_read(const char *dname, int verbose) + { + int n = 0, i; + struct dirent **namelist = NULL; +@@ -729,7 +729,7 @@ export_d_read(const char *dname) + continue; + } + +- export_read(fname); ++ export_read(fname, verbose); + } + + for (i = 0; i < n; i++) diff --git a/nfs-utils.spec b/nfs-utils.spec index e253f27..5fbe1d4 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser Name: nfs-utils URL: http://sourceforge.net/projects/nfs Version: 1.3.1 -Release: 2.1%{?dist} +Release: 2.2%{?dist} Epoch: 1 # group all 32bit related archs @@ -17,6 +17,7 @@ Source4: lockd.conf Patch001: nfs-utils-1.3.2-rc2.patch Patch002: nfs-utils-1.3.1-mountd-dos.patch +Patch003: nfs-utils-1.3.1-exportfs-empty.patch Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch @@ -76,6 +77,7 @@ This package also contains the mount.nfs and umount.nfs program. %patch001 -p1 %patch002 -p1 +%patch003 -p1 %patch100 -p1 %patch101 -p1 @@ -285,6 +287,9 @@ fi /sbin/umount.nfs4 %changelog +* Mon Nov 17 2014 Steve Dickson 1.3.1-2.2 +- Allow the server to start with an empty /etc/exports (bz 1164477) + * Thu Nov 13 2014 Steve Dickson 1.3.1-2.1 - Fixed a mount DOS (bz 1163886)