12 #include <linux/types.h>
13 #include <linux/module.h>
19 #include <linux/hash.h>
21 #define RPCDBG_FACILITY RPCDBG_AUTH
31 static struct auth_ops *authtab[RPC_AUTH_MAXFLAVOR] = {
39 rpc_authflavor_t flavor;
40 struct auth_ops *aops;
44 flavor = svc_getnl(&rqstp->
rq_arg.head[0]);
46 dprintk(
"svc: svc_authenticate (%d)\n", flavor);
48 spin_lock(&authtab_lock);
49 if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) ||
50 !try_module_get(aops->owner)) {
51 spin_unlock(&authtab_lock);
52 *authp = rpc_autherr_badcred;
55 spin_unlock(&authtab_lock);
58 return aops->accept(rqstp, authp);
64 return rqstp->
rq_authop->set_client(rqstp);
80 rv = aops->release(rqstp);
81 module_put(aops->owner);
90 spin_lock(&authtab_lock);
91 if (flavor < RPC_AUTH_MAXFLAVOR && authtab[flavor] ==
NULL) {
92 authtab[flavor] = aops;
95 spin_unlock(&authtab_lock);
103 spin_lock(&authtab_lock);
104 if (flavor < RPC_AUTH_MAXFLAVOR)
105 authtab[flavor] =
NULL;
106 spin_unlock(&authtab_lock);
119 #define DN_HASHBITS 6
120 #define DN_HASHMAX (1<<DN_HASHBITS)
129 hlist_del(&dom->hash);
130 dom->flavour->domain_release(dom);
131 spin_unlock(&auth_domain_lock);
139 struct auth_domain *hp;
143 head = &auth_domain_table[hash_str(name,
DN_HASHBITS)];
145 spin_lock(&auth_domain_lock);
148 if (
strcmp(hp->name, name)==0) {
150 spin_unlock(&auth_domain_lock);
155 hlist_add_head(&new->hash, head);
156 spin_unlock(&auth_domain_lock);