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 /* 22*1d7bfecdStz * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _BSM_AUDIT_RECORD_H 277c478bd9Sstevel@tonic-gate #define _BSM_AUDIT_RECORD_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef _KERNEL 327c478bd9Sstevel@tonic-gate #include <sys/priv.h> 337c478bd9Sstevel@tonic-gate #else 347c478bd9Sstevel@tonic-gate #include <priv.h> 357c478bd9Sstevel@tonic-gate #endif 367c478bd9Sstevel@tonic-gate #include <sys/socket.h> 377c478bd9Sstevel@tonic-gate #include <sys/acl.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include <sys/tsol/label.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * Version of audit attributes 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * OS Release Version Number Comments 497c478bd9Sstevel@tonic-gate * ========== ============== ======== 507c478bd9Sstevel@tonic-gate * SunOS 5.1 2 Unbundled Package 517c478bd9Sstevel@tonic-gate * SunOS 5.3 2 Bundled into the base OS 527c478bd9Sstevel@tonic-gate * SunOS 5.4-5.x 2 537c478bd9Sstevel@tonic-gate * Trusted Solaris 2.5 3 To distinguish potential new tokens 547c478bd9Sstevel@tonic-gate * Trusted Solaris 7-8 4 Redefine X tokens that overlap with 557c478bd9Sstevel@tonic-gate * SunOS 5.7 567c478bd9Sstevel@tonic-gate */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #define TOKEN_VERSION 2 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * Audit record token type codes 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * Control token types 667c478bd9Sstevel@tonic-gate */ 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #define AUT_INVALID ((char)0x00) 697c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE ((char)0x11) 707c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE32 AUT_OTHER_FILE 717c478bd9Sstevel@tonic-gate #define AUT_OHEADER ((char)0x12) 727c478bd9Sstevel@tonic-gate #define AUT_TRAILER ((char)0x13) 737c478bd9Sstevel@tonic-gate #define AUT_HEADER ((char)0x14) 747c478bd9Sstevel@tonic-gate #define AUT_HEADER32 AUT_HEADER 757c478bd9Sstevel@tonic-gate #define AUT_HEADER32_EX ((char)0x15) 767c478bd9Sstevel@tonic-gate #define AUT_TRAILER_MAGIC ((short)0xB105) 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate /* 797c478bd9Sstevel@tonic-gate * Data token types 807c478bd9Sstevel@tonic-gate */ 817c478bd9Sstevel@tonic-gate 82103b2b15Sgww #define AUT_FMRI ((char)0x20) 837c478bd9Sstevel@tonic-gate #define AUT_DATA ((char)0x21) 847c478bd9Sstevel@tonic-gate #define AUT_IPC ((char)0x22) 857c478bd9Sstevel@tonic-gate #define AUT_PATH ((char)0x23) 867c478bd9Sstevel@tonic-gate #define AUT_SUBJECT ((char)0x24) 877c478bd9Sstevel@tonic-gate #define AUT_SUBJECT32 AUT_SUBJECT 887c478bd9Sstevel@tonic-gate #define AUT_XATPATH ((char)0x25) 897c478bd9Sstevel@tonic-gate #define AUT_PROCESS ((char)0x26) 907c478bd9Sstevel@tonic-gate #define AUT_PROCESS32 AUT_PROCESS 917c478bd9Sstevel@tonic-gate #define AUT_RETURN ((char)0x27) 927c478bd9Sstevel@tonic-gate #define AUT_RETURN32 AUT_RETURN 937c478bd9Sstevel@tonic-gate #define AUT_TEXT ((char)0x28) 947c478bd9Sstevel@tonic-gate #define AUT_OPAQUE ((char)0x29) 957c478bd9Sstevel@tonic-gate #define AUT_IN_ADDR ((char)0x2A) 967c478bd9Sstevel@tonic-gate #define AUT_IP ((char)0x2B) 977c478bd9Sstevel@tonic-gate #define AUT_IPORT ((char)0x2C) 987c478bd9Sstevel@tonic-gate #define AUT_ARG ((char)0x2D) 997c478bd9Sstevel@tonic-gate #define AUT_ARG32 AUT_ARG 1007c478bd9Sstevel@tonic-gate #define AUT_SOCKET ((char)0x2E) 1017c478bd9Sstevel@tonic-gate #define AUT_SEQ ((char)0x2F) 1027c478bd9Sstevel@tonic-gate #define AUT_TID ((char)0x61) 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * Modifier token types 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #define AUT_ACL ((char)0x30) 1097c478bd9Sstevel@tonic-gate #define AUT_ATTR ((char)0x31) 1107c478bd9Sstevel@tonic-gate #define AUT_IPC_PERM ((char)0x32) 1117c478bd9Sstevel@tonic-gate #define AUT_LABEL ((char)0x33) 1127c478bd9Sstevel@tonic-gate #define AUT_GROUPS ((char)0x34) 11381490fd2Sgww /* 11481490fd2Sgww * 0x35, 0x36, 0x37 unused 11581490fd2Sgww */ 1167c478bd9Sstevel@tonic-gate #define AUT_PRIV ((char)0x38) 1177c478bd9Sstevel@tonic-gate #define AUT_UPRIV ((char)0x39) 1187c478bd9Sstevel@tonic-gate #define AUT_LIAISON ((char)0x3A) 1197c478bd9Sstevel@tonic-gate #define AUT_NEWGROUPS ((char)0x3B) 1207c478bd9Sstevel@tonic-gate #define AUT_EXEC_ARGS ((char)0x3C) 1217c478bd9Sstevel@tonic-gate #define AUT_EXEC_ENV ((char)0x3D) 1227c478bd9Sstevel@tonic-gate #define AUT_ATTR32 ((char)0x3E) 1237c478bd9Sstevel@tonic-gate #define AUT_UAUTH ((char)0x3F) 1247c478bd9Sstevel@tonic-gate #define AUT_ZONENAME ((char)0x60) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * X windows token types 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #define AUT_XATOM ((char)0x40) 1317c478bd9Sstevel@tonic-gate #define AUT_XOBJ ((char)0x41) 1327c478bd9Sstevel@tonic-gate #define AUT_XPROTO ((char)0x42) 1337c478bd9Sstevel@tonic-gate #define AUT_XSELECT ((char)0x43) 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #if TOKEN_VERSION != 3 1367c478bd9Sstevel@tonic-gate #define AUT_XCOLORMAP ((char)0x44) 1377c478bd9Sstevel@tonic-gate #define AUT_XCURSOR ((char)0x45) 1387c478bd9Sstevel@tonic-gate #define AUT_XFONT ((char)0x46) 1397c478bd9Sstevel@tonic-gate #define AUT_XGC ((char)0x47) 1407c478bd9Sstevel@tonic-gate #define AUT_XPIXMAP ((char)0x48) 1417c478bd9Sstevel@tonic-gate #define AUT_XPROPERTY ((char)0x49) 1427c478bd9Sstevel@tonic-gate #define AUT_XWINDOW ((char)0x4A) 1437c478bd9Sstevel@tonic-gate #define AUT_XCLIENT ((char)0x4B) 1447c478bd9Sstevel@tonic-gate #else /* TOKEN_VERSION == 3 */ 1457c478bd9Sstevel@tonic-gate #define AUT_XCOLORMAP ((char)0x74) 1467c478bd9Sstevel@tonic-gate #define AUT_XCURSOR ((char)0x75) 1477c478bd9Sstevel@tonic-gate #define AUT_XFONT ((char)0x76) 1487c478bd9Sstevel@tonic-gate #define AUT_XGC ((char)0x77) 1497c478bd9Sstevel@tonic-gate #define AUT_XPIXMAP ((char)0x78) 1507c478bd9Sstevel@tonic-gate #define AUT_XPROPERTY ((char)0x79) 1517c478bd9Sstevel@tonic-gate #define AUT_XWINDOW ((char)0x7A) 1527c478bd9Sstevel@tonic-gate #define AUT_XCLIENT ((char)0x7B) 1537c478bd9Sstevel@tonic-gate #endif /* TOKEN_VERSION != 3 */ 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Command token types 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate #define AUT_CMD ((char)0x51) 1607c478bd9Sstevel@tonic-gate #define AUT_EXIT ((char)0x52) 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate /* 1637c478bd9Sstevel@tonic-gate * Miscellaneous token types 1647c478bd9Sstevel@tonic-gate */ 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate #define AUT_HOST ((char)0x70) 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate /* 1697c478bd9Sstevel@tonic-gate * Solaris64 token types 1707c478bd9Sstevel@tonic-gate */ 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #define AUT_ARG64 ((char)0x71) 1737c478bd9Sstevel@tonic-gate #define AUT_RETURN64 ((char)0x72) 1747c478bd9Sstevel@tonic-gate #define AUT_ATTR64 ((char)0x73) 1757c478bd9Sstevel@tonic-gate #define AUT_HEADER64 ((char)0x74) 1767c478bd9Sstevel@tonic-gate #define AUT_SUBJECT64 ((char)0x75) 1777c478bd9Sstevel@tonic-gate #define AUT_PROCESS64 ((char)0x77) 1787c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE64 ((char)0x78) 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate /* 1817c478bd9Sstevel@tonic-gate * Extended network address token types 1827c478bd9Sstevel@tonic-gate */ 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #define AUT_HEADER64_EX ((char)0x79) 1857c478bd9Sstevel@tonic-gate #define AUT_SUBJECT32_EX ((char)0x7a) 1867c478bd9Sstevel@tonic-gate #define AUT_PROCESS32_EX ((char)0x7b) 1877c478bd9Sstevel@tonic-gate #define AUT_SUBJECT64_EX ((char)0x7c) 1887c478bd9Sstevel@tonic-gate #define AUT_PROCESS64_EX ((char)0x7d) 1897c478bd9Sstevel@tonic-gate #define AUT_IN_ADDR_EX ((char)0x7e) 1907c478bd9Sstevel@tonic-gate #define AUT_SOCKET_EX ((char)0x7f) 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate /* 1947c478bd9Sstevel@tonic-gate * Audit print suggestion types. 1957c478bd9Sstevel@tonic-gate */ 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate #define AUP_BINARY ((char)0) 1987c478bd9Sstevel@tonic-gate #define AUP_OCTAL ((char)1) 1997c478bd9Sstevel@tonic-gate #define AUP_DECIMAL ((char)2) 2007c478bd9Sstevel@tonic-gate #define AUP_HEX ((char)3) 2017c478bd9Sstevel@tonic-gate #define AUP_STRING ((char)4) 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate /* 2047c478bd9Sstevel@tonic-gate * Audit data member types. 2057c478bd9Sstevel@tonic-gate */ 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #define AUR_BYTE ((char)0) 2087c478bd9Sstevel@tonic-gate #define AUR_CHAR ((char)0) 2097c478bd9Sstevel@tonic-gate #define AUR_SHORT ((char)1) 2107c478bd9Sstevel@tonic-gate #define AUR_INT ((char)2) 2117c478bd9Sstevel@tonic-gate #define AUR_INT32 ((char)2) 2127c478bd9Sstevel@tonic-gate #define AUR_INT64 ((char)3) 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate /* 2157c478bd9Sstevel@tonic-gate * Adr structures 2167c478bd9Sstevel@tonic-gate */ 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate struct adr_s { 2197c478bd9Sstevel@tonic-gate char *adr_stream; /* The base of the stream */ 2207c478bd9Sstevel@tonic-gate char *adr_now; /* The location within the stream */ 2217c478bd9Sstevel@tonic-gate }; 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate typedef struct adr_s adr_t; 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate #ifdef _KERNEL 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate #include <sys/param.h> 2297c478bd9Sstevel@tonic-gate #include <sys/systm.h> /* for rval */ 2307c478bd9Sstevel@tonic-gate #include <sys/time.h> 2317c478bd9Sstevel@tonic-gate #include <sys/types.h> 2327c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 2337c478bd9Sstevel@tonic-gate #include <sys/mode.h> 2347c478bd9Sstevel@tonic-gate #include <sys/user.h> 2357c478bd9Sstevel@tonic-gate #include <sys/session.h> 2367c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h> 2377c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h> 2387c478bd9Sstevel@tonic-gate #include <netinet/in.h> 2397c478bd9Sstevel@tonic-gate #include <netinet/ip.h> 2407c478bd9Sstevel@tonic-gate #include <sys/socket.h> 2417c478bd9Sstevel@tonic-gate #include <net/route.h> 2427c478bd9Sstevel@tonic-gate #include <netinet/in_pcb.h> 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate /* 2457c478bd9Sstevel@tonic-gate * au_close flag arguments 2467c478bd9Sstevel@tonic-gate */ 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #define AU_OK 0x1 /* Good audit record */ 2497c478bd9Sstevel@tonic-gate #define AU_DONTBLOCK 0x2 /* Don't block or discard if queue full */ 2507c478bd9Sstevel@tonic-gate #define AU_DEFER 0x4 /* Defer record queueing to syscall end */ 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate /* 2537c478bd9Sstevel@tonic-gate * Audit token type is really an au_membuf pointer 2547c478bd9Sstevel@tonic-gate */ 2557c478bd9Sstevel@tonic-gate typedef au_buff_t token_t; 2567c478bd9Sstevel@tonic-gate /* 2577c478bd9Sstevel@tonic-gate * token generation functions 2587c478bd9Sstevel@tonic-gate */ 2597c478bd9Sstevel@tonic-gate token_t *au_append_token(token_t *, token_t *); 2607c478bd9Sstevel@tonic-gate token_t *au_set(caddr_t, uint_t); 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate void au_free_rec(au_buff_t *); 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate #define au_getclr() ((token_t *)au_get_buff()) 2657c478bd9Sstevel@tonic-gate #define au_toss_token(tok) (au_free_rec((au_buff_t *)(tok))) 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate token_t *au_to_acl(); 2687c478bd9Sstevel@tonic-gate token_t *au_to_attr(struct vattr *); 2697c478bd9Sstevel@tonic-gate token_t *au_to_data(char, char, char, char *); 2707c478bd9Sstevel@tonic-gate token_t *au_to_header(int, au_event_t, au_emod_t); 2717c478bd9Sstevel@tonic-gate token_t *au_to_header_ex(int, au_event_t, au_emod_t); 2727c478bd9Sstevel@tonic-gate token_t *au_to_ipc(char, int); 2737c478bd9Sstevel@tonic-gate token_t *au_to_ipc_perm(kipc_perm_t *); 2747c478bd9Sstevel@tonic-gate token_t *au_to_iport(ushort_t); 2757c478bd9Sstevel@tonic-gate token_t *au_to_in_addr(struct in_addr *); 2767c478bd9Sstevel@tonic-gate token_t *au_to_in_addr_ex(int32_t *); 2777c478bd9Sstevel@tonic-gate token_t *au_to_ip(struct ip *); 2787c478bd9Sstevel@tonic-gate token_t *au_to_groups(const gid_t *, uint_t); 2797c478bd9Sstevel@tonic-gate token_t *au_to_path(struct audit_path *); 2807c478bd9Sstevel@tonic-gate token_t *au_to_seq(); 2817c478bd9Sstevel@tonic-gate token_t *au_to_process(uid_t, gid_t, uid_t, gid_t, pid_t, 2827c478bd9Sstevel@tonic-gate au_id_t, au_asid_t, const au_tid_addr_t *); 2837c478bd9Sstevel@tonic-gate token_t *au_to_subject(uid_t, gid_t, uid_t, gid_t, pid_t, 2847c478bd9Sstevel@tonic-gate au_id_t, au_asid_t, const au_tid_addr_t *); 2857c478bd9Sstevel@tonic-gate token_t *au_to_return32(int, int32_t); 2867c478bd9Sstevel@tonic-gate token_t *au_to_return64(int, int64_t); 2877c478bd9Sstevel@tonic-gate token_t *au_to_text(const char *); 2887c478bd9Sstevel@tonic-gate /* token_t *au_to_tid(au_generic_tid_t *); no kernel implementation */ 2897c478bd9Sstevel@tonic-gate token_t *au_to_trailer(int); 2907c478bd9Sstevel@tonic-gate token_t *au_to_uauth(char *); 291*1d7bfecdStz size_t au_zonename_length(zone_t *); 292*1d7bfecdStz token_t *au_to_zonename(size_t, zone_t *); 2937c478bd9Sstevel@tonic-gate token_t *au_to_arg32(char, char *, uint32_t); 2947c478bd9Sstevel@tonic-gate token_t *au_to_arg64(char, char *, uint64_t); 2957c478bd9Sstevel@tonic-gate token_t *au_to_socket(struct socket *); 2967c478bd9Sstevel@tonic-gate token_t *au_to_socket_ex(short, short, char *, char *); 2977c478bd9Sstevel@tonic-gate token_t *au_to_sock_inet(struct sockaddr_in *); 2987c478bd9Sstevel@tonic-gate token_t *au_to_exec_args(const char *, ssize_t); 2997c478bd9Sstevel@tonic-gate token_t *au_to_exec_env(const char *, ssize_t); 30045916cd2Sjpk token_t *au_to_label(bslabel_t *); 3017c478bd9Sstevel@tonic-gate token_t *au_to_privset(const char *, const priv_set_t *, char, int); 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate void au_uwrite(); 3047c478bd9Sstevel@tonic-gate void au_close(au_kcontext_t *, caddr_t *, int, au_event_t, au_emod_t); 3057c478bd9Sstevel@tonic-gate void au_close_defer(token_t *, int, au_event_t, au_emod_t); 3067c478bd9Sstevel@tonic-gate void au_close_time(au_kcontext_t *, token_t *, int, au_event_t, au_emod_t, 3077c478bd9Sstevel@tonic-gate timestruc_t *); 3087c478bd9Sstevel@tonic-gate void au_free_rec(au_buff_t *); 3097c478bd9Sstevel@tonic-gate void au_write(caddr_t *, token_t *); 3107c478bd9Sstevel@tonic-gate void au_mem_init(void); 3117c478bd9Sstevel@tonic-gate void au_zone_setup(); 3127c478bd9Sstevel@tonic-gate void au_enqueue(au_kcontext_t *, au_buff_t *, adr_t *, adr_t *, int, int); 3137c478bd9Sstevel@tonic-gate int au_doorio(au_kcontext_t *); 3147c478bd9Sstevel@tonic-gate int au_doormsg(au_kcontext_t *, uint32_t, void *); 3157c478bd9Sstevel@tonic-gate int au_doio(struct vnode *, int); 3167c478bd9Sstevel@tonic-gate int au_token_size(token_t *); 3177c478bd9Sstevel@tonic-gate int au_append_rec(au_buff_t *, au_buff_t *, int); 3187c478bd9Sstevel@tonic-gate int au_append_buf(const char *, int, au_buff_t *); 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate #else /* !_KERNEL */ 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate #include <limits.h> 3237c478bd9Sstevel@tonic-gate #include <sys/types.h> 3247c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 3257c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h> 3267c478bd9Sstevel@tonic-gate #include <netinet/in.h> 3277c478bd9Sstevel@tonic-gate #include <netinet/ip.h> 3287c478bd9Sstevel@tonic-gate #include <sys/ipc.h> 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate struct token_s { 3317c478bd9Sstevel@tonic-gate struct token_s *tt_next; /* Next in the list */ 3327c478bd9Sstevel@tonic-gate short tt_size; /* Size of data */ 3337c478bd9Sstevel@tonic-gate char *tt_data; /* The data */ 3347c478bd9Sstevel@tonic-gate }; 3357c478bd9Sstevel@tonic-gate typedef struct token_s token_t; 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate struct au_arg32_tok { 3387c478bd9Sstevel@tonic-gate uchar_t num; 3397c478bd9Sstevel@tonic-gate uint32_t val; 3407c478bd9Sstevel@tonic-gate ushort_t length; 3417c478bd9Sstevel@tonic-gate char *data; 3427c478bd9Sstevel@tonic-gate }; 3437c478bd9Sstevel@tonic-gate typedef struct au_arg32_tok au_arg32_tok_t; 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate struct au_acl_tok { 3467c478bd9Sstevel@tonic-gate ulong_t type; 3477c478bd9Sstevel@tonic-gate ulong_t id; 3487c478bd9Sstevel@tonic-gate ulong_t mode; 3497c478bd9Sstevel@tonic-gate }; 3507c478bd9Sstevel@tonic-gate typedef struct au_acl_tok au_acl_tok_t; 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate struct au_arg64_tok { 3537c478bd9Sstevel@tonic-gate uchar_t num; 3547c478bd9Sstevel@tonic-gate uint64_t val; 3557c478bd9Sstevel@tonic-gate ushort_t length; 3567c478bd9Sstevel@tonic-gate char *data; 3577c478bd9Sstevel@tonic-gate }; 3587c478bd9Sstevel@tonic-gate typedef struct au_arg64_tok au_arg64_tok_t; 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate struct au_attr_tok { 3617c478bd9Sstevel@tonic-gate uint_t mode; 3627c478bd9Sstevel@tonic-gate uint_t uid; 3637c478bd9Sstevel@tonic-gate uint_t gid; 3647c478bd9Sstevel@tonic-gate int fs; 3657c478bd9Sstevel@tonic-gate int32_t node; 3667c478bd9Sstevel@tonic-gate uint32_t dev; 3677c478bd9Sstevel@tonic-gate }; 3687c478bd9Sstevel@tonic-gate typedef struct au_attr_tok au_attr_tok_t; 3697c478bd9Sstevel@tonic-gate 3707c478bd9Sstevel@tonic-gate struct au_attr32_tok { 3717c478bd9Sstevel@tonic-gate uint_t mode; 3727c478bd9Sstevel@tonic-gate uint_t uid; 3737c478bd9Sstevel@tonic-gate uint_t gid; 3747c478bd9Sstevel@tonic-gate int fs; 3757c478bd9Sstevel@tonic-gate int64_t node; 3767c478bd9Sstevel@tonic-gate uint32_t dev; 3777c478bd9Sstevel@tonic-gate }; 3787c478bd9Sstevel@tonic-gate typedef struct au_attr32_tok au_attr32_tok_t; 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate struct au_attr64_tok { 3817c478bd9Sstevel@tonic-gate uint_t mode; 3827c478bd9Sstevel@tonic-gate uint_t uid; 3837c478bd9Sstevel@tonic-gate uint_t gid; 3847c478bd9Sstevel@tonic-gate int fs; 3857c478bd9Sstevel@tonic-gate int64_t node; 3867c478bd9Sstevel@tonic-gate uint64_t dev; 3877c478bd9Sstevel@tonic-gate }; 3887c478bd9Sstevel@tonic-gate typedef struct au_attr64_tok au_attr64_tok_t; 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate struct au_data_tok { 3917c478bd9Sstevel@tonic-gate uchar_t pfmt; 3927c478bd9Sstevel@tonic-gate uchar_t size; 3937c478bd9Sstevel@tonic-gate uchar_t number; 3947c478bd9Sstevel@tonic-gate char *data; 3957c478bd9Sstevel@tonic-gate }; 3967c478bd9Sstevel@tonic-gate typedef struct au_data_tok au_data_tok_t; 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate struct au_exit_tok { 3997c478bd9Sstevel@tonic-gate int status; 4007c478bd9Sstevel@tonic-gate int retval; 4017c478bd9Sstevel@tonic-gate }; 4027c478bd9Sstevel@tonic-gate typedef struct au_exit_tok au_exit_tok_t; 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate struct au_file32_tok { 4057c478bd9Sstevel@tonic-gate /* really struct timeval from gettimeofday() */ 4067c478bd9Sstevel@tonic-gate int32_t sec; /* seconds since epoc */ 4077c478bd9Sstevel@tonic-gate int32_t usec; /* microseconds */ 4087c478bd9Sstevel@tonic-gate ushort_t length; 4097c478bd9Sstevel@tonic-gate char *fname; 4107c478bd9Sstevel@tonic-gate }; 4117c478bd9Sstevel@tonic-gate typedef struct au_file32_tok au_file32_tok_t; 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate struct au_file64_tok { 4147c478bd9Sstevel@tonic-gate /* really struct timeval */ 4157c478bd9Sstevel@tonic-gate int64_t sec; /* seconds since epoc */ 4167c478bd9Sstevel@tonic-gate int64_t usec; /* microseconds */ 4177c478bd9Sstevel@tonic-gate ushort_t length; 4187c478bd9Sstevel@tonic-gate char *fname; 4197c478bd9Sstevel@tonic-gate }; 4207c478bd9Sstevel@tonic-gate typedef struct au_file64_tok au_file64_tok_t; 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gate 4237c478bd9Sstevel@tonic-gate struct au_groups_tok { 4247c478bd9Sstevel@tonic-gate gid_t groups[NGROUPS_MAX]; 4257c478bd9Sstevel@tonic-gate }; 4267c478bd9Sstevel@tonic-gate typedef struct au_groups_tok au_groups_tok_t; 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate struct au_header32_tok { 4297c478bd9Sstevel@tonic-gate uint_t length; 4307c478bd9Sstevel@tonic-gate uchar_t version; 4317c478bd9Sstevel@tonic-gate au_event_t event; 4327c478bd9Sstevel@tonic-gate ushort_t emod; 4337c478bd9Sstevel@tonic-gate /* really timestruct_t (struct timespec) from hrestime */ 4347c478bd9Sstevel@tonic-gate int32_t sec; /* seconds since epoc */ 4357c478bd9Sstevel@tonic-gate int32_t nsec; /* nanoseconds */ 4367c478bd9Sstevel@tonic-gate }; 4377c478bd9Sstevel@tonic-gate typedef struct au_header32_tok au_header32_tok_t; 4387c478bd9Sstevel@tonic-gate 4397c478bd9Sstevel@tonic-gate struct au_header64_tok { 4407c478bd9Sstevel@tonic-gate uint_t length; 4417c478bd9Sstevel@tonic-gate uchar_t version; 4427c478bd9Sstevel@tonic-gate au_event_t event; 4437c478bd9Sstevel@tonic-gate ushort_t emod; 4447c478bd9Sstevel@tonic-gate /* really timestruct_t (struct timespec) from hrestime */ 4457c478bd9Sstevel@tonic-gate int64_t sec; /* seconds since epoc */ 4467c478bd9Sstevel@tonic-gate int64_t nsec; /* nanoseconds */ 4477c478bd9Sstevel@tonic-gate }; 4487c478bd9Sstevel@tonic-gate typedef struct au_header64_tok au_header64_tok_t; 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gate struct au_inaddr_tok { 4517c478bd9Sstevel@tonic-gate struct in_addr ia; 4527c478bd9Sstevel@tonic-gate }; 4537c478bd9Sstevel@tonic-gate typedef struct au_inaddr_tok au_inaddr_tok_t; 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate struct au_ip_tok { 4567c478bd9Sstevel@tonic-gate uchar_t version; 4577c478bd9Sstevel@tonic-gate struct ip ip; 4587c478bd9Sstevel@tonic-gate }; 4597c478bd9Sstevel@tonic-gate typedef struct au_ip_tok au_ip_tok_t; 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate struct au_ipc_tok { 4627c478bd9Sstevel@tonic-gate key_t id; 4637c478bd9Sstevel@tonic-gate }; 4647c478bd9Sstevel@tonic-gate typedef struct au_ipc_tok au_ipc_tok_t; 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate struct au_ipc_perm_tok { 4677c478bd9Sstevel@tonic-gate struct ipc_perm ipc_perm; 4687c478bd9Sstevel@tonic-gate }; 4697c478bd9Sstevel@tonic-gate typedef struct au_ipc_perm_tok au_ipc_perm_tok_t; 4707c478bd9Sstevel@tonic-gate 4717c478bd9Sstevel@tonic-gate struct au_iport_tok { 4727c478bd9Sstevel@tonic-gate ushort_t iport; 4737c478bd9Sstevel@tonic-gate }; 4747c478bd9Sstevel@tonic-gate typedef struct au_iport_tok au_iport_tok_t; 4757c478bd9Sstevel@tonic-gate 4767c478bd9Sstevel@tonic-gate struct au_invalid_tok { 4777c478bd9Sstevel@tonic-gate ushort_t length; 4787c478bd9Sstevel@tonic-gate char *data; 4797c478bd9Sstevel@tonic-gate }; 4807c478bd9Sstevel@tonic-gate typedef struct au_invalid_tok au_invalid_tok_t; 4817c478bd9Sstevel@tonic-gate 4827c478bd9Sstevel@tonic-gate struct au_opaque_tok { 4837c478bd9Sstevel@tonic-gate ushort_t length; 4847c478bd9Sstevel@tonic-gate char *data; 4857c478bd9Sstevel@tonic-gate }; 4867c478bd9Sstevel@tonic-gate typedef struct au_opaque_tok au_opaque_tok_t; 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate struct au_path_tok { 4897c478bd9Sstevel@tonic-gate ushort_t length; 4907c478bd9Sstevel@tonic-gate char *name; 4917c478bd9Sstevel@tonic-gate }; 4927c478bd9Sstevel@tonic-gate typedef struct au_path_tok au_path_tok_t; 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate struct au_tid32 { 4957c478bd9Sstevel@tonic-gate uint32_t port; 4967c478bd9Sstevel@tonic-gate uint32_t machine; 4977c478bd9Sstevel@tonic-gate }; 4987c478bd9Sstevel@tonic-gate typedef struct au_tid32 au_tid32_t; 4997c478bd9Sstevel@tonic-gate 5007c478bd9Sstevel@tonic-gate struct au_tid64 { 5017c478bd9Sstevel@tonic-gate uint64_t port; 5027c478bd9Sstevel@tonic-gate uint32_t machine; 5037c478bd9Sstevel@tonic-gate }; 5047c478bd9Sstevel@tonic-gate typedef struct au_tid64 au_tid64_t; 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate struct au_proc32_tok { 5077c478bd9Sstevel@tonic-gate au_id_t auid; 5087c478bd9Sstevel@tonic-gate uid_t euid; 5097c478bd9Sstevel@tonic-gate gid_t egid; 5107c478bd9Sstevel@tonic-gate uid_t ruid; 5117c478bd9Sstevel@tonic-gate gid_t rgid; 5127c478bd9Sstevel@tonic-gate pid_t pid; 5137c478bd9Sstevel@tonic-gate pid_t sid; 5147c478bd9Sstevel@tonic-gate au_tid32_t tid; 5157c478bd9Sstevel@tonic-gate }; 5167c478bd9Sstevel@tonic-gate typedef struct au_proc32_tok au_proc32_tok_t; 5177c478bd9Sstevel@tonic-gate 5187c478bd9Sstevel@tonic-gate struct au_proc64_tok { 5197c478bd9Sstevel@tonic-gate au_id_t auid; 5207c478bd9Sstevel@tonic-gate uid_t euid; 5217c478bd9Sstevel@tonic-gate gid_t egid; 5227c478bd9Sstevel@tonic-gate uid_t ruid; 5237c478bd9Sstevel@tonic-gate gid_t rgid; 5247c478bd9Sstevel@tonic-gate pid_t pid; 5257c478bd9Sstevel@tonic-gate pid_t sid; 5267c478bd9Sstevel@tonic-gate au_tid64_t tid; 5277c478bd9Sstevel@tonic-gate }; 5287c478bd9Sstevel@tonic-gate typedef struct au_proc64_tok au_proc64_tok_t; 5297c478bd9Sstevel@tonic-gate 5307c478bd9Sstevel@tonic-gate struct au_ret32_tok { 5317c478bd9Sstevel@tonic-gate uchar_t error; 5327c478bd9Sstevel@tonic-gate uint32_t retval; 5337c478bd9Sstevel@tonic-gate }; 5347c478bd9Sstevel@tonic-gate typedef struct au_ret32_tok au_ret32_tok_t; 5357c478bd9Sstevel@tonic-gate 5367c478bd9Sstevel@tonic-gate struct au_ret64_tok { 5377c478bd9Sstevel@tonic-gate uchar_t error; 5387c478bd9Sstevel@tonic-gate uint64_t retval; 5397c478bd9Sstevel@tonic-gate }; 5407c478bd9Sstevel@tonic-gate typedef struct au_ret64_tok au_ret64_tok_t; 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate struct au_seq_tok { 5437c478bd9Sstevel@tonic-gate uint_t num; 5447c478bd9Sstevel@tonic-gate }; 5457c478bd9Sstevel@tonic-gate typedef struct au_seq_tok au_seq_tok_t; 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate struct au_socket_tok { 5487c478bd9Sstevel@tonic-gate short type; 5497c478bd9Sstevel@tonic-gate ushort_t lport; 5507c478bd9Sstevel@tonic-gate struct in_addr laddr; 5517c478bd9Sstevel@tonic-gate ushort_t fport; 5527c478bd9Sstevel@tonic-gate struct in_addr faddr; 5537c478bd9Sstevel@tonic-gate }; 5547c478bd9Sstevel@tonic-gate typedef struct au_socket_tok au_socket_tok_t; 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate struct au_subj32_tok { 5577c478bd9Sstevel@tonic-gate au_id_t auid; 5587c478bd9Sstevel@tonic-gate uid_t euid; 5597c478bd9Sstevel@tonic-gate gid_t egid; 5607c478bd9Sstevel@tonic-gate uid_t ruid; 5617c478bd9Sstevel@tonic-gate gid_t rgid; 5627c478bd9Sstevel@tonic-gate pid_t pid; 5637c478bd9Sstevel@tonic-gate pid_t sid; 5647c478bd9Sstevel@tonic-gate au_tid32_t tid; 5657c478bd9Sstevel@tonic-gate }; 5667c478bd9Sstevel@tonic-gate typedef struct au_subj32_tok au_subj32_tok_t; 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate struct au_subj64_tok { 5697c478bd9Sstevel@tonic-gate au_id_t auid; 5707c478bd9Sstevel@tonic-gate uid_t euid; 5717c478bd9Sstevel@tonic-gate gid_t egid; 5727c478bd9Sstevel@tonic-gate uid_t ruid; 5737c478bd9Sstevel@tonic-gate gid_t rgid; 5747c478bd9Sstevel@tonic-gate pid_t pid; 5757c478bd9Sstevel@tonic-gate pid_t sid; 5767c478bd9Sstevel@tonic-gate au_tid64_t tid; 5777c478bd9Sstevel@tonic-gate }; 5787c478bd9Sstevel@tonic-gate typedef struct au_subj64_tok au_subj64_tok_t; 5797c478bd9Sstevel@tonic-gate 5807c478bd9Sstevel@tonic-gate struct au_server_tok { 5817c478bd9Sstevel@tonic-gate au_id_t auid; 5827c478bd9Sstevel@tonic-gate uid_t euid; 5837c478bd9Sstevel@tonic-gate uid_t ruid; 5847c478bd9Sstevel@tonic-gate gid_t egid; 5857c478bd9Sstevel@tonic-gate pid_t pid; 5867c478bd9Sstevel@tonic-gate }; 5877c478bd9Sstevel@tonic-gate typedef struct au_server_tok au_server_tok_t; 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gate struct au_text_tok { 5907c478bd9Sstevel@tonic-gate ushort_t length; 5917c478bd9Sstevel@tonic-gate char *data; 5927c478bd9Sstevel@tonic-gate }; 5937c478bd9Sstevel@tonic-gate typedef struct au_text_tok au_text_tok_t; 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate struct au_trailer_tok { 5967c478bd9Sstevel@tonic-gate ushort_t magic; 5977c478bd9Sstevel@tonic-gate uint_t length; 5987c478bd9Sstevel@tonic-gate }; 5997c478bd9Sstevel@tonic-gate typedef struct au_trailer_tok au_trailer_tok_t; 6007c478bd9Sstevel@tonic-gate 6017c478bd9Sstevel@tonic-gate struct au_uauth_tok { 6027c478bd9Sstevel@tonic-gate ushort_t length; 6037c478bd9Sstevel@tonic-gate char *data; 6047c478bd9Sstevel@tonic-gate }; 6057c478bd9Sstevel@tonic-gate typedef struct au_uauth_tok au_uauth_tok_t; 6067c478bd9Sstevel@tonic-gate 6077c478bd9Sstevel@tonic-gate struct au_token { 6087c478bd9Sstevel@tonic-gate char id; 6097c478bd9Sstevel@tonic-gate struct au_token *next; 6107c478bd9Sstevel@tonic-gate struct au_token *prev; 6117c478bd9Sstevel@tonic-gate char *data; 6127c478bd9Sstevel@tonic-gate ushort_t size; 6137c478bd9Sstevel@tonic-gate union { 6147c478bd9Sstevel@tonic-gate au_arg32_tok_t arg32; 6157c478bd9Sstevel@tonic-gate au_arg64_tok_t arg64; 6167c478bd9Sstevel@tonic-gate au_acl_tok_t acl; 6177c478bd9Sstevel@tonic-gate au_attr32_tok_t attr32; 6187c478bd9Sstevel@tonic-gate au_attr64_tok_t attr64; 6197c478bd9Sstevel@tonic-gate au_data_tok_t data; 6207c478bd9Sstevel@tonic-gate au_exit_tok_t exit; 6217c478bd9Sstevel@tonic-gate au_file32_tok_t file32; 6227c478bd9Sstevel@tonic-gate au_file64_tok_t file64; 6237c478bd9Sstevel@tonic-gate au_groups_tok_t groups; 6247c478bd9Sstevel@tonic-gate au_header32_tok_t header32; 6257c478bd9Sstevel@tonic-gate au_header64_tok_t header64; 6267c478bd9Sstevel@tonic-gate au_inaddr_tok_t inaddr; 6277c478bd9Sstevel@tonic-gate au_ip_tok_t ip; 6287c478bd9Sstevel@tonic-gate au_ipc_perm_tok_t ipc_perm; 6297c478bd9Sstevel@tonic-gate au_ipc_tok_t ipc; 6307c478bd9Sstevel@tonic-gate au_iport_tok_t iport; 6317c478bd9Sstevel@tonic-gate au_invalid_tok_t invalid; 6327c478bd9Sstevel@tonic-gate au_opaque_tok_t opaque; 6337c478bd9Sstevel@tonic-gate au_path_tok_t path; 6347c478bd9Sstevel@tonic-gate au_proc32_tok_t proc32; 6357c478bd9Sstevel@tonic-gate au_proc64_tok_t proc64; 6367c478bd9Sstevel@tonic-gate au_ret32_tok_t ret32; 6377c478bd9Sstevel@tonic-gate au_ret64_tok_t ret64; 6387c478bd9Sstevel@tonic-gate au_server_tok_t server; 6397c478bd9Sstevel@tonic-gate au_seq_tok_t seq; 6407c478bd9Sstevel@tonic-gate au_socket_tok_t socket; 6417c478bd9Sstevel@tonic-gate au_subj32_tok_t subj32; 6427c478bd9Sstevel@tonic-gate au_subj64_tok_t subj64; 6437c478bd9Sstevel@tonic-gate au_text_tok_t text; 6447c478bd9Sstevel@tonic-gate au_trailer_tok_t trailer; 6457c478bd9Sstevel@tonic-gate au_uauth_tok_t useofauth; 6467c478bd9Sstevel@tonic-gate } un; 6477c478bd9Sstevel@tonic-gate }; 6487c478bd9Sstevel@tonic-gate typedef struct au_token au_token_t; 6497c478bd9Sstevel@tonic-gate 6507c478bd9Sstevel@tonic-gate 6517c478bd9Sstevel@tonic-gate /* 6527c478bd9Sstevel@tonic-gate * Old socket structure definition, formerly in <sys/socketvar.h> 6537c478bd9Sstevel@tonic-gate */ 6547c478bd9Sstevel@tonic-gate struct oldsocket { 6557c478bd9Sstevel@tonic-gate short so_type; /* generic type, see socket.h */ 6567c478bd9Sstevel@tonic-gate short so_options; /* from socket call, see socket.h */ 6577c478bd9Sstevel@tonic-gate short so_linger; /* time to linger while closing */ 6587c478bd9Sstevel@tonic-gate short so_state; /* internal state flags SS_*, below */ 6597c478bd9Sstevel@tonic-gate struct inpcb *so_pcb; /* protocol control block */ 6607c478bd9Sstevel@tonic-gate struct protosw *so_proto; /* protocol handle */ 6617c478bd9Sstevel@tonic-gate /* 6627c478bd9Sstevel@tonic-gate * Variables for connection queueing. 6637c478bd9Sstevel@tonic-gate * Socket where accepts occur is so_head in all subsidiary sockets. 6647c478bd9Sstevel@tonic-gate * If so_head is 0, socket is not related to an accept. 6657c478bd9Sstevel@tonic-gate * For head socket so_q0 queues partially completed connections, 6667c478bd9Sstevel@tonic-gate * while so_q is a queue of connections ready to be accepted. 6677c478bd9Sstevel@tonic-gate * If a connection is aborted and it has so_head set, then 6687c478bd9Sstevel@tonic-gate * it has to be pulled out of either so_q0 or so_q. 6697c478bd9Sstevel@tonic-gate * We allow connections to queue up based on current queue lengths 6707c478bd9Sstevel@tonic-gate * and limit on number of queued connections for this socket. 6717c478bd9Sstevel@tonic-gate */ 6727c478bd9Sstevel@tonic-gate struct oldsocket *so_head; /* back pointer to accept socket */ 6737c478bd9Sstevel@tonic-gate struct oldsocket *so_q0; /* queue of partial connections */ 6747c478bd9Sstevel@tonic-gate struct oldsocket *so_q; /* queue of incoming connections */ 6757c478bd9Sstevel@tonic-gate short so_q0len; /* partials on so_q0 */ 6767c478bd9Sstevel@tonic-gate short so_qlen; /* number of connections on so_q */ 6777c478bd9Sstevel@tonic-gate short so_qlimit; /* max number queued connections */ 6787c478bd9Sstevel@tonic-gate short so_timeo; /* connection timeout */ 6797c478bd9Sstevel@tonic-gate ushort_t so_error; /* error affecting connection */ 6807c478bd9Sstevel@tonic-gate short so_pgrp; /* pgrp for signals */ 6817c478bd9Sstevel@tonic-gate ulong_t so_oobmark; /* chars to oob mark */ 6827c478bd9Sstevel@tonic-gate /* 6837c478bd9Sstevel@tonic-gate * Variables for socket buffering. 6847c478bd9Sstevel@tonic-gate */ 6857c478bd9Sstevel@tonic-gate struct sockbuf { 6867c478bd9Sstevel@tonic-gate ulong_t sb_cc; /* actual chars in buffer */ 6877c478bd9Sstevel@tonic-gate ulong_t sb_hiwat; /* max actual char count */ 6887c478bd9Sstevel@tonic-gate ulong_t sb_mbcnt; /* chars of mbufs used */ 6897c478bd9Sstevel@tonic-gate ulong_t sb_mbmax; /* max chars of mbufs to use */ 6907c478bd9Sstevel@tonic-gate ulong_t sb_lowat; /* low water mark (not used yet) */ 6917c478bd9Sstevel@tonic-gate struct mbuf *sb_mb; /* the mbuf chain */ 6927c478bd9Sstevel@tonic-gate struct proc *sb_sel; /* process selecting read/write */ 6937c478bd9Sstevel@tonic-gate short sb_timeo; /* timeout (not used yet) */ 6947c478bd9Sstevel@tonic-gate short sb_flags; /* flags, see below */ 6957c478bd9Sstevel@tonic-gate } so_rcv, so_snd; 6967c478bd9Sstevel@tonic-gate /* 6977c478bd9Sstevel@tonic-gate * Hooks for alternative wakeup strategies. 6987c478bd9Sstevel@tonic-gate * These are used by kernel subsystems wishing to access the socket 6997c478bd9Sstevel@tonic-gate * abstraction. If so_wupfunc is nonnull, it is called in place of 7007c478bd9Sstevel@tonic-gate * wakeup any time that wakeup would otherwise be called with an 7017c478bd9Sstevel@tonic-gate * argument whose value is an address lying within a socket structure. 7027c478bd9Sstevel@tonic-gate */ 7037c478bd9Sstevel@tonic-gate struct wupalt *so_wupalt; 7047c478bd9Sstevel@tonic-gate }; 7057c478bd9Sstevel@tonic-gate extern token_t *au_to_arg32(char, char *, uint32_t); 7067c478bd9Sstevel@tonic-gate extern token_t *au_to_arg64(char, char *, uint64_t); 7077c478bd9Sstevel@tonic-gate extern token_t *au_to_acl(struct acl *); 7087c478bd9Sstevel@tonic-gate extern token_t *au_to_attr(struct vattr *); 7097c478bd9Sstevel@tonic-gate extern token_t *au_to_cmd(uint_t, char **, char **); 7107c478bd9Sstevel@tonic-gate extern token_t *au_to_data(char, char, char, char *); 7117c478bd9Sstevel@tonic-gate extern token_t *au_to_exec_args(char **); 7127c478bd9Sstevel@tonic-gate extern token_t *au_to_exec_env(char **); 7137c478bd9Sstevel@tonic-gate extern token_t *au_to_exit(int, int); 714103b2b15Sgww extern token_t *au_to_fmri(char *); 7157c478bd9Sstevel@tonic-gate extern token_t *au_to_groups(int *); 7167c478bd9Sstevel@tonic-gate extern token_t *au_to_newgroups(int, gid_t *); 7177c478bd9Sstevel@tonic-gate extern token_t *au_to_header(au_event_t, au_emod_t); 7187c478bd9Sstevel@tonic-gate extern token_t *au_to_header_ex(au_event_t, au_emod_t); 7197c478bd9Sstevel@tonic-gate extern token_t *au_to_in_addr(struct in_addr *); 7207c478bd9Sstevel@tonic-gate extern token_t *au_to_in_addr_ex(int32_t *); 7217c478bd9Sstevel@tonic-gate extern token_t *au_to_ipc(char, int); 7227c478bd9Sstevel@tonic-gate extern token_t *au_to_ipc_perm(struct ipc_perm *); 7237c478bd9Sstevel@tonic-gate extern token_t *au_to_iport(ushort_t); 7247c478bd9Sstevel@tonic-gate extern token_t *au_to_me(void); 72545916cd2Sjpk extern token_t *au_to_mylabel(void); 7267c478bd9Sstevel@tonic-gate extern token_t *au_to_opaque(char *, short); 7277c478bd9Sstevel@tonic-gate extern token_t *au_to_path(char *); 7287c478bd9Sstevel@tonic-gate extern token_t *au_to_privset(const char *, const priv_set_t *); 7297c478bd9Sstevel@tonic-gate extern token_t *au_to_process(au_id_t, uid_t, gid_t, uid_t, gid_t, 7307c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_t *); 7317c478bd9Sstevel@tonic-gate extern token_t *au_to_process_ex(au_id_t, uid_t, gid_t, uid_t, gid_t, 7327c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_addr_t *); 7337c478bd9Sstevel@tonic-gate extern token_t *au_to_return32(char, uint32_t); 7347c478bd9Sstevel@tonic-gate extern token_t *au_to_return64(char, uint64_t); 7357c478bd9Sstevel@tonic-gate extern token_t *au_to_seq(int); 73681490fd2Sgww extern token_t *au_to_label(m_label_t *); 7377c478bd9Sstevel@tonic-gate extern token_t *au_to_socket(struct oldsocket *); 7387c478bd9Sstevel@tonic-gate extern token_t *au_to_socket_ex(short, short, 7397c478bd9Sstevel@tonic-gate struct sockaddr *, struct sockaddr *); 7407c478bd9Sstevel@tonic-gate extern token_t *au_to_sock_inet(struct sockaddr_in *); 7417c478bd9Sstevel@tonic-gate extern token_t *au_to_subject(au_id_t, uid_t, gid_t, uid_t, gid_t, 7427c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_t *); 7437c478bd9Sstevel@tonic-gate extern token_t *au_to_subject_ex(au_id_t, uid_t, gid_t, uid_t, gid_t, 7447c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_addr_t *); 7457c478bd9Sstevel@tonic-gate extern token_t *au_to_text(char *); 7467c478bd9Sstevel@tonic-gate extern token_t *au_to_tid(au_generic_tid_t *); 7477c478bd9Sstevel@tonic-gate extern token_t *au_to_trailer(void); 7487c478bd9Sstevel@tonic-gate extern token_t *au_to_uauth(char *); 7497c478bd9Sstevel@tonic-gate extern token_t *au_to_xatom(ushort_t, char *); 7507c478bd9Sstevel@tonic-gate extern token_t *au_to_xobj(int, int, int); 7517c478bd9Sstevel@tonic-gate extern token_t *au_to_xproto(pid_t); 7527c478bd9Sstevel@tonic-gate extern token_t *au_to_xselect(char *, char *, short, char *); 7537c478bd9Sstevel@tonic-gate extern token_t *au_to_zonename(char *); 7547c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 7557c478bd9Sstevel@tonic-gate 7567c478bd9Sstevel@tonic-gate #ifdef _KERNEL 7577c478bd9Sstevel@tonic-gate 7587c478bd9Sstevel@tonic-gate void adr_char(adr_t *, char *, int); 7597c478bd9Sstevel@tonic-gate void adr_int32(adr_t *, int32_t *, int); 7607c478bd9Sstevel@tonic-gate void adr_uint32(adr_t *, uint32_t *, int); 7617c478bd9Sstevel@tonic-gate void adr_int64(adr_t *, int64_t *, int); 7627c478bd9Sstevel@tonic-gate void adr_uint64(adr_t *, uint64_t *, int); 7637c478bd9Sstevel@tonic-gate void adr_short(adr_t *, short *, int); 7647c478bd9Sstevel@tonic-gate void adr_ushort(adr_t *, ushort_t *, int); 7657c478bd9Sstevel@tonic-gate void adr_start(adr_t *, char *); 7667c478bd9Sstevel@tonic-gate 7677c478bd9Sstevel@tonic-gate char *adr_getchar(adr_t *, char *); 7687c478bd9Sstevel@tonic-gate char *adr_getshort(adr_t *, short *); 7697c478bd9Sstevel@tonic-gate char *adr_getushort(adr_t *, ushort_t *); 7707c478bd9Sstevel@tonic-gate char *adr_getint32(adr_t *, int32_t *); 7717c478bd9Sstevel@tonic-gate char *adr_getuint32(adr_t *, uint32_t *); 7727c478bd9Sstevel@tonic-gate char *adr_getint64(adr_t *, int64_t *); 7737c478bd9Sstevel@tonic-gate char *adr_getuint64(adr_t *, uint64_t *); 7747c478bd9Sstevel@tonic-gate 7757c478bd9Sstevel@tonic-gate int adr_count(adr_t *); 7767c478bd9Sstevel@tonic-gate 7777c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 7787c478bd9Sstevel@tonic-gate 7797c478bd9Sstevel@tonic-gate #ifdef __cplusplus 7807c478bd9Sstevel@tonic-gate } 7817c478bd9Sstevel@tonic-gate #endif 7827c478bd9Sstevel@tonic-gate 7837c478bd9Sstevel@tonic-gate #endif /* _BSM_AUDIT_RECORD_H */ 784