]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls_acl.cc
import ceph 15.2.10
[ceph.git] / ceph / src / cls_acl.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 #include <iostream>
4 #include <string.h>
5 #include <stdlib.h>
6 #include <errno.h>
7
8 #include <openssl/md5.h>
9 #include <openssl/sha.h>
10
11 #include "include/types.h"
12 #include "objclass/objclass.h"
13
14 CLS_VER(1,0)
15 CLS_NAME(acl)
16
17 int get_method(cls_method_context_t ctx, char *indata, int datalen,
18 char **outdata, int *outdatalen)
19 {
20 MD5_CTX c;
21
22 cls_log("acl test method");
23 cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
24
25 cls_getxattr(ctx, "acls", outdata, outdatalen);
26
27 return 0;
28 }
29
30 int set_method(cls_method_context_t ctx, char *indata, int datalen,
31 char **outdata, int *outdatalen)
32 {
33 MD5_CTX c;
34
35 cls_log("acl test method");
36 cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
37
38 cls_setxattr(ctx, "acls", indata, datalen);
39
40 return 0;
41 }
42
43 CLS_INIT(acl)
44 {
45 cls_log("Loaded acl class!");
46
47 cls_handle_t h_class;
48 cls_method_handle_t h_get;
49 cls_method_handle_t h_set;
50
51 cls_register("acl", &h_class);
52 cls_register_method(h_class, "get", CLS_METHOD_RD, get_method, &h_get);
53 cls_register_method(h_class, "set", CLS_METHOD_WR, set_method, &h_set);
54
55 return;
56 }
57