ObjFW  Check-in [c554cd71da]

Overview
Comment:ofhttp: Use OFSandbox's new unveiling
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c554cd71dab5a61a4620406ac987563176507f6e29258c6c5a48e4fed8e906a0
User & Date: js on 2018-11-04 20:46:15
Other Links: manifest | tags
Context
2018-11-10
10:01
OFHTTPServer: Add support for TLS check-in: f6d9264de0 user: js tags: trunk
2018-11-04
20:46
ofhttp: Use OFSandbox's new unveiling check-in: c554cd71da user: js tags: trunk
20:28
ofhash: Use OFSandbox's new unveiling check-in: 0fd8ab483c user: js tags: trunk
Changes

Modified utils/ofarc/OFArc.m from [b7dd938e02] to [5901ca9a12].

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	of_unichar_t option, mode = '\0';
	of_string_encoding_t encoding = OF_STRING_ENCODING_AUTODETECT;
	OFArray OF_GENERIC(OFString *) *remainingArguments, *files;
	id <Archive> archive;

#ifdef OF_HAVE_SANDBOX
	OFSandbox *sandbox = [OFSandbox sandbox];

	[sandbox setAllowsStdIO: true];
	[sandbox setAllowsReadingFiles: true];
	[sandbox setAllowsWritingFiles: true];
	[sandbox setAllowsCreatingFiles: true];
	[sandbox setAllowsChangingFileAttributes: true];
	[sandbox setAllowsUserDatabaseReading: true];
	/* Dropped after parsing options */







<







172
173
174
175
176
177
178

179
180
181
182
183
184
185
	of_unichar_t option, mode = '\0';
	of_string_encoding_t encoding = OF_STRING_ENCODING_AUTODETECT;
	OFArray OF_GENERIC(OFString *) *remainingArguments, *files;
	id <Archive> archive;

#ifdef OF_HAVE_SANDBOX
	OFSandbox *sandbox = [OFSandbox sandbox];

	[sandbox setAllowsStdIO: true];
	[sandbox setAllowsReadingFiles: true];
	[sandbox setAllowsWritingFiles: true];
	[sandbox setAllowsCreatingFiles: true];
	[sandbox setAllowsChangingFileAttributes: true];
	[sandbox setAllowsUserDatabaseReading: true];
	/* Dropped after parsing options */

Modified utils/ofhttp/OFHTTP.m from [43dea22caf] to [661d5ad21b].

22
23
24
25
26
27
28

29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
#import "OFData.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFHTTPClient.h"
#import "OFHTTPRequest.h"
#import "OFHTTPResponse.h"

#import "OFOptionsParser.h"

#import "OFStdIOStream.h"
#import "OFSystemInfo.h"
#import "OFTCPSocket.h"
#import "OFTLSSocket.h"
#import "OFURL.h"
#import "OFLocale.h"
#import "OFSandbox.h"

#import "OFConnectionFailedException.h"
#import "OFHTTPRequestFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFInvalidServerReplyException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfRangeException.h"







>

>





<
<







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
#import "OFData.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFHTTPClient.h"
#import "OFHTTPRequest.h"
#import "OFHTTPResponse.h"
#import "OFLocale.h"
#import "OFOptionsParser.h"
#import "OFSandbox.h"
#import "OFStdIOStream.h"
#import "OFSystemInfo.h"
#import "OFTCPSocket.h"
#import "OFTLSSocket.h"
#import "OFURL.h"



#import "OFConnectionFailedException.h"
#import "OFHTTPRequestFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFInvalidServerReplyException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfRangeException.h"
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391


392
393
394
395
396
397
398
399
400
401
402
403
		{ '\0', @"insecure", 0, &_insecure, NULL },
		{ '\0', nil, 0, NULL, NULL }
	};
	OFOptionsParser *optionsParser;
	of_unichar_t option;

#ifdef OF_HAVE_SANDBOX
	OFSandbox *sandbox = [[OFSandbox alloc] init];
	@try {
		[sandbox setAllowsStdIO: true];
		[sandbox setAllowsReadingFiles: true];
		[sandbox setAllowsWritingFiles: true];
		[sandbox setAllowsCreatingFiles: true];
		[sandbox setAllowsIPSockets: true];
		[sandbox setAllowsDNS: true];
		[sandbox setAllowsUserDatabaseReading: true];
		[sandbox setAllowsTTY: true];



		[OFApplication activateSandbox: sandbox];
	} @finally {
		[sandbox release];
	}
#endif

#ifndef OF_AMIGAOS
	[OFLocale addLanguageDirectory: @LANGUAGE_DIR];
#else
	[OFLocale addLanguageDirectory: @"PROGDIR:/share/ofhttp/lang"];
#endif







|
<
|
|
|
|
|
|
|
|
>
>

|
<
<
<







375
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390
391
392
393
394



395
396
397
398
399
400
401
		{ '\0', @"insecure", 0, &_insecure, NULL },
		{ '\0', nil, 0, NULL, NULL }
	};
	OFOptionsParser *optionsParser;
	of_unichar_t option;

#ifdef OF_HAVE_SANDBOX
	OFSandbox *sandbox = [OFSandbox sandbox];

	[sandbox setAllowsStdIO: true];
	[sandbox setAllowsReadingFiles: true];
	[sandbox setAllowsWritingFiles: true];
	[sandbox setAllowsCreatingFiles: true];
	[sandbox setAllowsIPSockets: true];
	[sandbox setAllowsDNS: true];
	[sandbox setAllowsUserDatabaseReading: true];
	[sandbox setAllowsTTY: true];
	/* Dropped after parsing options */
	[sandbox setAllowsUnveil: true];

	[OFApplication activateSandbox: sandbox];



#endif

#ifndef OF_AMIGAOS
	[OFLocale addLanguageDirectory: @LANGUAGE_DIR];
#else
	[OFLocale addLanguageDirectory: @"PROGDIR:/share/ofhttp/lang"];
#endif
469
470
471
472
473
474
475









476
477
478
479
480
481
482
				    @"opt", optStr)];
			}

			[OFApplication terminateWithStatus: 1];
			break;
		}
	}










	_outputPath = [outputPath copy];
	_URLs = [[optionsParser remainingArguments] retain];

	if ([_URLs count] < 1)
		help(of_stderr, false, 1);








>
>
>
>
>
>
>
>
>







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
				    @"opt", optStr)];
			}

			[OFApplication terminateWithStatus: 1];
			break;
		}
	}

#ifdef OF_HAVE_SANDBOX
	[sandbox unveilPath: (outputPath != nil
				 ? outputPath : OF_PATH_CURRENT_DIRECTORY)
		permissions: @"wc"];

	[sandbox setAllowsUnveil: false];
	[OFApplication activateSandbox: sandbox];
#endif

	_outputPath = [outputPath copy];
	_URLs = [[optionsParser remainingArguments] retain];

	if ([_URLs count] < 1)
		help(of_stderr, false, 1);