MAN page for: t6export_attr(3n)
Table of Contents

WARNING - This is a TSIG draft specification, currently under review.

Name

t6export_attr, t6import_attr - TSIX(re) 1.1 interfaces for sending and receiving in-message security attributes

Synopsis

#include

t6attr_ext_buffer_t *t6export_attr (
t6attr_mask_t mask, t6attr_t *attr, long *buflen)

t6attr_t *t6import_attr (
t6attr_ext_buffer_t *buf, long buflen, t6attr_mask_t *mask)

Description

These functions allow communicating applications to pass attributes in a

system-independent format. They provide what is called in-message attribute passing, where the attributes are passed in an application defined message protocol along with the data to which they apply. It is distinct from and may be used in addition to the on-message attribute passing provided by the

TSIX(re) 1.1 Security Attribute Modulation Protocol ( samp(7) ).

The t6export_attr function encodes the supplied attr list in the system

independent format and returns a buffer containing the encoded attributes.

The buffer is dynamically allocated and may be freed using free(3n) . The

total length of the encoded attribute buffer is returned in buflen. Only those attributes whose corresponding bit is set in mask and whose value has been set by a prior call to t6set_attr(3n) are converted.

The t6import_attr function takes as input a buffer containing attributes

encoded in the system independent format and converts them to local internal representation. The buflen specifies the actual length of the buffer and must be consistent with the total length field in the encoded attribute header. The converted attributes are returned in a dynamically allocated t6attr_t structure which may be freed using t6free_attr(3n) . The attributes which were converted are identified in the mask output parameter.

System Independent Encoded Format

The System Independent Encoded Format consists of a header and a variable

number of attribute specifications, as illustrated below. The illustration describes the contents of the t6attr_ext_buffer_t returned by t6export_attr and expected as input to t6import_attr . All fields are in network byte order with no padding for alignment.

_______________________________________________
|
Octets |_______________________________________________ | 1 | 2 | 3 | 4 | 5 | 6 |_______|_______|_______|_______|_______|_______
|
Total Length | Version |_______|_______|_______|_______|_______|_______|<--Header

_______________________________________________
| Id |Format | DOT Length |Encoded Length |<--Attribute |_______|_______|_______|_______|_______|_______| #1 | DOT Name (variable length) | |_______|_______|_______|_______|_______|_______ | Encoded Attribute (variable length) | |_______|_______|_______|_______|_______|_______

_______________________________________________
| Id |Format | DOT Length |Encoded Length |<--Attribute |_______|_______|_______|_______|_______|_______| #2 | DOT Name (variable length) | |_______|_______|_______|_______|_______|_______ | Encoded Attribute (variable length) | |_______|_______|_______|_______|_______|_______

The total length field in the header gives the size of the encoded attri

bute buffer and includes the length of the header itself. The version identifies the version of the attribute buffer and currently must be assigned the TSIX(re) 1.1 value 0x0101 .

Each attribute is represented by a variable length attribute specification.

The id is a t6attr_id_t identifying the attribute type as follows:

0 - T6EXT_SEN_LABEL

1 - T6EXT_CLEARANCE

2 - T6EXT_INFO_LABEL

3 - T6EXT_PRIVILEGES

4 - T6EXT_AUDIT_ID

5 - T6EXT_UID

6 - T6EXT_GID

7 - T6EXT_GROUPS

8 - T6EXT_NAT_CAVEATS

9 - T6EXT_INTEG_LABEL

10 - T6EXT_ACL

The format field specifies the attribute system independent format as a

t6attr_format_t and may have one of the following values:

1 - BINARY_FORMAT
This value indicates that the attribute is in binary encoded system independent format. The encoding for each attribute type is described below.

2 - ASCII_FORMAT
This value indicates that the attribute is in ASCII encoded system independent format. The encoding for each attribute type is described below.

