| 1 | #ifndef _host_security_user_ |
| 2 | #define _host_security_user_ |
| 3 | |
| 4 | /* Module host_security */ |
| 5 | |
| 6 | #include <string.h> |
| 7 | #include <mach/ndr.h> |
| 8 | #include <mach/boolean.h> |
| 9 | #include <mach/kern_return.h> |
| 10 | #include <mach/notify.h> |
| 11 | #include <mach/mach_types.h> |
| 12 | #include <mach/message.h> |
| 13 | #include <mach/mig_errors.h> |
| 14 | #include <mach/port.h> |
| 15 | |
| 16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
| 17 | |
| 18 | #if defined(__has_include) |
| 19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
| 20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
| 21 | #define USING_MIG_STRNCPY_ZEROFILL |
| 22 | #endif |
| 23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
| 24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR |
| 29 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable |
| 30 | #endif |
| 31 | extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); |
| 32 | #ifdef __cplusplus |
| 33 | } |
| 34 | #endif |
| 35 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
| 36 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
| 37 | #endif /* __has_include */ |
| 38 | |
| 39 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
| 40 | |
| 41 | |
| 42 | #ifdef AUTOTEST |
| 43 | #ifndef FUNCTION_PTR_T |
| 44 | #define FUNCTION_PTR_T |
| 45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
| 46 | typedef struct { |
| 47 | char * name; |
| 48 | function_ptr_t function; |
| 49 | } function_table_entry; |
| 50 | typedef function_table_entry *function_table_t; |
| 51 | #endif /* FUNCTION_PTR_T */ |
| 52 | #endif /* AUTOTEST */ |
| 53 | |
| 54 | #ifndef host_security_MSG_COUNT |
| 55 | #define host_security_MSG_COUNT 2 |
| 56 | #endif /* host_security_MSG_COUNT */ |
| 57 | |
| 58 | #include <Availability.h> |
| 59 | #include <mach/std_types.h> |
| 60 | #include <mach/mig.h> |
| 61 | #include <mach/mig.h> |
| 62 | #include <mach/mach_types.h> |
| 63 | |
| 64 | #ifdef __BeforeMigUserHeader |
| 65 | __BeforeMigUserHeader |
| 66 | #endif /* __BeforeMigUserHeader */ |
| 67 | |
| 68 | #include <sys/cdefs.h> |
| 69 | __BEGIN_DECLS |
| 70 | |
| 71 | |
| 72 | /* Routine host_security_create_task_token */ |
| 73 | #ifdef mig_external |
| 74 | mig_external |
| 75 | #else |
| 76 | extern |
| 77 | #endif /* mig_external */ |
| 78 | kern_return_t host_security_create_task_token |
| 79 | ( |
| 80 | host_security_t host_security, |
| 81 | task_t parent_task, |
| 82 | security_token_t sec_token, |
| 83 | audit_token_t audit_token, |
| 84 | host_t host, |
| 85 | ledger_array_t ledgers, |
| 86 | mach_msg_type_number_t ledgersCnt, |
| 87 | boolean_t inherit_memory, |
| 88 | task_t *child_task |
| 89 | ); |
| 90 | |
| 91 | /* Routine host_security_set_task_token */ |
| 92 | #ifdef mig_external |
| 93 | mig_external |
| 94 | #else |
| 95 | extern |
| 96 | #endif /* mig_external */ |
| 97 | kern_return_t host_security_set_task_token |
| 98 | ( |
| 99 | host_security_t host_security, |
| 100 | task_t target_task, |
| 101 | security_token_t sec_token, |
| 102 | audit_token_t audit_token, |
| 103 | host_t host |
| 104 | ); |
| 105 | |
| 106 | __END_DECLS |
| 107 | |
| 108 | /********************** Caution **************************/ |
| 109 | /* The following data types should be used to calculate */ |
| 110 | /* maximum message sizes only. The actual message may be */ |
| 111 | /* smaller, and the position of the arguments within the */ |
| 112 | /* message layout may vary from what is presented here. */ |
| 113 | /* For example, if any of the arguments are variable- */ |
| 114 | /* sized, and less than the maximum is sent, the data */ |
| 115 | /* will be packed tight in the actual message to reduce */ |
| 116 | /* the presence of holes. */ |
| 117 | /********************** Caution **************************/ |
| 118 | |
| 119 | /* typedefs for all requests */ |
| 120 | |
| 121 | #ifndef __Request__host_security_subsystem__defined |
| 122 | #define __Request__host_security_subsystem__defined |
| 123 | |
| 124 | #ifdef __MigPackStructs |
| 125 | #pragma pack(push, 4) |
| 126 | #endif |
| 127 | typedef struct { |
| 128 | mach_msg_header_t Head; |
| 129 | /* start of the kernel processed data */ |
| 130 | mach_msg_body_t msgh_body; |
| 131 | mach_msg_port_descriptor_t parent_task; |
| 132 | mach_msg_port_descriptor_t host; |
| 133 | mach_msg_ool_ports_descriptor_t ledgers; |
| 134 | /* end of the kernel processed data */ |
| 135 | NDR_record_t NDR; |
| 136 | security_token_t sec_token; |
| 137 | audit_token_t audit_token; |
| 138 | mach_msg_type_number_t ledgersCnt; |
| 139 | boolean_t inherit_memory; |
| 140 | } __Request__host_security_create_task_token_t __attribute__((unused)); |
| 141 | #ifdef __MigPackStructs |
| 142 | #pragma pack(pop) |
| 143 | #endif |
| 144 | |
| 145 | #ifdef __MigPackStructs |
| 146 | #pragma pack(push, 4) |
| 147 | #endif |
| 148 | typedef struct { |
| 149 | mach_msg_header_t Head; |
| 150 | /* start of the kernel processed data */ |
| 151 | mach_msg_body_t msgh_body; |
| 152 | mach_msg_port_descriptor_t target_task; |
| 153 | mach_msg_port_descriptor_t host; |
| 154 | /* end of the kernel processed data */ |
| 155 | NDR_record_t NDR; |
| 156 | security_token_t sec_token; |
| 157 | audit_token_t audit_token; |
| 158 | } __Request__host_security_set_task_token_t __attribute__((unused)); |
| 159 | #ifdef __MigPackStructs |
| 160 | #pragma pack(pop) |
| 161 | #endif |
| 162 | #endif /* !__Request__host_security_subsystem__defined */ |
| 163 | |
| 164 | /* union of all requests */ |
| 165 | |
| 166 | #ifndef __RequestUnion__host_security_subsystem__defined |
| 167 | #define __RequestUnion__host_security_subsystem__defined |
| 168 | union __RequestUnion__host_security_subsystem { |
| 169 | __Request__host_security_create_task_token_t Request_host_security_create_task_token; |
| 170 | __Request__host_security_set_task_token_t Request_host_security_set_task_token; |
| 171 | }; |
| 172 | #endif /* !__RequestUnion__host_security_subsystem__defined */ |
| 173 | /* typedefs for all replies */ |
| 174 | |
| 175 | #ifndef __Reply__host_security_subsystem__defined |
| 176 | #define __Reply__host_security_subsystem__defined |
| 177 | |
| 178 | #ifdef __MigPackStructs |
| 179 | #pragma pack(push, 4) |
| 180 | #endif |
| 181 | typedef struct { |
| 182 | mach_msg_header_t Head; |
| 183 | /* start of the kernel processed data */ |
| 184 | mach_msg_body_t msgh_body; |
| 185 | mach_msg_port_descriptor_t child_task; |
| 186 | /* end of the kernel processed data */ |
| 187 | } __Reply__host_security_create_task_token_t __attribute__((unused)); |
| 188 | #ifdef __MigPackStructs |
| 189 | #pragma pack(pop) |
| 190 | #endif |
| 191 | |
| 192 | #ifdef __MigPackStructs |
| 193 | #pragma pack(push, 4) |
| 194 | #endif |
| 195 | typedef struct { |
| 196 | mach_msg_header_t Head; |
| 197 | NDR_record_t NDR; |
| 198 | kern_return_t RetCode; |
| 199 | } __Reply__host_security_set_task_token_t __attribute__((unused)); |
| 200 | #ifdef __MigPackStructs |
| 201 | #pragma pack(pop) |
| 202 | #endif |
| 203 | #endif /* !__Reply__host_security_subsystem__defined */ |
| 204 | |
| 205 | /* union of all replies */ |
| 206 | |
| 207 | #ifndef __ReplyUnion__host_security_subsystem__defined |
| 208 | #define __ReplyUnion__host_security_subsystem__defined |
| 209 | union __ReplyUnion__host_security_subsystem { |
| 210 | __Reply__host_security_create_task_token_t Reply_host_security_create_task_token; |
| 211 | __Reply__host_security_set_task_token_t Reply_host_security_set_task_token; |
| 212 | }; |
| 213 | #endif /* !__RequestUnion__host_security_subsystem__defined */ |
| 214 | |
| 215 | #ifndef subsystem_to_name_map_host_security |
| 216 | #define subsystem_to_name_map_host_security \ |
| 217 | { "host_security_create_task_token", 600 },\ |
| 218 | { "host_security_set_task_token", 601 } |
| 219 | #endif |
| 220 | |
| 221 | #ifdef __AfterMigUserHeader |
| 222 | __AfterMigUserHeader |
| 223 | #endif /* __AfterMigUserHeader */ |
| 224 | |
| 225 | #endif /* _host_security_user_ */ |
| 226 | |