]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/xacl_linux.h
XACL - refactoring an ACL and XATTR codes.
[bacula/bacula] / bacula / src / filed / xacl_linux.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2016 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18  */
19 /**
20  * Major refactoring of ACL and XATTR code written by:
21  *
22  *  RadosÅ‚aw Korzeniewski, MMXVI
23  *  radoslaw@korzeniewski.net, radekk@inteos.pl
24  *  Inteos Sp. z o.o. http://www.inteos.pl/
25  *
26  */
27
28 #ifndef __XACL_LINUX_H_
29 #define __XACL_LINUX_H_
30
31 #if defined(HAVE_LINUX_OS)
32 #include <sys/types.h>
33
34 #ifdef HAVE_SYS_ACL_H
35 #include <sys/acl.h>
36 #else
37 #error "configure failed to detect availability of sys/acl.h"
38 #endif
39
40 #if !defined(HAVE_LLISTXATTR) || !defined(HAVE_LGETXATTR) || !defined(HAVE_LSETXATTR)
41 #error "Missing full support for the XATTR functions."
42 #endif
43
44 #ifdef HAVE_SYS_XATTR_H
45 #include <sys/xattr.h>
46 #else
47 #error "Missing sys/xattr.h header file"
48 #endif
49
50 /*
51  *
52  *
53  */
54 class XACL_Linux : public XACL {
55 private:
56    bRC_XACL os_backup_acl (JCR *jcr, FF_PKT *ff_pkt);
57    bRC_XACL os_restore_acl (JCR *jcr, int stream, char *content, uint32_t length);
58    bRC_XACL os_backup_xattr (JCR *jcr, FF_PKT *ff_pkt);
59    bRC_XACL os_restore_xattr (JCR *jcr, int stream, char *content, uint32_t length);
60    bRC_XACL os_get_acl(JCR *jcr, XACL_type xacltype);
61    bRC_XACL os_set_acl(JCR *jcr, XACL_type xacltype, char *content, uint32_t length);
62    bRC_XACL os_get_xattr_names (JCR *jcr, POOLMEM **list, uint32_t *length);
63    bRC_XACL os_get_xattr_value (JCR *jcr, char * name, char ** pvalue, uint32_t * plen);
64    bRC_XACL os_set_xattr (JCR *jcr, FF_PKT *ff_pkt, char *list, uint32_t length);
65    bRC_XACL os_set_xattr (JCR *jcr, XACL_xattr *xattr);
66    acl_type_t get_acltype(XACL_type xacltype);
67    int acl_nrentries(acl_t acl);
68    bool acl_issimple(acl_t acl);
69 public:
70    XACL_Linux ();
71 };
72
73 #endif /* HAVE_LINUX_OS */
74
75 #endif /* __XACL_LINUX_H_ */