--- a/open-src/xserver/xorg/sun-src/tsol/Makefile.am Thu Jan 31 10:24:47 2008 -0800
+++ b/open-src/xserver/xorg/sun-src/tsol/Makefile.am Mon Feb 04 12:32:09 2008 -0800
@@ -1,6 +1,6 @@
#########################################################################
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -29,13 +29,13 @@
#
#########################################################################
#
-# ident "@(#)Makefile.am 1.9 07/05/29 SMI"
+# ident "@(#)Makefile.am 1.10 08/02/02 SMI"
#
noinst_LTLIBRARIES = libxtsol.la
libxtsol_la_SOURCES= tsolpolicy.c tsolutils.c tsolextension.c tsolprotocol.c \
- auditwrite.c au_to_tsol.c
+ auditwrite.c
INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/os
--- a/open-src/xserver/xorg/sun-src/tsol/au_to_tsol.c Thu Jan 31 10:24:47 2008 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "@(#)au_to_tsol.c 1.3 06/03/05 SMI"
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <bsm/audit.h>
-#include <bsm/audit_record.h>
-#include <bsm/libbsm.h>
-#include <priv.h>
-#include <sys/ipc.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/vnode.h>
-#include <sys/tsol/label.h>
-#include <malloc.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_pcb.h>
-#include <string.h>
-
-
-static token_t *
-get_token(int s)
-{
- token_t *token; /* Resultant token */
-
- if ((token = (token_t *)malloc(sizeof (token_t))) == NULL)
- return (NULL);
- if ((token->tt_data = malloc(s)) == NULL) {
- free(token);
- return (NULL);
- }
- token->tt_size = s;
- token->tt_next = NULL;
- return (token);
-}
-
-/*
- * au_to_in_addr_ex
- * returns:
- * pointer to an extended IP address token
- */
-token_t *
-au_to_in_addr_ex(int32_t *internet_addr)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header_v4 = AUT_IN_ADDR; /* header for v4 token */
- char data_header_v6 = AUT_IN_ADDR_EX; /* header for v6 token */
- int32_t type = AU_IPv6;
-
- if (IN6_IS_ADDR_V4MAPPED((in6_addr_t *)internet_addr)) {
- struct in_addr ip;
-
- IN6_V4MAPPED_TO_INADDR((struct in6_addr *)internet_addr, &ip);
-
- token = get_token(sizeof (char) +
- (sizeof (char) * sizeof (struct in_addr)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header_v4, 1);
- adr_char(&adr, (char *)&ip, sizeof (struct in_addr));
- } else {
- token = get_token(sizeof (char) + sizeof (uint32_t) +
- (sizeof (char) * sizeof (struct in6_addr)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header_v6, 1);
- adr_int32(&adr, (int32_t *)&type, 1);
- adr_char(&adr, (char *)internet_addr, sizeof (struct in6_addr));
- }
-
- return (token);
-}
-
-/*
- * au_to_tsol_xclient
- * return s:
- * pointer to a xclient token.
- */
-token_t *
-au_to_tsol_xclient(uint32_t client)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XCLIENT; /* header for this token */
-
- token = get_token(sizeof (char) + sizeof (int32_t));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, (int32_t *)&client, 1);
-
- return (token);
-}
-
-/*
- * au_to_ipc_perm
- * return s:
- * pointer to token containing a System V IPC attribute token.
- */
-token_t *
-au_to_ipc_perm(struct ipc_perm *perm)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_IPC_PERM; /* header for this token */
- int32_t value;
-
- token = get_token(sizeof (char) + (sizeof (int32_t)*7));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- value = (int32_t)perm->uid;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->gid;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->cuid;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->cgid;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->mode;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->seq;
- adr_int32(&adr, &value, 1);
- value = (int32_t)perm->key;
- adr_int32(&adr, &value, 1);
-
- return (token);
-}
-
-/*
- * au_to_upriv
- * return s:
- * pointer to token chain containing a use of a privilege token.
- */
-token_t *
-au_to_upriv(char flag, char *priv)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_UPRIV; /* header for this token */
- short bytes; /* length of string */
-
- bytes = strlen(priv) + 1;
-
- token = get_token(sizeof (char) + sizeof (char) + sizeof (ushort_t) +
- bytes);
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_char(&adr, &flag, 1); /* success/failure */
- adr_short(&adr, &bytes, 1);
- adr_char(&adr, priv, bytes);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xatom
- * return s:
- * pointer to token chain containing a XATOM token.
- */
-token_t *
-au_to_tsol_xatom(char *atom)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XATOM; /* header for this token */
- short bytes; /* length of string */
-
- bytes = strlen(atom) + 1;
-
- token = get_token(sizeof (char) + sizeof (ushort_t) + bytes);
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_short(&adr, &bytes, 1);
- adr_char(&adr, atom, bytes);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xcolormap
- * return s:
- * pointer to token chain containing a XCOLORMAP token.
- */
-token_t *
-au_to_tsol_xcolormap(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XCOLORMAP; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xcursor
- * return s:
- * pointer to token chain containing a XCURSOR token.
- */
-token_t *
-au_to_tsol_xcursor(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XCURSOR; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xfont
- * return s:
- * pointer to token chain containing a XFONT token.
- */
-token_t *
-au_to_tsol_xfont(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XFONT; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xgc
- * return s:
- * pointer to token chain containing a XGC token.
- */
-token_t *
-au_to_tsol_xgc(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XGC; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xpixmap
- * return s:
- * pointer to token chain containing a XPIXMAP token.
- */
-token_t *
-au_to_tsol_xpixmap(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XPIXMAP; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xproperty
- * return s:
- * pointer to token chain containing a ... token.
- */
-token_t *
-au_to_tsol_xproperty(int32_t xid, uid_t cuid, char *name)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XPROPERTY; /* header for this token */
- short bytes; /* length of string */
-
- bytes = strlen(name) + 1;
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t))
- + sizeof (short) + bytes);
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
- adr_short(&adr, &bytes, 1);
- adr_char(&adr, name, bytes);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xselect
- * return s:
- * pointer to token chain containing a ... token.
- */
-token_t *
-au_to_tsol_xselect(char *propname, char *proptype, char *windata)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XSELECT; /* header for this token */
- short bytes1, bytes2, bytes3; /* length of string */
-
- bytes1 = strlen(propname) + 1;
- bytes2 = strlen(proptype) + 1;
- bytes3 = strlen(windata) + 1;
-
- token = get_token(sizeof (char) + (3 * sizeof (short)) +
- bytes1 + bytes2 + bytes3);
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_short(&adr, &bytes1, 1);
- adr_char(&adr, propname, bytes1);
- adr_short(&adr, &bytes2, 1);
- adr_char(&adr, proptype, bytes2);
- adr_short(&adr, &bytes3, 1);
- adr_char(&adr, windata, bytes3);
-
- return (token);
-}
-
-/*
- * au_to_tsol_xwindow
- * return s:
- * pointer to token chain containing a XWINDOW token.
- */
-token_t *
-au_to_tsol_xwindow(int32_t xid, uid_t cuid)
-{
- token_t *token; /* local token */
- adr_t adr; /* adr memory stream header */
- char data_header = AUT_XWINDOW; /* header for this token */
-
- token = get_token(sizeof (char) + (2 * sizeof (int32_t)));
- if (token == (token_t *)0)
- return ((token_t *)0);
- adr_start(&adr, token->tt_data);
- adr_char(&adr, &data_header, 1);
- adr_int32(&adr, &xid, 1);
- adr_int32(&adr, (int32_t *)&cuid, 1);
-
- return (token);
-}
--- a/open-src/xserver/xorg/sun-src/tsol/auditwrite.c Thu Jan 31 10:24:47 2008 -0800
+++ b/open-src/xserver/xorg/sun-src/tsol/auditwrite.c Mon Feb 04 12:32:09 2008 -0800
@@ -1,9 +1,9 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "@(#)auditwrite.c 1.10 07/05/29 SMI"
+#pragma ident "@(#)auditwrite.c 1.11 08/02/02 SMI"
/*
* auditwrite() - Construct and write user level records to the audit trail.
@@ -103,7 +103,7 @@
}
#define AW_CMD_MIN AW_END
-#define AW_CMD_MAX AW_IN_ADDR_EX
+#define AW_CMD_MAX AW_SUBJECT_EX
/*
* Where control commands end and attribute commands begin.
@@ -229,7 +229,7 @@
{AW_GROUPS, 2},
{AW_IN_ADDR, 1},
{AW_IPC, 2},
- {AW_IPC_PERM, 1},
+ {AW_END, 0}, /* obsolete AW_IPC_PERM */
{AW_IPORT, 1},
{AW_OPAQUE, 2},
{AW_PATH, 1},
@@ -268,8 +268,7 @@
{AW_XCLIENT, 1},
{AW_PROCESS_EX, 8},
- {AW_SUBJECT_EX, 8},
- {AW_IN_ADDR_EX, 1}
+ {AW_SUBJECT_EX, 8}
};
/* externally accessible data */
@@ -1356,22 +1355,6 @@
aw_free_tok(tokp);
break;
- case AW_IN_ADDR_EX:
- if (aw_chk_addr((caddr_t)ad[0]) == AW_ERR_RTN)
- AW_GEN_ERR(AW_ERR_ADDR_INVALID);
- if ((tokp = au_to_in_addr_ex((int32_t *)
- ad[0])) == (token_t *)0)
- AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
- if (aw_buf_append(&(aw_recs[cur_rd]->buf),
- &(aw_recs[cur_rd]->len),
- tokp->tt_data,
- (int)tokp->tt_size) == AW_ERR_RTN) {
- aw_free_tok(tokp);
- return (AW_ERR_RTN);
- }
- aw_free_tok(tokp);
- break;
-
case AW_IPC:
if ((tokp = au_to_ipc((char)(uintptr_t)ad[0],
(int)(uintptr_t)ad[1])) == (token_t *)0)
@@ -1386,22 +1369,6 @@
aw_free_tok(tokp);
break;
- case AW_IPC_PERM:
- if (aw_chk_addr((caddr_t)ad[0]) == AW_ERR_RTN)
- AW_GEN_ERR(AW_ERR_ADDR_INVALID);
- if ((tokp = au_to_ipc_perm((struct ipc_perm *)ad[0]))
- == (token_t *)0)
- AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
- if (aw_buf_append(&(aw_recs[cur_rd]->buf),
- &(aw_recs[cur_rd]->len),
- tokp->tt_data,
- (int)tokp->tt_size) == AW_ERR_RTN) {
- aw_free_tok(tokp);
- return (AW_ERR_RTN);
- }
- aw_free_tok(tokp);
- break;
-
case AW_IPORT:
if ((tokp = au_to_iport((ushort_t)(uintptr_t)ad[0])) ==
(token_t *)0)
@@ -1693,7 +1660,7 @@
case AW_XATOM:
if (aw_chk_addr((caddr_t)ad[0]) == AW_ERR_RTN)
AW_GEN_ERR(AW_ERR_ADDR_INVALID);
- if ((tokp = au_to_tsol_xatom((char *)ad[0]))
+ if ((tokp = au_to_xatom((char *)ad[0]))
== (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
if (aw_buf_append(&(aw_recs[cur_rd]->buf),
@@ -1707,7 +1674,7 @@
break;
case AW_XCLIENT:
- if ((tokp = au_to_tsol_xclient(
+ if ((tokp = au_to_xclient(
(uint32_t)(uintptr_t)ad[0])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
if (aw_buf_append(&(aw_recs[cur_rd]->buf),
@@ -1721,7 +1688,7 @@
break;
case AW_XCURSOR:
- if ((tokp = au_to_tsol_xcursor(
+ if ((tokp = au_to_xcursor(
(int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
@@ -1736,7 +1703,7 @@
break;
case AW_XCOLORMAP:
- if ((tokp = au_to_tsol_xcolormap(
+ if ((tokp = au_to_xcolormap(
(int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
@@ -1751,7 +1718,7 @@
break;
case AW_XFONT:
- if ((tokp = au_to_tsol_xfont((int32_t)(uintptr_t)ad[0],
+ if ((tokp = au_to_xfont((int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
if (aw_buf_append(&(aw_recs[cur_rd]->buf),
@@ -1765,7 +1732,7 @@
break;
case AW_XGC:
- if ((tokp = au_to_tsol_xgc((int32_t)(uintptr_t)ad[0],
+ if ((tokp = au_to_xgc((int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
if (aw_buf_append(&(aw_recs[cur_rd]->buf),
@@ -1779,7 +1746,7 @@
break;
case AW_XPIXMAP:
- if ((tokp = au_to_tsol_xpixmap(
+ if ((tokp = au_to_xpixmap(
(int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
@@ -1796,7 +1763,7 @@
case AW_XPROPERTY:
if (aw_chk_addr((caddr_t)ad[2]) == AW_ERR_RTN)
AW_GEN_ERR(AW_ERR_ADDR_INVALID);
- if ((tokp = au_to_tsol_xproperty(
+ if ((tokp = au_to_xproperty(
(int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1], (char *)ad[2])) ==
(token_t *)0)
@@ -1818,7 +1785,7 @@
AW_GEN_ERR(AW_ERR_ADDR_INVALID);
if (aw_chk_addr((caddr_t)ad[2]) == AW_ERR_RTN)
AW_GEN_ERR(AW_ERR_ADDR_INVALID);
- if ((tokp = au_to_tsol_xselect((char *)ad[0],
+ if ((tokp = au_to_xselect((char *)ad[0],
(char *)ad[1], (char *)ad[2])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
if (aw_buf_append(&(aw_recs[cur_rd]->buf),
@@ -1832,7 +1799,7 @@
break;
case AW_XWINDOW:
- if ((tokp = au_to_tsol_xwindow(
+ if ((tokp = au_to_xwindow(
(int32_t)(uintptr_t)ad[0],
(uid_t)(uintptr_t)ad[1])) == (token_t *)0)
AW_GEN_ERR(AW_ERR_ALLOC_FAIL);
--- a/open-src/xserver/xorg/sun-src/tsol/auditwrite.h Thu Jan 31 10:24:47 2008 -0800
+++ b/open-src/xserver/xorg/sun-src/tsol/auditwrite.h Mon Feb 04 12:32:09 2008 -0800
@@ -1,12 +1,12 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _BSM_AUDITWRITE_H
#define _BSM_AUDITWRITE_H
-#pragma ident "@(#)auditwrite.h 1.3 06/03/05 SMI"
+#pragma ident "@(#)auditwrite.h 1.5 08/02/04 SMI"
#include <bsm/libbsm.h>
#include <tsol/label.h>
@@ -64,7 +64,6 @@
#define AW_INADDR (35)
#define AW_IN_ADDR AW_INADDR
#define AW_IPC (36)
-#define AW_IPC_PERM (37)
#define AW_IPORT (38)
#define AW_OPAQUE (39)
#define AW_PATH (40)
@@ -95,12 +94,11 @@
#define AW_XWINDOW (70)
#define AW_XCLIENT (71)
#define AW_PROCESS_EX (72)
-#define AW_SUBJECT_EX (73)
/*
* The next is the last and highest numbered valid command code; if more
* are added, remember to update AW_CMD_MAX in auditwrite.c.
*/
-#define AW_IN_ADDR_EX (74)
+#define AW_SUBJECT_EX (73)
/*
* describe data specified with AW_DATA
@@ -164,21 +162,6 @@
extern char *aw_strerror();
#endif /* __STDC__ */
-
-extern token_t *au_to_upriv(char, char *);
-
-extern token_t *au_to_tsol_xatom(char *);
-extern token_t *au_to_tsol_xclient(uint32_t);
-extern token_t *au_to_tsol_xcolormap(int32_t, uid_t);
-extern token_t *au_to_tsol_xcursor(int32_t, uid_t);
-extern token_t *au_to_tsol_xfont(int32_t, uid_t);
-extern token_t *au_to_tsol_xgc(int32_t, uid_t);
-extern token_t *au_to_tsol_xpixmap(int32_t, uid_t);
-extern token_t *au_to_tsol_xproperty(int32_t, uid_t, char *);
-extern token_t *au_to_tsol_xselect(char *, char *, char *);
-extern token_t *au_to_tsol_xwindow(int32_t, uid_t);
-
-
#ifdef __cplusplus
}
#endif