linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] exportfs: Fix the default authentication flavour setting
Date: Tue, 24 Sep 2013 15:18:31 -0400	[thread overview]
Message-ID: <5241E587.8040503@RedHat.com> (raw)
In-Reply-To: <1380049625-2875-1-git-send-email-Trond.Myklebust@netapp.com>



On 24/09/13 15:07, Trond Myklebust wrote:
> Commit 11ba3b1e01b67b7d19f26fba94fabdb60878e809 (Add a default flavor
> to an export's e_secinfo list) breaks the ordering of security flavours
> in the secinfo list, by reordering 'sec=sys' to always be the first
> secinfo flavour if one fails to set a default 'sec' setting.
> 
> An export of the form:
> 
> /export -sync,no_subtree_check,mp \
>            192.168.1.0/24(sec=krb5p:krb5i:krb5,rw,sec=sys,ro)
> 
> ends up getting translated by exportfs into the following entry in
> /var/lib/nfs/etab:
> 
> /export	192.168.1.0/24(ro,sync,wdelay,hide,nocrossmnt,\
>                        secure,root_squash,no_all_squash,\
> 		       no_subtree_check,secure_locks,acl,\
> 		       mountpoint,anonuid=65534,anongid=65534,\
> 		       sec=sys,ro,root_squash,no_all_squash,\
> 		       sec=krb5p:krb5i:krb5,rw,root_squash,no_all_squash)
> 
> Note how the 'sec=sys' is now listed first...
> 
> The fix is to defer adding the default flavour until the call to
> secinfo_show, when we can see if it is even needed at all.
> With the patch, the above export is now correctly entered in
> /var/lib/nfs/etab as:
> 
> /export	192.168.1.0/24(ro,sync,wdelay,hide,nocrossmnt,\
> 			secure,root_squash,no_all_squash,\
> 			no_subtree_check,secure_locks,acl,\
> 			mountpoint,anonuid=65534,anongid=65534,\
> 			sec=krb5p:krb5i:krb5,rw,root_squash,no_all_squash,\
> 			sec=sys,ro,root_squash,no_all_squash)
> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> Cc: Chuck Lever <chuck.lever@oracle.com>
Committed....

steved.

> ---
>  support/nfs/exports.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/support/nfs/exports.c b/support/nfs/exports.c
> index dea040f..3e99de6 100644
> --- a/support/nfs/exports.c
> +++ b/support/nfs/exports.c
> @@ -63,6 +63,7 @@ static int	parsesquash(char *list, int **idp, int *lenp, char **ep);
>  static int	parsenum(char **cpp);
>  static void	freesquash(void);
>  static void	syntaxerr(char *msg);
> +static struct flav_info *find_flavor(char *name);
>  
>  void
>  setexportent(char *fname, char *type)
> @@ -201,6 +202,8 @@ void secinfo_show(FILE *fp, struct exportent *ep)
>  	struct sec_entry *p1, *p2;
>  	int flags;
>  
> +	if (ep->e_secinfo[0].flav == NULL)
> +		secinfo_addflavor(find_flavor("sys"), ep);
>  	for (p1=ep->e_secinfo; p1->flav; p1=p2) {
>  
>  		fprintf(fp, ",sec=%s", p1->flav->flavour);
> @@ -643,8 +646,6 @@ bad_option:
>  			cp++;
>  	}
>  
> -	if (ep->e_secinfo[0].flav == NULL)
> -		secinfo_addflavor(find_flavor("sys"), ep);
>  	fix_pseudoflavor_flags(ep);
>  	ep->e_squids = squids;
>  	ep->e_sqgids = sqgids;
> 

       reply	other threads:[~2013-09-24 19:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1380049625-2875-1-git-send-email-Trond.Myklebust@netapp.com>
2013-09-24 19:18 ` Steve Dickson [this message]
2013-09-08 16:58 [PATCH] exportfs: Fix the default authentication flavour setting Trond Myklebust
2013-09-08 19:58 ` Chuck Lever
2013-09-08 21:08   ` Myklebust, Trond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5241E587.8040503@RedHat.com \
    --to=steved@redhat.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).