rpms/nfs-utils/devel nfs-utils-1.0.10-export-nosubtree.patch, NONE, 1.1 nfs-utils-1.0.9-idmap-dirscancb-listloop.patch, NONE, 1.1 nfs-utils-1.0.9-idmapd-scandir-leak.patch, NONE, 1.1 nfs-utils-1.0.9-mount-remount.patch, NONE, 1.1 nfs-utils.spec, 1.111, 1.112

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Oct 31 16:39:00 UTC 2006


Author: steved

Update of /cvs/dist/rpms/nfs-utils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv3732

Modified Files:
	nfs-utils.spec 
Added Files:
	nfs-utils-1.0.10-export-nosubtree.patch 
	nfs-utils-1.0.9-idmap-dirscancb-listloop.patch 
	nfs-utils-1.0.9-idmapd-scandir-leak.patch 
	nfs-utils-1.0.9-mount-remount.patch 
Log Message:
- Fixed -o remount (bz 210346)
- fix memory leak in rpc.idmapd (bz 212547)
- fix use after free bug in dirscancb (bz 212547)
- Made no_subtree_check a default export option (bz 212218)


nfs-utils-1.0.10-export-nosubtree.patch:
 export/export.c  |    2 +-
 export/xtab.c    |    2 +-
 include/nfslib.h |    2 +-
 nfs/exports.c    |   26 ++++++++------------------
 4 files changed, 11 insertions(+), 21 deletions(-)

--- NEW FILE nfs-utils-1.0.10-export-nosubtree.patch ---
--- nfs-utils-1.0.10/support/export/export.c.orig	2006-08-07 02:40:50.000000000 -0400
+++ nfs-utils-1.0.10/support/export/export.c	2006-10-31 11:21:12.458470000 -0500
@@ -34,7 +34,7 @@ export_read(char *fname)
 	nfs_export		*exp;
 
 	setexportent(fname, "r");
