adt_token.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * This file does not provide any user callable functions. See adt.c 2N/A/* 0x + Classification + Compartments + end of string */ 2N/A return (
"hex label failed");
2N/A#
else /* !C2_DEBUG */ 2N/A#
endif /* C2_DEBUG */ 2N/A * call adt_token_open() first and adt_token_close() last. 2N/A * au_open returns -1 if it cannot allocate an audit record descriptor, 2N/A * errno is either from calloc, if it cannot allocate the record descriptor 2N/A * table, or EMFILE if the table is of maximum size and has no available 2N/A * call generate_token for each token in the order you want the tokens 2N/A DPRINTF((
"p_entry=%p, p_data=%p, offset=%llu, msgFmt=%s\n",
2N/A * one function per token -- see the jump table at the end of file 2N/A * the command line is described with argc and argv and the environment 2N/A * with envp. The envp list is NULL terminated and has no separate 2N/A * counter; envp will be a NULL list unless the AUDIT_ARGE policy is 2N/A * special case of AUT_CMD with 1 argument that is 2N/A * a string showing the whole command and no envp 2N/A /* argc is hardcoded as 1 */ 2N/A * adt_to_tid -- generic address (ip is only one defined at present) 2N/A * terminal type: ADT_IPv4, ADT_IPv6... 2N/A * case: ADT_IPv4 or ADT_IPv6... 2N/A * case: not defined... 2N/A /* arg3 is for the array element, not the array size */ 2N/A * au_to_frmi takes a char * that is the fmri. 2N/A * au_to_label takes an m_label_t * that is the label. 2N/A * au_to_newgroups takes a length and an array of gids 2N/A * as input. The input to adt_to_newgroups is a length 2N/A * and a pointer to an array of gids. 2N/A n = 0;
/* in case negative n was passed */ 2N/A * dummy token id: AUT_PATHLIST 2N/A * -AUT_PRIV_L AUT_PRIV for a limit set 2N/A * -AUT_PRIV_I AUT_PRIV for an inherit set 2N/A if (*
pid == 0) {
/* getpinfo for this pid */ 2N/A * Generate subject information. 2N/A * If labels are present, generate the subject label token. 2N/A * If the group audit policy is set, generate the subject group token. 2N/A * The required flag does not apply here. 2N/A * Non-attributable records are indicated by an auid of AU_NOAUDITID; 2N/A * no subject token or group token is generated for a non-attributable 2N/A * Add optional tokens if in the process model. 2N/A * In a session model, the groups list is undefined and label 2N/A * The format string, normally null, is sort of a wrapper around 2N/A * the input. adt_write_text() is a wrapper around au_write that 2N/A * handles the format string 2N/A char *
cvt;
/* used by WRITE_TEXT */ 2N/A * Consider creating a separate token type for dates 2N/A * -- store as longs and format them in praudit. 2N/A * For now, a date is input as a time_t and output as 2N/A * a text token. If we do this, we need to consider 2N/A * carrying timezone info so that praudit can 2N/A * represent times in an unambiguous manner. 2N/A * The "input size" is overloaded to mean the list number 2N/A * and the msg_selector indexes the desired string in 2N/A * ADT_IN_PEER dummy token 2N/A /* The consumer is expected to provide a valid socket. */ 2N/A /* Try inet family first. */ 2N/A * Pathname returned by getsockname() may be relative. We need 2N/A * to make it absolute. 2N/A /* Record unresolved path if nothing else. */ 2N/A * ADT_IN_REMOTE dummy token 2N/A * Similar to ADT_IN_PEER except the input is 2N/A * an IP address type (ADT_IPv4 | ADT_IPv6) and an address V4/V6 2N/A /* required and not specified */ 2N/A * adt_to_iport takes a uint16_t IP port. 2N/A /* required and not specified */ 2N/A /* get the argument value */ 2N/A /* get the argument value */ 2N/A /* get the argument id */ 2N/A /* get the argument description */ 2N/A /* required and not specified */ 2N/A * This is a compact table that defines only the tokens that are 2N/A * actually generated in the adt.xml file. It can't be a pure 2N/A * indexed table because the adt.xml language defines internal extension 2N/A * tokens for some processing. VIZ. ADT_CMD_ALT, ADT_AUT_PRIV_* (see 2N/A * {AUT_ACL, adt_to_acl}, not used 2N/A * {AUT_ARBITRARY, adt_to_arbitrary}, AUT_ARBITRARY is undefined 2N/A * {AUT_XATOM, adt_to_atom}, not used 2N/A * {AUT_EXEC_ARGS, adt_to_exec_args}, not used 2N/A * {AUT_EXEC_ENV, adt_to_exec_env}, not used 2N/A * {AUT_EXIT, adt_to_exit}, obsolete 2N/A * {AUT_FILE, adt_to_file}, AUT_FILE is undefined 2N/A * {AUT_XCOLORMAP, adt_to_colormap}, not used 2N/A * {AUT_XCURSOR, adt_to_cursor}, not used 2N/A * {AUT_XFONT, adt_to_font}, not used 2N/A * {AUT_XGC, adt_to_gc}, not used 2N/A * {AUT_GROUPS, adt_to_groups}, obsolete 2N/A * {AUT_HEADER, adt_to_header}, generated by au_close 2N/A * {AUT_IP, adt_to_ip}, not used 2N/A * {AUT_IPC, adt_to_ipc}, not used 2N/A * {AUT_IPC_PERM, adt_to_ipc_perm}, not used 2N/A * {AUT_OPAQUE, adt_to_opaque}, not used 2N/A * {AUT_XPIXMAP, adt_to_pixmap}, not used 2N/A * {AUT_XPROPERTY, adt_to_property}, not used 2N/A * {AUT_SEQ, adt_to_seq}, not used 2N/A * {AUT_SOCKET, adt_to_socket}, not used 2N/A * {AUT_SOCKET_INET, adt_to_socket_inet}, AUT_SOCKET_INET is undefined 2N/A * {AUT_TRAILER, adt_to_trailer}, generated by au_close 2N/A/* find function to generate token */ 2N/A * adjustAddress -- given the address of data, its size, and the type of 2N/A * the next data field, calculate the offset to the next piece of data. 2N/A * Depending on the caller, "current" and "next" mean the current pointer 2N/A * and the next pointer or the last pointer and the current pointer.