Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119273
b: refs/heads/master
c: 23918b0
h: refs/heads/master
i:
  119271: c063896
v: v3
  • Loading branch information
Trond Myklebust authored and Linus Torvalds committed Nov 20, 2008
1 parent b6d45c8 commit 9c3df7d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 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: 0cb39aa0ac3a9dc64171b43a85d17e539d82f2d6
refs/heads/master: 23918b03060f6e572168fdde1798a905679d2e06
20 changes: 18 additions & 2 deletions trunk/net/sunrpc/auth_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,29 @@ static int
generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
{
struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base);
int i;

if (gcred->acred.uid != acred->uid ||
gcred->acred.gid != acred->gid ||
gcred->acred.group_info != acred->group_info ||
gcred->acred.machine_cred != acred->machine_cred)
return 0;
goto out_nomatch;

/* Optimisation in the case where pointers are identical... */
if (gcred->acred.group_info == acred->group_info)
goto out_match;

/* Slow path... */
if (gcred->acred.group_info->ngroups != acred->group_info->ngroups)
goto out_nomatch;
for (i = 0; i < gcred->acred.group_info->ngroups; i++) {
if (GROUP_AT(gcred->acred.group_info, i) !=
GROUP_AT(acred->group_info, i))
goto out_nomatch;
}
out_match:
return 1;
out_nomatch:
return 0;
}

void __init rpc_init_generic_auth(void)
Expand Down

0 comments on commit 9c3df7d

Please sign in to comment.