Lines Matching refs:th
100 struct ceph_x_ticket_handler *th; in get_ticket_handler() local
106 th = rb_entry(parent, struct ceph_x_ticket_handler, node); in get_ticket_handler()
107 if (service < th->service) in get_ticket_handler()
109 else if (service > th->service) in get_ticket_handler()
112 return th; in get_ticket_handler()
116 th = kzalloc(sizeof(*th), GFP_NOFS); in get_ticket_handler()
117 if (!th) in get_ticket_handler()
119 th->service = service; in get_ticket_handler()
120 rb_link_node(&th->node, parent, p); in get_ticket_handler()
121 rb_insert_color(&th->node, &xi->ticket_handlers); in get_ticket_handler()
122 return th; in get_ticket_handler()
126 struct ceph_x_ticket_handler *th) in remove_ticket_handler() argument
130 dout("remove_ticket_handler %p %d\n", th, th->service); in remove_ticket_handler()
131 rb_erase(&th->node, &xi->ticket_handlers); in remove_ticket_handler()
132 ceph_crypto_key_destroy(&th->session_key); in remove_ticket_handler()
133 if (th->ticket_blob) in remove_ticket_handler()
134 ceph_buffer_put(th->ticket_blob); in remove_ticket_handler()
135 kfree(th); in remove_ticket_handler()
145 struct ceph_x_ticket_handler *th; in process_one_ticket() local
171 th = get_ticket_handler(ac, type); in process_one_ticket()
172 if (IS_ERR(th)) { in process_one_ticket()
173 ret = PTR_ERR(th); in process_one_ticket()
191 memcpy(&old_key, &th->session_key, sizeof(old_key)); in process_one_ticket()
231 ceph_crypto_key_destroy(&th->session_key); in process_one_ticket()
232 if (th->ticket_blob) in process_one_ticket()
233 ceph_buffer_put(th->ticket_blob); in process_one_ticket()
234 th->session_key = new_session_key; in process_one_ticket()
235 th->ticket_blob = new_ticket_blob; in process_one_ticket()
236 th->validity = new_validity; in process_one_ticket()
237 th->secret_id = new_secret_id; in process_one_ticket()
238 th->expires = new_expires; in process_one_ticket()
239 th->renew_after = new_renew_after; in process_one_ticket()
241 type, ceph_entity_type_name(type), th->secret_id, in process_one_ticket()
242 (int)th->ticket_blob->vec.iov_len); in process_one_ticket()
243 xi->have_keys |= th->service; in process_one_ticket()
293 struct ceph_x_ticket_handler *th, in ceph_x_build_authorizer() argument
302 (th->ticket_blob ? th->ticket_blob->vec.iov_len : 0); in ceph_x_build_authorizer()
305 ceph_entity_type_name(th->service), au); in ceph_x_build_authorizer()
308 ret = ceph_crypto_key_clone(&au->session_key, &th->session_key); in ceph_x_build_authorizer()
326 au->service = th->service; in ceph_x_build_authorizer()
327 au->secret_id = th->secret_id; in ceph_x_build_authorizer()
332 msg_a->service_id = cpu_to_le32(th->service); in ceph_x_build_authorizer()
334 msg_a->ticket_blob.secret_id = cpu_to_le64(th->secret_id); in ceph_x_build_authorizer()
337 memcpy(msg_a->ticket_blob.blob, th->ticket_blob->vec.iov_base, in ceph_x_build_authorizer()
338 th->ticket_blob->vec.iov_len); in ceph_x_build_authorizer()
340 dout(" th %p secret_id %lld %lld\n", th, th->secret_id, in ceph_x_build_authorizer()
366 static int ceph_x_encode_ticket(struct ceph_x_ticket_handler *th, in ceph_x_encode_ticket() argument
371 ceph_encode_64(p, th->secret_id); in ceph_x_encode_ticket()
372 if (th->ticket_blob) { in ceph_x_encode_ticket()
373 const char *buf = th->ticket_blob->vec.iov_base; in ceph_x_encode_ticket()
374 u32 len = th->ticket_blob->vec.iov_len; in ceph_x_encode_ticket()
396 struct ceph_x_ticket_handler *th; in ceph_x_validate_tickets() local
404 th = get_ticket_handler(ac, service); in ceph_x_validate_tickets()
406 if (IS_ERR(th)) { in ceph_x_validate_tickets()
411 if (get_seconds() >= th->renew_after) in ceph_x_validate_tickets()
413 if (get_seconds() >= th->expires) in ceph_x_validate_tickets()
426 struct ceph_x_ticket_handler *th = in ceph_x_build_request() local
429 if (IS_ERR(th)) in ceph_x_build_request()
430 return PTR_ERR(th); in ceph_x_build_request()
468 ret = ceph_x_encode_ticket(th, &p, end); in ceph_x_build_request()
483 ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); in ceph_x_build_request()
503 struct ceph_x_ticket_handler *th; in ceph_x_handle_reply() local
536 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_handle_reply()
537 if (IS_ERR(th)) in ceph_x_handle_reply()
538 return PTR_ERR(th); in ceph_x_handle_reply()
539 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, in ceph_x_handle_reply()
558 struct ceph_x_ticket_handler *th; in ceph_x_create_authorizer() local
561 th = get_ticket_handler(ac, peer_type); in ceph_x_create_authorizer()
562 if (IS_ERR(th)) in ceph_x_create_authorizer()
563 return PTR_ERR(th); in ceph_x_create_authorizer()
569 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
591 struct ceph_x_ticket_handler *th; in ceph_x_update_authorizer() local
593 th = get_ticket_handler(ac, peer_type); in ceph_x_update_authorizer()
594 if (IS_ERR(th)) in ceph_x_update_authorizer()
595 return PTR_ERR(th); in ceph_x_update_authorizer()
598 if (au->secret_id < th->secret_id) { in ceph_x_update_authorizer()
600 au->service, au->secret_id, th->secret_id); in ceph_x_update_authorizer()
601 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
659 struct ceph_x_ticket_handler *th = in ceph_x_destroy() local
661 remove_ticket_handler(ac, th); in ceph_x_destroy()
673 struct ceph_x_ticket_handler *th; in ceph_x_invalidate_authorizer() local
675 th = get_ticket_handler(ac, peer_type); in ceph_x_invalidate_authorizer()
676 if (!IS_ERR(th)) in ceph_x_invalidate_authorizer()
677 memset(&th->validity, 0, sizeof(th->validity)); in ceph_x_invalidate_authorizer()