Skip to content

Commit 7eaf040

Browse files
committed
sunrpc: Use kuid_t and kgid_t where appropriate
Convert variables that store uids and gids to be of type kuid_t and kgid_t instead of type uid_t and gid_t. Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent bf37f79 commit 7eaf040

5 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎include/linux/sunrpc/auth.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717

1818
#include <linux/atomic.h>
1919
#include <linux/rcupdate.h>
20+
#include <linux/uidgid.h>
2021

2122
/* size of the nodename buffer */
2223
#define UNX_MAXNODENAME 32
2324

2425
/* Work around the lack of a VFS credential */
2526
struct auth_cred {
26-
uid_t uid;
27-
gid_t gid;
27+
kuid_t uid;
28+
kgid_t gid;
2829
struct group_info *group_info;
2930
const char *principal;
3031
unsigned char machine_cred : 1;
@@ -48,7 +49,7 @@ struct rpc_cred {
4849
unsigned long cr_flags; /* various flags */
4950
atomic_t cr_count; /* ref count */
5051

51-
uid_t cr_uid;
52+
kuid_t cr_uid;
5253

5354
/* per-flavor data */
5455
};

‎include/linux/sunrpc/svcauth.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <linux/cred.h>
1919

2020
struct svc_cred {
21-
uid_t cr_uid;
22-
gid_t cr_gid;
21+
kuid_t cr_uid;
22+
kgid_t cr_gid;
2323
struct group_info *cr_group_info;
2424
u32 cr_flavor; /* pseudoflavor */
2525
char *cr_principal; /* for gss */

‎net/sunrpc/auth_gss/auth_gss.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
256256

257257
struct gss_upcall_msg {
258258
atomic_t count;
259-
uid_t uid;
259+
kuid_t uid;
260260
struct rpc_pipe_msg msg;
261261
struct list_head list;
262262
struct gss_auth *auth;
@@ -303,7 +303,7 @@ gss_release_msg(struct gss_upcall_msg *gss_msg)
303303
}
304304

305305
static struct gss_upcall_msg *
306-
__gss_find_upcall(struct rpc_pipe *pipe, uid_t uid)
306+
__gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid)
307307
{
308308
struct gss_upcall_msg *pos;
309309
list_for_each_entry(pos, &pipe->in_downcall, list) {
@@ -445,7 +445,7 @@ static void gss_encode_msg(struct gss_upcall_msg *gss_msg,
445445

446446
static struct gss_upcall_msg *
447447
gss_alloc_msg(struct gss_auth *gss_auth, struct rpc_clnt *clnt,
448-
uid_t uid, const char *service_name)
448+
kuid_t uid, const char *service_name)
449449
{
450450
struct gss_upcall_msg *gss_msg;
451451
int vers;
@@ -475,7 +475,7 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr
475475
struct gss_cred *gss_cred = container_of(cred,
476476
struct gss_cred, gc_base);
477477
struct gss_upcall_msg *gss_new, *gss_msg;
478-
uid_t uid = cred->cr_uid;
478+
kuid_t uid = cred->cr_uid;
479479

480480
gss_new = gss_alloc_msg(gss_auth, clnt, uid, gss_cred->gc_principal);
481481
if (IS_ERR(gss_new))

‎net/sunrpc/auth_unix.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
struct unx_cred {
2020
struct rpc_cred uc_base;
21-
gid_t uc_gid;
22-
gid_t uc_gids[NFS_NGROUPS];
21+
kgid_t uc_gid;
22+
kgid_t uc_gids[NFS_NGROUPS];
2323
};
2424
#define uc_uid uc_base.cr_uid
2525

‎net/sunrpc/svcauth_unix.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ svcauth_unix_info_release(struct svc_xprt *xpt)
415415

416416
struct unix_gid {
417417
struct cache_head h;
418-
uid_t uid;
418+
kuid_t uid;
419419
struct group_info *gi;
420420
};
421421

@@ -475,7 +475,7 @@ static int unix_gid_upcall(struct cache_detail *cd, struct cache_head *h)
475475
return sunrpc_cache_pipe_upcall(cd, h, unix_gid_request);
476476
}
477477

478-
static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, uid_t uid);
478+
static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, kuid_t uid);
479479

480480
static int unix_gid_parse(struct cache_detail *cd,
481481
char *mesg, int mlen)
@@ -615,7 +615,7 @@ void unix_gid_cache_destroy(struct net *net)
615615
cache_destroy_net(cd, net);
616616
}
617617

618-
static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, uid_t uid)
618+
static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, kuid_t uid)
619619
{
620620
struct unix_gid ug;
621621
struct cache_head *ch;
@@ -628,7 +628,7 @@ static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, uid_t uid)
628628
return NULL;
629629
}
630630

631-
static struct group_info *unix_gid_find(uid_t uid, struct svc_rqst *rqstp)
631+
static struct group_info *unix_gid_find(kuid_t uid, struct svc_rqst *rqstp)
632632
{
633633
struct unix_gid *ug;
634634
struct group_info *gi;

0 commit comments

Comments
 (0)