lib/param: bring lp_smb_ports() into common by making it a list everywhere
[kai/samba.git] / source3 / include / smb_acls.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Portable SMB ACL interface
4    Copyright (C) Jeremy Allison 2000
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _SMB_ACLS_H
21 #define _SMB_ACLS_H
22
23 struct vfs_handle_struct;
24 struct files_struct;
25
26 typedef int                     SMB_ACL_TYPE_T;
27 typedef mode_t                  *SMB_ACL_PERMSET_T;
28 typedef mode_t                  SMB_ACL_PERM_T;
29 #define SMB_ACL_READ                            4
30 #define SMB_ACL_WRITE                           2
31 #define SMB_ACL_EXECUTE                         1
32
33 /* Types of ACLs. */
34 enum smb_acl_tag_t {
35         SMB_ACL_TAG_INVALID=0,
36         SMB_ACL_USER=1,
37         SMB_ACL_USER_OBJ,
38         SMB_ACL_GROUP,
39         SMB_ACL_GROUP_OBJ,
40         SMB_ACL_OTHER,
41         SMB_ACL_MASK
42 };
43
44 typedef enum smb_acl_tag_t SMB_ACL_TAG_T;
45
46 struct smb_acl_entry {
47         enum smb_acl_tag_t a_type;
48         SMB_ACL_PERM_T a_perm;
49         uid_t uid;
50         gid_t gid;
51 };
52
53 typedef struct smb_acl_t {
54         int     size;
55         int     count;
56         int     next;
57         struct smb_acl_entry acl[1];
58 } *SMB_ACL_T;
59
60 typedef struct smb_acl_entry    *SMB_ACL_ENTRY_T;
61
62 #define SMB_ACL_FIRST_ENTRY                     0
63 #define SMB_ACL_NEXT_ENTRY                      1
64
65 #define SMB_ACL_TYPE_ACCESS                     0
66 #define SMB_ACL_TYPE_DEFAULT            1
67
68 /* The following definitions come from lib/sysacls.c  */
69
70 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
71 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
72 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
73 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
74 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
75 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
76 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
77 char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p);
78 SMB_ACL_T sys_acl_init(int count);
79 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
80 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
81 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
82 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
83 int sys_acl_free_text(char *text);
84 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
85 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
86 int sys_acl_valid(SMB_ACL_T acl_d);
87 SMB_ACL_T sys_acl_get_file(struct vfs_handle_struct *handle,
88                            const char *path_p, SMB_ACL_TYPE_T type);
89 SMB_ACL_T sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp);
90 int sys_acl_set_file(struct vfs_handle_struct *handle,
91                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
92 int sys_acl_set_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
93                    SMB_ACL_T acl_d);
94 int sys_acl_delete_def_file(struct vfs_handle_struct *handle,
95                             const char *path);
96 int no_acl_syscall_error(int err);
97
98 #endif /* _SMB_ACLS_H */