-	while ((eep = getexportent(0,1)) != NULL) {
+	while ((eep = getexportent(0)) != NULL) {
 	  exp = export_lookup(eep->e_hostname, eep->e_path, 0);
 	  if (!exp)
 	    export_create(eep,0);
--- nfs-utils-1.0.10/support/export/xtab.c.orig	2006-08-07 02:40:50.000000000 -0400
+++ nfs-utils-1.0.10/support/export/xtab.c	2006-10-31 11:21:29.838160000 -0500
@@ -36,7 +36,7 @@ xtab_read(char *xtab, int is_export)
 	if ((lockid = xflock(xtab, "r")) < 0)
 		return 0;
 	setexportent(xtab, "r");
-	while ((xp = getexportent(is_export==0, 0)) != NULL) {
+	while ((xp = getexportent(is_export==0)) != NULL) {
 		if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
 		    !(exp = export_create(xp, is_export!=1))) {
 			continue;
--- nfs-utils-1.0.10/support/include/nfslib.h.orig	2006-08-07 02:40:50.000000000 -0400
+++ nfs-utils-1.0.10/support/include/nfslib.h	2006-10-31 11:21:01.807421000 -0500
@@ -92,7 +92,7 @@ struct rmtabent {
  * configuration file parsing
  */
 void			setexportent(char *fname, char *type);
-struct exportent *	getexportent(int,int);
+struct exportent *	getexportent(int);
 void			putexportent(struct exportent *xep);
 void			endexportent(void);
 struct exportent *	mkexportent(char *hname, char *path, char *opts);
--- nfs-utils-1.0.10/support/nfs/exports.c.orig	2006-08-07 02:40:50.000000000 -0400
+++ nfs-utils-1.0.10/support/nfs/exports.c	2006-10-31 11:22:44.654243000 -0500
@@ -32,7 +32,8 @@
 #include "xio.h"
 
 #define EXPORT_DEFAULT_FLAGS	\
-  (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES)
+  (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES|\
+  NFSEXP_NOSUBTREECHECK)
 
 int export_errno;
 
@@ -44,7 +45,7 @@ static int	*squids = NULL, nsquids = 0,
 
 static int	getexport(char *exp, int len);
 static int	getpath(char *path, int len);
-static int	parseopts(char *cp, struct exportent *ep, int warn);
+static int	parseopts(char *cp, struct exportent *ep);
 static int	parsesquash(char *list, int **idp, int *lenp, char **ep);
 static int	parsenum(char **cpp);
 static int	parsemaptype(char *type);
@@ -66,7 +67,7 @@ setexportent(char *fname, char *type)
 }
 
 struct exportent *
-getexportent(int fromkernel, int fromexports)
+getexportent(int fromkernel)
 {
 	static struct exportent	ee;
 	char		exp[512], *hostname;
@@ -140,7 +141,7 @@ getexportent(int fromkernel, int fromexp
 	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)
+	if (parseopts(opt, &ee) < 0)
 		return NULL;
 
 	/* resolve symlinks */
@@ -293,7 +294,7 @@ mkexportent(char *hname, char *path, cha
 	ee.e_path[sizeof (ee.e_path) - 1] = '\0';
 	strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1);
 	ee.m_path [sizeof (ee.m_path) - 1] = '\0';
-	if (parseopts(options, &ee, 0) < 0)
+	if (parseopts(options, &ee) < 0)
 		return NULL;
 	return ⅇ
 }
@@ -301,7 +302,7 @@ mkexportent(char *hname, char *path, cha
 int
 updateexportent(struct exportent *eep, char *options)
 {
-	if (parseopts(options, eep, 0) < 0)
+	if (parseopts(options, eep) < 0)
 		return 0;
 	return 1;
 }
@@ -310,9 +311,8 @@ updateexportent(struct exportent *eep, c
  * Parse option string pointed to by cp and set mount options accordingly.
  */
 static int
-parseopts(char *cp, struct exportent *ep, int warn)
+parseopts(char *cp, struct exportent *ep)
 {
-	int	had_subtree_opt = 0;
 	char 	*flname = efname?efname:"command line";
 	int	flline = efp?efp->x_line:0;
 
@@ -369,10 +369,8 @@ parseopts(char *cp, struct exportent *ep
 		else if (strcmp(opt, "no_all_squash") == 0)
 			ep->e_flags &= ~NFSEXP_ALLSQUASH;
 		else if (strcmp(opt, "subtree_check") == 0) {
-			had_subtree_opt = 1;
 			ep->e_flags &= ~NFSEXP_NOSUBTREECHECK;
 		} else if (strcmp(opt, "no_subtree_check") == 0) {
-			had_subtree_opt = 1;
 			ep->e_flags |= NFSEXP_NOSUBTREECHECK;
 		} else if (strcmp(opt, "auth_nlm") == 0)
 			ep->e_flags &= ~NFSEXP_NOAUTHNLM;
@@ -454,14 +452,6 @@ bad_option:
 	ep->e_nsqgids = nsqgids;
 
 out:
-	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);
-
 	return 1;
 }
 

nfs-utils-1.0.9-idmap-dirscancb-listloop.patch:
 idmapd.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

--- NEW FILE nfs-utils-1.0.9-idmap-dirscancb-listloop.patch ---
--- nfs-utils-1.0.10/utils/idmapd/idmapd.c.segv
+++ nfs-utils-1.0.10/utils/idmapd/idmapd.c
@@ -444,7 +444,7 @@ dirscancb(int fd, short which, void *dat
 {
 	int nent, i;
 	struct dirent **ents;
-	struct idmap_client *ic;
+	struct idmap_client *ic, *nextic;
 	char path[PATH_MAX];
 	struct idmap_clientq *icq = data;
 
@@ -498,7 +498,9 @@ dirscancb(int fd, short which, void *dat
 		}
 	}
 
-	TAILQ_FOREACH(ic, icq, ic_next) {
+	ic = TAILQ_FIRST(icq);
+	while(ic != NULL) {
+		nextic=TAILQ_NEXT(ic, ic_next);
 		if (!ic->ic_scanned) {
 			event_del(&ic->ic_event);
 			close(ic->ic_fd);
@@ -511,6 +513,7 @@ dirscancb(int fd, short which, void *dat
 			free(ic);
 		} else
 			ic->ic_scanned = 0;
+		ic = nextic;
 	}
 
 out:

nfs-utils-1.0.9-idmapd-scandir-leak.patch:
 idmapd.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

--- NEW FILE nfs-utils-1.0.9-idmapd-scandir-leak.patch ---
--- nfs-utils-1.0.10/utils/idmapd/idmapd.c.leak
+++ nfs-utils-1.0.10/utils/idmapd/idmapd.c
@@ -464,7 +464,7 @@ dirscancb(int fd, short which, void *dat
 				goto next;
 
 			if ((ic = calloc(1, sizeof(*ic))) == NULL)
-				return;
+				goto out;
 			strlcpy(ic->ic_clid, ents[i]->d_name + 4,
 			    sizeof(ic->ic_clid));
 			path[0] = '\0';
@@ -474,7 +474,7 @@ dirscancb(int fd, short which, void *dat
 			if ((ic->ic_dirfd = open(path, O_RDONLY, 0)) == -1) {
 				idmapd_warn("dirscancb: open(%s)", path);
 				free(ic);
-				return;
+				goto out;
 			}
 
 			strlcat(path, "/idmap", sizeof(path));
@@ -486,7 +486,7 @@ dirscancb(int fd, short which, void *dat
 			if (nfsopen(ic) == -1) {
 				close(ic->ic_dirfd);
 				free(ic);
-				return;
+				goto out;
 			}
 
 			ic->ic_id = "Client";
@@ -512,6 +512,11 @@ dirscancb(int fd, short which, void *dat
 		} else
 			ic->ic_scanned = 0;
 	}
+
+out:
+	for (i = 0;  i < nent; i++)
+		free(ents[i]);
+	free(ents);
 	return;
 }
 

nfs-utils-1.0.9-mount-remount.patch:
 mount.c |   55 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 19 deletions(-)

--- NEW FILE nfs-utils-1.0.9-mount-remount.patch ---
--- nfs-utils-1.0.9/utils/mount/mount.c.orig	2006-10-25 10:52:32.000000000 -0400
+++ nfs-utils-1.0.9/utils/mount/mount.c	2006-10-25 12:09:52.000000000 -0400
@@ -163,16 +163,29 @@ static char * fix_opts_string (int flags
 	return new_opts;
 }
 
-void copy_mntent(struct mntent *ment, nfs_mntent_t *nment)
+static inline void dup_mntent(struct mntent *ment, nfs_mntent_t *nment)
 {
 	/* Not sure why nfs_mntent_t should exist */
-	strcpy(nment->mnt_fsname, ment->mnt_fsname);
-	strcpy(nment->mnt_dir, ment->mnt_dir);
-	strcpy(nment->mnt_type, ment->mnt_type);
-	strcpy(nment->mnt_opts, ment->mnt_opts);
+	nment->mnt_fsname = strdup(ment->mnt_fsname);
+	nment->mnt_dir = strdup(ment->mnt_dir);
+	nment->mnt_type = strdup(ment->mnt_type);
+	nment->mnt_opts = strdup(ment->mnt_opts);
 	nment->mnt_freq = ment->mnt_freq;
 	nment->mnt_passno = ment->mnt_passno;
 }
+static inline void 
+free_mntent(struct mntent *ment, int remount)
+{
+	free(ment->mnt_fsname);
+	free(ment->mnt_dir);
+	free(ment->mnt_type);
+	/* 
+	 * Note: free(ment->mnt_opts) happens in discard_mntentchn()
+	 * via update_mtab() on remouts
+	 */
+	 if (!remount)
+	 	free(ment->mnt_opts);
+}
 
 int add_mtab(char *fsname, char *mount_point, char *fstype, int flags, char *opts, int freq, int passno)
 {
@@ -190,8 +203,9 @@ int add_mtab(char *fsname, char *mount_p
 	if(flags & MS_REMOUNT) {
 		nfs_mntent_t nment;
 		
-		copy_mntent(&ment, &nment);
+		dup_mntent(&ment, &nment);
 		update_mtab(nment.mnt_dir, &nment);
+		free_mntent(&nment, 1);
 		return 0;
 	}
 
@@ -341,10 +355,11 @@ static void mount_error(char *node)
 			fprintf(stderr, "%s: %s\n", progname, strerror(errno));
 	}
 }
+#define NFS_MOUNT_VERS_DEFAULT 3
 
 int main(int argc, char *argv[])
 {
-	int c, flags = 0, nfs_mount_vers = 0, mnt_err = 1, fake = 0;
+	int c, flags = 0, nfs_mount_vers, mnt_err = 1, fake = 0;
 	char *spec, *mount_point, *extra_opts = NULL;
 	char *mount_opts = NULL, *p;
 	struct mntentchn *mc;
@@ -375,6 +390,10 @@ int main(int argc, char *argv[])
 		return 0;
 	}
 
+	nfs_mount_vers = NFS_MOUNT_VERS_DEFAULT;
+	if (!strcmp(progname, "mount.nfs4"))
+		nfs_mount_vers = 4;
+
 	while ((c = getopt_long (argc - 2, argv + 2, "rt:vVwfno:hs",
 				longopts, NULL)) != -1) {
 		switch (c) {
@@ -465,9 +484,9 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if (!strcmp(progname, "mount.nfs4") || nfs_mount_vers == 4) {
-		nfs_mount_vers = 4;
-		mnt_err = nfs4mount(spec, mount_point, &flags, &extra_opts, &mount_opts, 0);
+	if (nfs_mount_vers == 4) {
+		mnt_err = nfs4mount(spec, mount_point, &flags, 
+			&extra_opts, &mount_opts, 0);
 	}
 	else {
 		if (!strcmp(progname, "mount.nfs")) {
@@ -475,21 +494,19 @@ int main(int argc, char *argv[])
 					&extra_opts, &mount_opts, &nfs_mount_vers, 0);
 		}
 	}
-
 	if (fake)
 		return 0;
 	if (mnt_err)
 		exit(EX_FAIL);
 
-	if(!(flags & MS_REMOUNT)) {
-		mnt_err = do_mount_syscall(spec, mount_point,
-				nfs_mount_vers == 4 ? "nfs4" : "nfs", flags, mount_opts);
-
-		if(mnt_err) {
-			mount_error(mount_point);
-			exit(EX_FAIL);
-		}
+	mnt_err = do_mount_syscall(spec, mount_point,
+			nfs_mount_vers == 4 ? "nfs4" : "nfs", flags, mount_opts);
+
+	if(mnt_err) {
+		mount_error(mount_point);
+		exit(EX_FAIL);
 	}
+
 	if(!nomtab) {
 		add_mtab(spec, mount_point, nfs_mount_vers == 4 ? "nfs4" : "nfs",
 			 flags, extra_opts, 0, 0);


Index: nfs-utils.spec
===================================================================
RCS file: /cvs/dist/rpms/nfs-utils/devel/nfs-utils.spec,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- nfs-utils.spec	25 Oct 2006 16:47:09 -0000	1.111
+++ nfs-utils.spec	31 Oct 2006 16:38:58 -0000	1.112
@@ -1,7 +1,7 @@
 Summary: NFS utlilities and supporting clients and daemons for the kernel NFS server.
 Name: nfs-utils
 Version: 1.0.10
-Release: 1%{?dist}
+Release: 2%{?dist}
 Epoch: 1
 
 # group all 32bit related archs
@@ -31,6 +31,8 @@
 Patch53: nfs-utils-1.0.6-gssd_mixed_case.patch
 Patch54: nfs-utils-1.0.8-privports.patch
 Patch55: nfs-utils-1.0.9-krb5-memory.patch
+Patch56: nfs-utils-1.0.9-idmapd-scandir-leak.patch
+Patch57: nfs-utils-1.0.9-idmap-dirscancb-listloop.patch
 
 %if %{enablemount}
 Patch70: nfs-utils-1.0.9-mount-options-v3.patch
@@ -39,6 +41,8 @@
 Patch73: nfs-utils-1.0.9-mount-man-nfs.patch
 Patch74: nfs-utils-1.0.9-return-mount-error.patch
 Patch75: nfs-utils-1.0.9-nfsmount-authnone.patch
+Patch76: nfs-utils-1.0.9-mount-remount.patch
+Patch77: nfs-utils-1.0.10-export-nosubtree.patch
 
 %if %{enablefscache}
 Patch90: nfs-utils-1.0.9-mount-fsc.patch
@@ -92,6 +96,8 @@
 %patch53 -p1
 %patch54 -p1
 %patch55 -p1
+%patch57 -p1
+%patch56 -p1
 %if %{enablemount}
 %patch70 -p1
 %patch71 -p1
@@ -99,6 +105,8 @@
 %patch73 -p1
 %patch74 -p1
 %patch75 -p1
+%patch76 -p1
+%patch77 -p1
 %if %{enablefscache}
 %patch90 -p1
 %endif
@@ -276,6 +284,12 @@
 %endif
 
 %changelog
+* Tue Oct 31 2006 Steve Dickson <steved at redhat.com> 1.0.10-2
+- Fixed -o remount (bz 210346)
+- fix memory leak in rpc.idmapd (bz 212547)
+- fix use after free bug in dirscancb (bz 212547)
+- Made no_subtree_check a default export option (bz 212218)
+
 * Wed Oct 25 2006 Steve Dickson <steved at redhat.com> 1.0.10-1
 - Upgraded to 1.0.10 
 




More information about the fedora-cvs-commits mailing list