3 - VENDOR_IR_FORMAT
This value indicates that the attribute is in vendor-specific internal representation format. The encoding is entirely vendor defined and results are unpredictable if used between different vendor systems. Support for this encoding is optional.

4 - TOKEN_FORMAT
This value indicates that the attribute encoding is in the form of a 32-bit token. Support for this format is optional and implies that both hosts support the TSIX(re) 1.1 Security Token Mapping Protocol ( satmp(7) ).

The DOT Name gives the domain of translation for this attribute as a

null-terminated ASCII string. The DOT Length gives the length of the DOT name in octets, including the terminating null. The DOT length may be zero, in which case the DOT name shall not be present. The DOT length may also be 1 with the DOT name consisting of a single null octet. Both of these shall be considered valid and ordinary special cases, indicating that no DOT translation is needed. The DOT name is only meaningful for

BINARY_FORMAT and ASCII_FORMAT .

The DOT for an attribute is set by t6set_attr_domain(3n) . and determines

how the attribute in question is interpreted by the sender and the receiver. If a DOT has been established for an attribute, the domain name will be included along with the encoded representation of the attribute.

Depending upon the DOT, either sender or receiver (or both) may perform a

mapping between the host internal representation of the attribute and the system-independent encoded format. For more details on domains of translation please refer to the TSIX(re) 1.1 Security Attribute Token Mapping Protocol ( satmp(7) ).

The Encoded Attribute holds the system independent encoding of the attri

butes. The Encoded Length gives the length of the encoded attribute in octets. If the length is zero, the encoded attribute shall not be present and shall be considered to have a T6NULL_ATTR_REP value. This is a valid but not ordinary special case and the interpretation is application dependent.

ASCII Encoded Format

All ASCII encoded attributes are null (0) terminated strings, with the fol

lowings specific formats for each attribute type:

T6EXT_SEN_LABEL, T6EXT_CLEARANCE

A set of words separated by spaces. The first word(s) must be the classification. Any remaining words are elements of the compartment set. The various words can be parsed using standard sensitivity label encoding rules.

T6EXT_INFO_LABEL
A set of words separated by spaces. The first word(s) specifies the classification. Remaining words consist of elements of the compartment set and elements of the marking set. The various words can be parsed using the DIA's standard encoding rules.

T6EXT_PRIVILEGES
A set of privilege names separated by spaces or commas.

T6EXT_AUDIT_ID, T6EXT_UID, T6EXT_GID
A user or group name.

T6EXT_GROUPS
A u_short , specifying the number of supplementary groups, followed by that number of ASCII group names. Each group name is a null (0) terminated string. If a system does not support supplementary groups, the number of groups shall be zero(0) with no following group names.

T6EXT_INTEG_LABEL
Currently undefined.

T6EXT_NAT_CAVEAT
A set of country names separated by spaces or commas.

T6EXT_ACL
An ACL entry consists of a u_int32, specifying the number of entries in the ACL, followed by a list of ACL entries. Each ACL entry consists of an ACL header followed by zero or more null-terminated ASCII strings. The ASCII format ACL header is described as shown below:

typedef struct {
u_char acl_type;
u_char acl_class;
char acl_perm[];
} t6attr_acl_ascii;

The defined values for acl_type are:

0 ACL_MODEMASK
No following string
1 ACL_USER_OBJ
One following string specifying the owning user name
2 ACL_GROUP_OBJ
One following string specifying the owning group name
3 ACL_OTHER_OBJ
No following string
4 ACL_USER
One following string specifying a user name
5 ACL_GROUP
One following string specifying a group name
6 ACL_USER_GROUP
Two following strings specifying a user name and a group name
7-127
Reserved for future use

The defined values for acl_class are:

0 ACL_CL_ACCESS
The entry is part of an access ACL
1 ACL_CL_DEFAULT
The entry is part of a default ACL
2-127
Reserved for future use

