aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc/auth.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-13 19:46:18 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-13 19:46:18 -0400
commit16cefa8c3863721fd40445a1b34dea18cd16ccfe (patch)
treec8e58ca06e2edfd667d3e6062a642b80cc58e5e7 /include/linux/sunrpc/auth.h
parent4fbef206daead133085fe33905f5e842d38fb8da (diff)
parentd8558f99fbc5ef5d4ae76b893784005056450f82 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (122 commits) sunrpc: drop BKL around wrap and unwrap NFSv4: Make sure unlock is really an unlock when cancelling a lock NLM: fix source address of callback to client SUNRPC client: add interface for binding to a local address SUNRPC server: record the destination address of a request SUNRPC: cleanup transport creation argument passing NFSv4: Make the NFS state model work with the nosharedcache mount option NFS: Error when mounting the same filesystem with different options NFS: Add the mount option "nosharecache" NFS: Add support for mounting NFSv4 file systems with string options NFS: Add final pieces to support in-kernel mount option parsing NFS: Introduce generic mount client API NFS: Add enums and match tables for mount option parsing NFS: Improve debugging output in NFS in-kernel mount client NFS: Clean up in-kernel NFS mount NFS: Remake nfsroot_mount as a permanent part of NFS client SUNRPC: Add a convenient default for the hostname when calling rpc_create() SUNRPC: Rename rpcb_getport to be consistent with new rpcb_getport_sync name SUNRPC: Rename rpcb_getport_external routine SUNRPC: Allow rpcbind requests to be interrupted by a signal. ...
Diffstat (limited to 'include/linux/sunrpc/auth.h')
-rw-r--r--include/linux/sunrpc/auth.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 534cdc7be58d..7a69ca3bebaf 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -16,6 +16,7 @@
16#include <linux/sunrpc/xdr.h> 16#include <linux/sunrpc/xdr.h>
17 17
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19#include <linux/rcupdate.h>
19 20
20/* size of the nodename buffer */ 21/* size of the nodename buffer */
21#define UNX_MAXNODENAME 32 22#define UNX_MAXNODENAME 32
@@ -30,22 +31,28 @@ struct auth_cred {
30/* 31/*
31 * Client user credentials 32 * Client user credentials
32 */ 33 */
34struct rpc_auth;
35struct rpc_credops;
33struct rpc_cred { 36struct rpc_cred {
34 struct hlist_node cr_hash; /* hash chain */ 37 struct hlist_node cr_hash; /* hash chain */
35 struct rpc_credops * cr_ops; 38 struct list_head cr_lru; /* lru garbage collection */
36 unsigned long cr_expire; /* when to gc */ 39 struct rcu_head cr_rcu;
37 atomic_t cr_count; /* ref count */ 40 struct rpc_auth * cr_auth;
38 unsigned short cr_flags; /* various flags */ 41 const struct rpc_credops *cr_ops;
39#ifdef RPC_DEBUG 42#ifdef RPC_DEBUG
40 unsigned long cr_magic; /* 0x0f4aa4f0 */ 43 unsigned long cr_magic; /* 0x0f4aa4f0 */
41#endif 44#endif
45 unsigned long cr_expire; /* when to gc */
46 unsigned long cr_flags; /* various flags */
47 atomic_t cr_count; /* ref count */
42 48
43 uid_t cr_uid; 49 uid_t cr_uid;
44 50
45 /* per-flavor data */ 51 /* per-flavor data */
46}; 52};
47#define RPCAUTH_CRED_NEW 0x0001 53#define RPCAUTH_CRED_NEW 0
48#define RPCAUTH_CRED_UPTODATE 0x0002 54#define RPCAUTH_CRED_UPTODATE 1
55#define RPCAUTH_CRED_HASHED 2
49 56
50#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 57#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
51 58
@@ -56,10 +63,10 @@ struct rpc_cred {
56#define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1) 63#define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1)
57struct rpc_cred_cache { 64struct rpc_cred_cache {
58 struct hlist_head hashtable[RPC_CREDCACHE_NR]; 65 struct hlist_head hashtable[RPC_CREDCACHE_NR];
59 unsigned long nextgc; /* next garbage collection */ 66 spinlock_t lock;
60 unsigned long expire; /* cache expiry interval */
61}; 67};
62 68
69struct rpc_authops;
63struct rpc_auth { 70struct rpc_auth {
64 unsigned int au_cslack; /* call cred size estimate */ 71 unsigned int au_cslack; /* call cred size estimate */
65 /* guess at number of u32's auth adds before 72 /* guess at number of u32's auth adds before
@@ -69,7 +76,7 @@ struct rpc_auth {
69 unsigned int au_verfsize; 76 unsigned int au_verfsize;
70 77
71 unsigned int au_flags; /* various flags */ 78 unsigned int au_flags; /* various flags */
72 struct rpc_authops * au_ops; /* operations */ 79 const struct rpc_authops *au_ops; /* operations */
73 rpc_authflavor_t au_flavor; /* pseudoflavor (note may 80 rpc_authflavor_t au_flavor; /* pseudoflavor (note may
74 * differ from the flavor in 81 * differ from the flavor in
75 * au_ops->au_flavor in gss 82 * au_ops->au_flavor in gss
@@ -115,17 +122,19 @@ struct rpc_credops {
115 void *, __be32 *, void *); 122 void *, __be32 *, void *);
116}; 123};
117 124
118extern struct rpc_authops authunix_ops; 125extern const struct rpc_authops authunix_ops;
119extern struct rpc_authops authnull_ops; 126extern const struct rpc_authops authnull_ops;
120#ifdef CONFIG_SUNRPC_SECURE 127
121extern struct rpc_authops authdes_ops; 128void __init rpc_init_authunix(void);
122#endif 129void __init rpcauth_init_module(void);
130void __exit rpcauth_remove_module(void);
123 131
124int rpcauth_register(struct rpc_authops *); 132int rpcauth_register(const struct rpc_authops *);
125int rpcauth_unregister(struct rpc_authops *); 133int rpcauth_unregister(const struct rpc_authops *);
126struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 134struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
127void rpcauth_destroy(struct rpc_auth *); 135void rpcauth_release(struct rpc_auth *);
128struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); 136struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
137void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
129struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 138struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
130struct rpc_cred * rpcauth_bindcred(struct rpc_task *); 139struct rpc_cred * rpcauth_bindcred(struct rpc_task *);
131void rpcauth_holdcred(struct rpc_task *); 140void rpcauth_holdcred(struct rpc_task *);
@@ -138,8 +147,9 @@ int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
138int rpcauth_refreshcred(struct rpc_task *); 147int rpcauth_refreshcred(struct rpc_task *);
139void rpcauth_invalcred(struct rpc_task *); 148void rpcauth_invalcred(struct rpc_task *);
140int rpcauth_uptodatecred(struct rpc_task *); 149int rpcauth_uptodatecred(struct rpc_task *);
141int rpcauth_init_credcache(struct rpc_auth *, unsigned long); 150int rpcauth_init_credcache(struct rpc_auth *);
142void rpcauth_free_credcache(struct rpc_auth *); 151void rpcauth_destroy_credcache(struct rpc_auth *);
152void rpcauth_clear_credcache(struct rpc_cred_cache *);
143 153
144static inline 154static inline
145struct rpc_cred * get_rpccred(struct rpc_cred *cred) 155struct rpc_cred * get_rpccred(struct rpc_cred *cred)