2 .\" Copyright (c) 2006 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 BLTOS 3TSOL "Jul 20, 2007"
8 bltos, bsltos, bcleartos \- translate binary labels to character coded labels
12 \fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
17 #include <tsol/label.h>
19 \fBint\fR \fBbsltos\fR(\fBconst m_label_t *\fR\fIlabel\fR, char **\fIstring\fR,
20 const int \fIstr_len\fR, const int \fIflags\fR);
25 \fBint\fR \fBbcleartos\fR(\fBconst m_label_t *\fR\fIlabel\fR, char **\fIstring\fR,
26 const int \fIstr_len\fR, const int \fIflags\fR);
32 These functions translate binary labels into strings controlled by the value of
33 the \fIflags\fR parameter.
36 The \fBbsltos()\fR function translates a binary sensitivity label into a
37 string. The applicable \fIflags\fR are \fBLONG_CLASSIFICATION\fR or
38 \fBSHORT_CLASSIFICATION\fR, \fBLONG_WORDS\fR or \fBSHORT_WORDS\fR,
39 \fBVIEW_EXTERNAL\fR or \fBVIEW_INTERNAL\fR, and \fBNO_CLASSIFICATION\fR. A
40 \fIflags\fR value \fB0\fR is equivalent to (\fBSHORT_CLASSIFICATION\fR |
44 The \fBbcleartos()\fR function translates a binary clearance into a string. The
45 applicable \fIflags\fR are \fBLONG_CLASSIFICATION\fR or
46 \fBSHORT_CLASSIFICATION\fR, \fBLONG_WORDS\fR or \fBSHORT_WORDS\fR,
47 \fBVIEW_EXTERNAL\fR or \fBVIEW_INTERNAL\fR, and \fBNO_CLASSIFICATION\fR. A
48 \fIflags\fR value 0 is equivalent to (\fBSHORT_CLASSIFICATION\fR |
49 \fBLONG_WORDS\fR). The translation of a clearance might not be the same as the
50 translation of a sensitivity label. These functions use different
51 \fBlabel_encodings\fR file tables that might contain different words and
55 The calling process must have \fBPRIV_SYS_TRANS_LABEL\fR in its set of
56 effective privileges to perform label translation on labels that dominate the
57 current process's sensitivity label.
60 The generic form of an output character-coded label is:
64 CLASSIFICATION WORD1 WORD2 WORD3/WORD4 SUFFIX PREFIX WORD5/WORD6
71 Capital letters are used to display all \fBCLASSIFICATION\fR names and
72 \fBWORD\fRs. The ` ' (space) character separates classifications and words from
73 other words in all character-coded labels except where multiple words that
74 require the same \fBPREFIX\fR or \fBSUFFIX\fR are present, in which case the
75 multiple words are separated from each other by the `\fB/\fR' (slash)
79 The \fIstring\fR argument can point to either a pointer to pre-allocated
80 memory, or the value \fB(char *)0\fR. If \fIstring\fR points to a pointer to
81 pre-allocated memory, then \fIstr_len\fR indicates the size of that memory. If
82 \fIstring\fR points to the value \fB(char\ *)0\fR, memory is allocated using
83 \fBmalloc()\fR to contain the translated character-coded labels. The translated
84 \fIlabel\fR is copied into allocated or pre-allocated memory.
87 The \fIflags\fR argument is \fB0\fR or the logical sum of the following:
91 \fB\fBLONG_WORDS\fR\fR
94 Translate using long names of words defined in \fIlabel\fR.
100 \fB\fBSHORT_WORDS\fR\fR
103 Translate using short names of words defined in \fIlabel\fR. If no short name
104 is defined in the \fBlabel_encodings\fR file for a word, the long name is used.
110 \fB\fBLONG_CLASSIFICATION\fR\fR
113 Translate using long name of classification defined in \fIlabel\fR.
119 \fB\fBSHORT_CLASSIFICATION\fR\fR
122 Translate using short name of classification defined in \fIlabel\fR.
128 \fB\fBACCESS_RELATED\fR\fR
131 Translate only \fBaccess-related\fR entries defined in information label
138 \fB\fBVIEW_EXTERNAL\fR\fR
141 Translate \fBADMIN_LOW\fR and \fBADMIN_HIGH\fR labels to the lowest and highest
142 labels defined in the \fBlabel_encodings\fR file.
148 \fB\fBVIEW_INTERNAL\fR\fR
151 Translate \fBADMIN_LOW\fR and \fBADMIN_HIGH\fR labels to the \fBadmin low\fR
152 \fBname\fR and \fBadmin high\fR \fBname\fR strings specified in the
153 \fBlabel_encodings\fR file. If no strings are specified, the strings
154 "\fBADMIN_LOW\fR" and "\fBADMIN_HIGH\fR" are used.
160 \fB\fBNO_CLASSIFICATION\fR\fR
163 Do not translate classification defined in \fIlabel\fR.
166 .SS "Process Attributes"
169 If the \fBVIEW_EXTERNAL\fR or \fBVIEW_INTERNAL\fR flags are not specified,
170 translation of \fBADMIN_LOW\fR and \fBADMIN_HIGH\fR labels is controlled by the
171 label view process attribute flags. If no label view process attribute flags
172 are defined, their translation is controlled by the label view configured in
173 the \fBlabel_encodings\fR file. A value of \fBExternal\fR specifies that
174 \fBADMIN_LOW\fR and \fBADMIN_HIGH\fR labels are mapped to the lowest and
175 highest labels defined in the \fBlabel_encodings\fR file. A value of
176 \fBInternal\fR specifies that the \fBADMIN_LOW\fR and \fBADMIN_HIGH\fR labels
177 are translated to the \fBadmin low\fR and \fBadmin high\fR name strings
178 specified in the \fBlabel_encodings\fR file. If no such names are specified,
179 the strings "\fBADMIN_LOW\fR" and "\fBADMIN_HIGH\fR" are used.
183 Upon successful completion, the \fBbsltos()\fR and \fBbcleartos()\fR functions
184 return the length of the character-coded label, including the \fINULL\fR
188 If the label is not of the valid defined required type, if the label is not
189 dominated by the process sensitivity label and the process does not have
190 \fBPRIV_SYS_TRANS_LABEL\fR in its set of effective privileges, or if the
191 \fBlabel_encodings\fR file is inaccessible, these functions return \(mi1.
194 If memory cannot be allocated for the return string or if the pre-allocated
195 return string memory is insufficient to hold the string, these functions return
196 0. The value of the pre-allocated string is set to the \fINULL\fR string
197 (\fB*string[0]='\00';\fR).
202 \fB\fB/etc/security/tsol/label_encodings\fR\fR
206 The label encodings file contains the classification names, words, constraints,
207 and values for the defined labels of this system.
213 See \fBattributes\fR(5) for descriptions of the following attributes:
221 ATTRIBUTE TYPE ATTRIBUTE VALUE
223 Interface Stability Obsolete
225 MT-Level MT-Safe with exceptions
230 The \fBbsltos()\fR and \fBbcleartos()\fR functions are Obsolete. Use the
231 \fBlabel_to_str\fR(3TSOL) function instead.
235 \fBfree\fR(3C), \fBlabel_to_str\fR(3TSOL), \fBlibtsol\fR(3LIB),
236 \fBmalloc\fR(3C), \fBlabel_encodings\fR(4), \fBattributes\fR(5)
240 The functionality described on this manual page is available only if the system
241 is configured with Trusted Extensions.
244 If memory is allocated by these functions, the caller must free the memory with
245 \fBfree\fR(3C) when the memory is no longer in use.