1/*-
2 * Copyright (c) 2004-2009 Apple Inc.
3 * Copyright (c) 2005 SPARTA, Inc.
4 * All rights reserved.
5 *
6 * This code was developed in part by Robert N. M. Watson, Senior Principal
7 * Scientist, SPARTA, Inc.
8 *
--- 16 unchanged lines hidden (view full) ---
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#91
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/security/audit/audit_bsm_token.c 191270 2009-04-19 14:53:17Z rwatson $");
38
39#include <sys/types.h>
40#include <sys/endian.h>
41#include <sys/queue.h>
42#include <sys/socket.h>
43#include <sys/time.h>
44
45#include <sys/ipc.h>
--- 879 unchanged lines hidden (view full) ---
925
926 return (t);
927}
928#endif
929
930/*
931 * token ID 1 byte
932 * socket family 2 bytes
933 * path 104 bytes
934 */
935token_t *
936au_to_sock_unix(struct sockaddr_un *so)
937{
938 token_t *t;
939 u_char *dptr;
940
941 GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + strlen(so->sun_path) + 1);
--- 241 unchanged lines hidden (view full) ---
1183/*
1184 * Collects audit information for the current process and creates a subject
1185 * token from it.
1186 */
1187token_t *
1188au_to_me(void)
1189{
1190 auditinfo_t auinfo;
1191
1192 if (getaudit(&auinfo) != 0)
1193 return (NULL);
1194
1195 return (au_to_subject32(auinfo.ai_auid, geteuid(), getegid(),
1196 getuid(), getgid(), getpid(), auinfo.ai_asid, &auinfo.ai_termid));
1197}
1198#endif
1199
1200#if defined(_KERNEL) || defined(KERNEL)
1201static token_t *
1202au_to_exec_strings(char *strs, int count, u_char type)
1203{
1204 token_t *t;
--- 326 unchanged lines hidden ---
2 * Copyright (c) 2004-2009 Apple Inc.
3 * Copyright (c) 2005 SPARTA, Inc.
4 * All rights reserved.
5 *
6 * This code was developed in part by Robert N. M. Watson, Senior Principal
7 * Scientist, SPARTA, Inc.
8 *
--- 16 unchanged lines hidden (view full) ---
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#91
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/security/audit/audit_bsm_token.c 191270 2009-04-19 14:53:17Z rwatson $");
38
39#include <sys/types.h>
40#include <sys/endian.h>
41#include <sys/queue.h>
42#include <sys/socket.h>
43#include <sys/time.h>
44
45#include <sys/ipc.h>
--- 879 unchanged lines hidden (view full) ---
925
926 return (t);
927}
928#endif
929
930/*
931 * token ID 1 byte
932 * socket family 2 bytes
933 * path 104 bytes
934 */
935token_t *
936au_to_sock_unix(struct sockaddr_un *so)
937{
938 token_t *t;
939 u_char *dptr;
940
941 GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + strlen(so->sun_path) + 1);
--- 241 unchanged lines hidden (view full) ---
1183/*
1184 * Collects audit information for the current process and creates a subject
1185 * token from it.
1186 */
1187token_t *
1188au_to_me(void)
1189{
1190 auditinfo_t auinfo;
1191
1192 if (getaudit(&auinfo) != 0)
1193 return (NULL);
1194
1195 return (au_to_subject32(auinfo.ai_auid, geteuid(), getegid(),
1196 getuid(), getgid(), getpid(), auinfo.ai_asid, &auinfo.ai_termid));
1197}
1198#endif
1199
1200#if defined(_KERNEL) || defined(KERNEL)
1201static token_t *
1202au_to_exec_strings(char *strs, int count, u_char type)
1203{
1204 token_t *t;
--- 326 unchanged lines hidden ---