xref: /illumos-gate/usr/src/cmd/praudit/toktable.h (revision b5c366f4)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22047f6e6fSgww  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
24*b5c366f4SMatt Barden  *
25*b5c366f4SMatt Barden  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_TOKTABLE_H
297c478bd9Sstevel@tonic-gate #define	_TOKTABLE_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Solaris Audit Token Table.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate typedef struct token_desc {
407c478bd9Sstevel@tonic-gate 	char	*t_name;	/* name of the token */
417c478bd9Sstevel@tonic-gate 	char	*t_tagname;	/* tag name */
427c478bd9Sstevel@tonic-gate 	int	(*func)();	/* token processing function */
437c478bd9Sstevel@tonic-gate 	short	t_type;		/* token or tag type */
447c478bd9Sstevel@tonic-gate } token_desc_t;
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define	NOFUNC		(int (*)())0
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #define	MAXTOKEN	0xff
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate extern token_desc_t tokentable[];
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Tag types -
557c478bd9Sstevel@tonic-gate  *
567c478bd9Sstevel@tonic-gate  *	attribute:	an attribute:
577c478bd9Sstevel@tonic-gate  *			xxx="..."
587c478bd9Sstevel@tonic-gate  *
597c478bd9Sstevel@tonic-gate  *	element:	a simple element:
607c478bd9Sstevel@tonic-gate  *			<xxx> ... </xxx>
617c478bd9Sstevel@tonic-gate  *
627c478bd9Sstevel@tonic-gate  *	enclosed:	a self contained element, optionally with attributes:
637c478bd9Sstevel@tonic-gate  *			<xxx a="" b="" ... />
647c478bd9Sstevel@tonic-gate  *
657c478bd9Sstevel@tonic-gate  *	extended:	an element with attributes:
667c478bd9Sstevel@tonic-gate  *			<xxx a="" b="" ...> ... </xxx>
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate #define	T_ATTRIBUTE	1	/* attribute */
697c478bd9Sstevel@tonic-gate #define	T_ELEMENT	2	/* element */
707c478bd9Sstevel@tonic-gate #define	T_ENCLOSED	3	/* enclosed element */
717c478bd9Sstevel@tonic-gate #define	T_EXTENDED	4	/* extended element */
727c478bd9Sstevel@tonic-gate #define	T_UNKNOWN	99	/* huh... */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * Define the kinds of tags
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate enum tagnum_t { TAG_INVALID = MAXTOKEN,
787c478bd9Sstevel@tonic-gate 	TAG_UID,
797c478bd9Sstevel@tonic-gate 	TAG_GID,
807c478bd9Sstevel@tonic-gate 	TAG_RUID,
817c478bd9Sstevel@tonic-gate 	TAG_RGID,
827c478bd9Sstevel@tonic-gate 	TAG_AUID,
837c478bd9Sstevel@tonic-gate 	TAG_PID,
847c478bd9Sstevel@tonic-gate 	TAG_SID,
857c478bd9Sstevel@tonic-gate 	TAG_TID32,
867c478bd9Sstevel@tonic-gate 	TAG_TID64,
877c478bd9Sstevel@tonic-gate 	TAG_TID32_EX,
887c478bd9Sstevel@tonic-gate 	TAG_TID64_EX,
897c478bd9Sstevel@tonic-gate 	TAG_EVMOD,
907c478bd9Sstevel@tonic-gate 	TAG_TOKVERS,
917c478bd9Sstevel@tonic-gate 	TAG_EVTYPE,
927c478bd9Sstevel@tonic-gate 	TAG_ISO,
937c478bd9Sstevel@tonic-gate 	TAG_ERRVAL,
947c478bd9Sstevel@tonic-gate 	TAG_RETVAL,
957c478bd9Sstevel@tonic-gate 	TAG_SETTYPE,
967c478bd9Sstevel@tonic-gate 	TAG_GROUPID,
977c478bd9Sstevel@tonic-gate 	TAG_XID,
987c478bd9Sstevel@tonic-gate 	TAG_XCUID,
997c478bd9Sstevel@tonic-gate 	TAG_XSELTEXT,
1007c478bd9Sstevel@tonic-gate 	TAG_XSELTYPE,
1017c478bd9Sstevel@tonic-gate 	TAG_XSELDATA,
1027c478bd9Sstevel@tonic-gate 	TAG_ARGNUM,
1037c478bd9Sstevel@tonic-gate 	TAG_ARGVAL32,
1047c478bd9Sstevel@tonic-gate 	TAG_ARGVAL64,
1057c478bd9Sstevel@tonic-gate 	TAG_ARGDESC,
1067c478bd9Sstevel@tonic-gate 	TAG_MODE,
1077c478bd9Sstevel@tonic-gate 	TAG_FSID,
1087c478bd9Sstevel@tonic-gate 	TAG_NODEID32,
1097c478bd9Sstevel@tonic-gate 	TAG_NODEID64,
1107c478bd9Sstevel@tonic-gate 	TAG_DEVICE32,
1117c478bd9Sstevel@tonic-gate 	TAG_DEVICE64,
1127c478bd9Sstevel@tonic-gate 	TAG_SEQNUM,			/* with sequence token */
1137c478bd9Sstevel@tonic-gate 	TAG_ARGV,			/* with cmd token */
1147c478bd9Sstevel@tonic-gate 	TAG_ARGE,			/* with cmd token */
1157c478bd9Sstevel@tonic-gate 	TAG_ARG,			/* with exec_args token */
1167c478bd9Sstevel@tonic-gate 	TAG_ENV,			/* with exec_env token */
1177c478bd9Sstevel@tonic-gate 	TAG_XAT,			/* with attr_path token */
1187c478bd9Sstevel@tonic-gate 	TAG_RESULT,			/* with use_of_privilege token */
1197c478bd9Sstevel@tonic-gate 	TAG_CUID,			/* with IPC_perm token */
1207c478bd9Sstevel@tonic-gate 	TAG_CGID,			/* with IPC_perm token */
1217c478bd9Sstevel@tonic-gate 	TAG_SEQ,			/* with IPC_perm token */
1227c478bd9Sstevel@tonic-gate 	TAG_KEY,			/* with IPC_perm token */
1237c478bd9Sstevel@tonic-gate 	TAG_IPVERS,			/* with ip token */
1247c478bd9Sstevel@tonic-gate 	TAG_IPSERV,			/* with ip token */
1257c478bd9Sstevel@tonic-gate 	TAG_IPLEN,			/* with ip token */
1267c478bd9Sstevel@tonic-gate 	TAG_IPID,			/* with ip token */
1277c478bd9Sstevel@tonic-gate 	TAG_IPOFFS,			/* with ip token */
1287c478bd9Sstevel@tonic-gate 	TAG_IPTTL,			/* with ip token */
1297c478bd9Sstevel@tonic-gate 	TAG_IPPROTO,			/* with ip token */
1307c478bd9Sstevel@tonic-gate 	TAG_IPCKSUM,			/* with ip token */
1317c478bd9Sstevel@tonic-gate 	TAG_IPSRC,			/* with ip token */
1327c478bd9Sstevel@tonic-gate 	TAG_IPDEST,			/* with ip token */
1337c478bd9Sstevel@tonic-gate 	TAG_ACLTYPE,			/* with acl token */
1347c478bd9Sstevel@tonic-gate 	TAG_ACLVAL,			/* with acl token */
1357c478bd9Sstevel@tonic-gate 	TAG_SOCKTYPE,			/* with socket token */
1367c478bd9Sstevel@tonic-gate 	TAG_SOCKPORT,			/* with socket token */
1377c478bd9Sstevel@tonic-gate 	TAG_SOCKADDR,			/* with socket token */
1387c478bd9Sstevel@tonic-gate 	TAG_SOCKEXDOM,			/* with socket_ex token */
1397c478bd9Sstevel@tonic-gate 	TAG_SOCKEXTYPE,			/* with socket_ex token */
1407c478bd9Sstevel@tonic-gate 	TAG_SOCKEXLPORT,		/* with socket_ex token */
1417c478bd9Sstevel@tonic-gate 	TAG_SOCKEXLADDR,		/* with socket_ex token */
1427c478bd9Sstevel@tonic-gate 	TAG_SOCKEXFPORT,		/* with socket_ex token */
1437c478bd9Sstevel@tonic-gate 	TAG_SOCKEXFADDR,		/* with socket_ex token */
1447c478bd9Sstevel@tonic-gate 	TAG_IPCTYPE,			/* with IPC token */
1457c478bd9Sstevel@tonic-gate 	TAG_IPCID,			/* with IPC token */
1467c478bd9Sstevel@tonic-gate 	TAG_ARBPRINT,			/* with arbitrary (data) token */
1477c478bd9Sstevel@tonic-gate 	TAG_ARBTYPE,			/* with arbitrary (data) token */
1487c478bd9Sstevel@tonic-gate 	TAG_ARBCOUNT,			/* with arbitrary (data) token */
1497c478bd9Sstevel@tonic-gate 	TAG_HOSTID,			/* with extended header token */
1507c478bd9Sstevel@tonic-gate 	TAG_ZONENAME,			/* with zonename token */
1517c478bd9Sstevel@tonic-gate 	TAG_TID_TYPE,			/* with tid token */
1527c478bd9Sstevel@tonic-gate 	TAG_IP,				/* with tid token, type=ip */
1537c478bd9Sstevel@tonic-gate 	TAG_IP_LOCAL,			/* with tid token, type=ip */
1547c478bd9Sstevel@tonic-gate 	TAG_IP_REMOTE,			/* with tid token, type=ip */
1557c478bd9Sstevel@tonic-gate 	TAG_IP_ADR,			/* with tid token, type=ip */
156a7746f66Stz 	TAG_ACEMASK,			/* with ace token */
157a7746f66Stz 	TAG_ACEFLAGS,			/* with ace token */
158a7746f66Stz 	TAG_ACETYPE,			/* with ace token */
159a7746f66Stz 	TAG_ACEID,			/* with ace token */
160047f6e6fSgww 	TAG_USERNAME,			/* with user token */
161*b5c366f4SMatt Barden 	TAG_WSID,			/* with wsid token */
1627c478bd9Sstevel@tonic-gate 	MAXTAG
1637c478bd9Sstevel@tonic-gate };
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate /*
1677c478bd9Sstevel@tonic-gate  * These tokens are the same for all versions of Solaris
1687c478bd9Sstevel@tonic-gate  */
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate /*
1717c478bd9Sstevel@tonic-gate  * Control tokens
1727c478bd9Sstevel@tonic-gate  */
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate extern int	file_token();
1757c478bd9Sstevel@tonic-gate extern int	trailer_token();
1767c478bd9Sstevel@tonic-gate extern int	header_token();
1777c478bd9Sstevel@tonic-gate extern int	header32_ex_token();
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /*
1807c478bd9Sstevel@tonic-gate  * Data tokens
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate extern int	arbitrary_data_token();
184103b2b15Sgww extern int	fmri_token();
1857c478bd9Sstevel@tonic-gate extern int	s5_IPC_token();
1867c478bd9Sstevel@tonic-gate extern int	path_token();
1877c478bd9Sstevel@tonic-gate extern int	path_attr_token();
1887c478bd9Sstevel@tonic-gate extern int	subject32_token();
1897c478bd9Sstevel@tonic-gate extern int	process32_token();
1907c478bd9Sstevel@tonic-gate extern int	return_value32_token();
1917c478bd9Sstevel@tonic-gate extern int	text_token();
1927c478bd9Sstevel@tonic-gate extern int	opaque_token();
1937c478bd9Sstevel@tonic-gate extern int	ip_addr_token();
1947c478bd9Sstevel@tonic-gate extern int	ip_token();
1957c478bd9Sstevel@tonic-gate extern int	iport_token();
1967c478bd9Sstevel@tonic-gate extern int	argument32_token();
1977c478bd9Sstevel@tonic-gate extern int	socket_token();
1987c478bd9Sstevel@tonic-gate extern int	sequence_token();
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate /*
2017c478bd9Sstevel@tonic-gate  * Modifier tokens
2027c478bd9Sstevel@tonic-gate  */
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate extern int	acl_token();
205a7746f66Stz extern int	ace_token();
2067c478bd9Sstevel@tonic-gate extern int	attribute_token();
2077c478bd9Sstevel@tonic-gate extern int	s5_IPC_perm_token();
2087c478bd9Sstevel@tonic-gate extern int	group_token();
209a13cf099Sgww extern int	label_token();
2107c478bd9Sstevel@tonic-gate extern int	privilege_token();
2117c478bd9Sstevel@tonic-gate extern int	useofpriv_token();
2127c478bd9Sstevel@tonic-gate extern int	liaison_token();
2137c478bd9Sstevel@tonic-gate extern int	newgroup_token();
2147c478bd9Sstevel@tonic-gate extern int	exec_args_token();
2157c478bd9Sstevel@tonic-gate extern int	exec_env_token();
2167c478bd9Sstevel@tonic-gate extern int	attribute32_token();
2177c478bd9Sstevel@tonic-gate extern int	useofauth_token();
218047f6e6fSgww extern int	user_token();
219047f6e6fSgww extern int	zonename_token();
220d2a70789SRichard Lowe extern int	secflags_token();
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate /*
2237c478bd9Sstevel@tonic-gate  * X windows tokens
2247c478bd9Sstevel@tonic-gate  */
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate extern int	xatom_token();
2277c478bd9Sstevel@tonic-gate extern int	xselect_token();
2287c478bd9Sstevel@tonic-gate extern int	xcolormap_token();
2297c478bd9Sstevel@tonic-gate extern int	xcursor_token();
2307c478bd9Sstevel@tonic-gate extern int	xfont_token();
2317c478bd9Sstevel@tonic-gate extern int	xgc_token();
2327c478bd9Sstevel@tonic-gate extern int	xpixmap_token();
2337c478bd9Sstevel@tonic-gate extern int	xproperty_token();
2347c478bd9Sstevel@tonic-gate extern int	xwindow_token();
2357c478bd9Sstevel@tonic-gate extern int	xclient_token();
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * Command tokens
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate extern int	cmd_token();
2427c478bd9Sstevel@tonic-gate extern int	exit_token();
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /*
2457c478bd9Sstevel@tonic-gate  * Miscellaneous tokens
2467c478bd9Sstevel@tonic-gate  */
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate extern int	host_token();
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate  * Solaris64 tokens
2527c478bd9Sstevel@tonic-gate  */
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate extern int	argument64_token();
2557c478bd9Sstevel@tonic-gate extern int	return_value64_token();
2567c478bd9Sstevel@tonic-gate extern int	attribute64_token();
2577c478bd9Sstevel@tonic-gate extern int	header64_token();
2587c478bd9Sstevel@tonic-gate extern int	subject64_token();
2597c478bd9Sstevel@tonic-gate extern int	process64_token();
2607c478bd9Sstevel@tonic-gate extern int	file64_token();
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /*
2637c478bd9Sstevel@tonic-gate  * Extended network address tokens
2647c478bd9Sstevel@tonic-gate  */
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate extern int	header64_ex_token();
2677c478bd9Sstevel@tonic-gate extern int	subject32_ex_token();
2687c478bd9Sstevel@tonic-gate extern int	process32_ex_token();
2697c478bd9Sstevel@tonic-gate extern int	subject64_ex_token();
2707c478bd9Sstevel@tonic-gate extern int	process64_ex_token();
2717c478bd9Sstevel@tonic-gate extern int	ip_addr_ex_token();
2727c478bd9Sstevel@tonic-gate extern int	socket_ex_token();
2737c478bd9Sstevel@tonic-gate extern int	tid_token();
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2767c478bd9Sstevel@tonic-gate }
2777c478bd9Sstevel@tonic-gate #endif
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate #endif	/* _TOKTABLE_H */
280