Bug 172279 - [openbsm] [patch] OpenBSM-21/openbsm/libbsm/bsm_token.c au_to_process32_ex documentation is incorrect
Summary: [openbsm] [patch] OpenBSM-21/openbsm/libbsm/bsm_token.c au_to_process32_ex do...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 1.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-02 18:10 UTC by Daniel U. Thibault
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel U. Thibault 2012-10-02 18:10:14 UTC
The au_to_process32_ex function of bsm_token.c (a component of the current libbsm implementation) reads in part:

/*
[...]
 *   machine address      16 bytes
 */
token_t *
au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid)
{
[...]
	if (tid->at_type == AU_IPv4)
		GET_TOKEN_AREA(t, dptr, sizeof(u_char) +
		    10 * sizeof(u_int32_t));
	else if (tid->at_type == AU_IPv6)
		GET_TOKEN_AREA(t, dptr, sizeof(u_char) +
		    13 * sizeof(u_int32_t));
[...]
	if (tid->at_type == AU_IPv6) {
		ADD_MEM(dptr, &tid->at_addr[1], sizeof(u_int32_t));
		ADD_MEM(dptr, &tid->at_addr[2], sizeof(u_int32_t));
		ADD_MEM(dptr, &tid->at_addr[3], sizeof(u_int32_t));
	}

   Clearly the token's size is variable, unlike what the preamble says.

Fix: 

Change the au_to_process32_ex preamble to conclude with:

 *   machine address       4 bytes/16 bytes (depending on address type-len)
 */
How-To-Repeat: Look up http://www.opensource.apple.com/source/OpenBSM/OpenBSM-21/openbsm/libbsm/bsm_token.c and search for au_to_process32_ex.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:00 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped