[PATCH 00/13] nfsd patches

J. Bruce Fields bfields at fieldses.org
Mon Sep 11 13:01:35 EDT 2006


On Wed, Sep 06, 2006 at 03:49:47PM -0400, J. Bruce Fields wrote:
> Don't we also need to escape whatever we're using as separators here?
> (commas, semicolons, etc.)

OK, so I just added comma and semicolon escaping to Manoj's patch.

The hostlist escaping is overkill.  (Anyone attempting to use such
characters in a hostname deserves whatever they get.)  But maybe it's
safer that way.

(Fred, Manoj, any objections?)

I've also added this (and fixed up the other small things you already
fixed up) to the "nfs-server-stable" branch of my git tree (at
git://linux-nfs.org/~bfields/linux).

--b.

From: Manoj Naik <manoj at almaden.ibm.com>
Date: Mon, 11 Sep 2006 12:53:37 -0400
Subject: [PATCH] nfsd4: fs_locations fixes

Add range check for 'migrated' flag and seq_escape 'path' and 'hosts'
fields of locations in export flags.

Signed-off-by: Manoj Naik <manoj at almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields at citi.umich.edu>
---
 fs/nfsd/export.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 4dd90f5..7e429ca 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -452,6 +452,9 @@ fsloc_parse(char **mesg, char *buf, stru
 	err = get_int(mesg, &migrated);
 	if (err)
 		goto out_free_all;
+	err = -EINVAL;
+	if (migrated < 0 || migrated > 1)
+		goto out_free_all;
 	fsloc->migrated = migrated;
 	return 0;
 out_free_all:
@@ -1276,9 +1279,14 @@ static void exp_flags(struct seq_file *m
 		int i;
 
 		seq_printf(m, "%s%s=", first++?",":"", loctype);
-		seq_printf(m, "%s@%s", fsloc->locations[0].path, fsloc->locations[0].hosts);
+		seq_escape(m, fsloc->locations[0].path, ",;@ \t\n\\");
+		seq_putc(m, '@');
+		seq_escape(m, fsloc->locations[0].hosts, ",;@ \t\n\\");
 		for (i = 1; i < fsloc->locations_count; i++) {
-			seq_printf(m, ",%s@%s", fsloc->locations[i].path, fsloc->locations[i].hosts);
+			seq_putc(m, ';');
+			seq_escape(m, fsloc->locations[i].path, ",;@ \t\n\\");
+			seq_putc(m, '@');
+			seq_escape(m, fsloc->locations[i].hosts, ",;@ \t\n\\");
 		}
 	}
 }
-- 
1.4.2.g55c3



More information about the NFSv4 mailing list