4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
27 * This file does not provide any user callable functions. See adt.c
31 #include <bsm/adt_event.h>
32 #include <bsm/audit.h>
34 #include <adt_xlate.h>
45 #include <sys/priv_names.h>
46 #include <sys/socket.h>
47 #include <sys/types.h>
48 #include <sys/vnode.h>
51 #define DPRINTF(x) { (void) printf x; }
52 #define DFLUSH (void) fflush(stdout);
54 /* 0x + Classification + Compartments + end of string */
55 #define HEX_SIZE 2 + 2*2 + 2*32 + 1
62 static adt_token_func_t
adt_getTokenFunction(char);
64 static char *empty
= "";
67 * call adt_token_open() first and adt_token_close() last.
69 * au_open is sort of broken; it returns a -1 when out of memory that
70 * you're supposed to ignore; au_write and au_close return without
71 * doing anything when a -1 is passed. This code sort of follows the
72 * au_open model except that it calls syslog to indicate underlying
73 * brokenness. Other than that, -1 is ignored.
77 adt_token_open(struct adt_event_state
*event
)
79 static int have_syslogged
= 0;
81 event
->ae_event_handle
= au_open();
82 if (event
->ae_event_handle
< 0) {
83 if (!have_syslogged
) {
84 adt_write_syslog("au_open failed", ENOMEM
);
93 * call generate_token for each token in the order you want the tokens
98 adt_generate_token(struct entry
*p_entry
, void *p_data
,
99 struct adt_event_state
*event
)
101 adt_token_func_t p_func
;
103 assert((p_entry
!= NULL
) && (p_data
!= NULL
) && (event
!= NULL
));
105 p_func
= adt_getTokenFunction(p_entry
->en_token_id
);
106 assert(p_func
!= NULL
);
108 DPRINTF(("p_entry=%p, p_data=%p, offset=%llu, msgFmt=%s\n",
109 (void *)p_entry
, p_data
, (long long)p_entry
->en_offset
,
110 p_entry
->en_msg_format
));
113 (*p_func
)(p_entry
->en_type_def
,
114 (char *)p_data
+ p_entry
->en_offset
, p_entry
->en_required
, event
,
115 p_entry
->en_msg_format
);
121 adt_token_close(struct adt_event_state
*event
)
125 rc
= au_close(event
->ae_event_handle
, AU_TO_WRITE
,
126 event
->ae_internal_id
);
128 adt_write_syslog("au_close failed", errno
);
133 * one function per token -- see the jump table at the end of file
138 adt_to_return(datadef
*def
, void *p_data
, int required
,
139 struct adt_event_state
*event
, char *notUsed
)
143 (void) au_write(event
->ae_event_handle
,
144 au_to_return64((int64_t)event
->ae_rc
, event
->ae_type
));
146 (void) au_write(event
->ae_event_handle
,
147 au_to_return32((int32_t)event
->ae_rc
, event
->ae_type
));
154 * the command line is described with argc and argv and the environment
155 * with envp. The envp list is NULL terminated and has no separate
156 * counter; envp will be a NULL list unless the AUDIT_ARGE policy is
162 adt_to_cmd(datadef
*def
, void *p_data
, int required
,
163 struct adt_event_state
*event
, char *notUsed
)
165 struct adt_internal_state
*sp
= event
->ae_session
;
170 argc
= ((union convert
*)p_data
)->tint
;
171 p_data
= adt_adjust_address(p_data
, sizeof (int), sizeof (char **));
172 argv
= ((union convert
*)p_data
)->tchar2star
;
173 p_data
= adt_adjust_address(p_data
, sizeof (char **), sizeof (char **));
175 if (sp
->as_kernel_audit_policy
& AUDIT_ARGE
)
176 envp
= ((union convert
*)p_data
)->tchar2star
;
178 (void) au_write(event
->ae_event_handle
,
179 au_to_cmd(argc
, argv
, envp
));
183 * special case of AUT_CMD with 1 argument that is
184 * a string showing the whole command and no envp
188 adt_to_cmd1(datadef
*def
, void *p_data
, int required
,
189 struct adt_event_state
*event
, char *notUsed
)
193 string
= ((union convert
*)p_data
)->tcharstar
;
195 if (string
== NULL
) {
202 /* argc is hardcoded as 1 */
203 (void) au_write(event
->ae_event_handle
, au_to_cmd(1, &string
,
208 * adt_to_tid -- generic address (ip is only one defined at present)
210 * terminal type: ADT_IPv4, ADT_IPv6...
211 * case: ADT_IPv4 or ADT_IPv6...
216 * case: not defined...
220 adt_to_tid(datadef
*def
, void *p_data
, int required
,
221 struct adt_event_state
*event
, char *notUsed
)
223 au_generic_tid_t tid
;
227 type
= ((union convert
*)p_data
)->tuint32
;
232 p_data
= adt_adjust_address(p_data
, sizeof (uint32_t),
235 tid
.gt_type
= AU_IPADR
;
236 ip
= &(tid
.gt_adr
.at_ip
);
238 ip
->at_type
= (type
== ADT_IPv4
) ?
241 ip
->at_r_port
= ((union convert
*)p_data
)->tuint16
;
242 p_data
= adt_adjust_address(p_data
, sizeof (uint16_t),
245 ip
->at_l_port
= ((union convert
*)p_data
)->tuint16
;
247 /* arg3 is for the array element, not the array size */
248 p_data
= adt_adjust_address(p_data
, sizeof (uint16_t),
251 (void) memcpy(ip
->at_addr
, p_data
, ip
->at_type
);
254 adt_write_syslog("Invalid terminal id type", EINVAL
);
257 (void) au_write(event
->ae_event_handle
, au_to_tid(&tid
));
261 * au_to_frmi takes a char * that is the fmri.
265 adt_to_frmi(datadef
*def
, void *p_data
, int required
,
266 struct adt_event_state
*event
, char *notUsed
)
270 DPRINTF((" adt_to_fmri dd_datatype=%d\n", def
->dd_datatype
));
272 fmri
= ((union convert
*)p_data
)->tcharstar
;
281 DPRINTF((" fmri=%s\n", fmri
));
282 (void) au_write(event
->ae_event_handle
, au_to_fmri(fmri
));
286 * au_to_newgroups takes a length and an array of gids
287 * as input. The input to adt_to_newgroups is a length
288 * and a pointer to an array of gids.
293 adt_to_newgroups(datadef
*def
, void *p_data
, int required
,
294 struct adt_event_state
*event
, char *notUsed
)
299 n
= ((union convert
*)p_data
)->tint
;
302 n
= 0; /* in case negative n was passed */
307 p_data
= adt_adjust_address(p_data
, sizeof (int), sizeof (int32_t *));
309 groups
= ((union convert
*)p_data
)->tgidstar
;
311 (void) au_write(event
->ae_event_handle
, au_to_newgroups(n
, groups
));
316 adt_to_path(datadef
*def
, void *p_data
, int required
,
317 struct adt_event_state
*event
, char *notUsed
)
321 path
= ((union convert
*)p_data
)->tcharstar
;
324 DPRINTF((" path=%s\n", path
));
325 (void) au_write(event
->ae_event_handle
, au_to_path(path
));
327 DPRINTF((" Null path\n"));
329 (void) au_write(event
->ae_event_handle
,
336 * dummy token id: AUT_PATHLIST
341 adt_to_pathlist(datadef
*def
, void *p_data
, int required
,
342 struct adt_event_state
*event
, char *notUsed
)
349 pathlist
= ((union convert
*)p_data
)->tcharstar
;
351 if (pathlist
!= NULL
) {
352 working_buf
= strdup(pathlist
);
353 if (working_buf
== NULL
) {
354 adt_write_syslog("audit failure", errno
);
356 (void) au_write(event
->ae_event_handle
,
361 for (path
= strtok_r(working_buf
, " ", &last_str
);
362 path
; path
= strtok_r(NULL
, " ", &last_str
)) {
363 DPRINTF((" path=%s\n", path
));
364 (void) au_write(event
->ae_event_handle
,
368 DPRINTF((" Null path list\n"));
370 (void) au_write(event
->ae_event_handle
,
381 adt_to_priv(datadef
*def
, void *p_data
, int required
,
382 struct adt_event_state
*event
, const char *priv_type
)
384 priv_set_t
*privilege
;
386 privilege
= ((union convert
*)p_data
)->tprivstar
;
388 if (privilege
!= NULL
) {
389 (void) au_write(event
->ae_event_handle
,
390 au_to_privset(priv_type
, privilege
));
393 DPRINTF((" Null privilege\n"));
394 (void) au_write(event
->ae_event_handle
,
395 au_to_privset(empty
, NULL
));
401 * -AUT_PRIV_L AUT_PRIV for a limit set
406 adt_to_priv_limit(datadef
*def
, void *p_data
, int required
,
407 struct adt_event_state
*event
, char *notUsed
)
409 adt_to_priv(def
, p_data
, required
, event
, PRIV_LIMIT
);
413 * -AUT_PRIV_I AUT_PRIV for an inherit set
418 adt_to_priv_inherit(datadef
*def
, void *p_data
, int required
,
419 struct adt_event_state
*event
, char *notUsed
)
421 adt_to_priv(def
, p_data
, required
, event
, PRIV_INHERITABLE
);
426 adt_to_priv_effective(datadef
*def
, void *p_data
, int required
,
427 struct adt_event_state
*event
, char *notUsed
)
429 adt_to_priv(def
, p_data
, required
, event
, PRIV_EFFECTIVE
);
433 getCharacteristics(struct auditpinfo_addr
*info
, pid_t
*pid
)
437 if (*pid
== 0) { /* getpinfo for this pid */
438 info
->ap_pid
= getpid();
443 rc
= auditon(A_GETPINFO_ADDR
, (caddr_t
)info
,
444 sizeof (struct auditpinfo_addr
));
446 info
->ap_auid
= AU_NOAUDITID
;
448 (void) memset(&(info
->ap_termid
), 0,
449 sizeof (au_tid_addr_t
));
450 info
->ap_termid
.at_type
= AU_IPv4
;
461 adt_to_process(datadef
*def
, void *p_data
, int required
,
462 struct adt_event_state
*event
, char *notUsed
)
472 struct auditpinfo_addr info
;
474 auid
= ((union convert
*)p_data
)->tuid
;
475 p_data
= adt_adjust_address(p_data
, sizeof (uid_t
), sizeof (uid_t
));
476 euid
= ((union convert
*)p_data
)->tuid
;
477 p_data
= adt_adjust_address(p_data
, sizeof (uid_t
), sizeof (gid_t
));
478 egid
= ((union convert
*)p_data
)->tgid
;
479 p_data
= adt_adjust_address(p_data
, sizeof (gid_t
), sizeof (uid_t
));
480 ruid
= ((union convert
*)p_data
)->tuid
;
481 p_data
= adt_adjust_address(p_data
, sizeof (uid_t
), sizeof (gid_t
));
482 rgid
= ((union convert
*)p_data
)->tgid
;
483 p_data
= adt_adjust_address(p_data
, sizeof (gid_t
), sizeof (pid_t
));
484 pid
= ((union convert
*)p_data
)->tpid
;
485 p_data
= adt_adjust_address(p_data
, sizeof (pid_t
), sizeof (uint32_t));
486 sid
= ((union convert
*)p_data
)->tuint32
;
487 p_data
= adt_adjust_address(p_data
, sizeof (uint32_t),
488 sizeof (au_tid_addr_t
*));
489 tid
= ((union convert
*)p_data
)->ttermid
;
491 getCharacteristics(&info
, &pid
);
493 if (auid
== AU_NOAUDITID
)
496 if (euid
== AU_NOAUDITID
)
499 if (egid
== AU_NOAUDITID
)
502 if (ruid
== AU_NOAUDITID
)
505 if (rgid
== AU_NOAUDITID
)
509 tid
= &(info
.ap_termid
);
517 (void) au_write(event
->ae_event_handle
,
518 au_to_process_ex(auid
, euid
, egid
, ruid
, rgid
, pid
, sid
, tid
));
522 * Generate subject information.
523 * If the group audit policy is set, generate the subject group token.
525 * The required flag does not apply here.
527 * Non-attributable records are indicated by an auid of AU_NOAUDITID;
528 * no subject token or group token is generated for a non-attributable
534 adt_to_subject(datadef
*def
, void *p_data
, int required
,
535 struct adt_event_state
*event
, char *notUsed
)
537 struct adt_internal_state
*sp
= event
->ae_session
;
539 if (sp
->as_info
.ai_auid
== AU_NOAUDITID
)
542 assert(sp
->as_have_user_data
== ADT_HAVE_ALL
);
544 (void) au_write(event
->ae_event_handle
,
545 au_to_subject_ex(sp
->as_info
.ai_auid
,
546 sp
->as_euid
, sp
->as_egid
, sp
->as_ruid
, sp
->as_rgid
,
547 sp
->as_pid
, sp
->as_info
.ai_asid
,
548 &(sp
->as_info
.ai_termid
)));
550 * Add optional tokens if in the process model.
551 * In a session model, the groups list is undefined.
553 if (sp
->as_session_model
== ADT_PROCESS_MODEL
) {
554 if (sp
->as_kernel_audit_policy
& AUDIT_GROUP
) {
556 int maxgrp
= getgroups(0, NULL
);
557 gid_t
*grouplist
= alloca(maxgrp
* sizeof (gid_t
));
559 if ((group_count
= getgroups(maxgrp
, grouplist
)) > 0) {
560 (void) au_write(event
->ae_event_handle
,
561 au_to_newgroups(group_count
, grouplist
));
570 * The format string, normally null, is sort of a wrapper around
571 * the input. adt_write_text() is a wrapper around au_write that
572 * handles the format string
575 #define TEXT_LENGTH 49
578 adt_write_text(int handle
, char *main_text
, const char *format
)
580 char buffer
[TEXT_LENGTH
* 2 + 1];
582 if (format
== NULL
) {
583 (void) au_write(handle
, au_to_text(main_text
));
585 (void) snprintf(buffer
, TEXT_LENGTH
* 2, format
, main_text
);
586 (void) au_write(handle
, au_to_text(buffer
));
591 adt_to_text(datadef
*def
, void *p_data
, int required
,
592 struct adt_event_state
*event
, char *format
)
594 static int have_syslogged
= 0;
597 char buffer
[TEXT_LENGTH
+ 1];
601 int written
, available
;
603 struct msg_text
*list
;
606 DPRINTF((" adt_to_text dd_datatype=%d\n", def
->dd_datatype
));
607 switch (def
->dd_datatype
) {
610 * Consider creating a separate token type for dates
611 * -- store as longs and format them in praudit.
612 * For now, a date is input as a time_t and output as
613 * a text token. If we do this, we need to consider
614 * carrying timezone info so that praudit can
615 * represent times in an unambiguous manner.
617 date
= ((union convert
*)p_data
)->tlong
;
618 if (strftime(buffer
, sizeof (buffer
), "%x",
619 localtime_r(&date
, &tm
)) > TEXT_LENGTH
) {
621 (void) strncpy(buffer
, "invalid date",
627 DPRINTF((" text=%s\n", buffer
));
628 adt_write_text(event
->ae_event_handle
, buffer
, format
);
631 * The "input size" is overloaded to mean the list number
632 * and the msg_selector indexes the desired string in
636 list
= &adt_msg_text
[(enum adt_msg_list
)def
->dd_input_size
];
637 list_index
= ((union convert
*)p_data
)->msg_selector
;
639 if ((list_index
+ list
->ml_offset
< list
->ml_min_index
) ||
640 (list_index
+ list
->ml_offset
> list
->ml_max_index
)) {
641 string
= "Invalid message index";
643 string
= list
->ml_msg_list
[list_index
+
647 if (string
== NULL
) { /* null is valid; means skip */
654 DPRINTF((" text=%s\n", string
));
655 adt_write_text(event
->ae_event_handle
, string
, format
);
661 (void) snprintf(buffer
, TEXT_LENGTH
, "%u",
662 ((union convert
*)p_data
)->tuint
);
664 DPRINTF((" text=%s\n", buffer
));
665 adt_write_text(event
->ae_event_handle
, buffer
, format
);
669 (void) snprintf(buffer
, TEXT_LENGTH
, "%d",
670 ((union convert
*)p_data
)->tint
);
672 DPRINTF((" text=%s\n", buffer
));
673 adt_write_text(event
->ae_event_handle
, buffer
, format
);
676 (void) snprintf(buffer
, TEXT_LENGTH
, "%ld",
677 ((union convert
*)p_data
)->tlong
);
679 DPRINTF((" text=%s\n", buffer
));
680 adt_write_text(event
->ae_event_handle
, buffer
, format
);
685 int_list
= ((union convert
*)p_data
)->tuint32star
;
686 p_data
= adt_adjust_address(p_data
, sizeof (int *),
688 arrayCount
= ((union convert
*)p_data
)->tint
;
691 available
= TEXT_LENGTH
; /* space available in buffer */
696 if ((arrayCount
> 0) && (int_list
!= NULL
)) {
697 for (; arrayCount
> 0; arrayCount
--) {
698 written
= snprintf(string
, available
,
703 available
-= written
;
705 } else if (required
) {
711 adt_write_text(event
->ae_event_handle
, buffer
, format
);
714 (void) snprintf(buffer
, TEXT_LENGTH
, "%lu",
715 ((union convert
*)p_data
)->tulong
);
717 DPRINTF((" text=%s\n", buffer
));
718 adt_write_text(event
->ae_event_handle
, buffer
, format
);
721 (void) snprintf(buffer
, TEXT_LENGTH
, "%llu",
722 ((union convert
*)p_data
)->tuint64
);
724 DPRINTF((" text=%s\n", buffer
));
725 adt_write_text(event
->ae_event_handle
, buffer
, format
);
728 string
= ((union convert
*)p_data
)->tcharstar
;
730 if (string
== NULL
) {
737 DPRINTF((" text=%s\n", string
));
738 adt_write_text(event
->ae_event_handle
, string
, format
);
741 string_list
= ((union convert
*)p_data
)->tchar2star
;
742 p_data
= adt_adjust_address(p_data
, sizeof (char **),
744 arrayCount
= ((union convert
*)p_data
)->tint
;
749 if ((arrayCount
> 0) && (string_list
!= NULL
)) {
750 for (i
= 0; i
< arrayCount
; i
++) {
751 string
= string_list
[i
];
753 adt_write_text(event
->ae_event_handle
,
756 } else if (required
) {
757 adt_write_text(event
->ae_event_handle
, empty
, format
);
763 if (!have_syslogged
) { /* don't flood the log */
764 adt_write_syslog("unsupported data conversion",
779 adt_to_uauth(datadef
*def
, void *p_data
, int required
,
780 struct adt_event_state
*event
, char *format
)
784 DPRINTF((" adt_to_uauth dd_datatype=%d\n", def
->dd_datatype
));
786 string
= ((union convert
*)p_data
)->tcharstar
;
788 if (string
== NULL
) {
795 DPRINTF((" text=%s\n", string
));
796 (void) au_write(event
->ae_event_handle
, au_to_uauth(string
));
805 adt_to_user(datadef
*def
, void *p_data
, int required
,
806 struct adt_event_state
*event
, char *format
)
811 DPRINTF((" adt_to_user dd_datatype=%d\n", def
->dd_datatype
));
813 uid
= ((union convert
*)p_data
)->tuid
;
814 p_data
= adt_adjust_address(p_data
, sizeof (uid_t
), sizeof (uid_t
));
816 username
= ((union convert
*)p_data
)->tcharstar
;
818 if (username
== NULL
) {
825 DPRINTF((" username=%s\n", username
));
826 (void) au_write(event
->ae_event_handle
, au_to_user(uid
, username
));
835 adt_to_zonename(datadef
*def
, void *p_data
, int required
,
836 struct adt_event_state
*event
, char *notUsed
)
840 name
= ((union convert
*)p_data
)->tcharstar
;
843 DPRINTF((" name=%s\n", name
));
844 (void) au_write(event
->ae_event_handle
, au_to_zonename(name
));
846 DPRINTF((" Null name\n"));
848 (void) au_write(event
->ae_event_handle
,
849 au_to_zonename(empty
));
855 * ADT_IN_PEER dummy token
860 adt_to_in_peer(datadef
*def
, void *p_data
, int required
,
861 struct adt_event_state
*event
, char *notUsed
)
864 struct sockaddr_in6 peer
;
865 int peerlen
= sizeof (peer
);
867 DPRINTF((" adt_to_in_peer dd_datatype=%d\n", def
->dd_datatype
));
869 sock
= ((union convert
*)p_data
)->tfd
;
872 DPRINTF((" Socket fd %d\n", sock
));
874 adt_write_syslog("adt_to_in_peer no required socket",
879 if (getpeername(sock
, (struct sockaddr
*)&peer
, (socklen_t
*)&peerlen
)
882 adt_write_syslog("adt_to_in_addr getpeername", errno
);
885 if (peer
.sin6_family
== AF_INET6
) {
886 (void) au_write(event
->ae_event_handle
,
887 au_to_in_addr_ex(&(peer
.sin6_addr
)));
888 (void) au_write(event
->ae_event_handle
,
889 au_to_iport((ushort_t
)peer
.sin6_port
));
891 (void) au_write(event
->ae_event_handle
,
892 au_to_in_addr(&(((struct sockaddr_in
*)&peer
)->sin_addr
)));
893 (void) au_write(event
->ae_event_handle
,
895 (ushort_t
)(((struct sockaddr_in
*)&peer
)->sin_port
)));
900 * ADT_IN_REMOTE dummy token
902 * Similar to ADT_IN_PEER except the input is
903 * an IP address type (ADT_IPv4 | ADT_IPv6) and an address V4/V6
908 adt_to_in_remote(datadef
*def
, void *p_data
, int required
,
909 struct adt_event_state
*event
, char *notUsed
)
913 DPRINTF((" adt_to_in_remote dd_datatype=%d\n", def
->dd_datatype
));
915 type
= ((union convert
*)p_data
)->tuint32
;
921 /* required and not specified */
922 adt_write_syslog("adt_to_in_remote required address not "
926 p_data
= adt_adjust_address(p_data
, sizeof (int32_t),
931 (void) au_write(event
->ae_event_handle
, au_to_in_addr(
932 (struct in_addr
*)&(((union convert
*)p_data
)->tuint32
)));
935 (void) au_write(event
->ae_event_handle
, au_to_in_addr_ex(
936 (struct in6_addr
*)&(((union convert
*)p_data
)->tuint32
)));
939 adt_write_syslog("adt_to_in_remote invalid type", EINVAL
);
945 * adt_to_iport takes a uint16_t IP port.
950 adt_to_iport(datadef
*def
, void *p_data
, int required
,
951 struct adt_event_state
*event
, char *notUsed
)
955 DPRINTF((" adt_to_iport dd_datatype=%d\n", def
->dd_datatype
));
957 port
= ((union convert
*)p_data
)->tuint16
;
963 /* required and not specified */
964 adt_write_syslog("adt_to_iport no required port", 0);
966 (void) au_write(event
->ae_event_handle
, au_to_iport(port
));
972 * This is a compact table that defines only the tokens that are
973 * actually generated in the adt.xml file. It can't be a pure
974 * indexed table because the adt.xml language defines internal extension
975 * tokens for some processing. VIZ. ADT_CMD_ALT, ADT_AUT_PRIV_* (see
976 * adt_xlate.h), and the -AUT_PATH value.
979 #define MAX_TOKEN_JMP 21
981 static struct token_jmp token_table
[MAX_TOKEN_JMP
] =
983 {AUT_CMD
, adt_to_cmd
},
984 {ADT_CMD_ALT
, adt_to_cmd1
},
985 {AUT_FMRI
, adt_to_frmi
},
986 {ADT_IN_PEER
, adt_to_in_peer
},
987 {ADT_IN_REMOTE
, adt_to_in_remote
},
988 {AUT_IPORT
, adt_to_iport
},
989 {AUT_NEWGROUPS
, adt_to_newgroups
},
990 {AUT_PATH
, adt_to_path
},
991 {-AUT_PATH
, adt_to_pathlist
}, /* private extension of token values */
992 {ADT_AUT_PRIV_L
, adt_to_priv_limit
},
993 {ADT_AUT_PRIV_I
, adt_to_priv_inherit
},
994 {ADT_AUT_PRIV_E
, adt_to_priv_effective
},
995 {AUT_PROCESS
, adt_to_process
},
996 {AUT_RETURN
, adt_to_return
},
997 {AUT_SUBJECT
, adt_to_subject
},
998 {AUT_TEXT
, adt_to_text
},
999 {AUT_TID
, adt_to_tid
},
1000 {AUT_UAUTH
, adt_to_uauth
},
1001 {AUT_USER
, adt_to_user
},
1002 {AUT_ZONENAME
, adt_to_zonename
}
1006 * {AUT_ACL, adt_to_acl}, not used
1007 * {AUT_ARBITRARY, adt_to_arbitrary}, AUT_ARBITRARY is undefined
1008 * {AUT_ARG, adt_to_arg}, not used
1009 * {AUT_ATTR, adt_to_attr}, not used in mountd
1010 * {AUT_XATOM, adt_to_atom}, not used
1011 * {AUT_EXEC_ARGS, adt_to_exec_args}, not used
1012 * {AUT_EXEC_ENV, adt_to_exec_env}, not used
1013 * {AUT_EXIT, adt_to_exit}, obsolete
1014 * {AUT_FILE, adt_to_file}, AUT_FILE is undefined
1015 * {AUT_XCOLORMAP, adt_to_colormap}, not used
1016 * {AUT_XCURSOR, adt_to_cursor}, not used
1017 * {AUT_XFONT, adt_to_font}, not used
1018 * {AUT_XGC, adt_to_gc}, not used
1019 * {AUT_GROUPS, adt_to_groups}, obsolete
1020 * {AUT_HEADER, adt_to_header}, generated by au_close
1021 * {AUT_IP, adt_to_ip}, not used
1022 * {AUT_IPC, adt_to_ipc}, not used
1023 * {AUT_IPC_PERM, adt_to_ipc_perm}, not used
1024 * {AUT_OPAQUE, adt_to_opaque}, not used
1025 * {AUT_XPIXMAP, adt_to_pixmap}, not used
1026 * {AUT_XPROPERTY, adt_to_property}, not used
1027 * {AUT_SEQ, adt_to_seq}, not used
1028 * {AUT_SOCKET, adt_to_socket}, not used
1029 * {AUT_SOCKET_INET, adt_to_socket_inet}, AUT_SOCKET_INET is undefined
1030 * {AUT_TRAILER, adt_to_trailer}, generated by au_close
1031 * {AUT_XCLIENT, adt_to_xclient} not used
1034 /* find function to generate token */
1036 static adt_token_func_t
1037 adt_getTokenFunction(char token_id
)
1040 struct token_jmp
*p_jmp
= token_table
;
1042 for (i
= 0; i
< MAX_TOKEN_JMP
; i
++) {
1043 if (token_id
== p_jmp
->jmp_id
) {
1044 return (p_jmp
->jmp_to
);
1053 * adjustAddress -- given the address of data, its size, and the type of
1054 * the next data field, calculate the offset to the next piece of data.
1055 * Depending on the caller, "current" and "next" mean the current pointer
1056 * and the next pointer or the last pointer and the current pointer.
1059 adt_adjust_address(void *current_address
, size_t current_size
,
1062 ptrdiff_t adjustment
;
1063 ptrdiff_t remainder
;
1065 adjustment
= (size_t)current_address
+ current_size
;
1068 remainder
= adjustment
% next_size
;
1070 adjustment
+= next_size
- remainder
;
1072 return ((char *)adjustment
);