1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2004-2008 Free Software Foundation Europe e.V. 5 Copyright (C) 2011-2012 Planets Communications B.V. 6 Copyright (C) 2013-2018 Bareos GmbH & Co. KG 7 8 This program is Free Software; you can redistribute it and/or 9 modify it under the terms of version three of the GNU Affero General Public 10 License as published by the Free Software Foundation and included 11 in the file LICENSE. 12 13 This program is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Affero General Public License for more details. 17 18 You should have received a copy of the GNU Affero General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 02110-1301, USA. 22 */ 23 /** 24 * @file 25 * Properties we use for getting and setting ACLs. 26 */ 27 28 #ifndef BAREOS_FINDLIB_ACL_H_ 29 #define BAREOS_FINDLIB_ACL_H_ 30 31 /** 32 * Number of acl errors to report per job. 33 */ 34 #define ACL_REPORT_ERR_MAX_PER_JOB 25 35 36 /** 37 * Return codes from acl subroutines. 38 */ 39 typedef enum { 40 bacl_exit_fatal = -1, 41 bacl_exit_error = 0, 42 bacl_exit_ok = 1 43 } bacl_exit_code; 44 45 /* For shorter ACL strings when possible, define BACL_WANT_SHORT_ACLS */ 46 /* #define BACL_WANT_SHORT_ACLS */ 47 48 /* For numeric user/group ids when possible, define BACL_WANT_NUMERIC_IDS */ 49 /* #define BACL_WANT_NUMERIC_IDS */ 50 51 /** 52 * We support the following types of ACLs 53 */ 54 typedef enum { 55 BACL_TYPE_NONE = 0, 56 BACL_TYPE_ACCESS = 1, 57 BACL_TYPE_DEFAULT = 2, 58 BACL_TYPE_DEFAULT_DIR = 3, 59 BACL_TYPE_EXTENDED = 4, 60 BACL_TYPE_NFS4 = 5 61 } bacl_type; 62 63 /** 64 * This value is used as ostype when we encounter an invalid acl type. 65 * The way the code is build this should never happen. 66 */ 67 #if !defined(ACL_TYPE_NONE) 68 #define ACL_TYPE_NONE 0x0 69 #endif 70 71 #if defined(HAVE_FREEBSD_OS) || \ 72 defined(HAVE_DARWIN_OS) || \ 73 defined(HAVE_HPUX_OS) || \ 74 defined(HAVE_LINUX_OS) 75 #define BACL_ENOTSUP EOPNOTSUPP 76 #elif defined(HAVE_IRIX_OS) 77 #define BACL_ENOTSUP ENOSYS 78 #endif 79 80 #define BACL_FLAG_SAVE_NATIVE 0x01 81 #define BACL_FLAG_SAVE_AFS 0x02 82 #define BACL_FLAG_RESTORE_NATIVE 0x04 83 #define BACL_FLAG_RESTORE_AFS 0x08 84 85 struct acl_build_data_t { 86 uint32_t nr_errors; 87 uint32_t content_length; 88 POOLMEM *content; 89 }; 90 91 struct acl_parse_data_t { 92 uint32_t nr_errors; 93 }; 94 95 /** 96 * Internal tracking data. 97 */ 98 struct acl_data_t { 99 int filetype; 100 POOLMEM *last_fname; 101 uint32_t flags; /* See BACL_FLAG_* */ 102 uint32_t current_dev; 103 union { 104 struct acl_build_data_t *build; 105 struct acl_parse_data_t *parse; 106 } u; 107 }; 108 109 bacl_exit_code SendAclStream(JobControlRecord *jcr, acl_data_t *acl_data, int stream); 110 bacl_exit_code BuildAclStreams(JobControlRecord *jcr, acl_data_t *acl_data, FindFilesPacket *ff_pkt); 111 bacl_exit_code parse_acl_streams(JobControlRecord *jcr, acl_data_t *acl_data, 112 int stream, char *content, uint32_t content_length); 113 114 #endif 115