1 | /* |
2 | * IDENTIFICATION: |
3 | * stub generated Tue Apr 9 11:33:39 2019 |
4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
5 | * OPTIONS: |
6 | * KernelUser |
7 | */ |
8 | #define __MIG_check__Reply__gssd_mach_subsystem__ 1 |
9 | |
10 | #include "gssd_mach.h" |
11 | |
12 | |
13 | #ifndef mig_internal |
14 | #define mig_internal static __inline__ |
15 | #endif /* mig_internal */ |
16 | |
17 | #ifndef mig_external |
18 | #define mig_external |
19 | #endif /* mig_external */ |
20 | |
21 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
22 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
23 | #endif /* !defined(__MigTypeCheck) */ |
24 | |
25 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
26 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
27 | #endif /* !defined(__MigKernelSpecificCode) */ |
28 | |
29 | #ifndef LimitCheck |
30 | #define LimitCheck 0 |
31 | #endif /* LimitCheck */ |
32 | |
33 | #ifndef min |
34 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
35 | #endif /* min */ |
36 | |
37 | #if !defined(_WALIGN_) |
38 | #define _WALIGN_(x) (((x) + 3) & ~3) |
39 | #endif /* !defined(_WALIGN_) */ |
40 | |
41 | #if !defined(_WALIGNSZ_) |
42 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
43 | #endif /* !defined(_WALIGNSZ_) */ |
44 | |
45 | #ifndef UseStaticTemplates |
46 | #define UseStaticTemplates 0 |
47 | #endif /* UseStaticTemplates */ |
48 | |
49 | #ifndef __MachMsgErrorWithTimeout |
50 | #define __MachMsgErrorWithTimeout(_R_) { \ |
51 | switch (_R_) { \ |
52 | case MACH_SEND_INVALID_DATA: \ |
53 | case MACH_SEND_INVALID_DEST: \ |
54 | case MACH_SEND_INVALID_HEADER: \ |
55 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
56 | break; \ |
57 | case MACH_SEND_TIMED_OUT: \ |
58 | case MACH_RCV_TIMED_OUT: \ |
59 | default: \ |
60 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
61 | } \ |
62 | } |
63 | #endif /* __MachMsgErrorWithTimeout */ |
64 | |
65 | #ifndef __MachMsgErrorWithoutTimeout |
66 | #define __MachMsgErrorWithoutTimeout(_R_) { \ |
67 | switch (_R_) { \ |
68 | case MACH_SEND_INVALID_DATA: \ |
69 | case MACH_SEND_INVALID_DEST: \ |
70 | case MACH_SEND_INVALID_HEADER: \ |
71 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
72 | break; \ |
73 | default: \ |
74 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
75 | } \ |
76 | } |
77 | #endif /* __MachMsgErrorWithoutTimeout */ |
78 | |
79 | #ifndef __DeclareSendRpc |
80 | #define __DeclareSendRpc(_NUM_, _NAME_) |
81 | #endif /* __DeclareSendRpc */ |
82 | |
83 | #ifndef __BeforeSendRpc |
84 | #define __BeforeSendRpc(_NUM_, _NAME_) |
85 | #endif /* __BeforeSendRpc */ |
86 | |
87 | #ifndef __AfterSendRpc |
88 | #define __AfterSendRpc(_NUM_, _NAME_) |
89 | #endif /* __AfterSendRpc */ |
90 | |
91 | #ifndef __DeclareSendSimple |
92 | #define __DeclareSendSimple(_NUM_, _NAME_) |
93 | #endif /* __DeclareSendSimple */ |
94 | |
95 | #ifndef __BeforeSendSimple |
96 | #define __BeforeSendSimple(_NUM_, _NAME_) |
97 | #endif /* __BeforeSendSimple */ |
98 | |
99 | #ifndef __AfterSendSimple |
100 | #define __AfterSendSimple(_NUM_, _NAME_) |
101 | #endif /* __AfterSendSimple */ |
102 | |
103 | #define msgh_request_port msgh_remote_port |
104 | #define msgh_reply_port msgh_local_port |
105 | |
106 | |
107 | |
108 | #if ( __MigTypeCheck ) |
109 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
110 | #if !defined(__MIG_check__Reply__mach_gss_init_sec_context_t__defined) |
111 | #define __MIG_check__Reply__mach_gss_init_sec_context_t__defined |
112 | |
113 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_init_sec_context_t(__Reply__mach_gss_init_sec_context_t *Out0P) |
114 | { |
115 | |
116 | typedef __Reply__mach_gss_init_sec_context_t __Reply __attribute__((unused)); |
117 | boolean_t msgh_simple; |
118 | #if __MigTypeCheck |
119 | unsigned int msgh_size; |
120 | #endif /* __MigTypeCheck */ |
121 | if (Out0P->Head.msgh_id != 1099) { |
122 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
123 | { return MIG_SERVER_DIED; } |
124 | else |
125 | { return MIG_REPLY_MISMATCH; } |
126 | } |
127 | |
128 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
129 | #if __MigTypeCheck |
130 | msgh_size = Out0P->Head.msgh_size; |
131 | |
132 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || |
133 | msgh_size != (mach_msg_size_t)sizeof(__Reply)) && |
134 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
135 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
136 | { return MIG_TYPE_ERROR ; } |
137 | #endif /* __MigTypeCheck */ |
138 | |
139 | if (msgh_simple) { |
140 | return ((mig_reply_error_t *)Out0P)->RetCode; |
141 | } |
142 | |
143 | #if __MigTypeCheck |
144 | if (Out0P->key.type != MACH_MSG_OOL_DESCRIPTOR) { |
145 | return MIG_TYPE_ERROR; |
146 | } |
147 | #endif /* __MigTypeCheck */ |
148 | |
149 | #if __MigTypeCheck |
150 | if (Out0P->outtoken.type != MACH_MSG_OOL_DESCRIPTOR) { |
151 | return MIG_TYPE_ERROR; |
152 | } |
153 | #endif /* __MigTypeCheck */ |
154 | |
155 | #if __MigTypeCheck |
156 | if (Out0P->key.size != Out0P->keyCnt) |
157 | return MIG_TYPE_ERROR; |
158 | if (Out0P->outtoken.size != Out0P->outtokenCnt) |
159 | return MIG_TYPE_ERROR; |
160 | #endif /* __MigTypeCheck */ |
161 | |
162 | return MACH_MSG_SUCCESS; |
163 | } |
164 | #endif /* !defined(__MIG_check__Reply__mach_gss_init_sec_context_t__defined) */ |
165 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
166 | #endif /* ( __MigTypeCheck ) */ |
167 | |
168 | |
169 | /* Routine mach_gss_init_sec_context */ |
170 | mig_external kern_return_t mach_gss_init_sec_context |
171 | ( |
172 | mach_port_t server, |
173 | gssd_mechtype mech, |
174 | gssd_byte_buffer intoken, |
175 | mach_msg_type_number_t intokenCnt, |
176 | uint32_t uid, |
177 | gssd_string princ_namestr, |
178 | gssd_string svc_namestr, |
179 | uint32_t flags, |
180 | uint32_t gssd_flags, |
181 | gssd_ctx *context, |
182 | gssd_cred *cred_handle, |
183 | uint32_t *ret_flags, |
184 | gssd_byte_buffer *key, |
185 | mach_msg_type_number_t *keyCnt, |
186 | gssd_byte_buffer *outtoken, |
187 | mach_msg_type_number_t *outtokenCnt, |
188 | uint32_t *major_stat, |
189 | uint32_t *minor_stat |
190 | ) |
191 | { |
192 | |
193 | #ifdef __MigPackStructs |
194 | #pragma pack(4) |
195 | #endif |
196 | typedef struct { |
197 | mach_msg_header_t Head; |
198 | /* start of the kernel processed data */ |
199 | mach_msg_body_t msgh_body; |
200 | mach_msg_ool_descriptor_t intoken; |
201 | /* end of the kernel processed data */ |
202 | NDR_record_t NDR; |
203 | gssd_mechtype mech; |
204 | mach_msg_type_number_t intokenCnt; |
205 | uint32_t uid; |
206 | mach_msg_type_number_t princ_namestrOffset; /* MiG doesn't use it */ |
207 | mach_msg_type_number_t princ_namestrCnt; |
208 | char princ_namestr[1024]; |
209 | mach_msg_type_number_t svc_namestrOffset; /* MiG doesn't use it */ |
210 | mach_msg_type_number_t svc_namestrCnt; |
211 | char svc_namestr[1024]; |
212 | uint32_t flags; |
213 | uint32_t gssd_flags; |
214 | gssd_ctx context; |
215 | gssd_cred cred_handle; |
216 | } Request __attribute__((unused)); |
217 | #ifdef __MigPackStructs |
218 | #pragma pack() |
219 | #endif |
220 | |
221 | #ifdef __MigPackStructs |
222 | #pragma pack(4) |
223 | #endif |
224 | typedef struct { |
225 | mach_msg_header_t Head; |
226 | /* start of the kernel processed data */ |
227 | mach_msg_body_t msgh_body; |
228 | mach_msg_ool_descriptor_t key; |
229 | mach_msg_ool_descriptor_t outtoken; |
230 | /* end of the kernel processed data */ |
231 | NDR_record_t NDR; |
232 | gssd_ctx context; |
233 | gssd_cred cred_handle; |
234 | uint32_t ret_flags; |
235 | mach_msg_type_number_t keyCnt; |
236 | mach_msg_type_number_t outtokenCnt; |
237 | uint32_t major_stat; |
238 | uint32_t minor_stat; |
239 | mach_msg_trailer_t trailer; |
240 | } Reply __attribute__((unused)); |
241 | #ifdef __MigPackStructs |
242 | #pragma pack() |
243 | #endif |
244 | |
245 | #ifdef __MigPackStructs |
246 | #pragma pack(4) |
247 | #endif |
248 | typedef struct { |
249 | mach_msg_header_t Head; |
250 | /* start of the kernel processed data */ |
251 | mach_msg_body_t msgh_body; |
252 | mach_msg_ool_descriptor_t key; |
253 | mach_msg_ool_descriptor_t outtoken; |
254 | /* end of the kernel processed data */ |
255 | NDR_record_t NDR; |
256 | gssd_ctx context; |
257 | gssd_cred cred_handle; |
258 | uint32_t ret_flags; |
259 | mach_msg_type_number_t keyCnt; |
260 | mach_msg_type_number_t outtokenCnt; |
261 | uint32_t major_stat; |
262 | uint32_t minor_stat; |
263 | } __Reply __attribute__((unused)); |
264 | #ifdef __MigPackStructs |
265 | #pragma pack() |
266 | #endif |
267 | /* |
268 | * typedef struct { |
269 | * mach_msg_header_t Head; |
270 | * NDR_record_t NDR; |
271 | * kern_return_t RetCode; |
272 | * } mig_reply_error_t; |
273 | */ |
274 | |
275 | union mach_gss_init_sec_contextMessU { |
276 | Request In; |
277 | Reply Out; |
278 | } *Mess = (union mach_gss_init_sec_contextMessU *) mig_user_allocate(sizeof(*Mess)); |
279 | |
280 | Request *InP = &Mess->In; |
281 | Reply *Out0P = &Mess->Out; |
282 | |
283 | mach_msg_return_t msg_result; |
284 | unsigned int msgh_size; |
285 | unsigned int msgh_size_delta; |
286 | |
287 | |
288 | #ifdef __MIG_check__Reply__mach_gss_init_sec_context_t__defined |
289 | kern_return_t check_result; |
290 | #endif /* __MIG_check__Reply__mach_gss_init_sec_context_t__defined */ |
291 | |
292 | __DeclareSendRpc(999, "mach_gss_init_sec_context" ) |
293 | |
294 | #if UseStaticTemplates |
295 | const static mach_msg_ool_descriptor_t intokenTemplate = { |
296 | /* addr = */ (void *)0, |
297 | /* size = */ 0, |
298 | /* deal = */ FALSE, |
299 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
300 | /* pad2 = */ 0, |
301 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
302 | }; |
303 | #endif /* UseStaticTemplates */ |
304 | |
305 | InP->msgh_body.msgh_descriptor_count = 1; |
306 | #if UseStaticTemplates |
307 | InP->intoken = intokenTemplate; |
308 | InP->intoken.address = (void *)(intoken); |
309 | InP->intoken.size = intokenCnt; |
310 | #else /* UseStaticTemplates */ |
311 | InP->intoken.address = (void *)(intoken); |
312 | InP->intoken.size = intokenCnt; |
313 | InP->intoken.deallocate = FALSE; |
314 | InP->intoken.copy = MACH_MSG_VIRTUAL_COPY; |
315 | InP->intoken.type = MACH_MSG_OOL_DESCRIPTOR; |
316 | #endif /* UseStaticTemplates */ |
317 | |
318 | InP->NDR = NDR_record; |
319 | |
320 | InP->mech = mech; |
321 | |
322 | InP->intokenCnt = intokenCnt; |
323 | |
324 | InP->uid = uid; |
325 | |
326 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
327 | if (mig_strncpy_zerofill != NULL) { |
328 | InP->princ_namestrCnt = mig_strncpy_zerofill(InP->princ_namestr, princ_namestr, 1024); |
329 | } else { |
330 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
331 | InP->princ_namestrCnt = mig_strncpy(InP->princ_namestr, princ_namestr, 1024); |
332 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
333 | } |
334 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
335 | |
336 | msgh_size_delta = _WALIGN_(InP->princ_namestrCnt); |
337 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 2048) + msgh_size_delta; |
338 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); |
339 | |
340 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
341 | if (mig_strncpy_zerofill != NULL) { |
342 | InP->svc_namestrCnt = mig_strncpy_zerofill(InP->svc_namestr, svc_namestr, 1024); |
343 | } else { |
344 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
345 | InP->svc_namestrCnt = mig_strncpy(InP->svc_namestr, svc_namestr, 1024); |
346 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
347 | } |
348 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
349 | |
350 | msgh_size_delta = _WALIGN_(InP->svc_namestrCnt); |
351 | msgh_size += msgh_size_delta; |
352 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); |
353 | |
354 | InP->flags = flags; |
355 | |
356 | InP->gssd_flags = gssd_flags; |
357 | |
358 | InP->context = *context; |
359 | |
360 | InP->cred_handle = *cred_handle; |
361 | |
362 | InP = &Mess->In; |
363 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
364 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
365 | /* msgh_size passed as argument */ |
366 | InP->Head.msgh_request_port = server; |
367 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
368 | InP->Head.msgh_id = 999; |
369 | InP->Head.msgh_reserved = 0; |
370 | |
371 | __BeforeSendRpc(999, "mach_gss_init_sec_context" ) |
372 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
373 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
374 | #else |
375 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
376 | #endif /* __MigKernelSpecificCode */ |
377 | __AfterSendRpc(999, "mach_gss_init_sec_context" ) |
378 | if (msg_result != MACH_MSG_SUCCESS) { |
379 | __MachMsgErrorWithoutTimeout(msg_result); |
380 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return msg_result; } |
381 | } |
382 | |
383 | |
384 | #if defined(__MIG_check__Reply__mach_gss_init_sec_context_t__defined) |
385 | check_result = __MIG_check__Reply__mach_gss_init_sec_context_t((__Reply__mach_gss_init_sec_context_t *)Out0P); |
386 | if (check_result != MACH_MSG_SUCCESS) |
387 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return check_result; } |
388 | #endif /* defined(__MIG_check__Reply__mach_gss_init_sec_context_t__defined) */ |
389 | |
390 | *context = Out0P->context; |
391 | |
392 | *cred_handle = Out0P->cred_handle; |
393 | |
394 | *ret_flags = Out0P->ret_flags; |
395 | |
396 | *key = (gssd_byte_buffer)(Out0P->key.address); |
397 | *keyCnt = Out0P->keyCnt; |
398 | |
399 | *outtoken = (gssd_byte_buffer)(Out0P->outtoken.address); |
400 | *outtokenCnt = Out0P->outtokenCnt; |
401 | |
402 | *major_stat = Out0P->major_stat; |
403 | |
404 | *minor_stat = Out0P->minor_stat; |
405 | |
406 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return KERN_SUCCESS; } |
407 | } |
408 | |
409 | #if ( __MigTypeCheck ) |
410 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
411 | #if !defined(__MIG_check__Reply__mach_gss_accept_sec_context_t__defined) |
412 | #define __MIG_check__Reply__mach_gss_accept_sec_context_t__defined |
413 | |
414 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_accept_sec_context_t(__Reply__mach_gss_accept_sec_context_t *Out0P, __Reply__mach_gss_accept_sec_context_t **Out1PP) |
415 | { |
416 | |
417 | typedef __Reply__mach_gss_accept_sec_context_t __Reply __attribute__((unused)); |
418 | __Reply *Out1P; |
419 | boolean_t msgh_simple; |
420 | #if __MigTypeCheck |
421 | unsigned int msgh_size; |
422 | #endif /* __MigTypeCheck */ |
423 | unsigned int msgh_size_delta; |
424 | |
425 | if (Out0P->Head.msgh_id != 1100) { |
426 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
427 | { return MIG_SERVER_DIED; } |
428 | else |
429 | { return MIG_REPLY_MISMATCH; } |
430 | } |
431 | |
432 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
433 | #if __MigTypeCheck |
434 | msgh_size = Out0P->Head.msgh_size; |
435 | |
436 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || |
437 | msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 64) || msgh_size > (mach_msg_size_t)sizeof(__Reply)) && |
438 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
439 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
440 | { return MIG_TYPE_ERROR ; } |
441 | #endif /* __MigTypeCheck */ |
442 | |
443 | if (msgh_simple) { |
444 | return ((mig_reply_error_t *)Out0P)->RetCode; |
445 | } |
446 | |
447 | #if __MigTypeCheck |
448 | if (Out0P->key.type != MACH_MSG_OOL_DESCRIPTOR) { |
449 | return MIG_TYPE_ERROR; |
450 | } |
451 | #endif /* __MigTypeCheck */ |
452 | |
453 | #if __MigTypeCheck |
454 | if (Out0P->outtoken.type != MACH_MSG_OOL_DESCRIPTOR) { |
455 | return MIG_TYPE_ERROR; |
456 | } |
457 | #endif /* __MigTypeCheck */ |
458 | |
459 | msgh_size_delta = Out0P->gidsCnt * 4; |
460 | #if __MigTypeCheck |
461 | if ( Out0P->gidsCnt > 16 ) |
462 | return MIG_TYPE_ERROR; |
463 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 64)) / 4< Out0P->gidsCnt) || |
464 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 64) + Out0P->gidsCnt * 4)) |
465 | { return MIG_TYPE_ERROR ; } |
466 | #endif /* __MigTypeCheck */ |
467 | |
468 | *Out1PP = Out1P = (__Reply *) ((pointer_t) Out0P + msgh_size_delta - 64); |
469 | |
470 | #if __MigTypeCheck |
471 | if (Out0P->key.size != Out1P->keyCnt) |
472 | return MIG_TYPE_ERROR; |
473 | if (Out0P->outtoken.size != Out1P->outtokenCnt) |
474 | return MIG_TYPE_ERROR; |
475 | #endif /* __MigTypeCheck */ |
476 | |
477 | return MACH_MSG_SUCCESS; |
478 | } |
479 | #endif /* !defined(__MIG_check__Reply__mach_gss_accept_sec_context_t__defined) */ |
480 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
481 | #endif /* ( __MigTypeCheck ) */ |
482 | |
483 | |
484 | /* Routine mach_gss_accept_sec_context */ |
485 | mig_external kern_return_t mach_gss_accept_sec_context |
486 | ( |
487 | mach_port_t server, |
488 | gssd_byte_buffer intoken, |
489 | mach_msg_type_number_t intokenCnt, |
490 | gssd_string svc_namestr, |
491 | uint32_t gssd_flags, |
492 | gssd_ctx *context, |
493 | gssd_cred *cred_handle, |
494 | uint32_t *flags, |
495 | uint32_t *uid, |
496 | gssd_gid_list gids, |
497 | mach_msg_type_number_t *gidsCnt, |
498 | gssd_byte_buffer *key, |
499 | mach_msg_type_number_t *keyCnt, |
500 | gssd_byte_buffer *outtoken, |
501 | mach_msg_type_number_t *outtokenCnt, |
502 | uint32_t *major_stat, |
503 | uint32_t *minor_stat |
504 | ) |
505 | { |
506 | |
507 | #ifdef __MigPackStructs |
508 | #pragma pack(4) |
509 | #endif |
510 | typedef struct { |
511 | mach_msg_header_t Head; |
512 | /* start of the kernel processed data */ |
513 | mach_msg_body_t msgh_body; |
514 | mach_msg_ool_descriptor_t intoken; |
515 | /* end of the kernel processed data */ |
516 | NDR_record_t NDR; |
517 | mach_msg_type_number_t intokenCnt; |
518 | mach_msg_type_number_t svc_namestrOffset; /* MiG doesn't use it */ |
519 | mach_msg_type_number_t svc_namestrCnt; |
520 | char svc_namestr[1024]; |
521 | uint32_t gssd_flags; |
522 | gssd_ctx context; |
523 | gssd_cred cred_handle; |
524 | } Request __attribute__((unused)); |
525 | #ifdef __MigPackStructs |
526 | #pragma pack() |
527 | #endif |
528 | |
529 | #ifdef __MigPackStructs |
530 | #pragma pack(4) |
531 | #endif |
532 | typedef struct { |
533 | mach_msg_header_t Head; |
534 | /* start of the kernel processed data */ |
535 | mach_msg_body_t msgh_body; |
536 | mach_msg_ool_descriptor_t key; |
537 | mach_msg_ool_descriptor_t outtoken; |
538 | /* end of the kernel processed data */ |
539 | NDR_record_t NDR; |
540 | gssd_ctx context; |
541 | gssd_cred cred_handle; |
542 | uint32_t flags; |
543 | uint32_t uid; |
544 | mach_msg_type_number_t gidsCnt; |
545 | uint32_t gids[16]; |
546 | mach_msg_type_number_t keyCnt; |
547 | mach_msg_type_number_t outtokenCnt; |
548 | uint32_t major_stat; |
549 | uint32_t minor_stat; |
550 | mach_msg_trailer_t trailer; |
551 | } Reply __attribute__((unused)); |
552 | #ifdef __MigPackStructs |
553 | #pragma pack() |
554 | #endif |
555 | |
556 | #ifdef __MigPackStructs |
557 | #pragma pack(4) |
558 | #endif |
559 | typedef struct { |
560 | mach_msg_header_t Head; |
561 | /* start of the kernel processed data */ |
562 | mach_msg_body_t msgh_body; |
563 | mach_msg_ool_descriptor_t key; |
564 | mach_msg_ool_descriptor_t outtoken; |
565 | /* end of the kernel processed data */ |
566 | NDR_record_t NDR; |
567 | gssd_ctx context; |
568 | gssd_cred cred_handle; |
569 | uint32_t flags; |
570 | uint32_t uid; |
571 | mach_msg_type_number_t gidsCnt; |
572 | uint32_t gids[16]; |
573 | mach_msg_type_number_t keyCnt; |
574 | mach_msg_type_number_t outtokenCnt; |
575 | uint32_t major_stat; |
576 | uint32_t minor_stat; |
577 | } __Reply __attribute__((unused)); |
578 | #ifdef __MigPackStructs |
579 | #pragma pack() |
580 | #endif |
581 | /* |
582 | * typedef struct { |
583 | * mach_msg_header_t Head; |
584 | * NDR_record_t NDR; |
585 | * kern_return_t RetCode; |
586 | * } mig_reply_error_t; |
587 | */ |
588 | |
589 | union mach_gss_accept_sec_contextMessU { |
590 | Request In; |
591 | Reply Out; |
592 | } *Mess = (union mach_gss_accept_sec_contextMessU *) mig_user_allocate(sizeof(*Mess)); |
593 | |
594 | Request *InP = &Mess->In; |
595 | Reply *Out0P = &Mess->Out; |
596 | Reply *Out1P = NULL; |
597 | |
598 | mach_msg_return_t msg_result; |
599 | unsigned int msgh_size; |
600 | unsigned int msgh_size_delta; |
601 | |
602 | |
603 | #ifdef __MIG_check__Reply__mach_gss_accept_sec_context_t__defined |
604 | kern_return_t check_result; |
605 | #endif /* __MIG_check__Reply__mach_gss_accept_sec_context_t__defined */ |
606 | |
607 | __DeclareSendRpc(1000, "mach_gss_accept_sec_context" ) |
608 | |
609 | #if UseStaticTemplates |
610 | const static mach_msg_ool_descriptor_t intokenTemplate = { |
611 | /* addr = */ (void *)0, |
612 | /* size = */ 0, |
613 | /* deal = */ FALSE, |
614 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
615 | /* pad2 = */ 0, |
616 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
617 | }; |
618 | #endif /* UseStaticTemplates */ |
619 | |
620 | InP->msgh_body.msgh_descriptor_count = 1; |
621 | #if UseStaticTemplates |
622 | InP->intoken = intokenTemplate; |
623 | InP->intoken.address = (void *)(intoken); |
624 | InP->intoken.size = intokenCnt; |
625 | #else /* UseStaticTemplates */ |
626 | InP->intoken.address = (void *)(intoken); |
627 | InP->intoken.size = intokenCnt; |
628 | InP->intoken.deallocate = FALSE; |
629 | InP->intoken.copy = MACH_MSG_VIRTUAL_COPY; |
630 | InP->intoken.type = MACH_MSG_OOL_DESCRIPTOR; |
631 | #endif /* UseStaticTemplates */ |
632 | |
633 | InP->NDR = NDR_record; |
634 | |
635 | InP->intokenCnt = intokenCnt; |
636 | |
637 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
638 | if (mig_strncpy_zerofill != NULL) { |
639 | InP->svc_namestrCnt = mig_strncpy_zerofill(InP->svc_namestr, svc_namestr, 1024); |
640 | } else { |
641 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
642 | InP->svc_namestrCnt = mig_strncpy(InP->svc_namestr, svc_namestr, 1024); |
643 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
644 | } |
645 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
646 | |
647 | msgh_size_delta = _WALIGN_(InP->svc_namestrCnt); |
648 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 1024) + msgh_size_delta; |
649 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); |
650 | |
651 | InP->gssd_flags = gssd_flags; |
652 | |
653 | InP->context = *context; |
654 | |
655 | InP->cred_handle = *cred_handle; |
656 | |
657 | InP = &Mess->In; |
658 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
659 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
660 | /* msgh_size passed as argument */ |
661 | InP->Head.msgh_request_port = server; |
662 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
663 | InP->Head.msgh_id = 1000; |
664 | InP->Head.msgh_reserved = 0; |
665 | |
666 | __BeforeSendRpc(1000, "mach_gss_accept_sec_context" ) |
667 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
668 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
669 | #else |
670 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
671 | #endif /* __MigKernelSpecificCode */ |
672 | __AfterSendRpc(1000, "mach_gss_accept_sec_context" ) |
673 | if (msg_result != MACH_MSG_SUCCESS) { |
674 | __MachMsgErrorWithoutTimeout(msg_result); |
675 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return msg_result; } |
676 | } |
677 | |
678 | |
679 | #if defined(__MIG_check__Reply__mach_gss_accept_sec_context_t__defined) |
680 | check_result = __MIG_check__Reply__mach_gss_accept_sec_context_t((__Reply__mach_gss_accept_sec_context_t *)Out0P, (__Reply__mach_gss_accept_sec_context_t **)&Out1P); |
681 | if (check_result != MACH_MSG_SUCCESS) |
682 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return check_result; } |
683 | #endif /* defined(__MIG_check__Reply__mach_gss_accept_sec_context_t__defined) */ |
684 | |
685 | *context = Out0P->context; |
686 | |
687 | *cred_handle = Out0P->cred_handle; |
688 | |
689 | *flags = Out0P->flags; |
690 | |
691 | *uid = Out0P->uid; |
692 | |
693 | if (Out0P->gidsCnt > 16) { |
694 | (void)memcpy((char *) gids, (const char *) Out0P->gids, 4 * 16); |
695 | *gidsCnt = Out0P->gidsCnt; |
696 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
697 | } |
698 | (void)memcpy((char *) gids, (const char *) Out0P->gids, 4 * Out0P->gidsCnt); |
699 | |
700 | *gidsCnt = Out0P->gidsCnt; |
701 | |
702 | *key = (gssd_byte_buffer)(Out0P->key.address); |
703 | *keyCnt = Out1P->keyCnt; |
704 | |
705 | *outtoken = (gssd_byte_buffer)(Out0P->outtoken.address); |
706 | *outtokenCnt = Out1P->outtokenCnt; |
707 | |
708 | *major_stat = Out1P->major_stat; |
709 | |
710 | *minor_stat = Out1P->minor_stat; |
711 | |
712 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return KERN_SUCCESS; } |
713 | } |
714 | |
715 | /* SimpleRoutine mach_gss_log_error */ |
716 | mig_external kern_return_t mach_gss_log_error |
717 | ( |
718 | mach_port_t server, |
719 | gssd_string mnt, |
720 | uint32_t uid, |
721 | gssd_string source, |
722 | uint32_t major_stat, |
723 | uint32_t minor_stat |
724 | ) |
725 | { |
726 | |
727 | #ifdef __MigPackStructs |
728 | #pragma pack(4) |
729 | #endif |
730 | typedef struct { |
731 | mach_msg_header_t Head; |
732 | NDR_record_t NDR; |
733 | mach_msg_type_number_t mntOffset; /* MiG doesn't use it */ |
734 | mach_msg_type_number_t mntCnt; |
735 | char mnt[1024]; |
736 | uint32_t uid; |
737 | mach_msg_type_number_t sourceOffset; /* MiG doesn't use it */ |
738 | mach_msg_type_number_t sourceCnt; |
739 | char source[1024]; |
740 | uint32_t major_stat; |
741 | uint32_t minor_stat; |
742 | } Request __attribute__((unused)); |
743 | #ifdef __MigPackStructs |
744 | #pragma pack() |
745 | #endif |
746 | /* |
747 | * typedef struct { |
748 | * mach_msg_header_t Head; |
749 | * NDR_record_t NDR; |
750 | * kern_return_t RetCode; |
751 | * } mig_reply_error_t; |
752 | */ |
753 | |
754 | union mach_gss_log_errorMessU { |
755 | Request In; |
756 | } *Mess = (union mach_gss_log_errorMessU *) mig_user_allocate(sizeof(*Mess)); |
757 | |
758 | Request *InP = &Mess->In; |
759 | |
760 | mach_msg_return_t msg_result; |
761 | unsigned int msgh_size; |
762 | unsigned int msgh_size_delta; |
763 | |
764 | |
765 | #ifdef __MIG_check__Reply__mach_gss_log_error_t__defined |
766 | kern_return_t check_result; |
767 | #endif /* __MIG_check__Reply__mach_gss_log_error_t__defined */ |
768 | |
769 | __DeclareSendSimple(1001, "mach_gss_log_error" ) |
770 | |
771 | InP->NDR = NDR_record; |
772 | |
773 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
774 | if (mig_strncpy_zerofill != NULL) { |
775 | InP->mntCnt = mig_strncpy_zerofill(InP->mnt, mnt, 1024); |
776 | } else { |
777 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
778 | InP->mntCnt = mig_strncpy(InP->mnt, mnt, 1024); |
779 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
780 | } |
781 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
782 | |
783 | msgh_size_delta = _WALIGN_(InP->mntCnt); |
784 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 2048) + msgh_size_delta; |
785 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); |
786 | |
787 | InP->uid = uid; |
788 | |
789 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
790 | if (mig_strncpy_zerofill != NULL) { |
791 | InP->sourceCnt = mig_strncpy_zerofill(InP->source, source, 1024); |
792 | } else { |
793 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
794 | InP->sourceCnt = mig_strncpy(InP->source, source, 1024); |
795 | #ifdef USING_MIG_STRNCPY_ZEROFILL |
796 | } |
797 | #endif /* USING_MIG_STRNCPY_ZEROFILL */ |
798 | |
799 | msgh_size_delta = _WALIGN_(InP->sourceCnt); |
800 | msgh_size += msgh_size_delta; |
801 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); |
802 | |
803 | InP->major_stat = major_stat; |
804 | |
805 | InP->minor_stat = minor_stat; |
806 | |
807 | InP = &Mess->In; |
808 | InP->Head.msgh_bits = |
809 | MACH_MSGH_BITS(19, 0); |
810 | /* msgh_size passed as argument */ |
811 | InP->Head.msgh_request_port = server; |
812 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
813 | InP->Head.msgh_id = 1001; |
814 | InP->Head.msgh_reserved = 0; |
815 | |
816 | __BeforeSendSimple(1001, "mach_gss_log_error" ) |
817 | #if __MigKernelSpecificCode |
818 | msg_result = mach_msg_send_from_kernel(&InP->Head, msgh_size); |
819 | #else |
820 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
821 | #endif /* __MigKernelSpecificCode */ |
822 | __AfterSendSimple(1001, "mach_gss_log_error" ) |
823 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return msg_result; } |
824 | } |
825 | |
826 | #if ( __MigTypeCheck ) |
827 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
828 | #if !defined(__MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined) |
829 | #define __MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined |
830 | |
831 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_init_sec_context_v2_t(__Reply__mach_gss_init_sec_context_v2_t *Out0P, __Reply__mach_gss_init_sec_context_v2_t **Out1PP) |
832 | { |
833 | |
834 | typedef __Reply__mach_gss_init_sec_context_v2_t __Reply __attribute__((unused)); |
835 | __Reply *Out1P; |
836 | boolean_t msgh_simple; |
837 | #if __MigTypeCheck |
838 | unsigned int msgh_size; |
839 | #endif /* __MigTypeCheck */ |
840 | unsigned int msgh_size_delta; |
841 | |
842 | if (Out0P->Head.msgh_id != 1102) { |
843 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
844 | { return MIG_SERVER_DIED; } |
845 | else |
846 | { return MIG_REPLY_MISMATCH; } |
847 | } |
848 | |
849 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
850 | #if __MigTypeCheck |
851 | msgh_size = Out0P->Head.msgh_size; |
852 | |
853 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || |
854 | msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 128) || msgh_size > (mach_msg_size_t)sizeof(__Reply)) && |
855 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
856 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
857 | { return MIG_TYPE_ERROR ; } |
858 | #endif /* __MigTypeCheck */ |
859 | |
860 | if (msgh_simple) { |
861 | return ((mig_reply_error_t *)Out0P)->RetCode; |
862 | } |
863 | |
864 | #if __MigTypeCheck |
865 | if (Out0P->key.type != MACH_MSG_OOL_DESCRIPTOR) { |
866 | return MIG_TYPE_ERROR; |
867 | } |
868 | #endif /* __MigTypeCheck */ |
869 | |
870 | #if __MigTypeCheck |
871 | if (Out0P->outtoken.type != MACH_MSG_OOL_DESCRIPTOR) { |
872 | return MIG_TYPE_ERROR; |
873 | } |
874 | #endif /* __MigTypeCheck */ |
875 | |
876 | msgh_size_delta = _WALIGN_(Out0P->displaynameCnt); |
877 | #if __MigTypeCheck |
878 | if ( Out0P->displaynameCnt > 128 ) |
879 | return MIG_TYPE_ERROR; |
880 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 128))< Out0P->displaynameCnt) || |
881 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 128) + _WALIGN_(Out0P->displaynameCnt))) |
882 | { return MIG_TYPE_ERROR ; } |
883 | #endif /* __MigTypeCheck */ |
884 | |
885 | *Out1PP = Out1P = (__Reply *) ((pointer_t) Out0P + msgh_size_delta - 128); |
886 | |
887 | #if __MigTypeCheck |
888 | if (Out0P->key.size != Out0P->keyCnt) |
889 | return MIG_TYPE_ERROR; |
890 | if (Out0P->outtoken.size != Out0P->outtokenCnt) |
891 | return MIG_TYPE_ERROR; |
892 | #endif /* __MigTypeCheck */ |
893 | |
894 | return MACH_MSG_SUCCESS; |
895 | } |
896 | #endif /* !defined(__MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined) */ |
897 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
898 | #endif /* ( __MigTypeCheck ) */ |
899 | |
900 | |
901 | /* Routine mach_gss_init_sec_context_v2 */ |
902 | mig_external kern_return_t mach_gss_init_sec_context_v2 |
903 | ( |
904 | mach_port_t server, |
905 | gssd_mechtype mech, |
906 | gssd_byte_buffer intoken, |
907 | mach_msg_type_number_t intokenCnt, |
908 | uint32_t uid, |
909 | gssd_nametype clnt_nt, |
910 | gssd_byte_buffer clnt_princ, |
911 | mach_msg_type_number_t clnt_princCnt, |
912 | gssd_nametype svc_nt, |
913 | gssd_byte_buffer svc_princ, |
914 | mach_msg_type_number_t svc_princCnt, |
915 | uint32_t flags, |
916 | uint32_t *gssd_flags, |
917 | gssd_ctx *context, |
918 | gssd_cred *cred_handle, |
919 | uint32_t *ret_flags, |
920 | gssd_byte_buffer *key, |
921 | mach_msg_type_number_t *keyCnt, |
922 | gssd_byte_buffer *outtoken, |
923 | mach_msg_type_number_t *outtokenCnt, |
924 | gssd_dstring displayname, |
925 | uint32_t *major_stat, |
926 | uint32_t *minor_stat |
927 | ) |
928 | { |
929 | |
930 | #ifdef __MigPackStructs |
931 | #pragma pack(4) |
932 | #endif |
933 | typedef struct { |
934 | mach_msg_header_t Head; |
935 | /* start of the kernel processed data */ |
936 | mach_msg_body_t msgh_body; |
937 | mach_msg_ool_descriptor_t intoken; |
938 | mach_msg_ool_descriptor_t clnt_princ; |
939 | mach_msg_ool_descriptor_t svc_princ; |
940 | /* end of the kernel processed data */ |
941 | NDR_record_t NDR; |
942 | gssd_mechtype mech; |
943 | mach_msg_type_number_t intokenCnt; |
944 | uint32_t uid; |
945 | gssd_nametype clnt_nt; |
946 | mach_msg_type_number_t clnt_princCnt; |
947 | gssd_nametype svc_nt; |
948 | mach_msg_type_number_t svc_princCnt; |
949 | uint32_t flags; |
950 | uint32_t gssd_flags; |
951 | gssd_ctx context; |
952 | gssd_cred cred_handle; |
953 | } Request __attribute__((unused)); |
954 | #ifdef __MigPackStructs |
955 | #pragma pack() |
956 | #endif |
957 | |
958 | #ifdef __MigPackStructs |
959 | #pragma pack(4) |
960 | #endif |
961 | typedef struct { |
962 | mach_msg_header_t Head; |
963 | /* start of the kernel processed data */ |
964 | mach_msg_body_t msgh_body; |
965 | mach_msg_ool_descriptor_t key; |
966 | mach_msg_ool_descriptor_t outtoken; |
967 | /* end of the kernel processed data */ |
968 | NDR_record_t NDR; |
969 | uint32_t gssd_flags; |
970 | gssd_ctx context; |
971 | gssd_cred cred_handle; |
972 | uint32_t ret_flags; |
973 | mach_msg_type_number_t keyCnt; |
974 | mach_msg_type_number_t outtokenCnt; |
975 | mach_msg_type_number_t displaynameOffset; /* MiG doesn't use it */ |
976 | mach_msg_type_number_t displaynameCnt; |
977 | char displayname[128]; |
978 | uint32_t major_stat; |
979 | uint32_t minor_stat; |
980 | mach_msg_trailer_t trailer; |
981 | } Reply __attribute__((unused)); |
982 | #ifdef __MigPackStructs |
983 | #pragma pack() |
984 | #endif |
985 | |
986 | #ifdef __MigPackStructs |
987 | #pragma pack(4) |
988 | #endif |
989 | typedef struct { |
990 | mach_msg_header_t Head; |
991 | /* start of the kernel processed data */ |
992 | mach_msg_body_t msgh_body; |
993 | mach_msg_ool_descriptor_t key; |
994 | mach_msg_ool_descriptor_t outtoken; |
995 | /* end of the kernel processed data */ |
996 | NDR_record_t NDR; |
997 | uint32_t gssd_flags; |
998 | gssd_ctx context; |
999 | gssd_cred cred_handle; |
1000 | uint32_t ret_flags; |
1001 | mach_msg_type_number_t keyCnt; |
1002 | mach_msg_type_number_t outtokenCnt; |
1003 | mach_msg_type_number_t displaynameOffset; /* MiG doesn't use it */ |
1004 | mach_msg_type_number_t displaynameCnt; |
1005 | char displayname[128]; |
1006 | uint32_t major_stat; |
1007 | uint32_t minor_stat; |
1008 | } __Reply __attribute__((unused)); |
1009 | #ifdef __MigPackStructs |
1010 | #pragma pack() |
1011 | #endif |
1012 | /* |
1013 | * typedef struct { |
1014 | * mach_msg_header_t Head; |
1015 | * NDR_record_t NDR; |
1016 | * kern_return_t RetCode; |
1017 | * } mig_reply_error_t; |
1018 | */ |
1019 | |
1020 | union { |
1021 | Request In; |
1022 | Reply Out; |
1023 | } Mess; |
1024 | |
1025 | Request *InP = &Mess.In; |
1026 | Reply *Out0P = &Mess.Out; |
1027 | Reply *Out1P = NULL; |
1028 | |
1029 | mach_msg_return_t msg_result; |
1030 | |
1031 | #ifdef __MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined |
1032 | kern_return_t check_result; |
1033 | #endif /* __MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined */ |
1034 | |
1035 | __DeclareSendRpc(1002, "mach_gss_init_sec_context_v2" ) |
1036 | |
1037 | #if UseStaticTemplates |
1038 | const static mach_msg_ool_descriptor_t intokenTemplate = { |
1039 | /* addr = */ (void *)0, |
1040 | /* size = */ 0, |
1041 | /* deal = */ FALSE, |
1042 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1043 | /* pad2 = */ 0, |
1044 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1045 | }; |
1046 | #endif /* UseStaticTemplates */ |
1047 | |
1048 | #if UseStaticTemplates |
1049 | const static mach_msg_ool_descriptor_t clnt_princTemplate = { |
1050 | /* addr = */ (void *)0, |
1051 | /* size = */ 0, |
1052 | /* deal = */ FALSE, |
1053 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1054 | /* pad2 = */ 0, |
1055 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1056 | }; |
1057 | #endif /* UseStaticTemplates */ |
1058 | |
1059 | #if UseStaticTemplates |
1060 | const static mach_msg_ool_descriptor_t svc_princTemplate = { |
1061 | /* addr = */ (void *)0, |
1062 | /* size = */ 0, |
1063 | /* deal = */ FALSE, |
1064 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1065 | /* pad2 = */ 0, |
1066 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1067 | }; |
1068 | #endif /* UseStaticTemplates */ |
1069 | |
1070 | InP->msgh_body.msgh_descriptor_count = 3; |
1071 | #if UseStaticTemplates |
1072 | InP->intoken = intokenTemplate; |
1073 | InP->intoken.address = (void *)(intoken); |
1074 | InP->intoken.size = intokenCnt; |
1075 | #else /* UseStaticTemplates */ |
1076 | InP->intoken.address = (void *)(intoken); |
1077 | InP->intoken.size = intokenCnt; |
1078 | InP->intoken.deallocate = FALSE; |
1079 | InP->intoken.copy = MACH_MSG_VIRTUAL_COPY; |
1080 | InP->intoken.type = MACH_MSG_OOL_DESCRIPTOR; |
1081 | #endif /* UseStaticTemplates */ |
1082 | |
1083 | #if UseStaticTemplates |
1084 | InP->clnt_princ = clnt_princTemplate; |
1085 | InP->clnt_princ.address = (void *)(clnt_princ); |
1086 | InP->clnt_princ.size = clnt_princCnt; |
1087 | #else /* UseStaticTemplates */ |
1088 | InP->clnt_princ.address = (void *)(clnt_princ); |
1089 | InP->clnt_princ.size = clnt_princCnt; |
1090 | InP->clnt_princ.deallocate = FALSE; |
1091 | InP->clnt_princ.copy = MACH_MSG_VIRTUAL_COPY; |
1092 | InP->clnt_princ.type = MACH_MSG_OOL_DESCRIPTOR; |
1093 | #endif /* UseStaticTemplates */ |
1094 | |
1095 | #if UseStaticTemplates |
1096 | InP->svc_princ = svc_princTemplate; |
1097 | InP->svc_princ.address = (void *)(svc_princ); |
1098 | InP->svc_princ.size = svc_princCnt; |
1099 | #else /* UseStaticTemplates */ |
1100 | InP->svc_princ.address = (void *)(svc_princ); |
1101 | InP->svc_princ.size = svc_princCnt; |
1102 | InP->svc_princ.deallocate = FALSE; |
1103 | InP->svc_princ.copy = MACH_MSG_VIRTUAL_COPY; |
1104 | InP->svc_princ.type = MACH_MSG_OOL_DESCRIPTOR; |
1105 | #endif /* UseStaticTemplates */ |
1106 | |
1107 | InP->NDR = NDR_record; |
1108 | |
1109 | InP->mech = mech; |
1110 | |
1111 | InP->intokenCnt = intokenCnt; |
1112 | |
1113 | InP->uid = uid; |
1114 | |
1115 | InP->clnt_nt = clnt_nt; |
1116 | |
1117 | InP->clnt_princCnt = clnt_princCnt; |
1118 | |
1119 | InP->svc_nt = svc_nt; |
1120 | |
1121 | InP->svc_princCnt = svc_princCnt; |
1122 | |
1123 | InP->flags = flags; |
1124 | |
1125 | InP->gssd_flags = *gssd_flags; |
1126 | |
1127 | InP->context = *context; |
1128 | |
1129 | InP->cred_handle = *cred_handle; |
1130 | |
1131 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
1132 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
1133 | /* msgh_size passed as argument */ |
1134 | InP->Head.msgh_request_port = server; |
1135 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
1136 | InP->Head.msgh_id = 1002; |
1137 | InP->Head.msgh_reserved = 0; |
1138 | |
1139 | __BeforeSendRpc(1002, "mach_gss_init_sec_context_v2" ) |
1140 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
1141 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
1142 | #else |
1143 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
1144 | #endif /* __MigKernelSpecificCode */ |
1145 | __AfterSendRpc(1002, "mach_gss_init_sec_context_v2" ) |
1146 | if (msg_result != MACH_MSG_SUCCESS) { |
1147 | __MachMsgErrorWithoutTimeout(msg_result); |
1148 | { return msg_result; } |
1149 | } |
1150 | |
1151 | |
1152 | #if defined(__MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined) |
1153 | check_result = __MIG_check__Reply__mach_gss_init_sec_context_v2_t((__Reply__mach_gss_init_sec_context_v2_t *)Out0P, (__Reply__mach_gss_init_sec_context_v2_t **)&Out1P); |
1154 | if (check_result != MACH_MSG_SUCCESS) |
1155 | { return check_result; } |
1156 | #endif /* defined(__MIG_check__Reply__mach_gss_init_sec_context_v2_t__defined) */ |
1157 | |
1158 | *gssd_flags = Out0P->gssd_flags; |
1159 | |
1160 | *context = Out0P->context; |
1161 | |
1162 | *cred_handle = Out0P->cred_handle; |
1163 | |
1164 | *ret_flags = Out0P->ret_flags; |
1165 | |
1166 | *key = (gssd_byte_buffer)(Out0P->key.address); |
1167 | *keyCnt = Out0P->keyCnt; |
1168 | |
1169 | *outtoken = (gssd_byte_buffer)(Out0P->outtoken.address); |
1170 | *outtokenCnt = Out0P->outtokenCnt; |
1171 | |
1172 | (void) mig_strncpy(displayname, Out0P->displayname, 128); |
1173 | |
1174 | *major_stat = Out1P->major_stat; |
1175 | |
1176 | *minor_stat = Out1P->minor_stat; |
1177 | |
1178 | return KERN_SUCCESS; |
1179 | } |
1180 | |
1181 | #if ( __MigTypeCheck ) |
1182 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
1183 | #if !defined(__MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined) |
1184 | #define __MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined |
1185 | |
1186 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_accept_sec_context_v2_t(__Reply__mach_gss_accept_sec_context_v2_t *Out0P, __Reply__mach_gss_accept_sec_context_v2_t **Out1PP) |
1187 | { |
1188 | |
1189 | typedef __Reply__mach_gss_accept_sec_context_v2_t __Reply __attribute__((unused)); |
1190 | __Reply *Out1P; |
1191 | boolean_t msgh_simple; |
1192 | #if __MigTypeCheck |
1193 | unsigned int msgh_size; |
1194 | #endif /* __MigTypeCheck */ |
1195 | unsigned int msgh_size_delta; |
1196 | |
1197 | if (Out0P->Head.msgh_id != 1103) { |
1198 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
1199 | { return MIG_SERVER_DIED; } |
1200 | else |
1201 | { return MIG_REPLY_MISMATCH; } |
1202 | } |
1203 | |
1204 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
1205 | #if __MigTypeCheck |
1206 | msgh_size = Out0P->Head.msgh_size; |
1207 | |
1208 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || |
1209 | msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 64) || msgh_size > (mach_msg_size_t)sizeof(__Reply)) && |
1210 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
1211 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
1212 | { return MIG_TYPE_ERROR ; } |
1213 | #endif /* __MigTypeCheck */ |
1214 | |
1215 | if (msgh_simple) { |
1216 | return ((mig_reply_error_t *)Out0P)->RetCode; |
1217 | } |
1218 | |
1219 | #if __MigTypeCheck |
1220 | if (Out0P->key.type != MACH_MSG_OOL_DESCRIPTOR) { |
1221 | return MIG_TYPE_ERROR; |
1222 | } |
1223 | #endif /* __MigTypeCheck */ |
1224 | |
1225 | #if __MigTypeCheck |
1226 | if (Out0P->outtoken.type != MACH_MSG_OOL_DESCRIPTOR) { |
1227 | return MIG_TYPE_ERROR; |
1228 | } |
1229 | #endif /* __MigTypeCheck */ |
1230 | |
1231 | msgh_size_delta = Out0P->gidsCnt * 4; |
1232 | #if __MigTypeCheck |
1233 | if ( Out0P->gidsCnt > 16 ) |
1234 | return MIG_TYPE_ERROR; |
1235 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 64)) / 4< Out0P->gidsCnt) || |
1236 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 64) + Out0P->gidsCnt * 4)) |
1237 | { return MIG_TYPE_ERROR ; } |
1238 | #endif /* __MigTypeCheck */ |
1239 | |
1240 | *Out1PP = Out1P = (__Reply *) ((pointer_t) Out0P + msgh_size_delta - 64); |
1241 | |
1242 | #if __MigTypeCheck |
1243 | if (Out0P->key.size != Out1P->keyCnt) |
1244 | return MIG_TYPE_ERROR; |
1245 | if (Out0P->outtoken.size != Out1P->outtokenCnt) |
1246 | return MIG_TYPE_ERROR; |
1247 | #endif /* __MigTypeCheck */ |
1248 | |
1249 | return MACH_MSG_SUCCESS; |
1250 | } |
1251 | #endif /* !defined(__MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined) */ |
1252 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
1253 | #endif /* ( __MigTypeCheck ) */ |
1254 | |
1255 | |
1256 | /* Routine mach_gss_accept_sec_context_v2 */ |
1257 | mig_external kern_return_t mach_gss_accept_sec_context_v2 |
1258 | ( |
1259 | mach_port_t server, |
1260 | gssd_byte_buffer intoken, |
1261 | mach_msg_type_number_t intokenCnt, |
1262 | gssd_nametype svc_nt, |
1263 | gssd_byte_buffer svc_princ, |
1264 | mach_msg_type_number_t svc_princCnt, |
1265 | uint32_t *gssd_flags, |
1266 | gssd_ctx *context, |
1267 | gssd_cred *cred_handle, |
1268 | uint32_t *flags, |
1269 | uint32_t *uid, |
1270 | gssd_gid_list gids, |
1271 | mach_msg_type_number_t *gidsCnt, |
1272 | gssd_byte_buffer *key, |
1273 | mach_msg_type_number_t *keyCnt, |
1274 | gssd_byte_buffer *outtoken, |
1275 | mach_msg_type_number_t *outtokenCnt, |
1276 | uint32_t *major_stat, |
1277 | uint32_t *minor_stat |
1278 | ) |
1279 | { |
1280 | |
1281 | #ifdef __MigPackStructs |
1282 | #pragma pack(4) |
1283 | #endif |
1284 | typedef struct { |
1285 | mach_msg_header_t Head; |
1286 | /* start of the kernel processed data */ |
1287 | mach_msg_body_t msgh_body; |
1288 | mach_msg_ool_descriptor_t intoken; |
1289 | mach_msg_ool_descriptor_t svc_princ; |
1290 | /* end of the kernel processed data */ |
1291 | NDR_record_t NDR; |
1292 | mach_msg_type_number_t intokenCnt; |
1293 | gssd_nametype svc_nt; |
1294 | mach_msg_type_number_t svc_princCnt; |
1295 | uint32_t gssd_flags; |
1296 | gssd_ctx context; |
1297 | gssd_cred cred_handle; |
1298 | } Request __attribute__((unused)); |
1299 | #ifdef __MigPackStructs |
1300 | #pragma pack() |
1301 | #endif |
1302 | |
1303 | #ifdef __MigPackStructs |
1304 | #pragma pack(4) |
1305 | #endif |
1306 | typedef struct { |
1307 | mach_msg_header_t Head; |
1308 | /* start of the kernel processed data */ |
1309 | mach_msg_body_t msgh_body; |
1310 | mach_msg_ool_descriptor_t key; |
1311 | mach_msg_ool_descriptor_t outtoken; |
1312 | /* end of the kernel processed data */ |
1313 | NDR_record_t NDR; |
1314 | uint32_t gssd_flags; |
1315 | gssd_ctx context; |
1316 | gssd_cred cred_handle; |
1317 | uint32_t flags; |
1318 | uint32_t uid; |
1319 | mach_msg_type_number_t gidsCnt; |
1320 | uint32_t gids[16]; |
1321 | mach_msg_type_number_t keyCnt; |
1322 | mach_msg_type_number_t outtokenCnt; |
1323 | uint32_t major_stat; |
1324 | uint32_t minor_stat; |
1325 | mach_msg_trailer_t trailer; |
1326 | } Reply __attribute__((unused)); |
1327 | #ifdef __MigPackStructs |
1328 | #pragma pack() |
1329 | #endif |
1330 | |
1331 | #ifdef __MigPackStructs |
1332 | #pragma pack(4) |
1333 | #endif |
1334 | typedef struct { |
1335 | mach_msg_header_t Head; |
1336 | /* start of the kernel processed data */ |
1337 | mach_msg_body_t msgh_body; |
1338 | mach_msg_ool_descriptor_t key; |
1339 | mach_msg_ool_descriptor_t outtoken; |
1340 | /* end of the kernel processed data */ |
1341 | NDR_record_t NDR; |
1342 | uint32_t gssd_flags; |
1343 | gssd_ctx context; |
1344 | gssd_cred cred_handle; |
1345 | uint32_t flags; |
1346 | uint32_t uid; |
1347 | mach_msg_type_number_t gidsCnt; |
1348 | uint32_t gids[16]; |
1349 | mach_msg_type_number_t keyCnt; |
1350 | mach_msg_type_number_t outtokenCnt; |
1351 | uint32_t major_stat; |
1352 | uint32_t minor_stat; |
1353 | } __Reply __attribute__((unused)); |
1354 | #ifdef __MigPackStructs |
1355 | #pragma pack() |
1356 | #endif |
1357 | /* |
1358 | * typedef struct { |
1359 | * mach_msg_header_t Head; |
1360 | * NDR_record_t NDR; |
1361 | * kern_return_t RetCode; |
1362 | * } mig_reply_error_t; |
1363 | */ |
1364 | |
1365 | union { |
1366 | Request In; |
1367 | Reply Out; |
1368 | } Mess; |
1369 | |
1370 | Request *InP = &Mess.In; |
1371 | Reply *Out0P = &Mess.Out; |
1372 | Reply *Out1P = NULL; |
1373 | |
1374 | mach_msg_return_t msg_result; |
1375 | |
1376 | #ifdef __MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined |
1377 | kern_return_t check_result; |
1378 | #endif /* __MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined */ |
1379 | |
1380 | __DeclareSendRpc(1003, "mach_gss_accept_sec_context_v2" ) |
1381 | |
1382 | #if UseStaticTemplates |
1383 | const static mach_msg_ool_descriptor_t intokenTemplate = { |
1384 | /* addr = */ (void *)0, |
1385 | /* size = */ 0, |
1386 | /* deal = */ FALSE, |
1387 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1388 | /* pad2 = */ 0, |
1389 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1390 | }; |
1391 | #endif /* UseStaticTemplates */ |
1392 | |
1393 | #if UseStaticTemplates |
1394 | const static mach_msg_ool_descriptor_t svc_princTemplate = { |
1395 | /* addr = */ (void *)0, |
1396 | /* size = */ 0, |
1397 | /* deal = */ FALSE, |
1398 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1399 | /* pad2 = */ 0, |
1400 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1401 | }; |
1402 | #endif /* UseStaticTemplates */ |
1403 | |
1404 | InP->msgh_body.msgh_descriptor_count = 2; |
1405 | #if UseStaticTemplates |
1406 | InP->intoken = intokenTemplate; |
1407 | InP->intoken.address = (void *)(intoken); |
1408 | InP->intoken.size = intokenCnt; |
1409 | #else /* UseStaticTemplates */ |
1410 | InP->intoken.address = (void *)(intoken); |
1411 | InP->intoken.size = intokenCnt; |
1412 | InP->intoken.deallocate = FALSE; |
1413 | InP->intoken.copy = MACH_MSG_VIRTUAL_COPY; |
1414 | InP->intoken.type = MACH_MSG_OOL_DESCRIPTOR; |
1415 | #endif /* UseStaticTemplates */ |
1416 | |
1417 | #if UseStaticTemplates |
1418 | InP->svc_princ = svc_princTemplate; |
1419 | InP->svc_princ.address = (void *)(svc_princ); |
1420 | InP->svc_princ.size = svc_princCnt; |
1421 | #else /* UseStaticTemplates */ |
1422 | InP->svc_princ.address = (void *)(svc_princ); |
1423 | InP->svc_princ.size = svc_princCnt; |
1424 | InP->svc_princ.deallocate = FALSE; |
1425 | InP->svc_princ.copy = MACH_MSG_VIRTUAL_COPY; |
1426 | InP->svc_princ.type = MACH_MSG_OOL_DESCRIPTOR; |
1427 | #endif /* UseStaticTemplates */ |
1428 | |
1429 | InP->NDR = NDR_record; |
1430 | |
1431 | InP->intokenCnt = intokenCnt; |
1432 | |
1433 | InP->svc_nt = svc_nt; |
1434 | |
1435 | InP->svc_princCnt = svc_princCnt; |
1436 | |
1437 | InP->gssd_flags = *gssd_flags; |
1438 | |
1439 | InP->context = *context; |
1440 | |
1441 | InP->cred_handle = *cred_handle; |
1442 | |
1443 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
1444 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
1445 | /* msgh_size passed as argument */ |
1446 | InP->Head.msgh_request_port = server; |
1447 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
1448 | InP->Head.msgh_id = 1003; |
1449 | InP->Head.msgh_reserved = 0; |
1450 | |
1451 | __BeforeSendRpc(1003, "mach_gss_accept_sec_context_v2" ) |
1452 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
1453 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
1454 | #else |
1455 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
1456 | #endif /* __MigKernelSpecificCode */ |
1457 | __AfterSendRpc(1003, "mach_gss_accept_sec_context_v2" ) |
1458 | if (msg_result != MACH_MSG_SUCCESS) { |
1459 | __MachMsgErrorWithoutTimeout(msg_result); |
1460 | { return msg_result; } |
1461 | } |
1462 | |
1463 | |
1464 | #if defined(__MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined) |
1465 | check_result = __MIG_check__Reply__mach_gss_accept_sec_context_v2_t((__Reply__mach_gss_accept_sec_context_v2_t *)Out0P, (__Reply__mach_gss_accept_sec_context_v2_t **)&Out1P); |
1466 | if (check_result != MACH_MSG_SUCCESS) |
1467 | { return check_result; } |
1468 | #endif /* defined(__MIG_check__Reply__mach_gss_accept_sec_context_v2_t__defined) */ |
1469 | |
1470 | *gssd_flags = Out0P->gssd_flags; |
1471 | |
1472 | *context = Out0P->context; |
1473 | |
1474 | *cred_handle = Out0P->cred_handle; |
1475 | |
1476 | *flags = Out0P->flags; |
1477 | |
1478 | *uid = Out0P->uid; |
1479 | |
1480 | if (Out0P->gidsCnt > 16) { |
1481 | (void)memcpy((char *) gids, (const char *) Out0P->gids, 4 * 16); |
1482 | *gidsCnt = Out0P->gidsCnt; |
1483 | { return MIG_ARRAY_TOO_LARGE; } |
1484 | } |
1485 | (void)memcpy((char *) gids, (const char *) Out0P->gids, 4 * Out0P->gidsCnt); |
1486 | |
1487 | *gidsCnt = Out0P->gidsCnt; |
1488 | |
1489 | *key = (gssd_byte_buffer)(Out0P->key.address); |
1490 | *keyCnt = Out1P->keyCnt; |
1491 | |
1492 | *outtoken = (gssd_byte_buffer)(Out0P->outtoken.address); |
1493 | *outtokenCnt = Out1P->outtokenCnt; |
1494 | |
1495 | *major_stat = Out1P->major_stat; |
1496 | |
1497 | *minor_stat = Out1P->minor_stat; |
1498 | |
1499 | return KERN_SUCCESS; |
1500 | } |
1501 | |
1502 | #if ( __MigTypeCheck ) |
1503 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
1504 | #if !defined(__MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined) |
1505 | #define __MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined |
1506 | |
1507 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_init_sec_context_v3_t(__Reply__mach_gss_init_sec_context_v3_t *Out0P, __Reply__mach_gss_init_sec_context_v3_t **Out1PP) |
1508 | { |
1509 | |
1510 | typedef __Reply__mach_gss_init_sec_context_v3_t __Reply __attribute__((unused)); |
1511 | __Reply *Out1P; |
1512 | boolean_t msgh_simple; |
1513 | #if __MigTypeCheck |
1514 | unsigned int msgh_size; |
1515 | #endif /* __MigTypeCheck */ |
1516 | unsigned int msgh_size_delta; |
1517 | |
1518 | if (Out0P->Head.msgh_id != 1104) { |
1519 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
1520 | { return MIG_SERVER_DIED; } |
1521 | else |
1522 | { return MIG_REPLY_MISMATCH; } |
1523 | } |
1524 | |
1525 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
1526 | #if __MigTypeCheck |
1527 | msgh_size = Out0P->Head.msgh_size; |
1528 | |
1529 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || |
1530 | msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 128) || msgh_size > (mach_msg_size_t)sizeof(__Reply)) && |
1531 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
1532 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
1533 | { return MIG_TYPE_ERROR ; } |
1534 | #endif /* __MigTypeCheck */ |
1535 | |
1536 | if (msgh_simple) { |
1537 | return ((mig_reply_error_t *)Out0P)->RetCode; |
1538 | } |
1539 | |
1540 | #if __MigTypeCheck |
1541 | if (Out0P->key.type != MACH_MSG_OOL_DESCRIPTOR) { |
1542 | return MIG_TYPE_ERROR; |
1543 | } |
1544 | #endif /* __MigTypeCheck */ |
1545 | |
1546 | #if __MigTypeCheck |
1547 | if (Out0P->outtoken.type != MACH_MSG_OOL_DESCRIPTOR) { |
1548 | return MIG_TYPE_ERROR; |
1549 | } |
1550 | #endif /* __MigTypeCheck */ |
1551 | |
1552 | msgh_size_delta = _WALIGN_(Out0P->displaynameCnt); |
1553 | #if __MigTypeCheck |
1554 | if ( Out0P->displaynameCnt > 128 ) |
1555 | return MIG_TYPE_ERROR; |
1556 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 128))< Out0P->displaynameCnt) || |
1557 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 128) + _WALIGN_(Out0P->displaynameCnt))) |
1558 | { return MIG_TYPE_ERROR ; } |
1559 | #endif /* __MigTypeCheck */ |
1560 | |
1561 | *Out1PP = Out1P = (__Reply *) ((pointer_t) Out0P + msgh_size_delta - 128); |
1562 | |
1563 | #if __MigTypeCheck |
1564 | if (Out0P->key.size != Out0P->keyCnt) |
1565 | return MIG_TYPE_ERROR; |
1566 | if (Out0P->outtoken.size != Out0P->outtokenCnt) |
1567 | return MIG_TYPE_ERROR; |
1568 | #endif /* __MigTypeCheck */ |
1569 | |
1570 | return MACH_MSG_SUCCESS; |
1571 | } |
1572 | #endif /* !defined(__MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined) */ |
1573 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
1574 | #endif /* ( __MigTypeCheck ) */ |
1575 | |
1576 | |
1577 | /* Routine mach_gss_init_sec_context_v3 */ |
1578 | mig_external kern_return_t mach_gss_init_sec_context_v3 |
1579 | ( |
1580 | mach_port_t server, |
1581 | gssd_mechtype mech, |
1582 | gssd_byte_buffer intoken, |
1583 | mach_msg_type_number_t intokenCnt, |
1584 | uint32_t uid, |
1585 | gssd_nametype clnt_nt, |
1586 | gssd_byte_buffer clnt_princ, |
1587 | mach_msg_type_number_t clnt_princCnt, |
1588 | gssd_nametype svc_nt, |
1589 | gssd_byte_buffer svc_princ, |
1590 | mach_msg_type_number_t svc_princCnt, |
1591 | uint32_t flags, |
1592 | gssd_etype_list etypes, |
1593 | mach_msg_type_number_t etypesCnt, |
1594 | uint32_t *gssd_flags, |
1595 | gssd_ctx *context, |
1596 | gssd_cred *cred_handle, |
1597 | uint32_t *ret_flags, |
1598 | gssd_byte_buffer *key, |
1599 | mach_msg_type_number_t *keyCnt, |
1600 | gssd_byte_buffer *outtoken, |
1601 | mach_msg_type_number_t *outtokenCnt, |
1602 | gssd_dstring displayname, |
1603 | uint32_t *major_stat, |
1604 | uint32_t *minor_stat |
1605 | ) |
1606 | { |
1607 | |
1608 | #ifdef __MigPackStructs |
1609 | #pragma pack(4) |
1610 | #endif |
1611 | typedef struct { |
1612 | mach_msg_header_t Head; |
1613 | /* start of the kernel processed data */ |
1614 | mach_msg_body_t msgh_body; |
1615 | mach_msg_ool_descriptor_t intoken; |
1616 | mach_msg_ool_descriptor_t clnt_princ; |
1617 | mach_msg_ool_descriptor_t svc_princ; |
1618 | /* end of the kernel processed data */ |
1619 | NDR_record_t NDR; |
1620 | gssd_mechtype mech; |
1621 | mach_msg_type_number_t intokenCnt; |
1622 | uint32_t uid; |
1623 | gssd_nametype clnt_nt; |
1624 | mach_msg_type_number_t clnt_princCnt; |
1625 | gssd_nametype svc_nt; |
1626 | mach_msg_type_number_t svc_princCnt; |
1627 | uint32_t flags; |
1628 | mach_msg_type_number_t etypesCnt; |
1629 | int32_t etypes[64]; |
1630 | uint32_t gssd_flags; |
1631 | gssd_ctx context; |
1632 | gssd_cred cred_handle; |
1633 | } Request __attribute__((unused)); |
1634 | #ifdef __MigPackStructs |
1635 | #pragma pack() |
1636 | #endif |
1637 | |
1638 | #ifdef __MigPackStructs |
1639 | #pragma pack(4) |
1640 | #endif |
1641 | typedef struct { |
1642 | mach_msg_header_t Head; |
1643 | /* start of the kernel processed data */ |
1644 | mach_msg_body_t msgh_body; |
1645 | mach_msg_ool_descriptor_t key; |
1646 | mach_msg_ool_descriptor_t outtoken; |
1647 | /* end of the kernel processed data */ |
1648 | NDR_record_t NDR; |
1649 | uint32_t gssd_flags; |
1650 | gssd_ctx context; |
1651 | gssd_cred cred_handle; |
1652 | uint32_t ret_flags; |
1653 | mach_msg_type_number_t keyCnt; |
1654 | mach_msg_type_number_t outtokenCnt; |
1655 | mach_msg_type_number_t displaynameOffset; /* MiG doesn't use it */ |
1656 | mach_msg_type_number_t displaynameCnt; |
1657 | char displayname[128]; |
1658 | uint32_t major_stat; |
1659 | uint32_t minor_stat; |
1660 | mach_msg_trailer_t trailer; |
1661 | } Reply __attribute__((unused)); |
1662 | #ifdef __MigPackStructs |
1663 | #pragma pack() |
1664 | #endif |
1665 | |
1666 | #ifdef __MigPackStructs |
1667 | #pragma pack(4) |
1668 | #endif |
1669 | typedef struct { |
1670 | mach_msg_header_t Head; |
1671 | /* start of the kernel processed data */ |
1672 | mach_msg_body_t msgh_body; |
1673 | mach_msg_ool_descriptor_t key; |
1674 | mach_msg_ool_descriptor_t outtoken; |
1675 | /* end of the kernel processed data */ |
1676 | NDR_record_t NDR; |
1677 | uint32_t gssd_flags; |
1678 | gssd_ctx context; |
1679 | gssd_cred cred_handle; |
1680 | uint32_t ret_flags; |
1681 | mach_msg_type_number_t keyCnt; |
1682 | mach_msg_type_number_t outtokenCnt; |
1683 | mach_msg_type_number_t displaynameOffset; /* MiG doesn't use it */ |
1684 | mach_msg_type_number_t displaynameCnt; |
1685 | char displayname[128]; |
1686 | uint32_t major_stat; |
1687 | uint32_t minor_stat; |
1688 | } __Reply __attribute__((unused)); |
1689 | #ifdef __MigPackStructs |
1690 | #pragma pack() |
1691 | #endif |
1692 | /* |
1693 | * typedef struct { |
1694 | * mach_msg_header_t Head; |
1695 | * NDR_record_t NDR; |
1696 | * kern_return_t RetCode; |
1697 | * } mig_reply_error_t; |
1698 | */ |
1699 | |
1700 | union { |
1701 | Request In; |
1702 | Reply Out; |
1703 | } Mess; |
1704 | |
1705 | Request *InP = &Mess.In; |
1706 | Reply *Out0P = &Mess.Out; |
1707 | Reply *Out1P = NULL; |
1708 | |
1709 | mach_msg_return_t msg_result; |
1710 | unsigned int msgh_size; |
1711 | unsigned int msgh_size_delta; |
1712 | |
1713 | |
1714 | #ifdef __MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined |
1715 | kern_return_t check_result; |
1716 | #endif /* __MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined */ |
1717 | |
1718 | __DeclareSendRpc(1004, "mach_gss_init_sec_context_v3" ) |
1719 | |
1720 | #if UseStaticTemplates |
1721 | const static mach_msg_ool_descriptor_t intokenTemplate = { |
1722 | /* addr = */ (void *)0, |
1723 | /* size = */ 0, |
1724 | /* deal = */ FALSE, |
1725 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1726 | /* pad2 = */ 0, |
1727 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1728 | }; |
1729 | #endif /* UseStaticTemplates */ |
1730 | |
1731 | #if UseStaticTemplates |
1732 | const static mach_msg_ool_descriptor_t clnt_princTemplate = { |
1733 | /* addr = */ (void *)0, |
1734 | /* size = */ 0, |
1735 | /* deal = */ FALSE, |
1736 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1737 | /* pad2 = */ 0, |
1738 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1739 | }; |
1740 | #endif /* UseStaticTemplates */ |
1741 | |
1742 | #if UseStaticTemplates |
1743 | const static mach_msg_ool_descriptor_t svc_princTemplate = { |
1744 | /* addr = */ (void *)0, |
1745 | /* size = */ 0, |
1746 | /* deal = */ FALSE, |
1747 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
1748 | /* pad2 = */ 0, |
1749 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
1750 | }; |
1751 | #endif /* UseStaticTemplates */ |
1752 | |
1753 | InP->msgh_body.msgh_descriptor_count = 3; |
1754 | #if UseStaticTemplates |
1755 | InP->intoken = intokenTemplate; |
1756 | InP->intoken.address = (void *)(intoken); |
1757 | InP->intoken.size = intokenCnt; |
1758 | #else /* UseStaticTemplates */ |
1759 | InP->intoken.address = (void *)(intoken); |
1760 | InP->intoken.size = intokenCnt; |
1761 | InP->intoken.deallocate = FALSE; |
1762 | InP->intoken.copy = MACH_MSG_VIRTUAL_COPY; |
1763 | InP->intoken.type = MACH_MSG_OOL_DESCRIPTOR; |
1764 | #endif /* UseStaticTemplates */ |
1765 | |
1766 | #if UseStaticTemplates |
1767 | InP->clnt_princ = clnt_princTemplate; |
1768 | InP->clnt_princ.address = (void *)(clnt_princ); |
1769 | InP->clnt_princ.size = clnt_princCnt; |
1770 | #else /* UseStaticTemplates */ |
1771 | InP->clnt_princ.address = (void *)(clnt_princ); |
1772 | InP->clnt_princ.size = clnt_princCnt; |
1773 | InP->clnt_princ.deallocate = FALSE; |
1774 | InP->clnt_princ.copy = MACH_MSG_VIRTUAL_COPY; |
1775 | InP->clnt_princ.type = MACH_MSG_OOL_DESCRIPTOR; |
1776 | #endif /* UseStaticTemplates */ |
1777 | |
1778 | #if UseStaticTemplates |
1779 | InP->svc_princ = svc_princTemplate; |
1780 | InP->svc_princ.address = (void *)(svc_princ); |
1781 | InP->svc_princ.size = svc_princCnt; |
1782 | #else /* UseStaticTemplates */ |
1783 | InP->svc_princ.address = (void *)(svc_princ); |
1784 | InP->svc_princ.size = svc_princCnt; |
1785 | InP->svc_princ.deallocate = FALSE; |
1786 | InP->svc_princ.copy = MACH_MSG_VIRTUAL_COPY; |
1787 | InP->svc_princ.type = MACH_MSG_OOL_DESCRIPTOR; |
1788 | #endif /* UseStaticTemplates */ |
1789 | |
1790 | InP->NDR = NDR_record; |
1791 | |
1792 | InP->mech = mech; |
1793 | |
1794 | InP->intokenCnt = intokenCnt; |
1795 | |
1796 | InP->uid = uid; |
1797 | |
1798 | InP->clnt_nt = clnt_nt; |
1799 | |
1800 | InP->clnt_princCnt = clnt_princCnt; |
1801 | |
1802 | InP->svc_nt = svc_nt; |
1803 | |
1804 | InP->svc_princCnt = svc_princCnt; |
1805 | |
1806 | InP->flags = flags; |
1807 | |
1808 | if (etypesCnt > 64) { |
1809 | { return MIG_ARRAY_TOO_LARGE; } |
1810 | } |
1811 | (void)memcpy((char *) InP->etypes, (const char *) etypes, 4 * etypesCnt); |
1812 | |
1813 | InP->etypesCnt = etypesCnt; |
1814 | |
1815 | msgh_size_delta = (4 * etypesCnt); |
1816 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 256) + msgh_size_delta; |
1817 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 256); |
1818 | |
1819 | InP->gssd_flags = *gssd_flags; |
1820 | |
1821 | InP->context = *context; |
1822 | |
1823 | InP->cred_handle = *cred_handle; |
1824 | |
1825 | InP = &Mess.In; |
1826 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
1827 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
1828 | /* msgh_size passed as argument */ |
1829 | InP->Head.msgh_request_port = server; |
1830 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
1831 | InP->Head.msgh_id = 1004; |
1832 | InP->Head.msgh_reserved = 0; |
1833 | |
1834 | __BeforeSendRpc(1004, "mach_gss_init_sec_context_v3" ) |
1835 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
1836 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
1837 | #else |
1838 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
1839 | #endif /* __MigKernelSpecificCode */ |
1840 | __AfterSendRpc(1004, "mach_gss_init_sec_context_v3" ) |
1841 | if (msg_result != MACH_MSG_SUCCESS) { |
1842 | __MachMsgErrorWithoutTimeout(msg_result); |
1843 | { return msg_result; } |
1844 | } |
1845 | |
1846 | |
1847 | #if defined(__MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined) |
1848 | check_result = __MIG_check__Reply__mach_gss_init_sec_context_v3_t((__Reply__mach_gss_init_sec_context_v3_t *)Out0P, (__Reply__mach_gss_init_sec_context_v3_t **)&Out1P); |
1849 | if (check_result != MACH_MSG_SUCCESS) |
1850 | { return check_result; } |
1851 | #endif /* defined(__MIG_check__Reply__mach_gss_init_sec_context_v3_t__defined) */ |
1852 | |
1853 | *gssd_flags = Out0P->gssd_flags; |
1854 | |
1855 | *context = Out0P->context; |
1856 | |
1857 | *cred_handle = Out0P->cred_handle; |
1858 | |
1859 | *ret_flags = Out0P->ret_flags; |
1860 | |
1861 | *key = (gssd_byte_buffer)(Out0P->key.address); |
1862 | *keyCnt = Out0P->keyCnt; |
1863 | |
1864 | *outtoken = (gssd_byte_buffer)(Out0P->outtoken.address); |
1865 | *outtokenCnt = Out0P->outtokenCnt; |
1866 | |
1867 | (void) mig_strncpy(displayname, Out0P->displayname, 128); |
1868 | |
1869 | *major_stat = Out1P->major_stat; |
1870 | |
1871 | *minor_stat = Out1P->minor_stat; |
1872 | |
1873 | return KERN_SUCCESS; |
1874 | } |
1875 | |
1876 | #if ( __MigTypeCheck ) |
1877 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
1878 | #if !defined(__MIG_check__Reply__mach_gss_hold_cred_t__defined) |
1879 | #define __MIG_check__Reply__mach_gss_hold_cred_t__defined |
1880 | |
1881 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_hold_cred_t(__Reply__mach_gss_hold_cred_t *Out0P) |
1882 | { |
1883 | |
1884 | typedef __Reply__mach_gss_hold_cred_t __Reply __attribute__((unused)); |
1885 | #if __MigTypeCheck |
1886 | unsigned int msgh_size; |
1887 | #endif /* __MigTypeCheck */ |
1888 | if (Out0P->Head.msgh_id != 1105) { |
1889 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
1890 | { return MIG_SERVER_DIED; } |
1891 | else |
1892 | { return MIG_REPLY_MISMATCH; } |
1893 | } |
1894 | |
1895 | #if __MigTypeCheck |
1896 | msgh_size = Out0P->Head.msgh_size; |
1897 | |
1898 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
1899 | ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && |
1900 | (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
1901 | Out0P->RetCode == KERN_SUCCESS))) |
1902 | { return MIG_TYPE_ERROR ; } |
1903 | #endif /* __MigTypeCheck */ |
1904 | |
1905 | if (Out0P->RetCode != KERN_SUCCESS) { |
1906 | return ((mig_reply_error_t *)Out0P)->RetCode; |
1907 | } |
1908 | |
1909 | return MACH_MSG_SUCCESS; |
1910 | } |
1911 | #endif /* !defined(__MIG_check__Reply__mach_gss_hold_cred_t__defined) */ |
1912 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
1913 | #endif /* ( __MigTypeCheck ) */ |
1914 | |
1915 | |
1916 | /* Routine mach_gss_hold_cred */ |
1917 | mig_external kern_return_t mach_gss_hold_cred |
1918 | ( |
1919 | mach_port_t server, |
1920 | gssd_mechtype mech, |
1921 | gssd_nametype nt, |
1922 | gssd_byte_buffer princ, |
1923 | mach_msg_type_number_t princCnt, |
1924 | uint32_t *major_stat, |
1925 | uint32_t *minor_stat |
1926 | ) |
1927 | { |
1928 | |
1929 | #ifdef __MigPackStructs |
1930 | #pragma pack(4) |
1931 | #endif |
1932 | typedef struct { |
1933 | mach_msg_header_t Head; |
1934 | /* start of the kernel processed data */ |
1935 | mach_msg_body_t msgh_body; |
1936 | mach_msg_ool_descriptor_t princ; |
1937 | /* end of the kernel processed data */ |
1938 | NDR_record_t NDR; |
1939 | gssd_mechtype mech; |
1940 | gssd_nametype nt; |
1941 | mach_msg_type_number_t princCnt; |
1942 | } Request __attribute__((unused)); |
1943 | #ifdef __MigPackStructs |
1944 | #pragma pack() |
1945 | #endif |
1946 | |
1947 | #ifdef __MigPackStructs |
1948 | #pragma pack(4) |
1949 | #endif |
1950 | typedef struct { |
1951 | mach_msg_header_t Head; |
1952 | NDR_record_t NDR; |
1953 | kern_return_t RetCode; |
1954 | uint32_t major_stat; |
1955 | uint32_t minor_stat; |
1956 | mach_msg_trailer_t trailer; |
1957 | } Reply __attribute__((unused)); |
1958 | #ifdef __MigPackStructs |
1959 | #pragma pack() |
1960 | #endif |
1961 | |
1962 | #ifdef __MigPackStructs |
1963 | #pragma pack(4) |
1964 | #endif |
1965 | typedef struct { |
1966 | mach_msg_header_t Head; |
1967 | NDR_record_t NDR; |
1968 | kern_return_t RetCode; |
1969 | uint32_t major_stat; |
1970 | uint32_t minor_stat; |
1971 | } __Reply __attribute__((unused)); |
1972 | #ifdef __MigPackStructs |
1973 | #pragma pack() |
1974 | #endif |
1975 | /* |
1976 | * typedef struct { |
1977 | * mach_msg_header_t Head; |
1978 | * NDR_record_t NDR; |
1979 | * kern_return_t RetCode; |
1980 | * } mig_reply_error_t; |
1981 | */ |
1982 | |
1983 | union { |
1984 | Request In; |
1985 | Reply Out; |
1986 | } Mess; |
1987 | |
1988 | Request *InP = &Mess.In; |
1989 | Reply *Out0P = &Mess.Out; |
1990 | |
1991 | mach_msg_return_t msg_result; |
1992 | |
1993 | #ifdef __MIG_check__Reply__mach_gss_hold_cred_t__defined |
1994 | kern_return_t check_result; |
1995 | #endif /* __MIG_check__Reply__mach_gss_hold_cred_t__defined */ |
1996 | |
1997 | __DeclareSendRpc(1005, "mach_gss_hold_cred" ) |
1998 | |
1999 | #if UseStaticTemplates |
2000 | const static mach_msg_ool_descriptor_t princTemplate = { |
2001 | /* addr = */ (void *)0, |
2002 | /* size = */ 0, |
2003 | /* deal = */ FALSE, |
2004 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
2005 | /* pad2 = */ 0, |
2006 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
2007 | }; |
2008 | #endif /* UseStaticTemplates */ |
2009 | |
2010 | InP->msgh_body.msgh_descriptor_count = 1; |
2011 | #if UseStaticTemplates |
2012 | InP->princ = princTemplate; |
2013 | InP->princ.address = (void *)(princ); |
2014 | InP->princ.size = princCnt; |
2015 | #else /* UseStaticTemplates */ |
2016 | InP->princ.address = (void *)(princ); |
2017 | InP->princ.size = princCnt; |
2018 | InP->princ.deallocate = FALSE; |
2019 | InP->princ.copy = MACH_MSG_VIRTUAL_COPY; |
2020 | InP->princ.type = MACH_MSG_OOL_DESCRIPTOR; |
2021 | #endif /* UseStaticTemplates */ |
2022 | |
2023 | InP->NDR = NDR_record; |
2024 | |
2025 | InP->mech = mech; |
2026 | |
2027 | InP->nt = nt; |
2028 | |
2029 | InP->princCnt = princCnt; |
2030 | |
2031 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
2032 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
2033 | /* msgh_size passed as argument */ |
2034 | InP->Head.msgh_request_port = server; |
2035 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
2036 | InP->Head.msgh_id = 1005; |
2037 | InP->Head.msgh_reserved = 0; |
2038 | |
2039 | __BeforeSendRpc(1005, "mach_gss_hold_cred" ) |
2040 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
2041 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
2042 | #else |
2043 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
2044 | #endif /* __MigKernelSpecificCode */ |
2045 | __AfterSendRpc(1005, "mach_gss_hold_cred" ) |
2046 | if (msg_result != MACH_MSG_SUCCESS) { |
2047 | __MachMsgErrorWithoutTimeout(msg_result); |
2048 | { return msg_result; } |
2049 | } |
2050 | |
2051 | |
2052 | #if defined(__MIG_check__Reply__mach_gss_hold_cred_t__defined) |
2053 | check_result = __MIG_check__Reply__mach_gss_hold_cred_t((__Reply__mach_gss_hold_cred_t *)Out0P); |
2054 | if (check_result != MACH_MSG_SUCCESS) |
2055 | { return check_result; } |
2056 | #endif /* defined(__MIG_check__Reply__mach_gss_hold_cred_t__defined) */ |
2057 | |
2058 | *major_stat = Out0P->major_stat; |
2059 | |
2060 | *minor_stat = Out0P->minor_stat; |
2061 | |
2062 | return KERN_SUCCESS; |
2063 | } |
2064 | |
2065 | #if ( __MigTypeCheck ) |
2066 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
2067 | #if !defined(__MIG_check__Reply__mach_gss_unhold_cred_t__defined) |
2068 | #define __MIG_check__Reply__mach_gss_unhold_cred_t__defined |
2069 | |
2070 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_unhold_cred_t(__Reply__mach_gss_unhold_cred_t *Out0P) |
2071 | { |
2072 | |
2073 | typedef __Reply__mach_gss_unhold_cred_t __Reply __attribute__((unused)); |
2074 | #if __MigTypeCheck |
2075 | unsigned int msgh_size; |
2076 | #endif /* __MigTypeCheck */ |
2077 | if (Out0P->Head.msgh_id != 1106) { |
2078 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
2079 | { return MIG_SERVER_DIED; } |
2080 | else |
2081 | { return MIG_REPLY_MISMATCH; } |
2082 | } |
2083 | |
2084 | #if __MigTypeCheck |
2085 | msgh_size = Out0P->Head.msgh_size; |
2086 | |
2087 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
2088 | ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && |
2089 | (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
2090 | Out0P->RetCode == KERN_SUCCESS))) |
2091 | { return MIG_TYPE_ERROR ; } |
2092 | #endif /* __MigTypeCheck */ |
2093 | |
2094 | if (Out0P->RetCode != KERN_SUCCESS) { |
2095 | return ((mig_reply_error_t *)Out0P)->RetCode; |
2096 | } |
2097 | |
2098 | return MACH_MSG_SUCCESS; |
2099 | } |
2100 | #endif /* !defined(__MIG_check__Reply__mach_gss_unhold_cred_t__defined) */ |
2101 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
2102 | #endif /* ( __MigTypeCheck ) */ |
2103 | |
2104 | |
2105 | /* Routine mach_gss_unhold_cred */ |
2106 | mig_external kern_return_t mach_gss_unhold_cred |
2107 | ( |
2108 | mach_port_t server, |
2109 | gssd_mechtype mech, |
2110 | gssd_nametype nt, |
2111 | gssd_byte_buffer princ, |
2112 | mach_msg_type_number_t princCnt, |
2113 | uint32_t *major_stat, |
2114 | uint32_t *minor_stat |
2115 | ) |
2116 | { |
2117 | |
2118 | #ifdef __MigPackStructs |
2119 | #pragma pack(4) |
2120 | #endif |
2121 | typedef struct { |
2122 | mach_msg_header_t Head; |
2123 | /* start of the kernel processed data */ |
2124 | mach_msg_body_t msgh_body; |
2125 | mach_msg_ool_descriptor_t princ; |
2126 | /* end of the kernel processed data */ |
2127 | NDR_record_t NDR; |
2128 | gssd_mechtype mech; |
2129 | gssd_nametype nt; |
2130 | mach_msg_type_number_t princCnt; |
2131 | } Request __attribute__((unused)); |
2132 | #ifdef __MigPackStructs |
2133 | #pragma pack() |
2134 | #endif |
2135 | |
2136 | #ifdef __MigPackStructs |
2137 | #pragma pack(4) |
2138 | #endif |
2139 | typedef struct { |
2140 | mach_msg_header_t Head; |
2141 | NDR_record_t NDR; |
2142 | kern_return_t RetCode; |
2143 | uint32_t major_stat; |
2144 | uint32_t minor_stat; |
2145 | mach_msg_trailer_t trailer; |
2146 | } Reply __attribute__((unused)); |
2147 | #ifdef __MigPackStructs |
2148 | #pragma pack() |
2149 | #endif |
2150 | |
2151 | #ifdef __MigPackStructs |
2152 | #pragma pack(4) |
2153 | #endif |
2154 | typedef struct { |
2155 | mach_msg_header_t Head; |
2156 | NDR_record_t NDR; |
2157 | kern_return_t RetCode; |
2158 | uint32_t major_stat; |
2159 | uint32_t minor_stat; |
2160 | } __Reply __attribute__((unused)); |
2161 | #ifdef __MigPackStructs |
2162 | #pragma pack() |
2163 | #endif |
2164 | /* |
2165 | * typedef struct { |
2166 | * mach_msg_header_t Head; |
2167 | * NDR_record_t NDR; |
2168 | * kern_return_t RetCode; |
2169 | * } mig_reply_error_t; |
2170 | */ |
2171 | |
2172 | union { |
2173 | Request In; |
2174 | Reply Out; |
2175 | } Mess; |
2176 | |
2177 | Request *InP = &Mess.In; |
2178 | Reply *Out0P = &Mess.Out; |
2179 | |
2180 | mach_msg_return_t msg_result; |
2181 | |
2182 | #ifdef __MIG_check__Reply__mach_gss_unhold_cred_t__defined |
2183 | kern_return_t check_result; |
2184 | #endif /* __MIG_check__Reply__mach_gss_unhold_cred_t__defined */ |
2185 | |
2186 | __DeclareSendRpc(1006, "mach_gss_unhold_cred" ) |
2187 | |
2188 | #if UseStaticTemplates |
2189 | const static mach_msg_ool_descriptor_t princTemplate = { |
2190 | /* addr = */ (void *)0, |
2191 | /* size = */ 0, |
2192 | /* deal = */ FALSE, |
2193 | /* copy = */ MACH_MSG_VIRTUAL_COPY, |
2194 | /* pad2 = */ 0, |
2195 | /* type = */ MACH_MSG_OOL_DESCRIPTOR, |
2196 | }; |
2197 | #endif /* UseStaticTemplates */ |
2198 | |
2199 | InP->msgh_body.msgh_descriptor_count = 1; |
2200 | #if UseStaticTemplates |
2201 | InP->princ = princTemplate; |
2202 | InP->princ.address = (void *)(princ); |
2203 | InP->princ.size = princCnt; |
2204 | #else /* UseStaticTemplates */ |
2205 | InP->princ.address = (void *)(princ); |
2206 | InP->princ.size = princCnt; |
2207 | InP->princ.deallocate = FALSE; |
2208 | InP->princ.copy = MACH_MSG_VIRTUAL_COPY; |
2209 | InP->princ.type = MACH_MSG_OOL_DESCRIPTOR; |
2210 | #endif /* UseStaticTemplates */ |
2211 | |
2212 | InP->NDR = NDR_record; |
2213 | |
2214 | InP->mech = mech; |
2215 | |
2216 | InP->nt = nt; |
2217 | |
2218 | InP->princCnt = princCnt; |
2219 | |
2220 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
2221 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
2222 | /* msgh_size passed as argument */ |
2223 | InP->Head.msgh_request_port = server; |
2224 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
2225 | InP->Head.msgh_id = 1006; |
2226 | InP->Head.msgh_reserved = 0; |
2227 | |
2228 | __BeforeSendRpc(1006, "mach_gss_unhold_cred" ) |
2229 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
2230 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
2231 | #else |
2232 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
2233 | #endif /* __MigKernelSpecificCode */ |
2234 | __AfterSendRpc(1006, "mach_gss_unhold_cred" ) |
2235 | if (msg_result != MACH_MSG_SUCCESS) { |
2236 | __MachMsgErrorWithoutTimeout(msg_result); |
2237 | { return msg_result; } |
2238 | } |
2239 | |
2240 | |
2241 | #if defined(__MIG_check__Reply__mach_gss_unhold_cred_t__defined) |
2242 | check_result = __MIG_check__Reply__mach_gss_unhold_cred_t((__Reply__mach_gss_unhold_cred_t *)Out0P); |
2243 | if (check_result != MACH_MSG_SUCCESS) |
2244 | { return check_result; } |
2245 | #endif /* defined(__MIG_check__Reply__mach_gss_unhold_cred_t__defined) */ |
2246 | |
2247 | *major_stat = Out0P->major_stat; |
2248 | |
2249 | *minor_stat = Out0P->minor_stat; |
2250 | |
2251 | return KERN_SUCCESS; |
2252 | } |
2253 | |
2254 | #if ( __MigTypeCheck ) |
2255 | #if __MIG_check__Reply__gssd_mach_subsystem__ |
2256 | #if !defined(__MIG_check__Reply__mach_gss_lookup_t__defined) |
2257 | #define __MIG_check__Reply__mach_gss_lookup_t__defined |
2258 | |
2259 | mig_internal kern_return_t __MIG_check__Reply__mach_gss_lookup_t(__Reply__mach_gss_lookup_t *Out0P) |
2260 | { |
2261 | |
2262 | typedef __Reply__mach_gss_lookup_t __Reply __attribute__((unused)); |
2263 | boolean_t msgh_simple; |
2264 | #if __MigTypeCheck |
2265 | unsigned int msgh_size; |
2266 | #endif /* __MigTypeCheck */ |
2267 | if (Out0P->Head.msgh_id != 1107) { |
2268 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
2269 | { return MIG_SERVER_DIED; } |
2270 | else |
2271 | { return MIG_REPLY_MISMATCH; } |
2272 | } |
2273 | |
2274 | msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); |
2275 | #if __MigTypeCheck |
2276 | msgh_size = Out0P->Head.msgh_size; |
2277 | |
2278 | if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || |
2279 | msgh_size != (mach_msg_size_t)sizeof(__Reply)) && |
2280 | (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
2281 | ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) |
2282 | { return MIG_TYPE_ERROR ; } |
2283 | #endif /* __MigTypeCheck */ |
2284 | |
2285 | if (msgh_simple) { |
2286 | return ((mig_reply_error_t *)Out0P)->RetCode; |
2287 | } |
2288 | |
2289 | #if __MigTypeCheck |
2290 | if (Out0P->gssd_session_port.type != MACH_MSG_PORT_DESCRIPTOR || |
2291 | Out0P->gssd_session_port.disposition != 17) { |
2292 | return MIG_TYPE_ERROR; |
2293 | } |
2294 | #endif /* __MigTypeCheck */ |
2295 | |
2296 | return MACH_MSG_SUCCESS; |
2297 | } |
2298 | #endif /* !defined(__MIG_check__Reply__mach_gss_lookup_t__defined) */ |
2299 | #endif /* __MIG_check__Reply__gssd_mach_subsystem__ */ |
2300 | #endif /* ( __MigTypeCheck ) */ |
2301 | |
2302 | |
2303 | /* Routine mach_gss_lookup */ |
2304 | mig_external kern_return_t mach_gss_lookup |
2305 | ( |
2306 | mach_port_t server, |
2307 | uint32_t uid, |
2308 | int32_t asid, |
2309 | mach_port_t *gssd_session_port |
2310 | ) |
2311 | { |
2312 | |
2313 | #ifdef __MigPackStructs |
2314 | #pragma pack(4) |
2315 | #endif |
2316 | typedef struct { |
2317 | mach_msg_header_t Head; |
2318 | NDR_record_t NDR; |
2319 | uint32_t uid; |
2320 | int32_t asid; |
2321 | } Request __attribute__((unused)); |
2322 | #ifdef __MigPackStructs |
2323 | #pragma pack() |
2324 | #endif |
2325 | |
2326 | #ifdef __MigPackStructs |
2327 | #pragma pack(4) |
2328 | #endif |
2329 | typedef struct { |
2330 | mach_msg_header_t Head; |
2331 | /* start of the kernel processed data */ |
2332 | mach_msg_body_t msgh_body; |
2333 | mach_msg_port_descriptor_t gssd_session_port; |
2334 | /* end of the kernel processed data */ |
2335 | mach_msg_trailer_t trailer; |
2336 | } Reply __attribute__((unused)); |
2337 | #ifdef __MigPackStructs |
2338 | #pragma pack() |
2339 | #endif |
2340 | |
2341 | #ifdef __MigPackStructs |
2342 | #pragma pack(4) |
2343 | #endif |
2344 | typedef struct { |
2345 | mach_msg_header_t Head; |
2346 | /* start of the kernel processed data */ |
2347 | mach_msg_body_t msgh_body; |
2348 | mach_msg_port_descriptor_t gssd_session_port; |
2349 | /* end of the kernel processed data */ |
2350 | } __Reply __attribute__((unused)); |
2351 | #ifdef __MigPackStructs |
2352 | #pragma pack() |
2353 | #endif |
2354 | /* |
2355 | * typedef struct { |
2356 | * mach_msg_header_t Head; |
2357 | * NDR_record_t NDR; |
2358 | * kern_return_t RetCode; |
2359 | * } mig_reply_error_t; |
2360 | */ |
2361 | |
2362 | union { |
2363 | Request In; |
2364 | Reply Out; |
2365 | } Mess; |
2366 | |
2367 | Request *InP = &Mess.In; |
2368 | Reply *Out0P = &Mess.Out; |
2369 | |
2370 | mach_msg_return_t msg_result; |
2371 | |
2372 | #ifdef __MIG_check__Reply__mach_gss_lookup_t__defined |
2373 | kern_return_t check_result; |
2374 | #endif /* __MIG_check__Reply__mach_gss_lookup_t__defined */ |
2375 | |
2376 | __DeclareSendRpc(1007, "mach_gss_lookup" ) |
2377 | |
2378 | InP->NDR = NDR_record; |
2379 | |
2380 | InP->uid = uid; |
2381 | |
2382 | InP->asid = asid; |
2383 | |
2384 | InP->Head.msgh_bits = |
2385 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
2386 | /* msgh_size passed as argument */ |
2387 | InP->Head.msgh_request_port = server; |
2388 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
2389 | InP->Head.msgh_id = 1007; |
2390 | InP->Head.msgh_reserved = 0; |
2391 | |
2392 | __BeforeSendRpc(1007, "mach_gss_lookup" ) |
2393 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
2394 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
2395 | #else |
2396 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
2397 | #endif /* __MigKernelSpecificCode */ |
2398 | __AfterSendRpc(1007, "mach_gss_lookup" ) |
2399 | if (msg_result != MACH_MSG_SUCCESS) { |
2400 | __MachMsgErrorWithoutTimeout(msg_result); |
2401 | { return msg_result; } |
2402 | } |
2403 | |
2404 | |
2405 | #if defined(__MIG_check__Reply__mach_gss_lookup_t__defined) |
2406 | check_result = __MIG_check__Reply__mach_gss_lookup_t((__Reply__mach_gss_lookup_t *)Out0P); |
2407 | if (check_result != MACH_MSG_SUCCESS) |
2408 | { return check_result; } |
2409 | #endif /* defined(__MIG_check__Reply__mach_gss_lookup_t__defined) */ |
2410 | |
2411 | *gssd_session_port = Out0P->gssd_session_port.name; |
2412 | return KERN_SUCCESS; |
2413 | } |
2414 | |