diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-01 19:39:32 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-13 09:15:17 -0500 |
commit | 0b4d51b02a2e941beec6f02a6c7a32c5a28c5b43 (patch) | |
tree | d25f90f6dbaf133865f9761b80e8a7324a5888f8 /net | |
parent | 7eaf040b720bc8c0ce5cd49151ca194ca2d56842 (diff) |
sunrpc: Use uid_eq and gid_eq where appropriate
When comparing uids use uid_eq instead of ==.
When comparing gids use gid_eq instead of ==.
And unfortunate cost of type safety.
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_generic.c | 8 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index 9d2e0b045596..bff3e4730f6b 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
@@ -129,8 +129,8 @@ machine_cred_match(struct auth_cred *acred, struct generic_cred *gcred, int flag | |||
129 | { | 129 | { |
130 | if (!gcred->acred.machine_cred || | 130 | if (!gcred->acred.machine_cred || |
131 | gcred->acred.principal != acred->principal || | 131 | gcred->acred.principal != acred->principal || |
132 | gcred->acred.uid != acred->uid || | 132 | !uid_eq(gcred->acred.uid, acred->uid) || |
133 | gcred->acred.gid != acred->gid) | 133 | !gid_eq(gcred->acred.gid, acred->gid)) |
134 | return 0; | 134 | return 0; |
135 | return 1; | 135 | return 1; |
136 | } | 136 | } |
@@ -147,8 +147,8 @@ generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags) | |||
147 | if (acred->machine_cred) | 147 | if (acred->machine_cred) |
148 | return machine_cred_match(acred, gcred, flags); | 148 | return machine_cred_match(acred, gcred, flags); |
149 | 149 | ||
150 | if (gcred->acred.uid != acred->uid || | 150 | if (!uid_eq(gcred->acred.uid, acred->uid) || |
151 | gcred->acred.gid != acred->gid || | 151 | !gid_eq(gcred->acred.gid, acred->gid) || |
152 | gcred->acred.machine_cred != 0) | 152 | gcred->acred.machine_cred != 0) |
153 | goto out_nomatch; | 153 | goto out_nomatch; |
154 | 154 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 4daab81ca337..1b8b3e4fad46 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -307,7 +307,7 @@ __gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid) | |||
307 | { | 307 | { |
308 | struct gss_upcall_msg *pos; | 308 | struct gss_upcall_msg *pos; |
309 | list_for_each_entry(pos, &pipe->in_downcall, list) { | 309 | list_for_each_entry(pos, &pipe->in_downcall, list) { |
310 | if (pos->uid != uid) | 310 | if (!uid_eq(pos->uid, uid)) |
311 | continue; | 311 | continue; |
312 | atomic_inc(&pos->count); | 312 | atomic_inc(&pos->count); |
313 | dprintk("RPC: %s found msg %p\n", __func__, pos); | 313 | dprintk("RPC: %s found msg %p\n", __func__, pos); |
@@ -1115,7 +1115,7 @@ out: | |||
1115 | } | 1115 | } |
1116 | if (gss_cred->gc_principal != NULL) | 1116 | if (gss_cred->gc_principal != NULL) |
1117 | return 0; | 1117 | return 0; |
1118 | return rc->cr_uid == acred->uid; | 1118 | return uid_eq(rc->cr_uid, acred->uid); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | /* | 1121 | /* |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 372d9156f6e3..8365a9cade98 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -123,7 +123,7 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags) | |||
123 | unsigned int i; | 123 | unsigned int i; |
124 | 124 | ||
125 | 125 | ||
126 | if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid) | 126 | if (!uid_eq(cred->uc_uid, acred->uid) || !gid_eq(cred->uc_gid, acred->gid)) |
127 | return 0; | 127 | return 0; |
128 | 128 | ||
129 | if (acred->group_info != NULL) | 129 | if (acred->group_info != NULL) |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index caae662f9fa3..92166b57ec7a 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -433,7 +433,7 @@ static int unix_gid_match(struct cache_head *corig, struct cache_head *cnew) | |||
433 | { | 433 | { |
434 | struct unix_gid *orig = container_of(corig, struct unix_gid, h); | 434 | struct unix_gid *orig = container_of(corig, struct unix_gid, h); |
435 | struct unix_gid *new = container_of(cnew, struct unix_gid, h); | 435 | struct unix_gid *new = container_of(cnew, struct unix_gid, h); |
436 | return orig->uid == new->uid; | 436 | return uid_eq(orig->uid, new->uid); |
437 | } | 437 | } |
438 | static void unix_gid_init(struct cache_head *cnew, struct cache_head *citem) | 438 | static void unix_gid_init(struct cache_head *cnew, struct cache_head *citem) |
439 | { | 439 | { |