2 #include "ceph_debug.h"
5 #include <linux/module.h>
6 #include <linux/random.h>
12 static void reset(struct ceph_auth_client *ac)
14 struct ceph_auth_none_info *xi = ac->private;
17 xi->built_authorizer = false;
20 static void destroy(struct ceph_auth_client *ac)
26 static int is_authenticated(struct ceph_auth_client *ac)
28 struct ceph_auth_none_info *xi = ac->private;
34 * the generic auth code decode the global_id, and we carry no actual
35 * authenticate state, so nothing happens here.
37 static int handle_reply(struct ceph_auth_client *ac, int result,
40 struct ceph_auth_none_info *xi = ac->private;
47 * build an 'authorizer' with our entity_name and global_id. we can
48 * reuse a single static copy since it is identical for all services
51 static int ceph_auth_none_create_authorizer(
52 struct ceph_auth_client *ac, int peer_type,
53 struct ceph_authorizer **a,
54 void **buf, size_t *len,
55 void **reply_buf, size_t *reply_len)
57 struct ceph_auth_none_info *ai = ac->private;
58 struct ceph_none_authorizer *au = &ai->au;
62 if (!ai->built_authorizer) {
64 end = p + sizeof(au->buf);
66 ret = ceph_entity_name_encode(ac->name, &p, end - 8);
69 ceph_decode_need(&p, end, sizeof(u64), bad2);
70 ceph_encode_64(&p, ac->global_id);
71 au->buf_len = p - (void *)au->buf;
72 ai->built_authorizer = true;
73 dout("built authorizer len %d\n", au->buf_len);
76 *a = (struct ceph_authorizer *)au;
79 *reply_buf = au->reply_buf;
80 *reply_len = sizeof(au->reply_buf);
89 static void ceph_auth_none_destroy_authorizer(struct ceph_auth_client *ac,
90 struct ceph_authorizer *a)
95 static const struct ceph_auth_client_ops ceph_auth_none_ops = {
98 .is_authenticated = is_authenticated,
99 .handle_reply = handle_reply,
100 .create_authorizer = ceph_auth_none_create_authorizer,
101 .destroy_authorizer = ceph_auth_none_destroy_authorizer,
104 int ceph_auth_none_init(struct ceph_auth_client *ac)
106 struct ceph_auth_none_info *xi;
108 dout("ceph_auth_none_init %p\n", ac);
109 xi = kzalloc(sizeof(*xi), GFP_NOFS);
114 xi->built_authorizer = false;
116 ac->protocol = CEPH_AUTH_NONE;
118 ac->ops = &ceph_auth_none_ops;