From b9239fb2e7a4e6d771e74631da4aafcc01e67bb8 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Tue, 17 Sep 2002 20:17:23 -0700 Subject: [PATCH] stricter type checking for rpc auth flavors This implements stricter type checking for rpc auth flavors. it is a prerequisite for RPC GSSAPI and its authentication pseudoflavors. please apply it. --- include/linux/lockd/lockd.h | 2 +- include/linux/sunrpc/auth.h | 8 ++++---- include/linux/sunrpc/clnt.h | 2 +- include/linux/sunrpc/msg_prot.h | 6 +++++- include/linux/sunrpc/svcauth.h | 9 +++++---- 5 files changed, 16 insertions(+), 11 deletions(-) (limited to 'include/linux') diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 556153082cd0..5bba7632919a 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -42,8 +42,8 @@ struct nlm_host { struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ char h_name[20]; /* remote hostname */ u32 h_version; /* interface version */ + rpc_authflavor_t h_authflavor; /* RPC authentication type */ unsigned short h_proto; /* transport proto */ - unsigned short h_authflavor; /* RPC authentication type */ unsigned short h_reclaiming : 1, h_server : 1, /* server side, not client side */ h_inuse : 1, diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 9ea631ace800..6106cf73da6b 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h @@ -1,7 +1,7 @@ /* - * linux/include/linux/auth.h + * linux/include/linux/sunrpc/auth.h * - * Declarations for the RPC authentication machinery. + * Declarations for the RPC client authentication machinery. * * Copyright (C) 1996, Olaf Kirch */ @@ -67,7 +67,7 @@ struct rpc_auth { * Client authentication ops */ struct rpc_authops { - unsigned int au_flavor; /* flavor (RPC_AUTH_*) */ + rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ #ifdef RPC_DEBUG char * au_name; #endif @@ -94,7 +94,7 @@ extern struct rpc_authops authdes_ops; int rpcauth_register(struct rpc_authops *); int rpcauth_unregister(struct rpc_authops *); -struct rpc_auth * rpcauth_create(unsigned int, struct rpc_clnt *); +struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); void rpcauth_destroy(struct rpc_auth *); struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); struct rpc_cred * rpcauth_bindcred(struct rpc_task *); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 92fa9755592e..cdf7cd60e358 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -111,7 +111,7 @@ struct rpc_procinfo { struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, struct rpc_program *info, - u32 version, int authflavor); + u32 version, rpc_authflavor_t authflavor); int rpc_shutdown_client(struct rpc_clnt *); int rpc_destroy_client(struct rpc_clnt *); void rpc_release_client(struct rpc_clnt *); diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index d513a767191f..7ec27ed3767b 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h @@ -11,12 +11,16 @@ #define RPC_VERSION 2 -enum rpc_auth_flavor { +/* spec defines authentication flavor as an unsigned 32 bit integer */ +typedef u32 rpc_authflavor_t; + +enum rpc_auth_flavors { RPC_AUTH_NULL = 0, RPC_AUTH_UNIX = 1, RPC_AUTH_SHORT = 2, RPC_AUTH_DES = 3, RPC_AUTH_KRB = 4, + RPC_AUTH_MAXFLAVOR = 8, }; enum rpc_msg_type { diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index 1db19cb1e8e9..83aa079fe2f3 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h @@ -14,7 +14,7 @@ #include struct svc_cred { - u32 cr_flavor; + rpc_authflavor_t cr_flavor; uid_t cr_uid; gid_t cr_gid; gid_t cr_groups[NGROUPS]; @@ -23,8 +23,9 @@ struct svc_cred { struct svc_rqst; /* forward decl */ void svc_authenticate(struct svc_rqst *rqstp, u32 *statp, u32 *authp); -int svc_auth_register(u32 flavor, void (*)(struct svc_rqst *,u32 *,u32 *)); -void svc_auth_unregister(u32 flavor); +int svc_auth_register(rpc_authflavor_t flavor, + void (*)(struct svc_rqst *,u32 *,u32 *)); +void svc_auth_unregister(rpc_authflavor_t flavor); #if 0 /* @@ -39,7 +40,7 @@ struct authunix_parms { u32 aup_gids[NGRPS]; }; -struct svc_authops * auth_getops(u32 flavor); +struct svc_authops * auth_getops(rpc_authflavor_t flavor); #endif -- cgit v1.2.3