LABTOA(3)

NAME
labtoa, atolab, atopriv, privtoa - security label conversion

SYNOPSIS
#include <sys/label.h>

char *labtoa(labp) struct label *labp;
struct label *atolab(string) char *string;

atopriv(string) char *string;

char *privtoa(n)

DESCRIPTION
Labtoa returns a pointer to a null-terminated ASCII string that represents the value of the security label pointed to by labp. The string has a form exemplified by

    guxnlp guxnlpFY 0000 0000 ...

The characters of the first group denote capabilities T_LOG, T_UAREA, T_EXTERN, T_NOCHK, T_SETLIC, and T_SETPRIV respectively. Characters of the second group denote corresponding licenses; see getplab(2). Missing capabilities or licenses are denoted by

The character shown as denotes the fixity of the label. It may be a space (loose), (frozen), (rigid), or (constant) The character shown as denotes the label's flag. It may be a space for a lattice label, for L_NO, for L_YES, or for the erroneous flag value 0.

Each group of four zeros may be any four lower case hex digits representing the value of two bytes of the lattice value. Repeating groups at the end of the string are denoted

Atolab inverts the process. The order of characters in, and length of, privilege strings are arbitrary, except that a nonempty license string must be preceded by a nonempty capability string. The order of characters from the set YNUFRC is arbitrary. Spaces must separate nonempty capability and license strings, and may be interspersed arbitrarily after the license string. A final ... causes the last four hex digits to be repeated, provided the preceding label contains a multiple of four digits. A short or missing lattice value is padded with zeros.

Atopriv converts a string of characters from the set into privilege bits that may be stored in the lb_t or lb_u fields of a label structure. The order and number of characters are arbitrary.

Privtoa is inverse to atopriv.

SEE ALSO
getflab(2), getplab(2), getlab(1)

DIAGNOSTICS
Atolab returns 0 for unrecognizable input.

Atopriv returns the negative value ~(T_LOG|T_UAREA|T_EXTERN|T_NOCHK|T_SETLIC|T_SETPRIV) for unrecognizable input.

BUGS
The value returned by labtoa, atolab, or privtoa points to a static buffer that is overwritten at each call.