2009-06-09 20:24:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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;
|
2009-06-10 18:18:17 +00:00
|
|
|
cls_method_handle_t h_get;
|
|
|
|
cls_method_handle_t h_set;
|
2009-06-09 20:24:03 +00:00
|
|
|
|
2009-06-10 18:18:17 +00:00
|
|
|
int get_method(cls_method_context_t ctx, char *indata, int datalen,
|
2009-06-09 20:24:03 +00:00
|
|
|
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);
|
|
|
|
|
2009-06-12 19:49:43 +00:00
|
|
|
cls_getxattr(ctx, "acls", outdata, outdatalen);
|
2009-06-09 20:24:03 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-10 18:18:17 +00:00
|
|
|
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);
|
|
|
|
|
2009-06-12 19:49:43 +00:00
|
|
|
cls_setxattr(ctx, "acls", indata, datalen);
|
2009-06-10 18:18:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-29 00:05:24 +00:00
|
|
|
void __cls_init()
|
2009-06-09 20:24:03 +00:00
|
|
|
{
|
|
|
|
cls_log("Loaded acl class!");
|
|
|
|
|
|
|
|
cls_register("acl", &h_class);
|
2009-06-10 18:18:17 +00:00
|
|
|
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);
|
2009-06-09 20:24:03 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|