[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-nfsv4
Subject: [PATCH 09/16] nfsd: use ip-address-based domain in secinfo case
From: "J. Bruce Fields" <bfields () fieldses ! org>
Date: 2007-05-18 21:28:02
Message-ID: 6878dae68d8bdaaa310cf6677ab263fcc802e614.1179523224.git.bfields () citi ! umich ! edu
[Download RAW message or body]
From: J. Bruce Fields <bfields@citi.umich.edu>
With this patch, we fall back on using the gss/pseudoflavor only if we
fail to find a matching auth_unix export that has a secinfo list.
As long as sec= options aren't used, there's still no change in behavior
here (except possibly for some additional auth_unix cache lookups, whose
results will be ignored).
The sec= option, however, is not actually enforced yet; later patches
will add the necessary checks.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
fs/nfsd/export.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index e52a1fd..a52c4b4 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1245,6 +1245,10 @@ exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
}
/*
+ * Uses rq_client and rq_gssclient to find an export; uses rq_client (an
+ * auth_unix client) if it's available and has secinfo information;
+ * otherwise, will try to use rq_gssclient.
+ *
* Called from functions that handle requests; functions that do work on
* behalf of mountd are passed a single client name to use, and should
* use exp_get_by_name() or exp_find().
@@ -1253,29 +1257,83 @@ struct svc_export *
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry)
{
- struct auth_domain *clp;
+ struct svc_export *gssexp, *exp = NULL;
+
+ if (rqstp->rq_client == NULL)
+ goto gss;
- clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
- return exp_get_by_name(clp, mnt, dentry, &rqstp->rq_chandle);
+ /* First try the auth_unix client: */
+ exp = exp_get_by_name(rqstp->rq_client, mnt, dentry,
+ &rqstp->rq_chandle);
+ if (exp == NULL)
+ goto gss;
+ if (IS_ERR(exp))
+ return exp;
+ /* If it has secinfo, assume there are no gss/... clients */
+ if (exp->ex_nflavors > 0)
+ return exp;
+gss:
+ /* Otherwise, try falling back on gss client */
+ if (rqstp->rq_gssclient == NULL)
+ return exp;
+ gssexp = exp_get_by_name(rqstp->rq_gssclient, mnt, dentry,
+ &rqstp->rq_chandle);
+ if (gssexp == NULL)
+ return exp;
+ if (exp)
+ exp_put(exp);
+ return gssexp;
}
struct svc_export *
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
{
- struct auth_domain *clp;
+ struct svc_export *gssexp, *exp = NULL;
- clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
- return exp_find(clp, fsid_type, fsidv, &rqstp->rq_chandle);
+ if (rqstp->rq_client == NULL)
+ goto gss;
+
+ /* First try the auth_unix client: */
+ exp = exp_find(rqstp->rq_client, fsid_type, fsidv, &rqstp->rq_chandle);
+ if (exp == NULL)
+ goto gss;
+ if (IS_ERR(exp))
+ return exp;
+ /* If it has secinfo, assume there are no gss/... clients */
+ if (exp->ex_nflavors > 0)
+ return exp;
+gss:
+ /* Otherwise, try falling back on gss client */
+ if (rqstp->rq_gssclient == NULL)
+ return exp;
+ gssexp = exp_find(rqstp->rq_gssclient, fsid_type, fsidv,
+ &rqstp->rq_chandle);
+ if (gssexp == NULL)
+ return exp;
+ if (exp)
+ exp_put(exp);
+ return gssexp;
}
struct svc_export *
rqst_exp_parent(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry)
{
- struct auth_domain *clp;
+ struct svc_export *exp;
- clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
- return exp_parent(rqstp->rq_client, mnt, dentry, &rqstp->rq_chandle);
+ dget(dentry);
+ exp = rqst_exp_get_by_name(rqstp, mnt, dentry);
+
+ while (exp == NULL && !IS_ROOT(dentry)) {
+ struct dentry *parent;
+
+ parent = dget_parent(dentry);
+ dput(dentry);
+ dentry = parent;
+ exp = rqst_exp_get_by_name(rqstp, mnt, dentry);
+ }
+ dput(dentry);
+ return exp;
}
/*
--
1.5.2.rc3
_______________________________________________
NFSv4 mailing list
NFSv4@linux-nfs.org
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic