AUTHOPEN(1) BSD General Commands Manual AUTHOPEN(1)
NAME
aauutthhooppeenn - open file with authorization
SYNOPSIS
aauutthhooppeenn [-ssttddoouuttppiippee] filename
aauutthhooppeenn [-ssttddoouuttppiippee] -ww [-aa] filename
aauutthhooppeenn [-ssttddoouuttppiippee] -cc [-xx -mm mode -ww] filename
aauutthhooppeenn [-ssttddoouuttppiippee] -oo flags filename
aauutthhooppeenn -hh
DESCRIPTION
aauutthhooppeenn provides authorization-based file opening services. In its sim-
plest form, aauutthhooppeenn verifies that it is allowed to open filename (using an appropriate sys.openfile.* authorization right) and then writes thefile to stdout. If -ww is specified, aauutthhooppeenn will read from stdin and
write to the file.aauutthhooppeenn is designed to be used both from the command line and program-
matically. The -ssttddoouuttppiippee flag allows a parent process to receive an
open file descriptor pointing to the file in question. Before opening filename, aauutthhooppeenn will make an authorization request for a right of the form: sys.openfile.[readonly|readwrite|readwritecreate]./fully/qualified/path.`.readonly' rights only allow for read-only file descriptors.
`.readwrite' rights allow for read/write file descriptors.`.readwritecreate' rights allow for read/write descriptors and the cre-
ation of new files. OOPPTTIIOONNSS-ssttddoouuttppiippee specifies that STDOUTFILENO has been dup2()'d onto a pipe
to a parent process and that an open file descriptor to filename (with the appropriate access mode) should be sent back across it using the SCMRIGHTS extension to sendmsg(2) rather than having the file itself written to or read from stdin / stdout.-ww instructs aauutthhooppeenn to open filename read/write and truncate it.
If -ssttddoouuttppiippee has not been specified, aauutthhooppeenn will then copy
stdin to filename until stdin is closed.-aa append to filename rather than truncating it (truncating is the
default).-cc create the file if it doesn't exist. -mm requires -cc.
-mm mode specify the mode bits if a file is created.
-oo flags numerically specify the flags that should be passed to open(2).
-xx require that the file being created not exist.
EEXXAAMMPPLLEESS To replace /etc/hostconfig (assuming sys.openfile.readwrite./etc/hostconfig or better can be obtained):$ cat tmpdata | authopen -w /etc/hostconfig
EERRRROORRSS aauutthhooppeenn will fail if an appropriate sys.openfile.readonly.*, sys.openfile.readwrite.*, or sys.openfile.readwritecreate.* right cannot be obtained or if the named path does not exist.BUGS
aauutthhooppeenn should should support prefix path authentication such that the right sys.openfile.*./dev/ could give access to all /dev entries andsys.openfile.*./dev/disk1 could give access to all disk1-related /dev
entries. aauutthhooppeenn should use getopt(3).SEE ALSO
open(2), realpath(3), recvmsg(2). HISTORY aauutthhooppeenn appeared in Mac OS X 10.1 to enable the manipulation of diskdevices at the /dev-entry level.
Darwin 28 March 2007 Darwin