trivial sunrpc cleanup
Subsystems (3)
PATCH 1/1 trivial sunrpc cleanup
Basically NFS_NGROUPS definitions are deleted at a few places, introducing RPC_MAXGROUPS as a more appropriate replacement. The patch also deletes a cast and SVC_CRED_NGROUPS (unused).
Signed-off-by Frank van Maarseveen <[email protected]>
include/linux/sunrpc/msg_prot.h +1 -0
@@ -75,6 +75,7 @@#define RPC_PMAP_PORT 111#define RPC_MAXNETNAMELEN 256 +#define RPC_MAXGROUPS 16#endif /* __KERNEL__ */ #endif /* _LINUX_SUNRPC_MSGPROT_H_ */
include/linux/sunrpc/svcauth.h +0 -1
@@ -16,7 +16,6 @@#include <linux/sunrpc/cache.h> #include <linux/hash.h> -#define SVC_CRED_NGROUPS 32struct svc_cred {uid_t cr_uid;gid_t cr_gid;
net/sunrpc/auth.c +1 -1
@@ -249,7 +249,7 @@ } } -return (struct rpc_cred *) cred; +return cred; } struct rpc_cred *
net/sunrpc/auth_gss/auth_gss.c +0 -2
@@ -63,8 +63,6 @@# define RPCDBG_FACILITY RPCDBG_AUTH#endif -#define NFS_NGROUPS 16 -#define GSS_CRED_EXPIRE (60 * HZ)/* XXX: reasonable? */ #define GSS_CRED_SLACK 1024/* XXX: unused */ /* length of a krb5 verifier (48), plus data added before arguments when
net/sunrpc/auth_unix.c +8 -10
@@ -14,14 +14,12 @@#include <linux/sunrpc/clnt.h> #include <linux/sunrpc/auth.h> -#define NFS_NGROUPS 16 -struct unx_cred {struct rpc_cred uc_base;gid_t uc_gid;uid_t uc_puid;/* process uid */ gid_t uc_pgid;/* process gid */ -gid_t uc_gids[NFS_NGROUPS ]; +gid_t uc_gids[RPC_MAXGROUPS ]; };#define uc_uid uc_base.cr_uid#define uc_count uc_base.cr_count
@@ -83,8 +81,8 @@ cred->uc_gids[0 ] =NOGROUP ; }else {int groups = acred->group_info->ngroups; -if (groups >NFS_NGROUPS ) - groups =NFS_NGROUPS ; +if (groups >RPC_MAXGROUPS ) + groups =RPC_MAXGROUPS ; cred->uc_uid = acred->uid; cred->uc_gid = acred->gid;
@@ -92,8 +90,8 @@ cred->uc_pgid = current->gid;for (i =0 ; i < groups; i++) cred->uc_gids[i] =GROUP_AT (acred->group_info, i); -if (i <NFS_NGROUPS ) - cred->uc_gids[i] =NOGROUP ; +if (i <RPC_MAXGROUPS ) + cred->uc_gids[i] =NOGROUP ; } cred->uc_base.cr_ops = &unix_credops;
@@ -127,8 +125,8 @@return 0 ; groups = acred->group_info->ngroups; -if (groups >NFS_NGROUPS ) - groups =NFS_NGROUPS ; +if (groups >RPC_MAXGROUPS ) + groups =RPC_MAXGROUPS ;for (i =0 ; i < groups ; i++)if (cred->uc_gids[i] !=GROUP_AT (acred->group_info, i))return 0 ;
@@ -169,7 +167,7 @@ *p++ =htonl ((u32 ) cred->uc_gid); } hold = p++; -for (i =0 ; i <16 && cred->uc_gids[i] != (gid_t )NOGROUP ; i++) +for (i =0 ; i <RPC_MAXGROUPS && cred->uc_gids[i] != (gid_t )NOGROUP ; i++) *p++ =htonl ((u32 ) cred->uc_gids[i]); *hold =htonl (p - hold -1 );/* gid array length */ *base =htonl ((p - base -1 ) <<2 );/* cred length */
net/sunrpc/svcauth_unix.c +1 -1
@@ -447,7 +447,7 @@ cred->cr_uid =ntohl (svc_getu32 (argv));/* uid */ cred->cr_gid =ntohl (svc_getu32 (argv));/* gid */ slen =ntohl (svc_getu32 (argv));/* gids length */ -if (slen >16 || (len -= (slen +2 )*4 ) <0 ) +if (slen >RPC_MAXGROUPS || (len -= (slen +2 )*4 ) <0 ) goto badcred; cred->cr_group_info =groups_alloc (slen);if (cred->cr_group_info ==NULL )
Signature · 11 lines
Frank ------------------------------------------------------- This SF.Net email is sponsored by: thawte's Crypto Challenge Vl Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam Camcorder. More prizes in the weekly Lunch Hour Challenge. Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs