.\" Copyright (c) 2008-2017 Apple Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of Apple Computer nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" .Dd March 9, 2017 .Dt SANDBOX_INIT 3 .Os "Mac OS X" .Sh NAME .Nm sandbox_init , .Nm sandbox_free_error .Nd set process sandbox (DEPRECATED) .Sh SYNOPSIS .Fd #include .Ft int .Fo sandbox_init .Fa "const char *profile" .Fa "uint64_t flags" .Fa "char **errorbuf" .Fc .Ft void .Fo sandbox_free_error .Fa "char *errorbuf" .Fc .Sh DESCRIPTION The .Fn sandbox_init and .Fn sandbox_free_error functions are .Sy DEPRECATED . Developers who wish to sandbox an app should instead adopt the App Sandbox feature described in the App Sandbox Design Guide. .Pp The .Fn sandbox_init function places the current process into a .Xr sandbox 7 . The NUL-terminated string .Fa profile specifies the profile to be used to configure the sandbox. The .Fa flags specified are formed by .Em or Ns 'ing the following values: .Pp .Bl -tag -width SANDBOX_NAMED_EXTERNAL .It Dv SANDBOX_NAMED The .Fa profile argument specifies a sandbox profile named by one of the constants given in the .Sx AVAILABLE PROFILES section below. .El .Pp The out parameter .Fa *errorbuf will be set according to the error status. .Sh RETURN VALUES Upon successful completion of .Fn sandbox_init , a value of 0 is returned and .Fa *errorbuf is set to NULL. In the event of an error, a value of -1 is returned and .Fa *errorbuf is set to a pointer to a NUL-terminated string describing the error. This string may contain embedded newlines. This error information is suitable for developers and is not intended for end users. This pointer should be passed to .Xr sandbox_free_error 3 to release the allocated storage when it is no longer needed. .Sh AVAILABLE PROFILES The following are brief descriptions of each available profile. Keep in mind that .Xr sandbox 7 restrictions are typically enforced at resource acquisition time. .Bl -tag -width kSBXProfileNoWriteExceptTemporary .It Dv kSBXProfileNoInternet TCP/IP networking is prohibited. .Sy DEPRECATED . .It Dv kSBXProfileNoNetwork All sockets-based networking is prohibited. .Sy DEPRECATED . .It Dv kSBXProfileNoWrite File system writes are prohibited. .Sy DEPRECATED . .It Dv kSBXProfileNoWriteExceptTemporary File system writes are restricted to the temporary folder /var/tmp and the folder specified by the .Xr confstr 3 configuration variable _CS_DARWIN_USER_TEMP_DIR. .Sy DEPRECATED . .It Dv kSBXProfilePureComputation All operating system services are prohibited. .Sy DEPRECATED . .El .Sh SEE ALSO .Xr sandbox-exec 1 , .Xr sandbox 7 , .Xr sandboxd 8