• Home
  • Raw
  • Download

Lines Matching refs:cred

41 static struct cred machine_cred = {
49 const struct cred *rpc_machine_cred(void) in rpc_machine_cred()
261 rpcauth_unhash_cred_locked(struct rpc_cred *cred) in rpcauth_unhash_cred_locked() argument
263 if (!test_and_clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags)) in rpcauth_unhash_cred_locked()
265 hlist_del_rcu(&cred->cr_hash); in rpcauth_unhash_cred_locked()
270 rpcauth_unhash_cred(struct rpc_cred *cred) in rpcauth_unhash_cred() argument
275 if (!test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags)) in rpcauth_unhash_cred()
277 cache_lock = &cred->cr_auth->au_credcache->lock; in rpcauth_unhash_cred()
279 ret = rpcauth_unhash_cred_locked(cred); in rpcauth_unhash_cred()
312 rpcauth_stringify_acceptor(struct rpc_cred *cred) in rpcauth_stringify_acceptor() argument
314 if (!cred->cr_ops->crstringify_acceptor) in rpcauth_stringify_acceptor()
316 return cred->cr_ops->crstringify_acceptor(cred); in rpcauth_stringify_acceptor()
326 struct rpc_cred *cred; in rpcauth_destroy_credlist() local
329 cred = list_entry(head->next, struct rpc_cred, cr_lru); in rpcauth_destroy_credlist()
330 list_del_init(&cred->cr_lru); in rpcauth_destroy_credlist()
331 put_rpccred(cred); in rpcauth_destroy_credlist()
336 rpcauth_lru_add_locked(struct rpc_cred *cred) in rpcauth_lru_add_locked() argument
338 if (!list_empty(&cred->cr_lru)) in rpcauth_lru_add_locked()
341 list_add_tail(&cred->cr_lru, &cred_unused); in rpcauth_lru_add_locked()
345 rpcauth_lru_add(struct rpc_cred *cred) in rpcauth_lru_add() argument
347 if (!list_empty(&cred->cr_lru)) in rpcauth_lru_add()
350 rpcauth_lru_add_locked(cred); in rpcauth_lru_add()
355 rpcauth_lru_remove_locked(struct rpc_cred *cred) in rpcauth_lru_remove_locked() argument
357 if (list_empty(&cred->cr_lru)) in rpcauth_lru_remove_locked()
360 list_del_init(&cred->cr_lru); in rpcauth_lru_remove_locked()
364 rpcauth_lru_remove(struct rpc_cred *cred) in rpcauth_lru_remove() argument
366 if (list_empty(&cred->cr_lru)) in rpcauth_lru_remove()
369 rpcauth_lru_remove_locked(cred); in rpcauth_lru_remove()
382 struct rpc_cred *cred; in rpcauth_clear_credcache() local
391 cred = hlist_entry(head->first, struct rpc_cred, cr_hash); in rpcauth_clear_credcache()
392 rpcauth_unhash_cred_locked(cred); in rpcauth_clear_credcache()
394 rpcauth_lru_remove_locked(cred); in rpcauth_clear_credcache()
395 list_add_tail(&cred->cr_lru, &free); in rpcauth_clear_credcache()
429 struct rpc_cred *cred, *next; in rpcauth_prune_expired() local
433 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { in rpcauth_prune_expired()
437 if (refcount_read(&cred->cr_count) > 1) { in rpcauth_prune_expired()
438 rpcauth_lru_remove_locked(cred); in rpcauth_prune_expired()
445 if (time_in_range(cred->cr_expire, expired, jiffies)) in rpcauth_prune_expired()
447 if (!rpcauth_unhash_cred(cred)) in rpcauth_prune_expired()
450 rpcauth_lru_remove_locked(cred); in rpcauth_prune_expired()
452 list_add_tail(&cred->cr_lru, free); in rpcauth_prune_expired()
519 struct rpc_cred *cred = NULL, in rpcauth_lookup_credcache() local
529 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
530 if (cred) in rpcauth_lookup_credcache()
535 if (cred != NULL) in rpcauth_lookup_credcache()
540 cred = new; in rpcauth_lookup_credcache()
548 cred = get_rpccred(entry); in rpcauth_lookup_credcache()
549 if (cred) in rpcauth_lookup_credcache()
552 if (cred == NULL) { in rpcauth_lookup_credcache()
553 cred = new; in rpcauth_lookup_credcache()
554 set_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); in rpcauth_lookup_credcache()
555 refcount_inc(&cred->cr_count); in rpcauth_lookup_credcache()
556 hlist_add_head_rcu(&cred->cr_hash, &cache->hashtable[nr]); in rpcauth_lookup_credcache()
562 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) && in rpcauth_lookup_credcache()
563 cred->cr_ops->cr_init != NULL && in rpcauth_lookup_credcache()
565 int res = cred->cr_ops->cr_init(auth, cred); in rpcauth_lookup_credcache()
567 put_rpccred(cred); in rpcauth_lookup_credcache()
568 cred = ERR_PTR(res); in rpcauth_lookup_credcache()
573 return cred; in rpcauth_lookup_credcache()
582 const struct cred *cred = current_cred(); in rpcauth_lookupcred() local
585 acred.cred = cred; in rpcauth_lookupcred()
592 rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, in rpcauth_init_cred() argument
595 INIT_HLIST_NODE(&cred->cr_hash); in rpcauth_init_cred()
596 INIT_LIST_HEAD(&cred->cr_lru); in rpcauth_init_cred()
597 refcount_set(&cred->cr_count, 1); in rpcauth_init_cred()
598 cred->cr_auth = auth; in rpcauth_init_cred()
599 cred->cr_flags = 0; in rpcauth_init_cred()
600 cred->cr_ops = ops; in rpcauth_init_cred()
601 cred->cr_expire = jiffies; in rpcauth_init_cred()
602 cred->cr_cred = get_cred(acred->cred); in rpcauth_init_cred()
611 .cred = get_task_cred(&init_task), in rpcauth_bind_root_cred()
618 put_cred(acred.cred); in rpcauth_bind_root_cred()
628 .cred = init_task.cred, in rpcauth_bind_machine_cred()
647 rpcauth_bindcred(struct rpc_task *task, const struct cred *cred, int flags) in rpcauth_bindcred() argument
654 .cred = cred, in rpcauth_bindcred()
662 else if (cred != NULL && cred != &machine_cred) in rpcauth_bindcred()
664 else if (cred == &machine_cred) in rpcauth_bindcred()
670 else if (cred == &machine_cred) in rpcauth_bindcred()
684 put_rpccred(struct rpc_cred *cred) in put_rpccred() argument
686 if (cred == NULL) in put_rpccred()
689 if (refcount_dec_and_test(&cred->cr_count)) in put_rpccred()
691 if (refcount_read(&cred->cr_count) != 1 || in put_rpccred()
692 !test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags)) in put_rpccred()
694 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) { in put_rpccred()
695 cred->cr_expire = jiffies; in put_rpccred()
696 rpcauth_lru_add(cred); in put_rpccred()
698 if (unlikely(!test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags))) in put_rpccred()
699 rpcauth_lru_remove(cred); in put_rpccred()
700 } else if (rpcauth_unhash_cred(cred)) { in put_rpccred()
701 rpcauth_lru_remove(cred); in put_rpccred()
702 if (refcount_dec_and_test(&cred->cr_count)) in put_rpccred()
710 cred->cr_ops->crdestroy(cred); in put_rpccred()
820 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_xmit_need_reencode() local
822 if (!cred || !cred->cr_ops->crneed_reencode) in rpcauth_xmit_need_reencode()
824 return cred->cr_ops->crneed_reencode(task); in rpcauth_xmit_need_reencode()
830 struct rpc_cred *cred; in rpcauth_refreshcred() local
833 cred = task->tk_rqstp->rq_cred; in rpcauth_refreshcred()
834 if (cred == NULL) { in rpcauth_refreshcred()
838 cred = task->tk_rqstp->rq_cred; in rpcauth_refreshcred()
841 err = cred->cr_ops->crrefresh(task); in rpcauth_refreshcred()
851 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_invalcred() local
853 if (cred) in rpcauth_invalcred()
854 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); in rpcauth_invalcred()
860 struct rpc_cred *cred = task->tk_rqstp->rq_cred; in rpcauth_uptodatecred() local
862 return cred == NULL || in rpcauth_uptodatecred()
863 test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0; in rpcauth_uptodatecred()