Lines Matching full:ac
24 static int ceph_auth_init_protocol(struct ceph_auth_client *ac, int protocol) in ceph_auth_init_protocol() argument
28 return ceph_auth_none_init(ac); in ceph_auth_init_protocol()
30 return ceph_x_init(ac); in ceph_auth_init_protocol()
41 struct ceph_auth_client *ac; in ceph_auth_init() local
47 ac = kzalloc(sizeof(*ac), GFP_NOFS); in ceph_auth_init()
48 if (!ac) in ceph_auth_init()
51 mutex_init(&ac->mutex); in ceph_auth_init()
52 ac->negotiating = true; in ceph_auth_init()
54 ac->name = name; in ceph_auth_init()
56 ac->name = CEPH_AUTH_NAME_DEFAULT; in ceph_auth_init()
57 dout("auth_init name %s\n", ac->name); in ceph_auth_init()
58 ac->key = key; in ceph_auth_init()
59 return ac; in ceph_auth_init()
65 void ceph_auth_destroy(struct ceph_auth_client *ac) in ceph_auth_destroy() argument
67 dout("auth_destroy %p\n", ac); in ceph_auth_destroy()
68 if (ac->ops) in ceph_auth_destroy()
69 ac->ops->destroy(ac); in ceph_auth_destroy()
70 kfree(ac); in ceph_auth_destroy()
76 void ceph_auth_reset(struct ceph_auth_client *ac) in ceph_auth_reset() argument
78 mutex_lock(&ac->mutex); in ceph_auth_reset()
79 dout("auth_reset %p\n", ac); in ceph_auth_reset()
80 if (ac->ops && !ac->negotiating) in ceph_auth_reset()
81 ac->ops->reset(ac); in ceph_auth_reset()
82 ac->negotiating = true; in ceph_auth_reset()
83 mutex_unlock(&ac->mutex); in ceph_auth_reset()
105 int ceph_auth_build_hello(struct ceph_auth_client *ac, void *buf, size_t len) in ceph_auth_build_hello() argument
112 mutex_lock(&ac->mutex); in ceph_auth_build_hello()
131 ret = ceph_auth_entity_name_encode(ac->name, &p, end); in ceph_auth_build_hello()
135 ceph_encode_64(&p, ac->global_id); in ceph_auth_build_hello()
140 mutex_unlock(&ac->mutex); in ceph_auth_build_hello()
148 static int ceph_build_auth_request(struct ceph_auth_client *ac, in ceph_build_auth_request() argument
160 ceph_encode_32(&p, ac->protocol); in ceph_build_auth_request()
162 ret = ac->ops->build_request(ac, p + sizeof(u32), end); in ceph_build_auth_request()
165 ac->ops->name); in ceph_build_auth_request()
178 int ceph_handle_auth_reply(struct ceph_auth_client *ac, in ceph_handle_auth_reply() argument
193 mutex_lock(&ac->mutex); in ceph_handle_auth_reply()
214 if (global_id && ac->global_id != global_id) { in ceph_handle_auth_reply()
215 dout(" set global_id %lld -> %lld\n", ac->global_id, global_id); in ceph_handle_auth_reply()
216 ac->global_id = global_id; in ceph_handle_auth_reply()
219 if (ac->negotiating) { in ceph_handle_auth_reply()
226 if (ac->protocol && ac->protocol != protocol) { in ceph_handle_auth_reply()
227 ac->ops->destroy(ac); in ceph_handle_auth_reply()
228 ac->protocol = 0; in ceph_handle_auth_reply()
229 ac->ops = NULL; in ceph_handle_auth_reply()
231 if (ac->protocol != protocol) { in ceph_handle_auth_reply()
232 ret = ceph_auth_init_protocol(ac, protocol); in ceph_handle_auth_reply()
240 ac->negotiating = false; in ceph_handle_auth_reply()
243 ret = ac->ops->handle_reply(ac, result, payload, payload_end); in ceph_handle_auth_reply()
245 ret = ceph_build_auth_request(ac, reply_buf, reply_len); in ceph_handle_auth_reply()
247 pr_err("auth method '%s' error %d\n", ac->ops->name, ret); in ceph_handle_auth_reply()
251 mutex_unlock(&ac->mutex); in ceph_handle_auth_reply()
260 int ceph_build_auth(struct ceph_auth_client *ac, in ceph_build_auth() argument
265 mutex_lock(&ac->mutex); in ceph_build_auth()
266 if (ac->ops->should_authenticate(ac)) in ceph_build_auth()
267 ret = ceph_build_auth_request(ac, msg_buf, msg_len); in ceph_build_auth()
268 mutex_unlock(&ac->mutex); in ceph_build_auth()
272 int ceph_auth_is_authenticated(struct ceph_auth_client *ac) in ceph_auth_is_authenticated() argument
276 mutex_lock(&ac->mutex); in ceph_auth_is_authenticated()
277 if (ac->ops) in ceph_auth_is_authenticated()
278 ret = ac->ops->is_authenticated(ac); in ceph_auth_is_authenticated()
279 mutex_unlock(&ac->mutex); in ceph_auth_is_authenticated()
284 int ceph_auth_create_authorizer(struct ceph_auth_client *ac, in ceph_auth_create_authorizer() argument
290 mutex_lock(&ac->mutex); in ceph_auth_create_authorizer()
291 if (ac->ops && ac->ops->create_authorizer) in ceph_auth_create_authorizer()
292 ret = ac->ops->create_authorizer(ac, peer_type, auth); in ceph_auth_create_authorizer()
293 mutex_unlock(&ac->mutex); in ceph_auth_create_authorizer()
304 int ceph_auth_update_authorizer(struct ceph_auth_client *ac, in ceph_auth_update_authorizer() argument
310 mutex_lock(&ac->mutex); in ceph_auth_update_authorizer()
311 if (ac->ops && ac->ops->update_authorizer) in ceph_auth_update_authorizer()
312 ret = ac->ops->update_authorizer(ac, peer_type, a); in ceph_auth_update_authorizer()
313 mutex_unlock(&ac->mutex); in ceph_auth_update_authorizer()
318 int ceph_auth_add_authorizer_challenge(struct ceph_auth_client *ac, in ceph_auth_add_authorizer_challenge() argument
325 mutex_lock(&ac->mutex); in ceph_auth_add_authorizer_challenge()
326 if (ac->ops && ac->ops->add_authorizer_challenge) in ceph_auth_add_authorizer_challenge()
327 ret = ac->ops->add_authorizer_challenge(ac, a, challenge_buf, in ceph_auth_add_authorizer_challenge()
329 mutex_unlock(&ac->mutex); in ceph_auth_add_authorizer_challenge()
334 int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, in ceph_auth_verify_authorizer_reply() argument
339 mutex_lock(&ac->mutex); in ceph_auth_verify_authorizer_reply()
340 if (ac->ops && ac->ops->verify_authorizer_reply) in ceph_auth_verify_authorizer_reply()
341 ret = ac->ops->verify_authorizer_reply(ac, a); in ceph_auth_verify_authorizer_reply()
342 mutex_unlock(&ac->mutex); in ceph_auth_verify_authorizer_reply()
347 void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, int peer_type) in ceph_auth_invalidate_authorizer() argument
349 mutex_lock(&ac->mutex); in ceph_auth_invalidate_authorizer()
350 if (ac->ops && ac->ops->invalidate_authorizer) in ceph_auth_invalidate_authorizer()
351 ac->ops->invalidate_authorizer(ac, peer_type); in ceph_auth_invalidate_authorizer()
352 mutex_unlock(&ac->mutex); in ceph_auth_invalidate_authorizer()