[PATCH 00/13] nfsd patches

J. Bruce Fields bfields at fieldses.org
Wed Sep 6 15:49:47 EDT 2006


On Mon, Sep 04, 2006 at 11:41:10PM -0700, Manoj Naik wrote:
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 8d5da7d..02c73bd 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -449,6 +449,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:
> @@ -1269,9 +1272,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\\");

Don't we also need to escape whatever we're using as separators here?
(commas, semicolons, etc.)

(And doesn't /etc/exports have the same problems?  Or are we just
telling people not to name exports with commas?  Though it's not
required, other things being equal, I'd rather use approximately the
same format for /etc/exports and the content file.)

--b.


More information about the NFSv4 mailing list