]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/xacl_solaris.h
Use if exists on dropping MAC table in postgres. Fixes bug #2314
[bacula/bacula] / bacula / src / filed / xacl_solaris.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_Solaris_H_
29 #define __XACL_Solaris_H_
30
31 #if defined(HAVE_SUN_OS)
32 #ifdef HAVE_SYS_ACL_H
33 #include <sys/acl.h>
34 #else
35 #error "configure failed to detect availability of sys/acl.h"
36 #endif
37
38 #ifdef HAVE_SYS_ATTR_H
39 #include <sys/attr.h>
40 #endif
41
42 /*
43  *
44  */
45 #if defined(HAVE_EXTENDED_ACL)
46 #if !defined(_SYS_ACL_IMPL_H)
47 typedef enum acl_type {
48    ACLENT_T = 0,
49    ACE_T = 1
50 } acl_type_t;
51 #endif
52
53 /*
54  *
55  */
56 extern "C" {
57 int acl_type(acl_t *);
58 char *acl_strerror(int);
59 };
60 #endif
61
62 /*
63  * Cache structure in alist
64  */
65 struct XACL_Solaris_Cache {
66    ino_t inode;
67    char * name;
68 };
69
70 /*
71  *
72  *
73  */
74 class XACL_Solaris : public XACL {
75 private:
76    alist * cache;
77    bRC_XACL os_backup_acl (JCR *jcr, FF_PKT *ff_pkt);
78    bRC_XACL os_restore_acl (JCR *jcr, int stream, char *content, uint32_t length);
79    bRC_XACL os_backup_xattr (JCR *jcr, FF_PKT *ff_pkt);
80    bRC_XACL os_restore_xattr (JCR *jcr, int stream, char *content, uint32_t length);
81    bRC_XACL os_get_acl(JCR *jcr, int *stream);
82    bRC_XACL os_set_acl(JCR *jcr, int stream, char *content, uint32_t length);
83    bRC_XACL os_get_xattr_names (JCR *jcr, POOLMEM **list, uint32_t *length);
84    bRC_XACL os_get_xattr_value (JCR *jcr, char * name, char ** pvalue, uint32_t * plen);
85    bRC_XACL os_set_xattr (JCR *jcr, bool extended, char *content, uint32_t length);
86    bRC_XACL os_get_xattr_acl(JCR *jcr, int fd, char **buffer);
87    bRC_XACL os_set_xattr_acl(JCR *jcr, int fd, char *name, char *acltext);
88    /* requires acl.h available */
89    bRC_XACL check_xacltype (JCR *jcr, int name);
90    inline char * find_xattr_cache(JCR *jcr, ino_t ino, char * name);
91    inline void delete_xattr_cache();
92 public:
93    XACL_Solaris ();
94    ~XACL_Solaris ();
95 };
96
97 #endif /* HAVE_SUN_OS */
98
99 #endif /* __XACL_Solaris_H_ */