bsm_token.c (159248) | bsm_token.c (159985) |
---|---|
1/* 2 * Copyright (c) 2004 Apple Computer, 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 * | 1/* 2 * Copyright (c) 2004 Apple Computer, 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#47 $ | 33 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#48 $ |
34 */ 35 36#include <sys/types.h> 37 38#include <config/config.h> 39#ifdef HAVE_SYS_ENDIAN_H 40#include <sys/endian.h> 41#else /* !HAVE_SYS_ENDIAN_H */ --- 644 unchanged lines hidden (view full) --- 686 */ 687token_t * 688au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 689 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 690{ 691 token_t *t; 692 u_char *dptr = NULL; 693 | 34 */ 35 36#include <sys/types.h> 37 38#include <config/config.h> 39#ifdef HAVE_SYS_ENDIAN_H 40#include <sys/endian.h> 41#else /* !HAVE_SYS_ENDIAN_H */ --- 644 unchanged lines hidden (view full) --- 686 */ 687token_t * 688au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 689 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 690{ 691 token_t *t; 692 u_char *dptr = NULL; 693 |
694 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t)); | 694 if (tid->at_type == AU_IPv4) 695 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 696 10 * sizeof(u_int32_t)); 697 else if (tid->at_type == AU_IPv6) 698 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 699 13 * sizeof(u_int32_t)); 700 else { 701 errno = EINVAL; 702 return (NULL); 703 } |
695 if (t == NULL) 696 return (NULL); 697 698 ADD_U_CHAR(dptr, AUT_PROCESS32_EX); 699 ADD_U_INT32(dptr, auid); 700 ADD_U_INT32(dptr, euid); 701 ADD_U_INT32(dptr, egid); 702 ADD_U_INT32(dptr, ruid); 703 ADD_U_INT32(dptr, rgid); 704 ADD_U_INT32(dptr, pid); 705 ADD_U_INT32(dptr, sid); 706 ADD_U_INT32(dptr, tid->at_port); 707 ADD_U_INT32(dptr, tid->at_type); 708 ADD_U_INT32(dptr, tid->at_addr[0]); | 704 if (t == NULL) 705 return (NULL); 706 707 ADD_U_CHAR(dptr, AUT_PROCESS32_EX); 708 ADD_U_INT32(dptr, auid); 709 ADD_U_INT32(dptr, euid); 710 ADD_U_INT32(dptr, egid); 711 ADD_U_INT32(dptr, ruid); 712 ADD_U_INT32(dptr, rgid); 713 ADD_U_INT32(dptr, pid); 714 ADD_U_INT32(dptr, sid); 715 ADD_U_INT32(dptr, tid->at_port); 716 ADD_U_INT32(dptr, tid->at_type); 717 ADD_U_INT32(dptr, tid->at_addr[0]); |
709 ADD_U_INT32(dptr, tid->at_addr[1]); 710 ADD_U_INT32(dptr, tid->at_addr[2]); 711 ADD_U_INT32(dptr, tid->at_addr[3]); | 718 if (tid->at_type == AU_IPv6) { 719 ADD_U_INT32(dptr, tid->at_addr[1]); 720 ADD_U_INT32(dptr, tid->at_addr[2]); 721 ADD_U_INT32(dptr, tid->at_addr[3]); 722 } |
712 713 return (t); 714} 715 716token_t * 717au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 718 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 719{ --- 244 unchanged lines hidden (view full) --- 964 */ 965token_t * 966au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 967 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 968{ 969 token_t *t; 970 u_char *dptr = NULL; 971 | 723 724 return (t); 725} 726 727token_t * 728au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 729 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 730{ --- 244 unchanged lines hidden (view full) --- 975 */ 976token_t * 977au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 978 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 979{ 980 token_t *t; 981 u_char *dptr = NULL; 982 |
972 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * sizeof(u_int32_t)); | 983 if (tid->at_type == AU_IPv4) 984 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 10 * 985 sizeof(u_int32_t)); 986 else if (tid->at_type == AU_IPv6) 987 GET_TOKEN_AREA(t, dptr, sizeof(u_char) + 13 * 988 sizeof(u_int32_t)); 989 else { 990 errno = EINVAL; 991 return (NULL); 992 } |
973 if (t == NULL) 974 return (NULL); 975 976 ADD_U_CHAR(dptr, AUT_SUBJECT32_EX); 977 ADD_U_INT32(dptr, auid); 978 ADD_U_INT32(dptr, euid); 979 ADD_U_INT32(dptr, egid); 980 ADD_U_INT32(dptr, ruid); 981 ADD_U_INT32(dptr, rgid); 982 ADD_U_INT32(dptr, pid); 983 ADD_U_INT32(dptr, sid); 984 ADD_U_INT32(dptr, tid->at_port); 985 ADD_U_INT32(dptr, tid->at_type); 986 ADD_U_INT32(dptr, tid->at_addr[0]); | 993 if (t == NULL) 994 return (NULL); 995 996 ADD_U_CHAR(dptr, AUT_SUBJECT32_EX); 997 ADD_U_INT32(dptr, auid); 998 ADD_U_INT32(dptr, euid); 999 ADD_U_INT32(dptr, egid); 1000 ADD_U_INT32(dptr, ruid); 1001 ADD_U_INT32(dptr, rgid); 1002 ADD_U_INT32(dptr, pid); 1003 ADD_U_INT32(dptr, sid); 1004 ADD_U_INT32(dptr, tid->at_port); 1005 ADD_U_INT32(dptr, tid->at_type); 1006 ADD_U_INT32(dptr, tid->at_addr[0]); |
987 ADD_U_INT32(dptr, tid->at_addr[1]); 988 ADD_U_INT32(dptr, tid->at_addr[2]); 989 ADD_U_INT32(dptr, tid->at_addr[3]); | 1007 if (tid->at_type == AU_IPv6) { 1008 ADD_U_INT32(dptr, tid->at_addr[1]); 1009 ADD_U_INT32(dptr, tid->at_addr[2]); 1010 ADD_U_INT32(dptr, tid->at_addr[3]); 1011 } |
990 991 return (t); 992} 993 994token_t * 995au_to_subject64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 996 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 997{ --- 201 unchanged lines hidden --- | 1012 1013 return (t); 1014} 1015 1016token_t * 1017au_to_subject64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, 1018 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid) 1019{ --- 201 unchanged lines hidden --- |