Release 4.11 net/sunrpc/svcauth.c
/*
* linux/net/sunrpc/svcauth.c
*
* The generic interface for RPC authentication on the server side.
*
* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
*
* CHANGES
* 19-Apr-2000 Chris Evans - Security fix
*/
#include <linux/types.h>
#include <linux/module.h>
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/svcsock.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/err.h>
#include <linux/hash.h>
#define RPCDBG_FACILITY RPCDBG_AUTH
/*
* Table of authenticators
*/
extern struct auth_ops svcauth_null;
extern struct auth_ops svcauth_unix;
static DEFINE_SPINLOCK(authtab_lock);
static struct auth_ops *authtab[RPC_AUTH_MAXFLAVOR] = {
[0] = &svcauth_null,
[1] = &svcauth_unix,
};
int
svc_authenticate(struct svc_rqst *rqstp, __be32 *authp)
{
rpc_authflavor_t flavor;
struct auth_ops *aops;
*authp = rpc_auth_ok;
flavor = svc_getnl(&rqstp->rq_arg.head[0]);
dprintk("svc: svc_authenticate (%d)\n", flavor);
spin_lock(&authtab_lock);
if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) ||
!try_module_get(aops->owner)) {
spin_unlock(&authtab_lock);
*authp = rpc_autherr_badcred;
return SVC_DENIED;
}
spin_unlock(&authtab_lock);
rqstp->rq_auth_slack = 0;
init_svc_cred(&rqstp->rq_cred);
rqstp->rq_authop = aops;
return aops->accept(rqstp, authp);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 62 | 47.33% | 1 | 10.00% |
Neil Brown | 51 | 38.93% | 4 | 40.00% |
J. Bruce Fields | 14 | 10.69% | 2 | 20.00% |
Alexey Dobriyan | 2 | 1.53% | 2 | 20.00% |
Chuck Lever | 2 | 1.53% | 1 | 10.00% |
Total | 131 | 100.00% | 10 | 100.00% |
EXPORT_SYMBOL_GPL(svc_authenticate);
int svc_set_client(struct svc_rqst *rqstp)
{
rqstp->rq_client = NULL;
return rqstp->rq_authop->set_client(rqstp);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 20 | 76.92% | 1 | 50.00% |
J. Bruce Fields | 6 | 23.08% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(svc_set_client);
/* A request, which was authenticated, has now executed.
* Time to finalise the credentials and verifier
* and release and resources
*/
int svc_authorise(struct svc_rqst *rqstp)
{
struct auth_ops *aops = rqstp->rq_authop;
int rv = 0;
rqstp->rq_authop = NULL;
if (aops) {
rv = aops->release(rqstp);
module_put(aops->owner);
}
return rv;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 54 | 98.18% | 2 | 66.67% |
Linus Torvalds (pre-git) | 1 | 1.82% | 1 | 33.33% |
Total | 55 | 100.00% | 3 | 100.00% |
int
svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops)
{
int rv = -EINVAL;
spin_lock(&authtab_lock);
if (flavor < RPC_AUTH_MAXFLAVOR && authtab[flavor] == NULL) {
authtab[flavor] = aops;
rv = 0;
}
spin_unlock(&authtab_lock);
return rv;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 34 | 56.67% | 2 | 50.00% |
Linus Torvalds (pre-git) | 24 | 40.00% | 1 | 25.00% |
Chuck Lever | 2 | 3.33% | 1 | 25.00% |
Total | 60 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL_GPL(svc_auth_register);
void
svc_auth_unregister(rpc_authflavor_t flavor)
{
spin_lock(&authtab_lock);
if (flavor < RPC_AUTH_MAXFLAVOR)
authtab[flavor] = NULL;
spin_unlock(&authtab_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 19 | 57.58% | 1 | 33.33% |
Neil Brown | 12 | 36.36% | 1 | 33.33% |
Chuck Lever | 2 | 6.06% | 1 | 33.33% |
Total | 33 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL_GPL(svc_auth_unregister);
/**************************************************
* 'auth_domains' are stored in a hash table indexed by name.
* When the last reference to an 'auth_domain' is dropped,
* the object is unhashed and freed.
* If auth_domain_lookup fails to find an entry, it will return
* it's second argument 'new'. If this is non-null, it will
* have been atomically linked into the table.
*/
#define DN_HASHBITS 6
#define DN_HASHMAX (1<<DN_HASHBITS)
static struct hlist_head auth_domain_table[DN_HASHMAX];
static DEFINE_SPINLOCK(auth_domain_lock);
static void auth_domain_release(struct kref *kref)
{
struct auth_domain *dom = container_of(kref, struct auth_domain, ref);
hlist_del(&dom->hash);
dom->flavour->domain_release(dom);
spin_unlock(&auth_domain_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 22 | 44.90% | 2 | 40.00% |
Peter Zijlstra | 16 | 32.65% | 1 | 20.00% |
Akinobu Mita | 6 | 12.24% | 1 | 20.00% |
Linus Torvalds (pre-git) | 5 | 10.20% | 1 | 20.00% |
Total | 49 | 100.00% | 5 | 100.00% |
void auth_domain_put(struct auth_domain *dom)
{
kref_put_lock(&dom->ref, auth_domain_release, &auth_domain_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Zijlstra | 22 | 95.65% | 1 | 50.00% |
Linus Torvalds (pre-git) | 1 | 4.35% | 1 | 50.00% |
Total | 23 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(auth_domain_put);
struct auth_domain *
auth_domain_lookup(char *name, struct auth_domain *new)
{
struct auth_domain *hp;
struct hlist_head *head;
head = &auth_domain_table[hash_str(name, DN_HASHBITS)];
spin_lock(&auth_domain_lock);
hlist_for_each_entry(hp, head, hash) {
if (strcmp(hp->name, name)==0) {
kref_get(&hp->ref);
spin_unlock(&auth_domain_lock);
return hp;
}
}
if (new)
hlist_add_head(&new->hash, head);
spin_unlock(&auth_domain_lock);
return new;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 108 | 98.18% | 5 | 83.33% |
Linus Torvalds (pre-git) | 2 | 1.82% | 1 | 16.67% |
Total | 110 | 100.00% | 6 | 100.00% |
EXPORT_SYMBOL_GPL(auth_domain_lookup);
struct auth_domain *auth_domain_find(char *name)
{
return auth_domain_lookup(name, NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 18 | 94.74% | 3 | 75.00% |
Linus Torvalds (pre-git) | 1 | 5.26% | 1 | 25.00% |
Total | 19 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL_GPL(auth_domain_find);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Neil Brown | 375 | 58.96% | 11 | 40.74% |
Linus Torvalds (pre-git) | 143 | 22.48% | 1 | 3.70% |
Peter Zijlstra | 41 | 6.45% | 2 | 7.41% |
Trond Myklebust | 31 | 4.87% | 2 | 7.41% |
J. Bruce Fields | 20 | 3.14% | 2 | 7.41% |
Chuck Lever | 7 | 1.10% | 1 | 3.70% |
Akinobu Mita | 6 | 0.94% | 1 | 3.70% |
Thomas Gleixner | 4 | 0.63% | 1 | 3.70% |
Dave Jones | 3 | 0.47% | 1 | 3.70% |
Fabian Frederick | 2 | 0.31% | 1 | 3.70% |
Alexey Dobriyan | 2 | 0.31% | 2 | 7.41% |
Hideaki Yoshifuji / 吉藤英明 | 1 | 0.16% | 1 | 3.70% |
Michael Opdenacker | 1 | 0.16% | 1 | 3.70% |
Total | 636 | 100.00% | 27 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.