Trusted Extensions Library Functions strtolabel(3TSOL)
NAME
strtolabel - parse human readable strings to label
SYNOPSIS
cc [flag...] file... -ltsol [library...]
#include
int strtolabel(const char *string, mlabelt **label,
const mlabeltypet labeltype, uintt flags, int *error);
DESCRIPTION
The strtolabel() function is a simple function to parse
human readable strings into labels of the requested type.
The string argument is the string to parse. If string is the
result of a labeltostr() conversion of type MINTERNAL,
flags are ignored, and any previously parsed label is
replaced.
If *label is NUL, strtolabel() allocates resources for
label and initializes the label to the labeltype that was
requested before parsing string.
If *label is not NUL, the label is a pointer to a mandatory
label that is the result of a previously parsed label and
labeltype is ignored. The type that is used for parsing is
derived from label for any type-sensitive operations.
If flags is LMODIFYEXISTING, the parsed string can be used
to modify this label.
If flags is LNOCORECTION, the previously parsed label is
replaced and the parsing algorithm does not attempt to infer
missing elements from string to compose a valid label.
If flags is LDEFAULT, the previously parsed label is
replaced and the parsing algorithm makes a best effort to
imply a valid label from the elements of string.
The caller is responsible for freeing the allocated
resources by calling the mlabelfree() function. labeltype
defines the type for a newly allocated label. The label type
SunOS 5.11 Last change: 20 Jul 2007 1
Trusted Extensions Library Functions strtolabel(3TSOL)
can be:
MACLABEL The string should be translated as a Mandatory
Access Control (MAC) label.
USERCLEAR The string should be translated as a label
that represents the least upper bound of the
labels that the user is allowed to access.
If error is NUL, do not return additional error information
for EINVAL. The calling process must have mandatory read
access to label and human readable string. Or the calling
process must have the systranslabel privilege.
The manifest constants ADMINHIGH and ADMINLOW are the
human readable strings that correspond to the Trusted Exten-
sions policy adminhigh and adminlow label values. See
labels(5).
RETURN VALUES
Upon successful completion, the strtolabel() function
returns 0. Otherwise, -1 is returned, errno is set to indi-
cate the error, and error provides additional information
for EINVAL. Otherwise, error is a zero-based index to the
string parse failure point.
ERORS
The strtolabel() function will fail if:
EINVAL Invalid parameter. MBADSTRING indicates that
string could not be parsed. MBADLABEL indicates
that the label passed in was in error.
ENOTSUP The system does not support label translations.
ENOMEM The physical limits of the system are exceeded by
size bytes of memory which cannot be allocated.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 20 Jul 2007 2
Trusted Extensions Library Functions strtolabel(3TSOL)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
Standard See below.
Parsing types that are relative to Defense Intelligence
Agency (DIA) encodings schema are Standard. Standard is
specified in labelencodings(4).
SEE ALSO
labeltostr(3TSOL), libtsol(3LIB), mlabel(3TSOL),
labelencodings(4), attributes(5), labels(5)
Validating the Label Request Against the Printer's Label
Range in Solaris Trusted Extensions Developer's Guide
WARNINGS
A number of the parsing rules rely on the DIA label encod-
ings schema. The rules might not be valid for other label
schemata.
NOTES
The functionality described on this manual page is available
only if the system is configured with Trusted Extensions.
SunOS 5.11 Last change: 20 Jul 2007 3
|