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