2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SETFLABEL 3TSOL "Jul 20, 2007"
8 setflabel \- move file to zone with corresponding sensitivity label
12 \fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
17 #include <tsol/label.h>
19 \fBint\fR \fBsetflabel\fR(\fBconst char *\fR\fIpath\fR, \fBconst m_label_t *\fR\fIlabel_p\fR);
25 The file that is named by \fIpath\fR is relabeled by moving it to a new
26 pathname relative to the root directory of the zone corresponding to
27 \fIlabel_p\fR. If the source and destination file systems are loopback mounted
28 from the same underlying file system, the file is renamed. Otherwise, the file
29 is copied and removed from the source directory.
32 The \fBsetflabel()\fR function enforces the following policy checks:
37 If the sensitivity label of \fIlabel_p\fR equals the existing sensitivity
38 label, then the file is not moved.
44 If the corresponding directory does not exist in the destination zone, or if
45 the directory exists, but has a different label than \fIlabel_p\fR, the file is
46 not moved. Also, if the file already exists in the destination directory, the
53 If the sensitivity label of the existing file is not equal to the calling
54 process label and the caller is not in the global zone, then the file is not
55 moved. If the caller is in the global zone, the existing file label must be in
56 a labeled zone (not \fBADMIN_LOW\fR or \fBADMIN_HIGH\fR).
62 If the calling process does not have write access to both the source and
63 destination directories, then the calling process must have
64 \fBPRIV_FILE_DAC_WRITE\fR in its set of effective privileges.
70 If the sensitivity label of \fIlabel_p\fR provides read only access to the
71 existing sensitivity label (an upgrade), then the user must have the
72 \fBsolaris.label.file.upgrade\fR authorization. In addition, if the current
73 zone is a labeled zone, then it must have been assigned the privilege
74 \fBPRIV_FILE_UPGRADE_SL\fR when the zone was configured.
80 If the sensitivity label of \fIlabel_p\fR does not provide access to the
81 existing sensitivity label (a downgrade), then the calling user must have the
82 \fBsolaris.label.file.downgrade\fR authorization. In addition, if the current
83 zone is a labeled zone, then it must have been assigned the privilege
84 \fBPRIV_FILE_DOWNGRADE_SL\fR when the zone was configured.
90 If the calling process is not in the global zone, and the user does not have
91 the \fBsolaris.label.range\fR authorization, then \fIlabel_p\fR must be within
92 the user's label range and within the system accreditation range.
98 If the existing file is in use (not tranquil) it is not moved. This tranquility
99 check does not cover race conditions nor remote file access.
103 Additional policy constraints can be implemented by customizing the shell
104 script \fB/etc/security/tsol/relabel\fR. See the comments in this file.
108 Upon successful completion, \fBsetflabel()\fR returns 0. Otherwise it returns
109 -1 and sets \fIerrno\fR to indicate the error.
113 The \fBsetflabel()\fR function fails and the file is unchanged if:
120 Search permission is denied for a component of the path prefix of \fIpath\fR.
122 The calling process does not have mandatory write access to the final component
123 of path because the sensitivity label of the final component of path does not
124 dominate the sensitivity label of the calling process and the calling process
125 does not have \fBPRIV_FILE_MAC_WRITE\fR in its set of effective privileges.
134 There is an open file descriptor reference to the final component of
141 \fB\fBECONNREFUSED\fR\fR
144 A connection to the label daemon could not be established.
153 A file with the same name exists in the destination directory.
162 Improper parameters were received by the label daemon.
171 The existing file is a directory.
180 Too many symbolic links were encountered in translating \fIpath\fR.
189 The existing file is hardlinked to another file.
195 \fB\fBENAMETOOLONG\fR\fR
198 The length of the path argument exceeds \fIPATH_MAX\fR.
207 The file referred to by \fIpath\fR does not exist.
216 The file system is read-only or its label is \fBADMIN_LOW\fR or
223 See \fBattributes\fR(5) for descriptions of the following attributes:
231 ATTRIBUTE TYPE ATTRIBUTE VALUE
233 Interface Stability Committed
241 \fBlibtsol\fR(3LIB), \fBattributes\fR(5)
244 \fISetting a File Sensitivity Label\fR in \fISolaris Trusted Extensions
245 Developer\&'s Guide\fR
249 The functionality described on this manual page is available only if the system
250 is configured with Trusted Extensions.