ObjFW
OFSandbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
22 @class OFArray OF_GENERIC(ObjectType);
23 @class OFMutableArray OF_GENERIC(ObjectType);
24 @class OFPair OF_GENERIC(FirstType, SecondType);
25 
31 
38 {
39  unsigned int _allowsStdIO: 1;
40  unsigned int _allowsReadingFiles: 1;
41  unsigned int _allowsWritingFiles: 1;
42  unsigned int _allowsCreatingFiles: 1;
43  unsigned int _allowsCreatingSpecialFiles: 1;
44  unsigned int _allowsTemporaryFiles: 1;
45  unsigned int _allowsIPSockets: 1;
46  unsigned int _allowsMulticastSockets: 1;
47  unsigned int _allowsChangingFileAttributes: 1;
48  unsigned int _allowsFileOwnerChanges: 1;
49  unsigned int _allowsFileLocks: 1;
50  unsigned int _allowsUNIXSockets: 1;
51  unsigned int _allowsDNS: 1;
52  unsigned int _allowsUserDatabaseReading: 1;
53  unsigned int _allowsFileDescriptorSending: 1;
54  unsigned int _allowsFileDescriptorReceiving: 1;
55  unsigned int _allowsTape: 1;
56  unsigned int _allowsTTY: 1;
57  unsigned int _allowsProcessOperations: 1;
58  unsigned int _allowsExec: 1;
59  unsigned int _allowsProtExec: 1;
60  unsigned int _allowsSetTime: 1;
61  unsigned int _allowsPS: 1;
62  unsigned int _allowsVMInfo: 1;
63  unsigned int _allowsChangingProcessRights: 1;
64  unsigned int _allowsPF: 1;
65  unsigned int _allowsAudio: 1;
66  unsigned int _allowsBPF: 1;
67  unsigned int _allowsUnveil: 1;
68  unsigned int _returnsErrors: 1;
69  OFMutableArray OF_GENERIC(of_sandbox_unveil_path_t) *_unveiledPaths;
70 @public
71  size_t _unveiledPathsIndex;
72  OF_RESERVE_IVARS(OFSandbox, 4)
73 }
74 
78 @property (nonatomic) bool allowsStdIO;
79 
83 @property (nonatomic) bool allowsReadingFiles;
84 
88 @property (nonatomic) bool allowsWritingFiles;
89 
93 @property (nonatomic) bool allowsCreatingFiles;
94 
98 @property (nonatomic) bool allowsCreatingSpecialFiles;
99 
103 @property (nonatomic) bool allowsTemporaryFiles;
104 
108 @property (nonatomic) bool allowsIPSockets;
109 
113 @property (nonatomic) bool allowsMulticastSockets;
114 
118 @property (nonatomic) bool allowsChangingFileAttributes;
119 
123 @property (nonatomic) bool allowsFileOwnerChanges;
124 
128 @property (nonatomic) bool allowsFileLocks;
129 
133 @property (nonatomic) bool allowsUNIXSockets;
134 
138 @property (nonatomic) bool allowsDNS;
139 
143 @property (nonatomic) bool allowsUserDatabaseReading;
144 
148 @property (nonatomic) bool allowsFileDescriptorSending;
149 
153 @property (nonatomic) bool allowsFileDescriptorReceiving;
154 
158 @property (nonatomic) bool allowsTape;
159 
163 @property (nonatomic) bool allowsTTY;
164 
168 @property (nonatomic) bool allowsProcessOperations;
169 
173 @property (nonatomic) bool allowsExec;
174 
178 @property (nonatomic) bool allowsProtExec;
179 
183 @property (nonatomic) bool allowsSetTime;
184 
188 @property (nonatomic) bool allowsPS;
189 
193 @property (nonatomic) bool allowsVMInfo;
194 
198 @property (nonatomic) bool allowsChangingProcessRights;
199 
203 @property (nonatomic) bool allowsPF;
204 
208 @property (nonatomic) bool allowsAudio;
209 
213 @property (nonatomic) bool allowsBPF;
214 
218 @property (nonatomic) bool allowsUnveil;
219 
223 @property (nonatomic) bool returnsErrors;
224 
225 #ifdef OF_HAVE_PLEDGE
231 @property (readonly, nonatomic) OFString *pledgeString;
232 #endif
233 
237 @property (readonly, nonatomic)
238  OFArray OF_GENERIC(of_sandbox_unveil_path_t) *unveiledPaths;
239 
243 + (instancetype)sandbox;
244 
263 - (void)unveilPath: (OFString *)path permissions: (OFString *)permissions;
264 @end
265 
266 OF_ASSUME_NONNULL_END
OFPair * of_sandbox_unveil_path_t
An OFPair for a path to unveil, with the first string being the path and the second the permissions.
Definition: OFSandbox.h:24
An abstract class for storing objects in an array.
Definition: OFArray.h:92
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:44
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A class for storing a pair of two objects.
Definition: OFPair.h:36
A class which describes a sandbox for the application.
Definition: OFSandbox.h:39
A class for handling strings.
Definition: OFString.h:132
A protocol for the creation of copies.
Definition: OFObject.h:1187