Lines Matching refs:cred
298 rpcauth_unhash_cred_locked(struct rpc_cred *cred) in rpcauth_unhash_cred_locked() argument
300 hlist_del_rcu(&cred->cr_hash); in rpcauth_unhash_cred_locked()
302 clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); in rpcauth_unhash_cred_locked()
306 rpcauth_unhash_cred(struct rpc_cred *cred) in rpcauth_unhash_cred() argument
311 cache_lock = &cred->cr_auth->au_credcache->lock; in rpcauth_unhash_cred()
313 ret = atomic_read(&cred->cr_count) == 0; in rpcauth_unhash_cred()
315 rpcauth_unhash_cred_locked(cred); in rpcauth_unhash_cred()
351 rpcauth_key_timeout_notify(struct rpc_auth *auth, struct rpc_cred *cred) in rpcauth_key_timeout_notify() argument
353 if (!cred->cr_auth->au_ops->key_timeout) in rpcauth_key_timeout_notify()
355 return cred->cr_auth->au_ops->key_timeout(auth, cred); in rpcauth_key_timeout_notify()
360 rpcauth_cred_key_to_expire(struct rpc_auth *auth, struct rpc_cred *cred) in rpcauth_cred_key_to_expire() argument
364 if (!cred->cr_ops->crkey_to_expire) in rpcauth_cred_key_to_expire()
366 return cred->cr_ops->crkey_to_expire(cred); in rpcauth_cred_key_to_expire()
371 rpcauth_stringify_acceptor(struct rpc_cred *cred) in rpcauth_stringify_acceptor() argument
373 if (!cred->cr_ops->crstringify_acceptor) in rpcauth_stringify_acceptor()
375 return cred->cr_ops->crstringify_acceptor(cred); in rpcauth_stringify_acceptor()
385 struct rpc_cred *cred; in rpcauth_destroy_credlist() local
388 cred = list_entry(head->next, struct rpc_cred, cr_lru); in rpcauth_destroy_credlist()
389 list_del_init(&cred->cr_lru); in rpcauth_destroy_credlist()
390 put_rpccred(cred); in rpcauth_destroy_credlist()
403 struct rpc_cred *cred; in rpcauth_clear_credcache() local
412 cred = hlist_entry(head->first, struct rpc_cred, cr_hash); in rpcauth_clear_credcache()
413 get_rpccred(cred); in rpcauth_clear_credcache()
414 if (!list_empty(&cred->cr_lru)) { in rpcauth_clear_credcache()
415 list_del(&cred->cr_lru); in rpcauth_clear_credcache()
418 list_add_tail(&cred->cr_lru, &free); in rpcauth_clear_credcache()
419 rpcauth_unhash_cred_locked(cred); in rpcauth_clear_credcache()
454 struct rpc_cred *cred, *next; in rpcauth_prune_expired() local
458 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { in rpcauth_prune_expired()
466 if (time_in_range(cred->cr_expire, expired, jiffies) && in rpcauth_prune_expired()
467 test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) in rpcauth_prune_expired()
470 list_del_init(&cred->cr_lru); in rpcauth_prune_expired()
473 if (atomic_read(&cred->cr_count) != 0) in rpcauth_prune_expired()
476 cache_lock = &cred->cr_auth->au_credcache->lock; in rpcauth_prune_expired()
478 if (atomic_read(&cred->cr_count) == 0) { in rpcauth_prune_expired()
479 get_rpccred(cred); in rpcauth_prune_expired()
480 list_add_tail(&cred->cr_lru, free); in rpcauth_prune_expired()
481 rpcauth_unhash_cred_locked(cred); in rpcauth_prune_expired()
550 struct rpc_cred *cred = NULL, in rpcauth_lookup_credcache() local
563 cred = entry; in rpcauth_lookup_credcache()
571 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
577 if (cred != NULL) in rpcauth_lookup_credcache()
585 cred = new; in rpcauth_lookup_credcache()
593 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
596 if (cred == NULL) { in rpcauth_lookup_credcache()
597 cred = new; in rpcauth_lookup_credcache()
598 set_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); in rpcauth_lookup_credcache()
599 hlist_add_head_rcu(&cred->cr_hash, &cache->hashtable[nr]); in rpcauth_lookup_credcache()
605 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) && in rpcauth_lookup_credcache()
606 cred->cr_ops->cr_init != NULL && in rpcauth_lookup_credcache()
608 int res = cred->cr_ops->cr_init(auth, cred); in rpcauth_lookup_credcache()
610 put_rpccred(cred); in rpcauth_lookup_credcache()
611 cred = ERR_PTR(res); in rpcauth_lookup_credcache()
616 return cred; in rpcauth_lookup_credcache()
625 const struct cred *cred = current_cred(); in rpcauth_lookupcred() local
631 acred.uid = cred->fsuid; in rpcauth_lookupcred()
632 acred.gid = cred->fsgid; in rpcauth_lookupcred()
633 acred.group_info = cred->group_info; in rpcauth_lookupcred()
640 rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, in rpcauth_init_cred() argument
643 INIT_HLIST_NODE(&cred->cr_hash); in rpcauth_init_cred()
644 INIT_LIST_HEAD(&cred->cr_lru); in rpcauth_init_cred()
645 atomic_set(&cred->cr_count, 1); in rpcauth_init_cred()
646 cred->cr_auth = auth; in rpcauth_init_cred()
647 cred->cr_ops = ops; in rpcauth_init_cred()
648 cred->cr_expire = jiffies; in rpcauth_init_cred()
650 cred->cr_magic = RPCAUTH_CRED_MAGIC; in rpcauth_init_cred()
652 cred->cr_uid = acred->uid; in rpcauth_init_cred()
657 rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) in rpcauth_generic_bind_cred() argument
660 cred->cr_auth->au_ops->au_name, cred); in rpcauth_generic_bind_cred()
661 return get_rpccred(cred); in rpcauth_generic_bind_cred()
690 rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) in rpcauth_bindcred() argument
698 if (cred != NULL) in rpcauth_bindcred()
699 new = cred->cr_ops->crbind(task, cred, lookupflags); in rpcauth_bindcred()
712 put_rpccred(struct rpc_cred *cred) in put_rpccred() argument
714 if (cred == NULL) in put_rpccred()
717 if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) == 0) { in put_rpccred()
718 if (atomic_dec_and_test(&cred->cr_count)) in put_rpccred()
719 cred->cr_ops->crdestroy(cred); in put_rpccred()
723 if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock)) in put_rpccred()
725 if (!list_empty(&cred->cr_lru)) { in put_rpccred()
727 list_del_init(&cred->cr_lru); in put_rpccred()
729 if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { in put_rpccred()
730 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) { in put_rpccred()
731 cred->cr_expire = jiffies; in put_rpccred()
732 list_add_tail(&cred->cr_lru, &cred_unused); in put_rpccred()
736 if (!rpcauth_unhash_cred(cred)) { in put_rpccred()
742 cred->cr_ops->crdestroy(cred); in put_rpccred()
752 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_marshcred() local
755 task->tk_pid, cred->cr_auth->au_ops->au_name, cred); in rpcauth_marshcred()
757 return cred->cr_ops->crmarshal(task, p); in rpcauth_marshcred()
763 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_checkverf() local
766 task->tk_pid, cred->cr_auth->au_ops->au_name, cred); in rpcauth_checkverf()
768 return cred->cr_ops->crvalidate(task, p); in rpcauth_checkverf()
784 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_wrap_req() local
787 task->tk_pid, cred->cr_ops->cr_name, cred); in rpcauth_wrap_req()
788 if (cred->cr_ops->crwrap_req) in rpcauth_wrap_req()
789 return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); in rpcauth_wrap_req()
809 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_unwrap_resp() local
812 task->tk_pid, cred->cr_ops->cr_name, cred); in rpcauth_unwrap_resp()
813 if (cred->cr_ops->crunwrap_resp) in rpcauth_unwrap_resp()
814 return cred->cr_ops->crunwrap_resp(task, decode, rqstp, in rpcauth_unwrap_resp()
823 struct rpc_cred *cred; in rpcauth_refreshcred() local
826 cred = task->tk_rqstp->rq_cred; in rpcauth_refreshcred()
827 if (cred == NULL) { in rpcauth_refreshcred()
831 cred = task->tk_rqstp->rq_cred; in rpcauth_refreshcred()
834 task->tk_pid, cred->cr_auth->au_ops->au_name, cred); in rpcauth_refreshcred()
836 err = cred->cr_ops->crrefresh(task); in rpcauth_refreshcred()
846 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_invalcred() local
849 task->tk_pid, cred->cr_auth->au_ops->au_name, cred); in rpcauth_invalcred()
850 if (cred) in rpcauth_invalcred()
851 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); in rpcauth_invalcred()
857 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_uptodatecred() local
859 return cred == NULL || in rpcauth_uptodatecred()
860 test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0; in rpcauth_uptodatecred()