summaryrefslogtreecommitdiff
path: root/src/cls_acl.cc
blob: d3c774d5b9373028a529e79f8bbe92c050f1d716 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63



#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)

cls_handle_t h_class;
cls_method_handle_t h_get;
cls_method_handle_t h_set;

int get_method(cls_method_context_t ctx, char *indata, int datalen,
				 char **outdata, int *outdatalen)
{
   int i;
   MD5_CTX c;
   unsigned char *md;

   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)
{
   int i;
   MD5_CTX c;
   unsigned char *md;

   cls_log("acl test method");
   cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);

   cls_setxattr(ctx, "acls", indata, datalen);

   return 0;
}

void __cls_init()
{
   cls_log("Loaded acl class!");

   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;
}