Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60836
b: refs/heads/master
c: 3ab4d8b
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Jul 17, 2007
1 parent 5cfa406 commit cf22be0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0989a7889695831e49e2c53c1884f52645516a90
refs/heads/master: 3ab4d8b1215d61736e2a9a26bea7cc2e6b029e3d
15 changes: 11 additions & 4 deletions trunk/fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,21 +1237,28 @@ struct svc_export *
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry)
{
return exp_get_by_name(rqstp->rq_client, mnt, dentry,
&rqstp->rq_chandle);
struct auth_domain *clp;

clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
return exp_get_by_name(clp, mnt, dentry, &rqstp->rq_chandle);
}

struct svc_export *
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
{
return exp_find(rqstp->rq_client, fsid_type, fsidv,
&rqstp->rq_chandle);
struct auth_domain *clp;

clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
return exp_find(clp, fsid_type, fsidv, &rqstp->rq_chandle);
}

struct svc_export *
rqst_exp_parent(struct svc_rqst *rqstp, struct vfsmount *mnt,
struct dentry *dentry)
{
struct auth_domain *clp;

clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
return exp_parent(rqstp->rq_client, mnt, dentry, &rqstp->rq_chandle);
}

Expand Down
13 changes: 11 additions & 2 deletions trunk/fs/nfsd/nfs4idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,15 @@ idmap_lookup(struct svc_rqst *rqstp,
return ret;
}

static char *
rqst_authname(struct svc_rqst *rqstp)
{
struct auth_domain *clp;

clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client;
return clp->name;
}

static int
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
uid_t *id)
Expand All @@ -600,7 +609,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
return -EINVAL;
memcpy(key.name, name, namelen);
key.name[namelen] = '\0';
strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname));
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item);
if (ret == -ENOENT)
ret = -ESRCH; /* nfserr_badname */
Expand All @@ -620,7 +629,7 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
};
int ret;

strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname));
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
ret = idmap_lookup(rqstp, idtoname_lookup, &key, &idtoname_cache, &item);
if (ret == -ENOENT)
return sprintf(name, "%u", id);
Expand Down
2 changes: 0 additions & 2 deletions trunk/fs/nfsd/nfsfh.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
int data_left = fh->fh_size/4;

error = nfserr_stale;
if (rqstp->rq_client == NULL)
goto out;
if (rqstp->rq_vers > 2)
error = nfserr_badhandle;
if (rqstp->rq_vers == 4 && fh->fh_size == 0)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ struct svc_rqst {
*/
/* Catering to nfsd */
struct auth_domain * rq_client; /* RPC peer info */
struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
struct svc_cacherep * rq_cacherep; /* cache info */
struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to
* determine what device number
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/sunrpc/svcauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
extern int auth_unix_forget_old(struct auth_domain *dom);
extern void svcauth_unix_purge(void);
extern void svcauth_unix_info_release(void *);
extern int svcauth_unix_set_client(struct svc_rqst *rqstp);

static inline unsigned long hash_str(char *name, int bits)
{
Expand Down
21 changes: 18 additions & 3 deletions trunk/net/sunrpc/auth_gss/svcauth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,10 +913,23 @@ svcauth_gss_set_client(struct svc_rqst *rqstp)
struct gss_svc_data *svcdata = rqstp->rq_auth_data;
struct rsc *rsci = svcdata->rsci;
struct rpc_gss_wire_cred *gc = &svcdata->clcred;
int stat;

rqstp->rq_client = find_gss_auth_domain(rsci->mechctx, gc->gc_svc);
if (rqstp->rq_client == NULL)
/*
* A gss export can be specified either by:
* export *(sec=krb5,rw)
* or by
* export gss/krb5(rw)
* The latter is deprecated; but for backwards compatibility reasons
* the nfsd code will still fall back on trying it if the former
* doesn't work; so we try to make both available to nfsd, below.
*/
rqstp->rq_gssclient = find_gss_auth_domain(rsci->mechctx, gc->gc_svc);
if (rqstp->rq_gssclient == NULL)
return SVC_DENIED;
stat = svcauth_unix_set_client(rqstp);
if (stat == SVC_DROP)
return stat;
return SVC_OK;
}

Expand Down Expand Up @@ -1088,7 +1101,6 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
svc_putnl(resv, GSS_SEQ_WIN);
if (svc_safe_putnetobj(resv, &rsip->out_token))
goto drop;
rqstp->rq_client = NULL;
}
goto complete;
case RPC_GSS_PROC_DESTROY:
Expand Down Expand Up @@ -1319,6 +1331,9 @@ svcauth_gss_release(struct svc_rqst *rqstp)
if (rqstp->rq_client)
auth_domain_put(rqstp->rq_client);
rqstp->rq_client = NULL;
if (rqstp->rq_gssclient)
auth_domain_put(rqstp->rq_gssclient);
rqstp->rq_gssclient = NULL;
if (rqstp->rq_cred.cr_group_info)
put_group_info(rqstp->rq_cred.cr_group_info);
rqstp->rq_cred.cr_group_info = NULL;
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/sunrpc/svcauth_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static int unix_gid_find(uid_t uid, struct group_info **gip,
}
}

static int
int
svcauth_unix_set_client(struct svc_rqst *rqstp)
{
struct sockaddr_in *sin = svc_addr_in(rqstp);
Expand Down Expand Up @@ -673,6 +673,8 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
return SVC_OK;
}

EXPORT_SYMBOL(svcauth_unix_set_client);

static int
svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
{
Expand Down

0 comments on commit cf22be0

Please sign in to comment.