Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mac_text(3) [freebsd man page]

MAC_TEXT(3)						   BSD Library Functions Manual 					       MAC_TEXT(3)

mac_from_text, mac_to_text -- convert MAC label to/from text representation LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/mac.h> int mac_from_text(mac_t *mac, const char *text); int mac_to_text(mac_t label, char **text); DESCRIPTION
The mac_from_text() function converts the text representation of a label into the internal policy label format (mac_t) and places it in *mac, which must later be freed with free(3). The mac_to_text() function allocates storage for *text, which will be set to the text representation of label. Refer to maclabel(7) for the MAC label format. RETURN VALUES
The mac_from_text() and mac_to_text() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. COMPATIBILITY
POSIX.1e does not define a format for text representations of MAC labels. POSIX.1e requires that text strings allocated using mac_to_text() be freed using mac_free(3); in the FreeBSD implementation, they must be freed using free(3), as mac_free(3) is used only to free memory used for type mac_t. ERRORS
[ENOMEM] Insufficient memory was available to allocate internal storage. SEE ALSO
free(3), mac(3), mac_get(3), mac_is_present(3), mac_prepare(3), mac_set(3), posix1e(3), mac(4), maclabel(7) STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion of the draft continues on the cross-platform POSIX.1e implementation mailing list. To join this list, see the FreeBSD POSIX.1e implementation page for more information. HISTORY
Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project. BSD
December 21, 2001 BSD

Check Out this Related Man Page

MAC(3)							   BSD Library Functions Manual 						    MAC(3)

mac -- introduction to the MAC security API LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/mac.h> In the kernel configuration file: options MAC DESCRIPTION
Mandatory Access Control labels describe confidentiality, integrity, and other security attributes of operating system objects, overriding discretionary access control. Not all system objects support MAC labeling, and MAC policies must be explicitly enabled by the administrator. This API, based on POSIX.1e, includes routines to retrieve, manipulate, set, and convert to and from text the MAC labels on files and pro- cesses. MAC labels consist of a set of (name, value) tuples, representing security attributes from MAC policies. For example, this label contains security labels defined by two policies, mac_biba(4) and mac_mls(4): biba/low,mls/low Further syntax and semantics of MAC labels may be found in maclabel(7). Applications operate on labels stored in mac_t, but can convert between this internal format and a text format for the purposes of presenta- tion to uses or external storage. When querying a label on an object, a mac_t must first be prepared using the interfaces described in mac_prepare(3), allowing the application to declare which policies it wishes to interrogate. The application writer can also rely on default label names declared in mac.conf(5). When finished with a mac_t, the application must call mac_free(3) to release its storage. The following functions are defined: mac_is_present() This function, described in mac_is_present(3), allows applications to test whether MAC is configured, as well as whether specific policies are configured. mac_get_fd(), mac_get_file(), mac_get_link(), mac_get_peer() These functions, described in mac_get(3), retrieve the MAC labels associated with file descriptors, files, and socket peers. mac_get_pid(), mac_get_proc() These functions, described in mac_get(3), retrieve the MAC labels associated with processes. mac_set_fd(), mac_set_file(), mac_set_link() These functions, described in mac_set(3), set the MAC labels associated with file descriptors and files. mac_set_proc() This function, described in mac_set(3), sets the MAC label associated with the current process. mac_free() This function, described in mac_free(3), frees working MAC label storage. mac_from_text() This function, described in mac_text(3), converts a text-form MAC label into working MAC label storage, mac_t. mac_prepare(), mac_prepare_file_label(), mac_prepare_ifnet_label(), mac_prepare_process_label(), mac_prepare_type() These functions, described in mac_prepare(3), allocate working storage for MAC label operations. mac_prepare(3) prepares a label based on caller-specified label names; the other calls rely on the default configuration specified in mac.conf(5). mac_to_text() This function is described in mac_text(3), and may be used to convert a mac_t into a text-form MAC label. FILES
/etc/mac.conf MAC library configuration file, documented in mac.conf(5). Provides default behavior for applications aware of MAC labels on system objects, but without policy-specific knowledge. SEE ALSO
mac_free(3), mac_get(3), mac_is_present(3), mac_prepare(3), mac_set(3), mac_text(3), posix1e(3), mac(4), mac.conf(5), mac(9) STANDARDS
These APIs are loosely based on the APIs described in POSIX.1e, as described in IEEE POSIX.1e draft 17. However, the resemblance of these APIs to the POSIX APIs is loose, as the POSIX APIs were unable to express some notions required for flexible and extensible access control. HISTORY
Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project. BUGS
The TrustedBSD MAC Framework and associated policies, interfaces, and applications are considered to be an experimental feature in FreeBSD. Sites considering production deployment should keep the experimental status of these services in mind during any deployment process. See also mac(9) for related considerations regarding the kernel framework. BSD
August 7, 2009 BSD
Man Page