1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _BSM_AUDIT_RECORD_H 28*7c478bd9Sstevel@tonic-gate #define _BSM_AUDIT_RECORD_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 33*7c478bd9Sstevel@tonic-gate #include <sys/priv.h> 34*7c478bd9Sstevel@tonic-gate #else 35*7c478bd9Sstevel@tonic-gate #include <priv.h> 36*7c478bd9Sstevel@tonic-gate #endif 37*7c478bd9Sstevel@tonic-gate #include <sys/socket.h> 38*7c478bd9Sstevel@tonic-gate #include <sys/acl.h> 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #if defined(TSOL) && defined(_KERNEL) 41*7c478bd9Sstevel@tonic-gate #include <sys/tsol/label.h> 42*7c478bd9Sstevel@tonic-gate #endif /* TSOL && _KERNEL */ 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 45*7c478bd9Sstevel@tonic-gate extern "C" { 46*7c478bd9Sstevel@tonic-gate #endif 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* 49*7c478bd9Sstevel@tonic-gate * Version of audit attributes 50*7c478bd9Sstevel@tonic-gate * 51*7c478bd9Sstevel@tonic-gate * OS Release Version Number Comments 52*7c478bd9Sstevel@tonic-gate * ========== ============== ======== 53*7c478bd9Sstevel@tonic-gate * SunOS 5.1 2 Unbundled Package 54*7c478bd9Sstevel@tonic-gate * SunOS 5.3 2 Bundled into the base OS 55*7c478bd9Sstevel@tonic-gate * SunOS 5.4-5.x 2 56*7c478bd9Sstevel@tonic-gate * Trusted Solaris 2.5 3 To distinguish potential new tokens 57*7c478bd9Sstevel@tonic-gate * Trusted Solaris 7-8 4 Redefine X tokens that overlap with 58*7c478bd9Sstevel@tonic-gate * SunOS 5.7 59*7c478bd9Sstevel@tonic-gate */ 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate #ifdef TSOL 62*7c478bd9Sstevel@tonic-gate #define TOKEN_VERSION 4 63*7c478bd9Sstevel@tonic-gate #else /* !TSOL */ 64*7c478bd9Sstevel@tonic-gate #define TOKEN_VERSION 2 65*7c478bd9Sstevel@tonic-gate #endif /* TSOL */ 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * Audit record token type codes 69*7c478bd9Sstevel@tonic-gate */ 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate /* 72*7c478bd9Sstevel@tonic-gate * Control token types 73*7c478bd9Sstevel@tonic-gate */ 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate #define AUT_INVALID ((char)0x00) 76*7c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE ((char)0x11) 77*7c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE32 AUT_OTHER_FILE 78*7c478bd9Sstevel@tonic-gate #define AUT_OHEADER ((char)0x12) 79*7c478bd9Sstevel@tonic-gate #define AUT_TRAILER ((char)0x13) 80*7c478bd9Sstevel@tonic-gate #define AUT_HEADER ((char)0x14) 81*7c478bd9Sstevel@tonic-gate #define AUT_HEADER32 AUT_HEADER 82*7c478bd9Sstevel@tonic-gate #define AUT_HEADER32_EX ((char)0x15) 83*7c478bd9Sstevel@tonic-gate #define AUT_TRAILER_MAGIC ((short)0xB105) 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate /* 86*7c478bd9Sstevel@tonic-gate * Data token types 87*7c478bd9Sstevel@tonic-gate */ 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate #define AUT_DATA ((char)0x21) 90*7c478bd9Sstevel@tonic-gate #define AUT_IPC ((char)0x22) 91*7c478bd9Sstevel@tonic-gate #define AUT_PATH ((char)0x23) 92*7c478bd9Sstevel@tonic-gate #define AUT_SUBJECT ((char)0x24) 93*7c478bd9Sstevel@tonic-gate #define AUT_SUBJECT32 AUT_SUBJECT 94*7c478bd9Sstevel@tonic-gate #define AUT_XATPATH ((char)0x25) 95*7c478bd9Sstevel@tonic-gate #define AUT_PROCESS ((char)0x26) 96*7c478bd9Sstevel@tonic-gate #define AUT_PROCESS32 AUT_PROCESS 97*7c478bd9Sstevel@tonic-gate #define AUT_RETURN ((char)0x27) 98*7c478bd9Sstevel@tonic-gate #define AUT_RETURN32 AUT_RETURN 99*7c478bd9Sstevel@tonic-gate #define AUT_TEXT ((char)0x28) 100*7c478bd9Sstevel@tonic-gate #define AUT_OPAQUE ((char)0x29) 101*7c478bd9Sstevel@tonic-gate #define AUT_IN_ADDR ((char)0x2A) 102*7c478bd9Sstevel@tonic-gate #define AUT_IP ((char)0x2B) 103*7c478bd9Sstevel@tonic-gate #define AUT_IPORT ((char)0x2C) 104*7c478bd9Sstevel@tonic-gate #define AUT_ARG ((char)0x2D) 105*7c478bd9Sstevel@tonic-gate #define AUT_ARG32 AUT_ARG 106*7c478bd9Sstevel@tonic-gate #define AUT_SOCKET ((char)0x2E) 107*7c478bd9Sstevel@tonic-gate #define AUT_SEQ ((char)0x2F) 108*7c478bd9Sstevel@tonic-gate #define AUT_TID ((char)0x61) 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate /* 111*7c478bd9Sstevel@tonic-gate * Modifier token types 112*7c478bd9Sstevel@tonic-gate */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate #define AUT_ACL ((char)0x30) 115*7c478bd9Sstevel@tonic-gate #define AUT_ATTR ((char)0x31) 116*7c478bd9Sstevel@tonic-gate #define AUT_IPC_PERM ((char)0x32) 117*7c478bd9Sstevel@tonic-gate #define AUT_LABEL ((char)0x33) 118*7c478bd9Sstevel@tonic-gate #define AUT_GROUPS ((char)0x34) 119*7c478bd9Sstevel@tonic-gate #define AUT_ILABEL ((char)0x35) 120*7c478bd9Sstevel@tonic-gate #define AUT_SLABEL ((char)0x36) 121*7c478bd9Sstevel@tonic-gate #define AUT_CLEAR ((char)0x37) 122*7c478bd9Sstevel@tonic-gate #define AUT_PRIV ((char)0x38) 123*7c478bd9Sstevel@tonic-gate #define AUT_UPRIV ((char)0x39) 124*7c478bd9Sstevel@tonic-gate #define AUT_LIAISON ((char)0x3A) 125*7c478bd9Sstevel@tonic-gate #define AUT_NEWGROUPS ((char)0x3B) 126*7c478bd9Sstevel@tonic-gate #define AUT_EXEC_ARGS ((char)0x3C) 127*7c478bd9Sstevel@tonic-gate #define AUT_EXEC_ENV ((char)0x3D) 128*7c478bd9Sstevel@tonic-gate #define AUT_ATTR32 ((char)0x3E) 129*7c478bd9Sstevel@tonic-gate #define AUT_UAUTH ((char)0x3F) 130*7c478bd9Sstevel@tonic-gate #define AUT_ZONENAME ((char)0x60) 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate /* 133*7c478bd9Sstevel@tonic-gate * X windows token types 134*7c478bd9Sstevel@tonic-gate */ 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate #define AUT_XATOM ((char)0x40) 137*7c478bd9Sstevel@tonic-gate #define AUT_XOBJ ((char)0x41) 138*7c478bd9Sstevel@tonic-gate #define AUT_XPROTO ((char)0x42) 139*7c478bd9Sstevel@tonic-gate #define AUT_XSELECT ((char)0x43) 140*7c478bd9Sstevel@tonic-gate 141*7c478bd9Sstevel@tonic-gate #if TOKEN_VERSION != 3 142*7c478bd9Sstevel@tonic-gate #define AUT_XCOLORMAP ((char)0x44) 143*7c478bd9Sstevel@tonic-gate #define AUT_XCURSOR ((char)0x45) 144*7c478bd9Sstevel@tonic-gate #define AUT_XFONT ((char)0x46) 145*7c478bd9Sstevel@tonic-gate #define AUT_XGC ((char)0x47) 146*7c478bd9Sstevel@tonic-gate #define AUT_XPIXMAP ((char)0x48) 147*7c478bd9Sstevel@tonic-gate #define AUT_XPROPERTY ((char)0x49) 148*7c478bd9Sstevel@tonic-gate #define AUT_XWINDOW ((char)0x4A) 149*7c478bd9Sstevel@tonic-gate #define AUT_XCLIENT ((char)0x4B) 150*7c478bd9Sstevel@tonic-gate #else /* TOKEN_VERSION == 3 */ 151*7c478bd9Sstevel@tonic-gate #define AUT_XCOLORMAP ((char)0x74) 152*7c478bd9Sstevel@tonic-gate #define AUT_XCURSOR ((char)0x75) 153*7c478bd9Sstevel@tonic-gate #define AUT_XFONT ((char)0x76) 154*7c478bd9Sstevel@tonic-gate #define AUT_XGC ((char)0x77) 155*7c478bd9Sstevel@tonic-gate #define AUT_XPIXMAP ((char)0x78) 156*7c478bd9Sstevel@tonic-gate #define AUT_XPROPERTY ((char)0x79) 157*7c478bd9Sstevel@tonic-gate #define AUT_XWINDOW ((char)0x7A) 158*7c478bd9Sstevel@tonic-gate #define AUT_XCLIENT ((char)0x7B) 159*7c478bd9Sstevel@tonic-gate #endif /* TOKEN_VERSION != 3 */ 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * Command token types 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate #define AUT_CMD ((char)0x51) 166*7c478bd9Sstevel@tonic-gate #define AUT_EXIT ((char)0x52) 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate /* 169*7c478bd9Sstevel@tonic-gate * Miscellaneous token types 170*7c478bd9Sstevel@tonic-gate */ 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate #define AUT_HOST ((char)0x70) 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate /* 175*7c478bd9Sstevel@tonic-gate * Solaris64 token types 176*7c478bd9Sstevel@tonic-gate */ 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate #define AUT_ARG64 ((char)0x71) 179*7c478bd9Sstevel@tonic-gate #define AUT_RETURN64 ((char)0x72) 180*7c478bd9Sstevel@tonic-gate #define AUT_ATTR64 ((char)0x73) 181*7c478bd9Sstevel@tonic-gate #define AUT_HEADER64 ((char)0x74) 182*7c478bd9Sstevel@tonic-gate #define AUT_SUBJECT64 ((char)0x75) 183*7c478bd9Sstevel@tonic-gate #define AUT_PROCESS64 ((char)0x77) 184*7c478bd9Sstevel@tonic-gate #define AUT_OTHER_FILE64 ((char)0x78) 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate /* 187*7c478bd9Sstevel@tonic-gate * Extended network address token types 188*7c478bd9Sstevel@tonic-gate */ 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate #define AUT_HEADER64_EX ((char)0x79) 191*7c478bd9Sstevel@tonic-gate #define AUT_SUBJECT32_EX ((char)0x7a) 192*7c478bd9Sstevel@tonic-gate #define AUT_PROCESS32_EX ((char)0x7b) 193*7c478bd9Sstevel@tonic-gate #define AUT_SUBJECT64_EX ((char)0x7c) 194*7c478bd9Sstevel@tonic-gate #define AUT_PROCESS64_EX ((char)0x7d) 195*7c478bd9Sstevel@tonic-gate #define AUT_IN_ADDR_EX ((char)0x7e) 196*7c478bd9Sstevel@tonic-gate #define AUT_SOCKET_EX ((char)0x7f) 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate /* 200*7c478bd9Sstevel@tonic-gate * Audit print suggestion types. 201*7c478bd9Sstevel@tonic-gate */ 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate #define AUP_BINARY ((char)0) 204*7c478bd9Sstevel@tonic-gate #define AUP_OCTAL ((char)1) 205*7c478bd9Sstevel@tonic-gate #define AUP_DECIMAL ((char)2) 206*7c478bd9Sstevel@tonic-gate #define AUP_HEX ((char)3) 207*7c478bd9Sstevel@tonic-gate #define AUP_STRING ((char)4) 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate /* 210*7c478bd9Sstevel@tonic-gate * Audit data member types. 211*7c478bd9Sstevel@tonic-gate */ 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate #define AUR_BYTE ((char)0) 214*7c478bd9Sstevel@tonic-gate #define AUR_CHAR ((char)0) 215*7c478bd9Sstevel@tonic-gate #define AUR_SHORT ((char)1) 216*7c478bd9Sstevel@tonic-gate #define AUR_INT ((char)2) 217*7c478bd9Sstevel@tonic-gate #define AUR_INT32 ((char)2) 218*7c478bd9Sstevel@tonic-gate #define AUR_INT64 ((char)3) 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate /* 221*7c478bd9Sstevel@tonic-gate * Adr structures 222*7c478bd9Sstevel@tonic-gate */ 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate struct adr_s { 225*7c478bd9Sstevel@tonic-gate char *adr_stream; /* The base of the stream */ 226*7c478bd9Sstevel@tonic-gate char *adr_now; /* The location within the stream */ 227*7c478bd9Sstevel@tonic-gate }; 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate typedef struct adr_s adr_t; 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate #include <sys/param.h> 235*7c478bd9Sstevel@tonic-gate #include <sys/systm.h> /* for rval */ 236*7c478bd9Sstevel@tonic-gate #include <sys/time.h> 237*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 238*7c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 239*7c478bd9Sstevel@tonic-gate #include <sys/mode.h> 240*7c478bd9Sstevel@tonic-gate #include <sys/user.h> 241*7c478bd9Sstevel@tonic-gate #include <sys/session.h> 242*7c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h> 243*7c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h> 244*7c478bd9Sstevel@tonic-gate #include <netinet/in.h> 245*7c478bd9Sstevel@tonic-gate #include <netinet/ip.h> 246*7c478bd9Sstevel@tonic-gate #include <sys/socket.h> 247*7c478bd9Sstevel@tonic-gate #include <net/route.h> 248*7c478bd9Sstevel@tonic-gate #include <netinet/in_pcb.h> 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate /* 251*7c478bd9Sstevel@tonic-gate * au_close flag arguments 252*7c478bd9Sstevel@tonic-gate */ 253*7c478bd9Sstevel@tonic-gate 254*7c478bd9Sstevel@tonic-gate #define AU_OK 0x1 /* Good audit record */ 255*7c478bd9Sstevel@tonic-gate #define AU_DONTBLOCK 0x2 /* Don't block or discard if queue full */ 256*7c478bd9Sstevel@tonic-gate #define AU_DEFER 0x4 /* Defer record queueing to syscall end */ 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate /* 259*7c478bd9Sstevel@tonic-gate * Audit token type is really an au_membuf pointer 260*7c478bd9Sstevel@tonic-gate */ 261*7c478bd9Sstevel@tonic-gate typedef au_buff_t token_t; 262*7c478bd9Sstevel@tonic-gate /* 263*7c478bd9Sstevel@tonic-gate * token generation functions 264*7c478bd9Sstevel@tonic-gate */ 265*7c478bd9Sstevel@tonic-gate token_t *au_append_token(token_t *, token_t *); 266*7c478bd9Sstevel@tonic-gate token_t *au_set(caddr_t, uint_t); 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate void au_free_rec(au_buff_t *); 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate #define au_getclr() ((token_t *)au_get_buff()) 271*7c478bd9Sstevel@tonic-gate #define au_toss_token(tok) (au_free_rec((au_buff_t *)(tok))) 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate token_t *au_to_acl(); 274*7c478bd9Sstevel@tonic-gate token_t *au_to_attr(struct vattr *); 275*7c478bd9Sstevel@tonic-gate token_t *au_to_data(char, char, char, char *); 276*7c478bd9Sstevel@tonic-gate token_t *au_to_header(int, au_event_t, au_emod_t); 277*7c478bd9Sstevel@tonic-gate token_t *au_to_header_ex(int, au_event_t, au_emod_t); 278*7c478bd9Sstevel@tonic-gate token_t *au_to_ipc(char, int); 279*7c478bd9Sstevel@tonic-gate token_t *au_to_ipc_perm(kipc_perm_t *); 280*7c478bd9Sstevel@tonic-gate token_t *au_to_iport(ushort_t); 281*7c478bd9Sstevel@tonic-gate token_t *au_to_in_addr(struct in_addr *); 282*7c478bd9Sstevel@tonic-gate token_t *au_to_in_addr_ex(int32_t *); 283*7c478bd9Sstevel@tonic-gate token_t *au_to_ip(struct ip *); 284*7c478bd9Sstevel@tonic-gate token_t *au_to_groups(const gid_t *, uint_t); 285*7c478bd9Sstevel@tonic-gate token_t *au_to_path(struct audit_path *); 286*7c478bd9Sstevel@tonic-gate token_t *au_to_seq(); 287*7c478bd9Sstevel@tonic-gate token_t *au_to_process(uid_t, gid_t, uid_t, gid_t, pid_t, 288*7c478bd9Sstevel@tonic-gate au_id_t, au_asid_t, const au_tid_addr_t *); 289*7c478bd9Sstevel@tonic-gate token_t *au_to_subject(uid_t, gid_t, uid_t, gid_t, pid_t, 290*7c478bd9Sstevel@tonic-gate au_id_t, au_asid_t, const au_tid_addr_t *); 291*7c478bd9Sstevel@tonic-gate token_t *au_to_return32(int, int32_t); 292*7c478bd9Sstevel@tonic-gate token_t *au_to_return64(int, int64_t); 293*7c478bd9Sstevel@tonic-gate token_t *au_to_text(const char *); 294*7c478bd9Sstevel@tonic-gate /* token_t *au_to_tid(au_generic_tid_t *); no kernel implementation */ 295*7c478bd9Sstevel@tonic-gate token_t *au_to_trailer(int); 296*7c478bd9Sstevel@tonic-gate token_t *au_to_uauth(char *); 297*7c478bd9Sstevel@tonic-gate size_t au_zonename_length(void); 298*7c478bd9Sstevel@tonic-gate token_t *au_to_zonename(size_t); 299*7c478bd9Sstevel@tonic-gate token_t *au_to_arg32(char, char *, uint32_t); 300*7c478bd9Sstevel@tonic-gate token_t *au_to_arg64(char, char *, uint64_t); 301*7c478bd9Sstevel@tonic-gate token_t *au_to_socket(struct socket *); 302*7c478bd9Sstevel@tonic-gate token_t *au_to_socket_ex(short, short, char *, char *); 303*7c478bd9Sstevel@tonic-gate token_t *au_to_sock_inet(struct sockaddr_in *); 304*7c478bd9Sstevel@tonic-gate token_t *au_to_exec_args(const char *, ssize_t); 305*7c478bd9Sstevel@tonic-gate token_t *au_to_exec_env(const char *, ssize_t); 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate #ifdef TSOL 308*7c478bd9Sstevel@tonic-gate token_t *au_to_clearance(bclear_t *); 309*7c478bd9Sstevel@tonic-gate token_t *au_to_host(void); 310*7c478bd9Sstevel@tonic-gate token_t *au_to_ilabel(bilabel_t *); 311*7c478bd9Sstevel@tonic-gate token_t *au_to_priv(priv_t, int); 312*7c478bd9Sstevel@tonic-gate token_t *au_to_privilege(priv_set_t *, char); 313*7c478bd9Sstevel@tonic-gate token_t *au_to_slabel(bslabel_t *); 314*7c478bd9Sstevel@tonic-gate #endif /* TSOL */ 315*7c478bd9Sstevel@tonic-gate token_t *au_to_privset(const char *, const priv_set_t *, char, int); 316*7c478bd9Sstevel@tonic-gate 317*7c478bd9Sstevel@tonic-gate void au_uwrite(); 318*7c478bd9Sstevel@tonic-gate void au_close(au_kcontext_t *, caddr_t *, int, au_event_t, au_emod_t); 319*7c478bd9Sstevel@tonic-gate void au_close_defer(token_t *, int, au_event_t, au_emod_t); 320*7c478bd9Sstevel@tonic-gate void au_close_time(au_kcontext_t *, token_t *, int, au_event_t, au_emod_t, 321*7c478bd9Sstevel@tonic-gate timestruc_t *); 322*7c478bd9Sstevel@tonic-gate void au_free_rec(au_buff_t *); 323*7c478bd9Sstevel@tonic-gate void au_write(caddr_t *, token_t *); 324*7c478bd9Sstevel@tonic-gate void au_mem_init(void); 325*7c478bd9Sstevel@tonic-gate void au_zone_setup(); 326*7c478bd9Sstevel@tonic-gate void au_enqueue(au_kcontext_t *, au_buff_t *, adr_t *, adr_t *, int, int); 327*7c478bd9Sstevel@tonic-gate int au_doorio(au_kcontext_t *); 328*7c478bd9Sstevel@tonic-gate int au_doormsg(au_kcontext_t *, uint32_t, void *); 329*7c478bd9Sstevel@tonic-gate int au_doio(struct vnode *, int); 330*7c478bd9Sstevel@tonic-gate int au_token_size(token_t *); 331*7c478bd9Sstevel@tonic-gate int au_append_rec(au_buff_t *, au_buff_t *, int); 332*7c478bd9Sstevel@tonic-gate int au_append_buf(const char *, int, au_buff_t *); 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate #else /* !_KERNEL */ 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gate #include <limits.h> 337*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 338*7c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 339*7c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h> 340*7c478bd9Sstevel@tonic-gate #include <netinet/in.h> 341*7c478bd9Sstevel@tonic-gate #include <netinet/ip.h> 342*7c478bd9Sstevel@tonic-gate #include <sys/ipc.h> 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate struct token_s { 345*7c478bd9Sstevel@tonic-gate struct token_s *tt_next; /* Next in the list */ 346*7c478bd9Sstevel@tonic-gate short tt_size; /* Size of data */ 347*7c478bd9Sstevel@tonic-gate char *tt_data; /* The data */ 348*7c478bd9Sstevel@tonic-gate }; 349*7c478bd9Sstevel@tonic-gate typedef struct token_s token_t; 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate struct au_arg32_tok { 352*7c478bd9Sstevel@tonic-gate uchar_t num; 353*7c478bd9Sstevel@tonic-gate uint32_t val; 354*7c478bd9Sstevel@tonic-gate ushort_t length; 355*7c478bd9Sstevel@tonic-gate char *data; 356*7c478bd9Sstevel@tonic-gate }; 357*7c478bd9Sstevel@tonic-gate typedef struct au_arg32_tok au_arg32_tok_t; 358*7c478bd9Sstevel@tonic-gate 359*7c478bd9Sstevel@tonic-gate struct au_acl_tok { 360*7c478bd9Sstevel@tonic-gate ulong_t type; 361*7c478bd9Sstevel@tonic-gate ulong_t id; 362*7c478bd9Sstevel@tonic-gate ulong_t mode; 363*7c478bd9Sstevel@tonic-gate }; 364*7c478bd9Sstevel@tonic-gate typedef struct au_acl_tok au_acl_tok_t; 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate struct au_arg64_tok { 367*7c478bd9Sstevel@tonic-gate uchar_t num; 368*7c478bd9Sstevel@tonic-gate uint64_t val; 369*7c478bd9Sstevel@tonic-gate ushort_t length; 370*7c478bd9Sstevel@tonic-gate char *data; 371*7c478bd9Sstevel@tonic-gate }; 372*7c478bd9Sstevel@tonic-gate typedef struct au_arg64_tok au_arg64_tok_t; 373*7c478bd9Sstevel@tonic-gate 374*7c478bd9Sstevel@tonic-gate struct au_attr_tok { 375*7c478bd9Sstevel@tonic-gate uint_t mode; 376*7c478bd9Sstevel@tonic-gate uint_t uid; 377*7c478bd9Sstevel@tonic-gate uint_t gid; 378*7c478bd9Sstevel@tonic-gate int fs; 379*7c478bd9Sstevel@tonic-gate int32_t node; 380*7c478bd9Sstevel@tonic-gate uint32_t dev; 381*7c478bd9Sstevel@tonic-gate }; 382*7c478bd9Sstevel@tonic-gate typedef struct au_attr_tok au_attr_tok_t; 383*7c478bd9Sstevel@tonic-gate 384*7c478bd9Sstevel@tonic-gate struct au_attr32_tok { 385*7c478bd9Sstevel@tonic-gate uint_t mode; 386*7c478bd9Sstevel@tonic-gate uint_t uid; 387*7c478bd9Sstevel@tonic-gate uint_t gid; 388*7c478bd9Sstevel@tonic-gate int fs; 389*7c478bd9Sstevel@tonic-gate int64_t node; 390*7c478bd9Sstevel@tonic-gate uint32_t dev; 391*7c478bd9Sstevel@tonic-gate }; 392*7c478bd9Sstevel@tonic-gate typedef struct au_attr32_tok au_attr32_tok_t; 393*7c478bd9Sstevel@tonic-gate 394*7c478bd9Sstevel@tonic-gate struct au_attr64_tok { 395*7c478bd9Sstevel@tonic-gate uint_t mode; 396*7c478bd9Sstevel@tonic-gate uint_t uid; 397*7c478bd9Sstevel@tonic-gate uint_t gid; 398*7c478bd9Sstevel@tonic-gate int fs; 399*7c478bd9Sstevel@tonic-gate int64_t node; 400*7c478bd9Sstevel@tonic-gate uint64_t dev; 401*7c478bd9Sstevel@tonic-gate }; 402*7c478bd9Sstevel@tonic-gate typedef struct au_attr64_tok au_attr64_tok_t; 403*7c478bd9Sstevel@tonic-gate 404*7c478bd9Sstevel@tonic-gate struct au_data_tok { 405*7c478bd9Sstevel@tonic-gate uchar_t pfmt; 406*7c478bd9Sstevel@tonic-gate uchar_t size; 407*7c478bd9Sstevel@tonic-gate uchar_t number; 408*7c478bd9Sstevel@tonic-gate char *data; 409*7c478bd9Sstevel@tonic-gate }; 410*7c478bd9Sstevel@tonic-gate typedef struct au_data_tok au_data_tok_t; 411*7c478bd9Sstevel@tonic-gate 412*7c478bd9Sstevel@tonic-gate struct au_exit_tok { 413*7c478bd9Sstevel@tonic-gate int status; 414*7c478bd9Sstevel@tonic-gate int retval; 415*7c478bd9Sstevel@tonic-gate }; 416*7c478bd9Sstevel@tonic-gate typedef struct au_exit_tok au_exit_tok_t; 417*7c478bd9Sstevel@tonic-gate 418*7c478bd9Sstevel@tonic-gate struct au_file32_tok { 419*7c478bd9Sstevel@tonic-gate /* really struct timeval from gettimeofday() */ 420*7c478bd9Sstevel@tonic-gate int32_t sec; /* seconds since epoc */ 421*7c478bd9Sstevel@tonic-gate int32_t usec; /* microseconds */ 422*7c478bd9Sstevel@tonic-gate ushort_t length; 423*7c478bd9Sstevel@tonic-gate char *fname; 424*7c478bd9Sstevel@tonic-gate }; 425*7c478bd9Sstevel@tonic-gate typedef struct au_file32_tok au_file32_tok_t; 426*7c478bd9Sstevel@tonic-gate 427*7c478bd9Sstevel@tonic-gate struct au_file64_tok { 428*7c478bd9Sstevel@tonic-gate /* really struct timeval */ 429*7c478bd9Sstevel@tonic-gate int64_t sec; /* seconds since epoc */ 430*7c478bd9Sstevel@tonic-gate int64_t usec; /* microseconds */ 431*7c478bd9Sstevel@tonic-gate ushort_t length; 432*7c478bd9Sstevel@tonic-gate char *fname; 433*7c478bd9Sstevel@tonic-gate }; 434*7c478bd9Sstevel@tonic-gate typedef struct au_file64_tok au_file64_tok_t; 435*7c478bd9Sstevel@tonic-gate 436*7c478bd9Sstevel@tonic-gate 437*7c478bd9Sstevel@tonic-gate struct au_groups_tok { 438*7c478bd9Sstevel@tonic-gate gid_t groups[NGROUPS_MAX]; 439*7c478bd9Sstevel@tonic-gate }; 440*7c478bd9Sstevel@tonic-gate typedef struct au_groups_tok au_groups_tok_t; 441*7c478bd9Sstevel@tonic-gate 442*7c478bd9Sstevel@tonic-gate struct au_header32_tok { 443*7c478bd9Sstevel@tonic-gate uint_t length; 444*7c478bd9Sstevel@tonic-gate uchar_t version; 445*7c478bd9Sstevel@tonic-gate au_event_t event; 446*7c478bd9Sstevel@tonic-gate ushort_t emod; 447*7c478bd9Sstevel@tonic-gate /* really timestruct_t (struct timespec) from hrestime */ 448*7c478bd9Sstevel@tonic-gate int32_t sec; /* seconds since epoc */ 449*7c478bd9Sstevel@tonic-gate int32_t nsec; /* nanoseconds */ 450*7c478bd9Sstevel@tonic-gate }; 451*7c478bd9Sstevel@tonic-gate typedef struct au_header32_tok au_header32_tok_t; 452*7c478bd9Sstevel@tonic-gate 453*7c478bd9Sstevel@tonic-gate struct au_header64_tok { 454*7c478bd9Sstevel@tonic-gate uint_t length; 455*7c478bd9Sstevel@tonic-gate uchar_t version; 456*7c478bd9Sstevel@tonic-gate au_event_t event; 457*7c478bd9Sstevel@tonic-gate ushort_t emod; 458*7c478bd9Sstevel@tonic-gate /* really timestruct_t (struct timespec) from hrestime */ 459*7c478bd9Sstevel@tonic-gate int64_t sec; /* seconds since epoc */ 460*7c478bd9Sstevel@tonic-gate int64_t nsec; /* nanoseconds */ 461*7c478bd9Sstevel@tonic-gate }; 462*7c478bd9Sstevel@tonic-gate typedef struct au_header64_tok au_header64_tok_t; 463*7c478bd9Sstevel@tonic-gate 464*7c478bd9Sstevel@tonic-gate struct au_inaddr_tok { 465*7c478bd9Sstevel@tonic-gate struct in_addr ia; 466*7c478bd9Sstevel@tonic-gate }; 467*7c478bd9Sstevel@tonic-gate typedef struct au_inaddr_tok au_inaddr_tok_t; 468*7c478bd9Sstevel@tonic-gate 469*7c478bd9Sstevel@tonic-gate struct au_ip_tok { 470*7c478bd9Sstevel@tonic-gate uchar_t version; 471*7c478bd9Sstevel@tonic-gate struct ip ip; 472*7c478bd9Sstevel@tonic-gate }; 473*7c478bd9Sstevel@tonic-gate typedef struct au_ip_tok au_ip_tok_t; 474*7c478bd9Sstevel@tonic-gate 475*7c478bd9Sstevel@tonic-gate struct au_ipc_tok { 476*7c478bd9Sstevel@tonic-gate key_t id; 477*7c478bd9Sstevel@tonic-gate }; 478*7c478bd9Sstevel@tonic-gate typedef struct au_ipc_tok au_ipc_tok_t; 479*7c478bd9Sstevel@tonic-gate 480*7c478bd9Sstevel@tonic-gate struct au_ipc_perm_tok { 481*7c478bd9Sstevel@tonic-gate struct ipc_perm ipc_perm; 482*7c478bd9Sstevel@tonic-gate }; 483*7c478bd9Sstevel@tonic-gate typedef struct au_ipc_perm_tok au_ipc_perm_tok_t; 484*7c478bd9Sstevel@tonic-gate 485*7c478bd9Sstevel@tonic-gate struct au_iport_tok { 486*7c478bd9Sstevel@tonic-gate ushort_t iport; 487*7c478bd9Sstevel@tonic-gate }; 488*7c478bd9Sstevel@tonic-gate typedef struct au_iport_tok au_iport_tok_t; 489*7c478bd9Sstevel@tonic-gate 490*7c478bd9Sstevel@tonic-gate struct au_invalid_tok { 491*7c478bd9Sstevel@tonic-gate ushort_t length; 492*7c478bd9Sstevel@tonic-gate char *data; 493*7c478bd9Sstevel@tonic-gate }; 494*7c478bd9Sstevel@tonic-gate typedef struct au_invalid_tok au_invalid_tok_t; 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate struct au_opaque_tok { 497*7c478bd9Sstevel@tonic-gate ushort_t length; 498*7c478bd9Sstevel@tonic-gate char *data; 499*7c478bd9Sstevel@tonic-gate }; 500*7c478bd9Sstevel@tonic-gate typedef struct au_opaque_tok au_opaque_tok_t; 501*7c478bd9Sstevel@tonic-gate 502*7c478bd9Sstevel@tonic-gate struct au_path_tok { 503*7c478bd9Sstevel@tonic-gate ushort_t length; 504*7c478bd9Sstevel@tonic-gate char *name; 505*7c478bd9Sstevel@tonic-gate }; 506*7c478bd9Sstevel@tonic-gate typedef struct au_path_tok au_path_tok_t; 507*7c478bd9Sstevel@tonic-gate 508*7c478bd9Sstevel@tonic-gate struct au_tid32 { 509*7c478bd9Sstevel@tonic-gate uint32_t port; 510*7c478bd9Sstevel@tonic-gate uint32_t machine; 511*7c478bd9Sstevel@tonic-gate }; 512*7c478bd9Sstevel@tonic-gate typedef struct au_tid32 au_tid32_t; 513*7c478bd9Sstevel@tonic-gate 514*7c478bd9Sstevel@tonic-gate struct au_tid64 { 515*7c478bd9Sstevel@tonic-gate uint64_t port; 516*7c478bd9Sstevel@tonic-gate uint32_t machine; 517*7c478bd9Sstevel@tonic-gate }; 518*7c478bd9Sstevel@tonic-gate typedef struct au_tid64 au_tid64_t; 519*7c478bd9Sstevel@tonic-gate 520*7c478bd9Sstevel@tonic-gate struct au_proc32_tok { 521*7c478bd9Sstevel@tonic-gate au_id_t auid; 522*7c478bd9Sstevel@tonic-gate uid_t euid; 523*7c478bd9Sstevel@tonic-gate gid_t egid; 524*7c478bd9Sstevel@tonic-gate uid_t ruid; 525*7c478bd9Sstevel@tonic-gate gid_t rgid; 526*7c478bd9Sstevel@tonic-gate pid_t pid; 527*7c478bd9Sstevel@tonic-gate pid_t sid; 528*7c478bd9Sstevel@tonic-gate au_tid32_t tid; 529*7c478bd9Sstevel@tonic-gate }; 530*7c478bd9Sstevel@tonic-gate typedef struct au_proc32_tok au_proc32_tok_t; 531*7c478bd9Sstevel@tonic-gate 532*7c478bd9Sstevel@tonic-gate struct au_proc64_tok { 533*7c478bd9Sstevel@tonic-gate au_id_t auid; 534*7c478bd9Sstevel@tonic-gate uid_t euid; 535*7c478bd9Sstevel@tonic-gate gid_t egid; 536*7c478bd9Sstevel@tonic-gate uid_t ruid; 537*7c478bd9Sstevel@tonic-gate gid_t rgid; 538*7c478bd9Sstevel@tonic-gate pid_t pid; 539*7c478bd9Sstevel@tonic-gate pid_t sid; 540*7c478bd9Sstevel@tonic-gate au_tid64_t tid; 541*7c478bd9Sstevel@tonic-gate }; 542*7c478bd9Sstevel@tonic-gate typedef struct au_proc64_tok au_proc64_tok_t; 543*7c478bd9Sstevel@tonic-gate 544*7c478bd9Sstevel@tonic-gate struct au_ret32_tok { 545*7c478bd9Sstevel@tonic-gate uchar_t error; 546*7c478bd9Sstevel@tonic-gate uint32_t retval; 547*7c478bd9Sstevel@tonic-gate }; 548*7c478bd9Sstevel@tonic-gate typedef struct au_ret32_tok au_ret32_tok_t; 549*7c478bd9Sstevel@tonic-gate 550*7c478bd9Sstevel@tonic-gate struct au_ret64_tok { 551*7c478bd9Sstevel@tonic-gate uchar_t error; 552*7c478bd9Sstevel@tonic-gate uint64_t retval; 553*7c478bd9Sstevel@tonic-gate }; 554*7c478bd9Sstevel@tonic-gate typedef struct au_ret64_tok au_ret64_tok_t; 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate struct au_seq_tok { 557*7c478bd9Sstevel@tonic-gate uint_t num; 558*7c478bd9Sstevel@tonic-gate }; 559*7c478bd9Sstevel@tonic-gate typedef struct au_seq_tok au_seq_tok_t; 560*7c478bd9Sstevel@tonic-gate 561*7c478bd9Sstevel@tonic-gate struct au_socket_tok { 562*7c478bd9Sstevel@tonic-gate short type; 563*7c478bd9Sstevel@tonic-gate ushort_t lport; 564*7c478bd9Sstevel@tonic-gate struct in_addr laddr; 565*7c478bd9Sstevel@tonic-gate ushort_t fport; 566*7c478bd9Sstevel@tonic-gate struct in_addr faddr; 567*7c478bd9Sstevel@tonic-gate }; 568*7c478bd9Sstevel@tonic-gate typedef struct au_socket_tok au_socket_tok_t; 569*7c478bd9Sstevel@tonic-gate 570*7c478bd9Sstevel@tonic-gate struct au_subj32_tok { 571*7c478bd9Sstevel@tonic-gate au_id_t auid; 572*7c478bd9Sstevel@tonic-gate uid_t euid; 573*7c478bd9Sstevel@tonic-gate gid_t egid; 574*7c478bd9Sstevel@tonic-gate uid_t ruid; 575*7c478bd9Sstevel@tonic-gate gid_t rgid; 576*7c478bd9Sstevel@tonic-gate pid_t pid; 577*7c478bd9Sstevel@tonic-gate pid_t sid; 578*7c478bd9Sstevel@tonic-gate au_tid32_t tid; 579*7c478bd9Sstevel@tonic-gate }; 580*7c478bd9Sstevel@tonic-gate typedef struct au_subj32_tok au_subj32_tok_t; 581*7c478bd9Sstevel@tonic-gate 582*7c478bd9Sstevel@tonic-gate struct au_subj64_tok { 583*7c478bd9Sstevel@tonic-gate au_id_t auid; 584*7c478bd9Sstevel@tonic-gate uid_t euid; 585*7c478bd9Sstevel@tonic-gate gid_t egid; 586*7c478bd9Sstevel@tonic-gate uid_t ruid; 587*7c478bd9Sstevel@tonic-gate gid_t rgid; 588*7c478bd9Sstevel@tonic-gate pid_t pid; 589*7c478bd9Sstevel@tonic-gate pid_t sid; 590*7c478bd9Sstevel@tonic-gate au_tid64_t tid; 591*7c478bd9Sstevel@tonic-gate }; 592*7c478bd9Sstevel@tonic-gate typedef struct au_subj64_tok au_subj64_tok_t; 593*7c478bd9Sstevel@tonic-gate 594*7c478bd9Sstevel@tonic-gate struct au_server_tok { 595*7c478bd9Sstevel@tonic-gate au_id_t auid; 596*7c478bd9Sstevel@tonic-gate uid_t euid; 597*7c478bd9Sstevel@tonic-gate uid_t ruid; 598*7c478bd9Sstevel@tonic-gate gid_t egid; 599*7c478bd9Sstevel@tonic-gate pid_t pid; 600*7c478bd9Sstevel@tonic-gate }; 601*7c478bd9Sstevel@tonic-gate typedef struct au_server_tok au_server_tok_t; 602*7c478bd9Sstevel@tonic-gate 603*7c478bd9Sstevel@tonic-gate struct au_text_tok { 604*7c478bd9Sstevel@tonic-gate ushort_t length; 605*7c478bd9Sstevel@tonic-gate char *data; 606*7c478bd9Sstevel@tonic-gate }; 607*7c478bd9Sstevel@tonic-gate typedef struct au_text_tok au_text_tok_t; 608*7c478bd9Sstevel@tonic-gate 609*7c478bd9Sstevel@tonic-gate struct au_trailer_tok { 610*7c478bd9Sstevel@tonic-gate ushort_t magic; 611*7c478bd9Sstevel@tonic-gate uint_t length; 612*7c478bd9Sstevel@tonic-gate }; 613*7c478bd9Sstevel@tonic-gate typedef struct au_trailer_tok au_trailer_tok_t; 614*7c478bd9Sstevel@tonic-gate 615*7c478bd9Sstevel@tonic-gate struct au_uauth_tok { 616*7c478bd9Sstevel@tonic-gate ushort_t length; 617*7c478bd9Sstevel@tonic-gate char *data; 618*7c478bd9Sstevel@tonic-gate }; 619*7c478bd9Sstevel@tonic-gate typedef struct au_uauth_tok au_uauth_tok_t; 620*7c478bd9Sstevel@tonic-gate 621*7c478bd9Sstevel@tonic-gate struct au_token { 622*7c478bd9Sstevel@tonic-gate char id; 623*7c478bd9Sstevel@tonic-gate struct au_token *next; 624*7c478bd9Sstevel@tonic-gate struct au_token *prev; 625*7c478bd9Sstevel@tonic-gate char *data; 626*7c478bd9Sstevel@tonic-gate ushort_t size; 627*7c478bd9Sstevel@tonic-gate union { 628*7c478bd9Sstevel@tonic-gate au_arg32_tok_t arg32; 629*7c478bd9Sstevel@tonic-gate au_arg64_tok_t arg64; 630*7c478bd9Sstevel@tonic-gate au_acl_tok_t acl; 631*7c478bd9Sstevel@tonic-gate au_attr32_tok_t attr32; 632*7c478bd9Sstevel@tonic-gate au_attr64_tok_t attr64; 633*7c478bd9Sstevel@tonic-gate au_data_tok_t data; 634*7c478bd9Sstevel@tonic-gate au_exit_tok_t exit; 635*7c478bd9Sstevel@tonic-gate au_file32_tok_t file32; 636*7c478bd9Sstevel@tonic-gate au_file64_tok_t file64; 637*7c478bd9Sstevel@tonic-gate au_groups_tok_t groups; 638*7c478bd9Sstevel@tonic-gate au_header32_tok_t header32; 639*7c478bd9Sstevel@tonic-gate au_header64_tok_t header64; 640*7c478bd9Sstevel@tonic-gate au_inaddr_tok_t inaddr; 641*7c478bd9Sstevel@tonic-gate au_ip_tok_t ip; 642*7c478bd9Sstevel@tonic-gate au_ipc_perm_tok_t ipc_perm; 643*7c478bd9Sstevel@tonic-gate au_ipc_tok_t ipc; 644*7c478bd9Sstevel@tonic-gate au_iport_tok_t iport; 645*7c478bd9Sstevel@tonic-gate au_invalid_tok_t invalid; 646*7c478bd9Sstevel@tonic-gate au_opaque_tok_t opaque; 647*7c478bd9Sstevel@tonic-gate au_path_tok_t path; 648*7c478bd9Sstevel@tonic-gate au_proc32_tok_t proc32; 649*7c478bd9Sstevel@tonic-gate au_proc64_tok_t proc64; 650*7c478bd9Sstevel@tonic-gate au_ret32_tok_t ret32; 651*7c478bd9Sstevel@tonic-gate au_ret64_tok_t ret64; 652*7c478bd9Sstevel@tonic-gate au_server_tok_t server; 653*7c478bd9Sstevel@tonic-gate au_seq_tok_t seq; 654*7c478bd9Sstevel@tonic-gate au_socket_tok_t socket; 655*7c478bd9Sstevel@tonic-gate au_subj32_tok_t subj32; 656*7c478bd9Sstevel@tonic-gate au_subj64_tok_t subj64; 657*7c478bd9Sstevel@tonic-gate au_text_tok_t text; 658*7c478bd9Sstevel@tonic-gate au_trailer_tok_t trailer; 659*7c478bd9Sstevel@tonic-gate au_uauth_tok_t useofauth; 660*7c478bd9Sstevel@tonic-gate } un; 661*7c478bd9Sstevel@tonic-gate }; 662*7c478bd9Sstevel@tonic-gate typedef struct au_token au_token_t; 663*7c478bd9Sstevel@tonic-gate 664*7c478bd9Sstevel@tonic-gate 665*7c478bd9Sstevel@tonic-gate /* 666*7c478bd9Sstevel@tonic-gate * Old socket structure definition, formerly in <sys/socketvar.h> 667*7c478bd9Sstevel@tonic-gate */ 668*7c478bd9Sstevel@tonic-gate struct oldsocket { 669*7c478bd9Sstevel@tonic-gate short so_type; /* generic type, see socket.h */ 670*7c478bd9Sstevel@tonic-gate short so_options; /* from socket call, see socket.h */ 671*7c478bd9Sstevel@tonic-gate short so_linger; /* time to linger while closing */ 672*7c478bd9Sstevel@tonic-gate short so_state; /* internal state flags SS_*, below */ 673*7c478bd9Sstevel@tonic-gate struct inpcb *so_pcb; /* protocol control block */ 674*7c478bd9Sstevel@tonic-gate struct protosw *so_proto; /* protocol handle */ 675*7c478bd9Sstevel@tonic-gate /* 676*7c478bd9Sstevel@tonic-gate * Variables for connection queueing. 677*7c478bd9Sstevel@tonic-gate * Socket where accepts occur is so_head in all subsidiary sockets. 678*7c478bd9Sstevel@tonic-gate * If so_head is 0, socket is not related to an accept. 679*7c478bd9Sstevel@tonic-gate * For head socket so_q0 queues partially completed connections, 680*7c478bd9Sstevel@tonic-gate * while so_q is a queue of connections ready to be accepted. 681*7c478bd9Sstevel@tonic-gate * If a connection is aborted and it has so_head set, then 682*7c478bd9Sstevel@tonic-gate * it has to be pulled out of either so_q0 or so_q. 683*7c478bd9Sstevel@tonic-gate * We allow connections to queue up based on current queue lengths 684*7c478bd9Sstevel@tonic-gate * and limit on number of queued connections for this socket. 685*7c478bd9Sstevel@tonic-gate */ 686*7c478bd9Sstevel@tonic-gate struct oldsocket *so_head; /* back pointer to accept socket */ 687*7c478bd9Sstevel@tonic-gate struct oldsocket *so_q0; /* queue of partial connections */ 688*7c478bd9Sstevel@tonic-gate struct oldsocket *so_q; /* queue of incoming connections */ 689*7c478bd9Sstevel@tonic-gate short so_q0len; /* partials on so_q0 */ 690*7c478bd9Sstevel@tonic-gate short so_qlen; /* number of connections on so_q */ 691*7c478bd9Sstevel@tonic-gate short so_qlimit; /* max number queued connections */ 692*7c478bd9Sstevel@tonic-gate short so_timeo; /* connection timeout */ 693*7c478bd9Sstevel@tonic-gate ushort_t so_error; /* error affecting connection */ 694*7c478bd9Sstevel@tonic-gate short so_pgrp; /* pgrp for signals */ 695*7c478bd9Sstevel@tonic-gate ulong_t so_oobmark; /* chars to oob mark */ 696*7c478bd9Sstevel@tonic-gate /* 697*7c478bd9Sstevel@tonic-gate * Variables for socket buffering. 698*7c478bd9Sstevel@tonic-gate */ 699*7c478bd9Sstevel@tonic-gate struct sockbuf { 700*7c478bd9Sstevel@tonic-gate ulong_t sb_cc; /* actual chars in buffer */ 701*7c478bd9Sstevel@tonic-gate ulong_t sb_hiwat; /* max actual char count */ 702*7c478bd9Sstevel@tonic-gate ulong_t sb_mbcnt; /* chars of mbufs used */ 703*7c478bd9Sstevel@tonic-gate ulong_t sb_mbmax; /* max chars of mbufs to use */ 704*7c478bd9Sstevel@tonic-gate ulong_t sb_lowat; /* low water mark (not used yet) */ 705*7c478bd9Sstevel@tonic-gate struct mbuf *sb_mb; /* the mbuf chain */ 706*7c478bd9Sstevel@tonic-gate struct proc *sb_sel; /* process selecting read/write */ 707*7c478bd9Sstevel@tonic-gate short sb_timeo; /* timeout (not used yet) */ 708*7c478bd9Sstevel@tonic-gate short sb_flags; /* flags, see below */ 709*7c478bd9Sstevel@tonic-gate } so_rcv, so_snd; 710*7c478bd9Sstevel@tonic-gate /* 711*7c478bd9Sstevel@tonic-gate * Hooks for alternative wakeup strategies. 712*7c478bd9Sstevel@tonic-gate * These are used by kernel subsystems wishing to access the socket 713*7c478bd9Sstevel@tonic-gate * abstraction. If so_wupfunc is nonnull, it is called in place of 714*7c478bd9Sstevel@tonic-gate * wakeup any time that wakeup would otherwise be called with an 715*7c478bd9Sstevel@tonic-gate * argument whose value is an address lying within a socket structure. 716*7c478bd9Sstevel@tonic-gate */ 717*7c478bd9Sstevel@tonic-gate struct wupalt *so_wupalt; 718*7c478bd9Sstevel@tonic-gate }; 719*7c478bd9Sstevel@tonic-gate extern token_t *au_to_arg32(char, char *, uint32_t); 720*7c478bd9Sstevel@tonic-gate extern token_t *au_to_arg64(char, char *, uint64_t); 721*7c478bd9Sstevel@tonic-gate extern token_t *au_to_acl(struct acl *); 722*7c478bd9Sstevel@tonic-gate extern token_t *au_to_attr(struct vattr *); 723*7c478bd9Sstevel@tonic-gate extern token_t *au_to_cmd(uint_t, char **, char **); 724*7c478bd9Sstevel@tonic-gate extern token_t *au_to_data(char, char, char, char *); 725*7c478bd9Sstevel@tonic-gate extern token_t *au_to_exec_args(char **); 726*7c478bd9Sstevel@tonic-gate extern token_t *au_to_exec_env(char **); 727*7c478bd9Sstevel@tonic-gate extern token_t *au_to_exit(int, int); 728*7c478bd9Sstevel@tonic-gate extern token_t *au_to_groups(int *); 729*7c478bd9Sstevel@tonic-gate extern token_t *au_to_newgroups(int, gid_t *); 730*7c478bd9Sstevel@tonic-gate extern token_t *au_to_header(au_event_t, au_emod_t); 731*7c478bd9Sstevel@tonic-gate extern token_t *au_to_header_ex(au_event_t, au_emod_t); 732*7c478bd9Sstevel@tonic-gate extern token_t *au_to_in_addr(struct in_addr *); 733*7c478bd9Sstevel@tonic-gate extern token_t *au_to_in_addr_ex(int32_t *); 734*7c478bd9Sstevel@tonic-gate extern token_t *au_to_ipc(char, int); 735*7c478bd9Sstevel@tonic-gate extern token_t *au_to_ipc_perm(struct ipc_perm *); 736*7c478bd9Sstevel@tonic-gate extern token_t *au_to_iport(ushort_t); 737*7c478bd9Sstevel@tonic-gate extern token_t *au_to_me(void); 738*7c478bd9Sstevel@tonic-gate extern token_t *au_to_opaque(char *, short); 739*7c478bd9Sstevel@tonic-gate extern token_t *au_to_path(char *); 740*7c478bd9Sstevel@tonic-gate extern token_t *au_to_privset(const char *, const priv_set_t *); 741*7c478bd9Sstevel@tonic-gate extern token_t *au_to_process(au_id_t, uid_t, gid_t, uid_t, gid_t, 742*7c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_t *); 743*7c478bd9Sstevel@tonic-gate extern token_t *au_to_process_ex(au_id_t, uid_t, gid_t, uid_t, gid_t, 744*7c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_addr_t *); 745*7c478bd9Sstevel@tonic-gate extern token_t *au_to_return32(char, uint32_t); 746*7c478bd9Sstevel@tonic-gate extern token_t *au_to_return64(char, uint64_t); 747*7c478bd9Sstevel@tonic-gate extern token_t *au_to_seq(int); 748*7c478bd9Sstevel@tonic-gate extern token_t *au_to_socket(struct oldsocket *); 749*7c478bd9Sstevel@tonic-gate extern token_t *au_to_socket_ex(short, short, 750*7c478bd9Sstevel@tonic-gate struct sockaddr *, struct sockaddr *); 751*7c478bd9Sstevel@tonic-gate extern token_t *au_to_sock_inet(struct sockaddr_in *); 752*7c478bd9Sstevel@tonic-gate extern token_t *au_to_subject(au_id_t, uid_t, gid_t, uid_t, gid_t, 753*7c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_t *); 754*7c478bd9Sstevel@tonic-gate extern token_t *au_to_subject_ex(au_id_t, uid_t, gid_t, uid_t, gid_t, 755*7c478bd9Sstevel@tonic-gate pid_t, au_asid_t, au_tid_addr_t *); 756*7c478bd9Sstevel@tonic-gate extern token_t *au_to_text(char *); 757*7c478bd9Sstevel@tonic-gate extern token_t *au_to_tid(au_generic_tid_t *); 758*7c478bd9Sstevel@tonic-gate extern token_t *au_to_trailer(void); 759*7c478bd9Sstevel@tonic-gate extern token_t *au_to_uauth(char *); 760*7c478bd9Sstevel@tonic-gate extern token_t *au_to_xatom(ushort_t, char *); 761*7c478bd9Sstevel@tonic-gate extern token_t *au_to_xobj(int, int, int); 762*7c478bd9Sstevel@tonic-gate extern token_t *au_to_xproto(pid_t); 763*7c478bd9Sstevel@tonic-gate extern token_t *au_to_xselect(char *, char *, short, char *); 764*7c478bd9Sstevel@tonic-gate extern token_t *au_to_zonename(char *); 765*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 766*7c478bd9Sstevel@tonic-gate 767*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 768*7c478bd9Sstevel@tonic-gate 769*7c478bd9Sstevel@tonic-gate void adr_char(adr_t *, char *, int); 770*7c478bd9Sstevel@tonic-gate void adr_int32(adr_t *, int32_t *, int); 771*7c478bd9Sstevel@tonic-gate void adr_uint32(adr_t *, uint32_t *, int); 772*7c478bd9Sstevel@tonic-gate void adr_int64(adr_t *, int64_t *, int); 773*7c478bd9Sstevel@tonic-gate void adr_uint64(adr_t *, uint64_t *, int); 774*7c478bd9Sstevel@tonic-gate void adr_short(adr_t *, short *, int); 775*7c478bd9Sstevel@tonic-gate void adr_ushort(adr_t *, ushort_t *, int); 776*7c478bd9Sstevel@tonic-gate void adr_start(adr_t *, char *); 777*7c478bd9Sstevel@tonic-gate 778*7c478bd9Sstevel@tonic-gate char *adr_getchar(adr_t *, char *); 779*7c478bd9Sstevel@tonic-gate char *adr_getshort(adr_t *, short *); 780*7c478bd9Sstevel@tonic-gate char *adr_getushort(adr_t *, ushort_t *); 781*7c478bd9Sstevel@tonic-gate char *adr_getint32(adr_t *, int32_t *); 782*7c478bd9Sstevel@tonic-gate char *adr_getuint32(adr_t *, uint32_t *); 783*7c478bd9Sstevel@tonic-gate char *adr_getint64(adr_t *, int64_t *); 784*7c478bd9Sstevel@tonic-gate char *adr_getuint64(adr_t *, uint64_t *); 785*7c478bd9Sstevel@tonic-gate 786*7c478bd9Sstevel@tonic-gate int adr_count(adr_t *); 787*7c478bd9Sstevel@tonic-gate 788*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 789*7c478bd9Sstevel@tonic-gate 790*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 791*7c478bd9Sstevel@tonic-gate } 792*7c478bd9Sstevel@tonic-gate #endif 793*7c478bd9Sstevel@tonic-gate 794*7c478bd9Sstevel@tonic-gate #endif /* _BSM_AUDIT_RECORD_H */ 795