Lines Matching refs:th

99 	struct ceph_x_ticket_handler *th;  in get_ticket_handler()  local
105 th = rb_entry(parent, struct ceph_x_ticket_handler, node); in get_ticket_handler()
106 if (service < th->service) in get_ticket_handler()
108 else if (service > th->service) in get_ticket_handler()
111 return th; in get_ticket_handler()
115 th = kzalloc(sizeof(*th), GFP_NOFS); in get_ticket_handler()
116 if (!th) in get_ticket_handler()
118 th->service = service; in get_ticket_handler()
119 rb_link_node(&th->node, parent, p); in get_ticket_handler()
120 rb_insert_color(&th->node, &xi->ticket_handlers); in get_ticket_handler()
121 return th; in get_ticket_handler()
125 struct ceph_x_ticket_handler *th) in remove_ticket_handler() argument
129 dout("remove_ticket_handler %p %d\n", th, th->service); in remove_ticket_handler()
130 rb_erase(&th->node, &xi->ticket_handlers); in remove_ticket_handler()
131 ceph_crypto_key_destroy(&th->session_key); in remove_ticket_handler()
132 if (th->ticket_blob) in remove_ticket_handler()
133 ceph_buffer_put(th->ticket_blob); in remove_ticket_handler()
134 kfree(th); in remove_ticket_handler()
144 struct ceph_x_ticket_handler *th; in process_one_ticket() local
170 th = get_ticket_handler(ac, type); in process_one_ticket()
171 if (IS_ERR(th)) { in process_one_ticket()
172 ret = PTR_ERR(th); in process_one_ticket()
190 memcpy(&old_key, &th->session_key, sizeof(old_key)); in process_one_ticket()
230 ceph_crypto_key_destroy(&th->session_key); in process_one_ticket()
231 if (th->ticket_blob) in process_one_ticket()
232 ceph_buffer_put(th->ticket_blob); in process_one_ticket()
233 th->session_key = new_session_key; in process_one_ticket()
234 th->ticket_blob = new_ticket_blob; in process_one_ticket()
235 th->validity = new_validity; in process_one_ticket()
236 th->secret_id = new_secret_id; in process_one_ticket()
237 th->expires = new_expires; in process_one_ticket()
238 th->renew_after = new_renew_after; in process_one_ticket()
240 type, ceph_entity_type_name(type), th->secret_id, in process_one_ticket()
241 (int)th->ticket_blob->vec.iov_len); in process_one_ticket()
242 xi->have_keys |= th->service; in process_one_ticket()
283 struct ceph_x_ticket_handler *th, in ceph_x_build_authorizer() argument
292 (th->ticket_blob ? th->ticket_blob->vec.iov_len : 0); in ceph_x_build_authorizer()
295 ceph_entity_type_name(th->service), au); in ceph_x_build_authorizer()
298 ret = ceph_crypto_key_clone(&au->session_key, &th->session_key); in ceph_x_build_authorizer()
316 au->service = th->service; in ceph_x_build_authorizer()
317 au->secret_id = th->secret_id; in ceph_x_build_authorizer()
322 msg_a->service_id = cpu_to_le32(th->service); in ceph_x_build_authorizer()
324 msg_a->ticket_blob.secret_id = cpu_to_le64(th->secret_id); in ceph_x_build_authorizer()
327 memcpy(msg_a->ticket_blob.blob, th->ticket_blob->vec.iov_base, in ceph_x_build_authorizer()
328 th->ticket_blob->vec.iov_len); in ceph_x_build_authorizer()
330 dout(" th %p secret_id %lld %lld\n", th, th->secret_id, in ceph_x_build_authorizer()
357 static int ceph_x_encode_ticket(struct ceph_x_ticket_handler *th, in ceph_x_encode_ticket() argument
362 ceph_encode_64(p, th->secret_id); in ceph_x_encode_ticket()
363 if (th->ticket_blob) { in ceph_x_encode_ticket()
364 const char *buf = th->ticket_blob->vec.iov_base; in ceph_x_encode_ticket()
365 u32 len = th->ticket_blob->vec.iov_len; in ceph_x_encode_ticket()
387 struct ceph_x_ticket_handler *th; in ceph_x_validate_tickets() local
395 th = get_ticket_handler(ac, service); in ceph_x_validate_tickets()
397 if (IS_ERR(th)) { in ceph_x_validate_tickets()
402 if (get_seconds() >= th->renew_after) in ceph_x_validate_tickets()
404 if (get_seconds() >= th->expires) in ceph_x_validate_tickets()
417 struct ceph_x_ticket_handler *th = in ceph_x_build_request() local
420 if (IS_ERR(th)) in ceph_x_build_request()
421 return PTR_ERR(th); in ceph_x_build_request()
459 ret = ceph_x_encode_ticket(th, &p, end); in ceph_x_build_request()
474 ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); in ceph_x_build_request()
494 struct ceph_x_ticket_handler *th; in ceph_x_handle_reply() local
527 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_handle_reply()
528 if (IS_ERR(th)) in ceph_x_handle_reply()
529 return PTR_ERR(th); in ceph_x_handle_reply()
530 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, in ceph_x_handle_reply()
549 struct ceph_x_ticket_handler *th; in ceph_x_create_authorizer() local
552 th = get_ticket_handler(ac, peer_type); in ceph_x_create_authorizer()
553 if (IS_ERR(th)) in ceph_x_create_authorizer()
554 return PTR_ERR(th); in ceph_x_create_authorizer()
560 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
582 struct ceph_x_ticket_handler *th; in ceph_x_update_authorizer() local
584 th = get_ticket_handler(ac, peer_type); in ceph_x_update_authorizer()
585 if (IS_ERR(th)) in ceph_x_update_authorizer()
586 return PTR_ERR(th); in ceph_x_update_authorizer()
589 if (au->secret_id < th->secret_id) { in ceph_x_update_authorizer()
591 au->service, au->secret_id, th->secret_id); in ceph_x_update_authorizer()
592 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
651 struct ceph_x_ticket_handler *th = in ceph_x_destroy() local
653 remove_ticket_handler(ac, th); in ceph_x_destroy()
666 struct ceph_x_ticket_handler *th; in ceph_x_invalidate_authorizer() local
668 th = get_ticket_handler(ac, peer_type); in ceph_x_invalidate_authorizer()
669 if (!IS_ERR(th)) in ceph_x_invalidate_authorizer()
670 memset(&th->validity, 0, sizeof(th->validity)); in ceph_x_invalidate_authorizer()