/** * svc_authenticate - Initialize an outgoing credential * @rqstp: RPC execution context * * Return values: * %SVC_OK: XDR encoding of the result can begin * %SVC_DENIED: Credential or verifier is not valid * %SVC_GARBAGE: Failed to decode credential or verifier * %SVC_COMPLETE: GSS context lifetime event; no further action * %SVC_DROP: Drop this request; no further action * %SVC_CLOSE: Like drop, but also close transport connection
*/ enum svc_auth_status svc_authenticate(struct svc_rqst *rqstp)
{ struct auth_ops *aops;
u32 flavor;
rqstp->rq_auth_stat = rpc_auth_ok;
/* * Decode the Call credential's flavor field. The credential's * body field is decoded in the chosen ->accept method below.
*/ if (xdr_stream_decode_u32(&rqstp->rq_arg_stream, &flavor) < 0) return SVC_GARBAGE;
if (!aops->pseudoflavor) return aops->flavour; return aops->pseudoflavor(rqstp);
}
EXPORT_SYMBOL_GPL(svc_auth_flavor);
/** * svcauth_map_clnt_to_svc_cred_local - maps a generic cred * to a svc_cred suitable for use in nfsd. * @clnt: rpc_clnt associated with nfs client * @cred: generic cred associated with nfs client * @svc: returned svc_cred that is suitable for use in nfsd
*/ void svcauth_map_clnt_to_svc_cred_local(struct rpc_clnt *clnt, conststruct cred *cred, struct svc_cred *svc)
{ struct user_namespace *userns = clnt->cl_cred ?
clnt->cl_cred->user_ns : &init_user_ns;
memset(svc, 0, sizeof(struct svc_cred));
svc->cr_uid = KUIDT_INIT(from_kuid_munged(userns, cred->fsuid));
svc->cr_gid = KGIDT_INIT(from_kgid_munged(userns, cred->fsgid));
svc->cr_flavor = clnt->cl_auth->au_flavor; if (cred->group_info)
svc->cr_group_info = get_group_info(cred->group_info); /* These aren't relevant for local (network is bypassed) */
svc->cr_principal = NULL;
svc->cr_gss_mech = NULL;
}
EXPORT_SYMBOL_GPL(svcauth_map_clnt_to_svc_cred_local);
/************************************************** * '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.
*/
head = &auth_domain_table[hash_str(name, DN_HASHBITS)];
rcu_read_lock();
hlist_for_each_entry_rcu(hp, head, hash) { if (strcmp(hp->name, name)==0) { if (!kref_get_unless_zero(&hp->ref))
hp = NULL;
rcu_read_unlock(); return hp;
}
}
rcu_read_unlock(); return NULL;
}
EXPORT_SYMBOL_GPL(auth_domain_find);
/** * auth_domain_cleanup - check that the auth_domain table is empty * * On module unload the auth_domain_table must be empty. To make it * easier to catch bugs which don't clean up domains properly, we * warn if anything remains in the table at cleanup time. * * Note that we cannot proactively remove the domains at this stage. * The ->release() function might be in a module that has already been * unloaded.
*/
void auth_domain_cleanup(void)
{ int h; struct auth_domain *hp;
for (h = 0; h < DN_HASHMAX; h++)
hlist_for_each_entry(hp, &auth_domain_table[h], hash)
pr_warn("svc: domain %s still present at module unload.\n",
hp->name);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.