The value of acl_perm is a null-terminated string specifying the permissions associated with the ACL entry (for ACL types 1-6) or a mode mask (for ACL type 0). The format, definition, and interpretation of acl_perm is dependent upon the ACL policy implied by the DOT. Any requirement for ACL entry ordering, required ACL entries, or ACL entry uniqueness is dependent upon the ACL policy implied by the DOT.

BINARY Encoded Format

All binary encoded attribute are specified as shown below. All attribute

bit masks are padded to a 32-bit longword boundary and are in network byte order. Bit 0 is the MSB of the first longword, bit 32 is the MSB of the second longword, and so forth.

T6EXT_SEN_LABEL, T6EXT_CLEARANCE

A u_int32 classification followed by a u_int32 compartment set bit mask size, specifying the number of octets in the compartment set bit mask. If the compartment set bit mask size is non-zero, it is followed by the compartment set bit mask octets.

T6EXT_INFO_LABEL
A u_int32 classification followed by a u_int32 compartment set bit mask size, specifying the number of octets in the compartment set bit mask. If the compartment set bit mask size is non-zero, it is followed by the compartment set bit mask octets. This is followed by a u_int32 markings bit mask size, specifying the number of octets in the markings bit mask. If the markings bit mask size is non-zero, it is followed by the markings bit mask octets.

T6EXT_PRIVILEGES
The privilege set is a bitmask rounded to a u_int32 boundary.

T6EXT_AUDIT_ID, T6EXT_UID, T6EXT_GID
A user id or a group id is a single u_int32 .

T6EXT_GROUPS
A u_int32 , specifying the number of supplementary groups, followed by that number of u_int32 group identifiers. If a system does not support supplementary groups, the number of groups shall be zero(0) with no following group identifiers.

T6EXT_INTEG_LABEL
Currently undefined.

T6EXT_NAT_CAVEAT
A caveat set is a bit mask rounded to a u_int32 boundary.

T6EXT_ACL
An ACL entry consists of a u_int32, specifying the number of entries in the ACL, followed by a list of ACL entries. Each ACL entry consists of an ACL header followed by zero or more u_int32 values. The binary format ACL header is described as shown below:

typedef struct {
u_char acl_type;
u_char acl_class;
ushort acl_perm;
} t6attr_acl_binary;

The defined values for acl_type are:

0 ACL_MODEMASK
No following u_int32
1 ACL_USER_OBJ
One following u_int32 specifying the owning user id
2 ACL_GROUP_OBJ
One following u_int32 specifying the owning group id
3 ACL_OTHER_OBJ
No following u_int32
4 ACL_USER
One following u_int32 specifying a user id
5 ACL_GROUP
One following u_int32 specifying a group id
6 ACL_USER_GROUP
Two following strings specifying a user id and a group id
7-127
Reserved for future use

The defined values for acl_class are:

0 ACL_CL_ACCESS
The entry is part of an access ACL
1 ACL_CL_DEFAULT
The entry is part of a default ACL
2-127
Reserved for future use

The value of acl_perm is a bit pattern specifying the permissions associated with the ACL entry (for ACL types 1-6) or a mode mask (for ACL type 0). The format, definition, and interpretation of acl_perm is dependent upon the ACL policy implied by the DOT. Any requirement for ACL entry ordering, required ACL entries, or ACL entry uniqueness is dependent upon the ACL policy implied by the DOT.

Return Value

Both t6export_attr and t6import_attr return addresses of dynamically allo

cated memory on success. They return a NULL address on any error. The memory returned by t6export_attr may be releases using free(3) . The memory returned by t6export_attr is an opaque attribute block and should be released using t6free_attr(3n) .

Notes

1. Programs using these routines must be compiled with -lt6 .

2. It is recommended that DOT naming conventions follow those described in satmp(7)

See Also

libt6(3n) , t6set_attr_domain(3n), t6set_attr(3n), tsix(7), satmp(7)


Table of Contents