summaryrefslogtreecommitdiffstats
path: root/src/cls_acl.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/cls_acl.cc
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cls_acl.cc')
-rw-r--r--src/cls_acl.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/cls_acl.cc b/src/cls_acl.cc
new file mode 100644
index 00000000..91d6a5ad
--- /dev/null
+++ b/src/cls_acl.cc
@@ -0,0 +1,57 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+#include <iostream>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <openssl/md5.h>
+#include <openssl/sha.h>
+
+#include "include/types.h"
+#include "objclass/objclass.h"
+
+CLS_VER(1,0)
+CLS_NAME(acl)
+
+int get_method(cls_method_context_t ctx, char *indata, int datalen,
+ char **outdata, int *outdatalen)
+{
+ MD5_CTX c;
+
+ cls_log("acl test method");
+ cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
+
+ cls_getxattr(ctx, "acls", outdata, outdatalen);
+
+ return 0;
+}
+
+int set_method(cls_method_context_t ctx, char *indata, int datalen,
+ char **outdata, int *outdatalen)
+{
+ MD5_CTX c;
+
+ cls_log("acl test method");
+ cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
+
+ cls_setxattr(ctx, "acls", indata, datalen);
+
+ return 0;
+}
+
+CLS_INIT(acl)
+{
+ cls_log("Loaded acl class!");
+
+ cls_handle_t h_class;
+ cls_method_handle_t h_get;
+ cls_method_handle_t h_set;
+
+ cls_register("acl", &h_class);
+ cls_register_method(h_class, "get", CLS_METHOD_RD, get_method, &h_get);
+ cls_register_method(h_class, "set", CLS_METHOD_WR, set_method, &h_set);
+
+ return;
+}
+