Lines Matching refs:cred

299 rpcauth_unhash_cred_locked(struct rpc_cred *cred)  in rpcauth_unhash_cred_locked()  argument
301 hlist_del_rcu(&cred->cr_hash); in rpcauth_unhash_cred_locked()
303 clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); in rpcauth_unhash_cred_locked()
307 rpcauth_unhash_cred(struct rpc_cred *cred) in rpcauth_unhash_cred() argument
312 cache_lock = &cred->cr_auth->au_credcache->lock; in rpcauth_unhash_cred()
314 ret = atomic_read(&cred->cr_count) == 0; in rpcauth_unhash_cred()
316 rpcauth_unhash_cred_locked(cred); in rpcauth_unhash_cred()
352 rpcauth_key_timeout_notify(struct rpc_auth *auth, struct rpc_cred *cred) in rpcauth_key_timeout_notify() argument
354 if (!cred->cr_auth->au_ops->key_timeout) in rpcauth_key_timeout_notify()
356 return cred->cr_auth->au_ops->key_timeout(auth, cred); in rpcauth_key_timeout_notify()
361 rpcauth_cred_key_to_expire(struct rpc_auth *auth, struct rpc_cred *cred) in rpcauth_cred_key_to_expire() argument
365 if (!cred->cr_ops->crkey_to_expire) in rpcauth_cred_key_to_expire()
367 return cred->cr_ops->crkey_to_expire(cred); in rpcauth_cred_key_to_expire()
372 rpcauth_stringify_acceptor(struct rpc_cred *cred) in rpcauth_stringify_acceptor() argument
374 if (!cred->cr_ops->crstringify_acceptor) in rpcauth_stringify_acceptor()
376 return cred->cr_ops->crstringify_acceptor(cred); in rpcauth_stringify_acceptor()
386 struct rpc_cred *cred; in rpcauth_destroy_credlist() local
389 cred = list_entry(head->next, struct rpc_cred, cr_lru); in rpcauth_destroy_credlist()
390 list_del_init(&cred->cr_lru); in rpcauth_destroy_credlist()
391 put_rpccred(cred); in rpcauth_destroy_credlist()
404 struct rpc_cred *cred; in rpcauth_clear_credcache() local
413 cred = hlist_entry(head->first, struct rpc_cred, cr_hash); in rpcauth_clear_credcache()
414 get_rpccred(cred); in rpcauth_clear_credcache()
415 if (!list_empty(&cred->cr_lru)) { in rpcauth_clear_credcache()
416 list_del(&cred->cr_lru); in rpcauth_clear_credcache()
419 list_add_tail(&cred->cr_lru, &free); in rpcauth_clear_credcache()
420 rpcauth_unhash_cred_locked(cred); in rpcauth_clear_credcache()
455 struct rpc_cred *cred, *next; in rpcauth_prune_expired() local
459 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { in rpcauth_prune_expired()
467 if (time_in_range(cred->cr_expire, expired, jiffies) && in rpcauth_prune_expired()
468 test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { in rpcauth_prune_expired()
473 list_del_init(&cred->cr_lru); in rpcauth_prune_expired()
476 if (atomic_read(&cred->cr_count) != 0) in rpcauth_prune_expired()
479 cache_lock = &cred->cr_auth->au_credcache->lock; in rpcauth_prune_expired()
481 if (atomic_read(&cred->cr_count) == 0) { in rpcauth_prune_expired()
482 get_rpccred(cred); in rpcauth_prune_expired()
483 list_add_tail(&cred->cr_lru, free); in rpcauth_prune_expired()
484 rpcauth_unhash_cred_locked(cred); in rpcauth_prune_expired()
553 struct rpc_cred *cred = NULL, in rpcauth_lookup_credcache() local
566 cred = entry; in rpcauth_lookup_credcache()
574 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
580 if (cred != NULL) in rpcauth_lookup_credcache()
588 cred = new; in rpcauth_lookup_credcache()
596 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
599 if (cred == NULL) { in rpcauth_lookup_credcache()
600 cred = new; in rpcauth_lookup_credcache()
601 set_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); in rpcauth_lookup_credcache()
602 hlist_add_head_rcu(&cred->cr_hash, &cache->hashtable[nr]); in rpcauth_lookup_credcache()
608 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) && in rpcauth_lookup_credcache()
609 cred->cr_ops->cr_init != NULL && in rpcauth_lookup_credcache()
611 int res = cred->cr_ops->cr_init(auth, cred); in rpcauth_lookup_credcache()
613 put_rpccred(cred); in rpcauth_lookup_credcache()
614 cred = ERR_PTR(res); in rpcauth_lookup_credcache()
619 return cred; in rpcauth_lookup_credcache()
628 const struct cred *cred = current_cred(); in rpcauth_lookupcred() local
634 acred.uid = cred->fsuid; in rpcauth_lookupcred()
635 acred.gid = cred->fsgid; in rpcauth_lookupcred()
636 acred.group_info = cred->group_info; in rpcauth_lookupcred()
643 rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, in rpcauth_init_cred() argument
646 INIT_HLIST_NODE(&cred->cr_hash); in rpcauth_init_cred()
647 INIT_LIST_HEAD(&cred->cr_lru); in rpcauth_init_cred()
648 atomic_set(&cred->cr_count, 1); in rpcauth_init_cred()
649 cred->cr_auth = auth; in rpcauth_init_cred()
650 cred->cr_ops = ops; in rpcauth_init_cred()
651 cred->cr_expire = jiffies; 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()