1str_to_label(3TSOL)  Trusted Extensions Library Functions  str_to_label(3TSOL)
2
3
4

NAME

6       str_to_label - parse human readable strings to label
7

SYNOPSIS

9       cc [flag...] file... -ltsol [library...]
10
11
12       #include <tsol/label.h>
13
14       int str_to_label(const char *string, m_label_t **label,
15           const m_label_type_t label_type, uint_t flags, int *error);
16
17

DESCRIPTION

19       The  str_to_label()  function is a simple function to parse human read‐
20       able strings into labels of the requested type.
21
22
23       The string argument is the string to parse. If string is the result  of
24       a  label_to_str() conversion of type M_INTERNAL, flags are ignored, and
25       any previously parsed label is replaced.
26
27
28       If *label is NULL, str_to_label() allocates  resources  for  label  and
29       initializes the label to the label_type that was requested before pars‐
30       ing string.
31
32
33       If *label is not NULL, the label is a pointer to a mandatory label that
34       is  the  result of a previously parsed label and label_type is ignored.
35       The type that is used for parsing is derived from label for  any  type-
36       sensitive operations.
37
38
39       If  flags is L_MODIFY_EXISTING, the parsed string can be used to modify
40       this label.
41
42
43       If flags is L_NO_CORRECTION, the previously parsed  label  is  replaced
44       and  the  parsing  algorithm does not attempt to infer missing elements
45       from string to compose a valid label.
46
47
48       If flags is L_DEFAULT, the previously parsed label is replaced and  the
49       parsing  algorithm  makes a best effort to imply a valid label from the
50       elements of string.
51
52
53       If flags contains L_CHECK_AR logically OR-ed with  another  value,  the
54       resulting  label  will  be  checked  to  ensure  that  it is within the
55       "Accreditation Range" of the DIA encodings schema. This flag is  inter‐
56       preted only for MAC_LABEL label types.
57
58
59       The  caller is responsible for freeing the allocated resources by call‐
60       ing the m_label_free() function. label_type  defines  the  type  for  a
61       newly allocated label. The label type can be:
62
63       MAC_LABEL     The  string  should  be  translated as a Mandatory Access
64                     Control (MAC) label.
65
66
67       USER_CLEAR    The string should be translated as a  label  that  repre‐
68                     sents  the  least upper bound of the labels that the user
69                     is allowed to access.
70
71
72
73       If error is NULL, do not return additional error information  for  EIN‐
74       VAL.  The  calling process must have mandatory read access to label and
75       human  readable  string.  Or  the  calling  process   must   have   the
76       sys_trans_label privilege.
77
78
79       The  manifest constants ADMIN_HIGH and ADMIN_LOW are the human readable
80       strings that correspond to the Trusted Extensions policy admin_high and
81       admin_low label values. See labels(5).
82

RETURN VALUES

84       Upon successful completion, the str_to_label() function returns 0. Oth‐
85       erwise, -1 is returned, errno is set to indicate the error,  and  error
86       provides additional information for EINVAL. Otherwise, error is a zero-
87       based index to the string parse failure point.
88

ERRORS

90       The str_to_label() function will fail if:
91
92       EINVAL     Invalid parameter. M_BAD_STRING indicates that string  could
93                  not  be  parsed. M_BAD_LABEL indicates that the label passed
94                  in was in error. M_OUTSIDE_AR indicates that  the  resulting
95                  label  is  not within the "Accreditation Range" specified in
96                  the DIA encodings schema.
97
98
99       ENOTSUP    The system does not support label translations.
100
101
102       ENOMEM     The physical limits of the system are exceeded by size bytes
103                  of memory which cannot be allocated.
104
105

ATTRIBUTES

107       See attributes(5) for descriptions of the following attributes:
108
109
110
111
112       ┌─────────────────────────────┬─────────────────────────────┐
113       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
114       ├─────────────────────────────┼─────────────────────────────┤
115       │Interface Stability          │Committed                    │
116       ├─────────────────────────────┼─────────────────────────────┤
117       │MT-Level                     │MT-Safe                      │
118       ├─────────────────────────────┼─────────────────────────────┤
119       │Standard                     │See below.                   │
120       └─────────────────────────────┴─────────────────────────────┘
121
122
123       Parsing  types  that  are relative to Defense Intelligence Agency (DIA)
124       encodings schema are Standard. Standard is  specified  in  label_encod‐
125       ings(4).
126

SEE ALSO

128       label_to_str(3TSOL), libtsol(3LIB), m_label(3TSOL), label_encodings(4),
129       attributes(5), labels(5)
130
131
132       Validating the Label Request  Against  the  Printer's  Label  Range  in
133       Solaris Trusted Extensions Developer's Guide
134

WARNINGS

136       A  number  of the parsing rules rely on the DIA label encodings schema.
137       The rules might not be valid for other label schemata.
138

NOTES

140       The functionality described on this manual page is  available  only  if
141       the system is configured with Trusted Extensions.
142
143
144
145SunOS 5.11                        15 Jun 2009              str_to_label(3TSOL)
Impressum