File: | obj-scan-build/utils/authServer.c |
Location: | line 82, column 12 |
Description: | Value stored to 'msgh_simple' during its initialization is never read |
1 | /* Module auth */ |
2 | |
3 | #ifndef _GNU_SOURCE1 |
4 | #define _GNU_SOURCE1 1 |
5 | #endif |
6 | |
7 | #define EXPORT_BOOLEAN |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/message.h> |
11 | #include <mach/mig_errors.h> |
12 | #include <mach/mig_support.h> |
13 | |
14 | #ifndef mig_internalstatic |
15 | #define mig_internalstatic static |
16 | #endif |
17 | |
18 | #ifndef mig_external |
19 | #define mig_external |
20 | #endif |
21 | |
22 | #ifndef mig_unlikely |
23 | #define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0) |
24 | #endif |
25 | |
26 | #ifndef TypeCheck1 |
27 | #define TypeCheck1 1 |
28 | #endif |
29 | |
30 | #ifndef UseExternRCSId1 |
31 | #define UseExternRCSId1 1 |
32 | #endif |
33 | |
34 | #define BAD_TYPECHECK(type, check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) mig_unlikely (({\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
35 | union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
36 | _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
37 | #define msgh_request_portmsgh_local_port msgh_local_port |
38 | #define MACH_MSGH_BITS_REQUEST(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
39 | #define msgh_reply_portmsgh_remote_port msgh_remote_port |
40 | #define MACH_MSGH_BITS_REPLY(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
41 | |
42 | #include <hurd/ports.h> |
43 | #include <mach/std_types.h> |
44 | #include <mach/mach_types.h> |
45 | #include <device/device_types.h> |
46 | #include <device/net_status.h> |
47 | #include <sys/types.h> |
48 | #include <sys/stat.h> |
49 | #include <sys/statfs.h> |
50 | #include <sys/resource.h> |
51 | #include <sys/utsname.h> |
52 | #include <hurd/hurd_types.h> |
53 | #include "mig-decls.h" |
54 | |
55 | /* Routine auth_getids */ |
56 | mig_internalstatic void _Xauth_getids |
57 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
58 | { |
59 | typedef struct { |
60 | mach_msg_header_t Head; |
61 | } Request; |
62 | |
63 | typedef struct { |
64 | mach_msg_header_t Head; |
65 | mach_msg_type_t RetCodeType; |
66 | kern_return_t RetCode; |
67 | mach_msg_type_long_t euidsType; |
68 | uid_t euids[512]; |
69 | mach_msg_type_long_t auidsType; |
70 | uid_t auids[512]; |
71 | mach_msg_type_long_t egidsType; |
72 | uid_t egids[512]; |
73 | mach_msg_type_long_t agidsType; |
74 | uid_t agids[512]; |
75 | } Reply; |
76 | |
77 | Request *In0P = (Request *) InHeadP; |
78 | Reply *OutP = (Reply *) OutHeadP; |
79 | mig_external kern_return_t S_auth_getids |
80 | (authhandle_t handle, idarray_t *euids, mach_msg_type_number_t *euidsCnt, idarray_t *auids, mach_msg_type_number_t *auidsCnt, idarray_t *egids, mach_msg_type_number_t *egidsCnt, idarray_t *agids, mach_msg_type_number_t *agidsCnt); |
81 | |
82 | boolean_t msgh_simple = msgh_simple; |
Value stored to 'msgh_simple' during its initialization is never read | |
83 | unsigned int msgh_size; |
84 | unsigned int msgh_size_delta; |
85 | |
86 | const mach_msg_type_long_t euidsType = { |
87 | { |
88 | /* msgt_name = */ 0, |
89 | /* msgt_size = */ 0, |
90 | /* msgt_number = */ 0, |
91 | /* msgt_inline = */ TRUE((boolean_t) 1), |
92 | /* msgt_longform = */ TRUE((boolean_t) 1), |
93 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
94 | /* msgt_unused = */ 0 |
95 | }, |
96 | /* msgtl_name = */ 2, |
97 | /* msgtl_size = */ 32, |
98 | /* msgtl_number = */ 512, |
99 | }; |
100 | |
101 | const mach_msg_type_long_t auidsType = { |
102 | { |
103 | /* msgt_name = */ 0, |
104 | /* msgt_size = */ 0, |
105 | /* msgt_number = */ 0, |
106 | /* msgt_inline = */ TRUE((boolean_t) 1), |
107 | /* msgt_longform = */ TRUE((boolean_t) 1), |
108 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
109 | /* msgt_unused = */ 0 |
110 | }, |
111 | /* msgtl_name = */ 2, |
112 | /* msgtl_size = */ 32, |
113 | /* msgtl_number = */ 512, |
114 | }; |
115 | |
116 | const mach_msg_type_long_t egidsType = { |
117 | { |
118 | /* msgt_name = */ 0, |
119 | /* msgt_size = */ 0, |
120 | /* msgt_number = */ 0, |
121 | /* msgt_inline = */ TRUE((boolean_t) 1), |
122 | /* msgt_longform = */ TRUE((boolean_t) 1), |
123 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
124 | /* msgt_unused = */ 0 |
125 | }, |
126 | /* msgtl_name = */ 2, |
127 | /* msgtl_size = */ 32, |
128 | /* msgtl_number = */ 512, |
129 | }; |
130 | |
131 | const mach_msg_type_long_t agidsType = { |
132 | { |
133 | /* msgt_name = */ 0, |
134 | /* msgt_size = */ 0, |
135 | /* msgt_number = */ 0, |
136 | /* msgt_inline = */ TRUE((boolean_t) 1), |
137 | /* msgt_longform = */ TRUE((boolean_t) 1), |
138 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
139 | /* msgt_unused = */ 0 |
140 | }, |
141 | /* msgtl_name = */ 2, |
142 | /* msgtl_size = */ 32, |
143 | /* msgtl_number = */ 512, |
144 | }; |
145 | |
146 | authhandle_t handle; |
147 | mach_msg_type_number_t euidsCnt; |
148 | uid_t auids[512]; |
149 | mach_msg_type_number_t auidsCnt; |
150 | uid_t egids[512]; |
151 | mach_msg_type_number_t egidsCnt; |
152 | uid_t agids[512]; |
153 | mach_msg_type_number_t agidsCnt; |
154 | |
155 | uid_t *euidsP; |
156 | uid_t *auidsP; |
157 | uid_t *egidsP; |
158 | uid_t *agidsP; |
159 | |
160 | #if TypeCheck1 |
161 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
162 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
163 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
164 | #endif /* TypeCheck */ |
165 | |
166 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
167 | handle = auth_payload_to_handle(In0P->Head.msgh_protected_payload); |
168 | else |
169 | handle = auth_port_to_handle(In0P->Head.msgh_request_portmsgh_local_port); |
170 | |
171 | euidsP = OutP->euids; |
172 | euidsCnt = 512; |
173 | |
174 | auidsP = auids; |
175 | auidsCnt = 512; |
176 | |
177 | egidsP = egids; |
178 | egidsCnt = 512; |
179 | |
180 | agidsP = agids; |
181 | agidsCnt = 512; |
182 | |
183 | OutP->RetCode = S_auth_getids(handle, &euidsP, &euidsCnt, &auidsP, &auidsCnt, &egidsP, &egidsCnt, &agidsP, &agidsCnt); |
184 | end_using_authhandle(handle); |
185 | if (OutP->RetCode != KERN_SUCCESS0) |
186 | return; |
187 | |
188 | msgh_simple = TRUE((boolean_t) 1); |
189 | |
190 | OutP->euidsType = euidsType; |
191 | if (euidsP != OutP->euids) { |
192 | OutP->euidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
193 | *((uid_t **)OutP->euids) = euidsP; |
194 | msgh_simple = FALSE((boolean_t) 0); |
195 | } |
196 | |
197 | OutP->euidsType.msgtl_number = euidsCnt; |
198 | msgh_size_delta = (OutP->euidsType.msgtl_header.msgt_inline) ? 4 * euidsCnt : sizeof(uid_t *); |
199 | msgh_size = 80 + msgh_size_delta; |
200 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
201 | |
202 | OutP->auidsType = auidsType; |
203 | |
204 | if (auidsP != auids) { |
205 | OutP->auidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
206 | *((uid_t **)OutP->auids) = auidsP; |
207 | msgh_simple = FALSE((boolean_t) 0); |
208 | } |
209 | else { |
210 | memcpy(OutP->auids, auids, 4 * auidsCnt); |
211 | } |
212 | |
213 | OutP->auidsType.msgtl_number = auidsCnt; |
214 | msgh_size_delta = (OutP->auidsType.msgtl_header.msgt_inline) ? 4 * auidsCnt : sizeof(uid_t *); |
215 | msgh_size += msgh_size_delta; |
216 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
217 | |
218 | OutP->egidsType = egidsType; |
219 | |
220 | if (egidsP != egids) { |
221 | OutP->egidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
222 | *((uid_t **)OutP->egids) = egidsP; |
223 | msgh_simple = FALSE((boolean_t) 0); |
224 | } |
225 | else { |
226 | memcpy(OutP->egids, egids, 4 * egidsCnt); |
227 | } |
228 | |
229 | OutP->egidsType.msgtl_number = egidsCnt; |
230 | msgh_size_delta = (OutP->egidsType.msgtl_header.msgt_inline) ? 4 * egidsCnt : sizeof(uid_t *); |
231 | msgh_size += msgh_size_delta; |
232 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
233 | |
234 | OutP->agidsType = agidsType; |
235 | |
236 | if (agidsP != agids) { |
237 | OutP->agidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
238 | *((uid_t **)OutP->agids) = agidsP; |
239 | msgh_simple = FALSE((boolean_t) 0); |
240 | } |
241 | else { |
242 | memcpy(OutP->agids, agids, 4 * agidsCnt); |
243 | } |
244 | |
245 | OutP->agidsType.msgtl_number = agidsCnt; |
246 | msgh_size += (OutP->agidsType.msgtl_header.msgt_inline) ? 4 * agidsCnt : sizeof(uid_t *); |
247 | |
248 | OutP = (Reply *) OutHeadP; |
249 | if (!msgh_simple) |
250 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
251 | OutP->Head.msgh_size = msgh_size; |
252 | } |
253 | |
254 | /* Default implementation of S_auth_getids */ |
255 | #ifdef MIG_EOPNOTSUPP |
256 | kern_return_t __attribute__ ((weak)) |
257 | S_auth_getids |
258 | ( |
259 | authhandle_t handle, |
260 | idarray_t *euids, |
261 | mach_msg_type_number_t *euidsCnt, |
262 | idarray_t *auids, |
263 | mach_msg_type_number_t *auidsCnt, |
264 | idarray_t *egids, |
265 | mach_msg_type_number_t *egidsCnt, |
266 | idarray_t *agids, |
267 | mach_msg_type_number_t *agidsCnt |
268 | ) { return MIG_EOPNOTSUPP; } |
269 | #endif /* MIG_EOPNOTSUPP */ |
270 | |
271 | /* Routine auth_makeauth */ |
272 | mig_internalstatic void _Xauth_makeauth |
273 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
274 | { |
275 | typedef struct { |
276 | mach_msg_header_t Head; |
277 | mach_msg_type_long_t other_handlesType; |
278 | mach_port_t other_handles[512]; |
279 | mach_msg_type_long_t euidsType; |
280 | uid_t euids[512]; |
281 | mach_msg_type_long_t auidsType; |
282 | uid_t auids[512]; |
283 | mach_msg_type_long_t egidsType; |
284 | uid_t egids[512]; |
285 | mach_msg_type_long_t agidsType; |
286 | uid_t agids[512]; |
287 | } Request; |
288 | |
289 | typedef struct { |
290 | mach_msg_header_t Head; |
291 | mach_msg_type_t RetCodeType; |
292 | kern_return_t RetCode; |
293 | mach_msg_type_t newhandleType; |
294 | mach_port_t newhandle; |
295 | } Reply; |
296 | |
297 | Request *In0P = (Request *) InHeadP; |
298 | Request *In1P; |
299 | Request *In2P; |
300 | Request *In3P; |
301 | Request *In4P; |
302 | Reply *OutP = (Reply *) OutHeadP; |
303 | mig_external kern_return_t S_auth_makeauth |
304 | (authhandle_t handle, portarray_t other_handles, mach_msg_type_number_t other_handlesCnt, idarray_t euids, mach_msg_type_number_t euidsCnt, idarray_t auids, mach_msg_type_number_t auidsCnt, idarray_t egids, mach_msg_type_number_t egidsCnt, idarray_t agids, mach_msg_type_number_t agidsCnt, mach_port_t *newhandle); |
305 | |
306 | unsigned int msgh_size; |
307 | unsigned int msgh_size_delta; |
308 | |
309 | const mach_msg_type_t newhandleType = { |
310 | /* msgt_name = */ 20, |
311 | /* msgt_size = */ 32, |
312 | /* msgt_number = */ 1, |
313 | /* msgt_inline = */ TRUE((boolean_t) 1), |
314 | /* msgt_longform = */ FALSE((boolean_t) 0), |
315 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
316 | /* msgt_unused = */ 0 |
317 | }; |
318 | |
319 | authhandle_t handle; |
320 | |
321 | #if TypeCheck1 |
322 | msgh_size = In0P->Head.msgh_size; |
323 | if (mig_unlikely ((msgh_size < 84) ||__builtin_expect (!! ((msgh_size < 84) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
324 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 84) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
325 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
326 | #endif /* TypeCheck */ |
327 | |
328 | #if TypeCheck1 |
329 | if (mig_unlikely ((In0P->other_handlesType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->other_handlesType.msgtl_header .msgt_longform != ((boolean_t) 1)) || (In0P->other_handlesType .msgtl_name != 17) || (In0P->other_handlesType.msgtl_size != 32)), 0) |
330 | (In0P->other_handlesType.msgtl_name != 17) ||__builtin_expect (!! ((In0P->other_handlesType.msgtl_header .msgt_longform != ((boolean_t) 1)) || (In0P->other_handlesType .msgtl_name != 17) || (In0P->other_handlesType.msgtl_size != 32)), 0) |
331 | (In0P->other_handlesType.msgtl_size != 32))__builtin_expect (!! ((In0P->other_handlesType.msgtl_header .msgt_longform != ((boolean_t) 1)) || (In0P->other_handlesType .msgtl_name != 17) || (In0P->other_handlesType.msgtl_size != 32)), 0)) |
332 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
333 | #endif /* TypeCheck */ |
334 | |
335 | msgh_size_delta = (In0P->other_handlesType.msgtl_header.msgt_inline) ? 4 * In0P->other_handlesType.msgtl_number : sizeof(mach_port_t *); |
336 | #if TypeCheck1 |
337 | if (mig_unlikely (msgh_size < 84 + msgh_size_delta)__builtin_expect (!! (msgh_size < 84 + msgh_size_delta), 0 )) |
338 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
339 | msgh_size -= msgh_size_delta; |
340 | #endif /* TypeCheck */ |
341 | |
342 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
343 | |
344 | #if TypeCheck1 |
345 | if (mig_unlikely ((In1P->euidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->euidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->euidsType.msgtl_name != 2) || (In1P->euidsType.msgtl_size != 32)), 0) |
346 | (In1P->euidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->euidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->euidsType.msgtl_name != 2) || (In1P->euidsType.msgtl_size != 32)), 0) |
347 | (In1P->euidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->euidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->euidsType.msgtl_name != 2) || (In1P->euidsType.msgtl_size != 32)), 0)) |
348 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
349 | #endif /* TypeCheck */ |
350 | |
351 | msgh_size_delta = (In1P->euidsType.msgtl_header.msgt_inline) ? 4 * In1P->euidsType.msgtl_number : sizeof(uid_t *); |
352 | #if TypeCheck1 |
353 | if (mig_unlikely (msgh_size < 84 + msgh_size_delta)__builtin_expect (!! (msgh_size < 84 + msgh_size_delta), 0 )) |
354 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
355 | msgh_size -= msgh_size_delta; |
356 | #endif /* TypeCheck */ |
357 | |
358 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
359 | |
360 | #if TypeCheck1 |
361 | if (mig_unlikely ((In2P->auidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In2P->auidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->auidsType.msgtl_name != 2) || (In2P->auidsType.msgtl_size != 32)), 0) |
362 | (In2P->auidsType.msgtl_name != 2) ||__builtin_expect (!! ((In2P->auidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->auidsType.msgtl_name != 2) || (In2P->auidsType.msgtl_size != 32)), 0) |
363 | (In2P->auidsType.msgtl_size != 32))__builtin_expect (!! ((In2P->auidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->auidsType.msgtl_name != 2) || (In2P->auidsType.msgtl_size != 32)), 0)) |
364 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
365 | #endif /* TypeCheck */ |
366 | |
367 | msgh_size_delta = (In2P->auidsType.msgtl_header.msgt_inline) ? 4 * In2P->auidsType.msgtl_number : sizeof(uid_t *); |
368 | #if TypeCheck1 |
369 | if (mig_unlikely (msgh_size < 84 + msgh_size_delta)__builtin_expect (!! (msgh_size < 84 + msgh_size_delta), 0 )) |
370 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
371 | msgh_size -= msgh_size_delta; |
372 | #endif /* TypeCheck */ |
373 | |
374 | In3P = (Request *) ((char *) In2P + msgh_size_delta - 2048); |
375 | |
376 | #if TypeCheck1 |
377 | if (mig_unlikely ((In3P->egidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In3P->egidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In3P->egidsType.msgtl_name != 2) || (In3P->egidsType.msgtl_size != 32)), 0) |
378 | (In3P->egidsType.msgtl_name != 2) ||__builtin_expect (!! ((In3P->egidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In3P->egidsType.msgtl_name != 2) || (In3P->egidsType.msgtl_size != 32)), 0) |
379 | (In3P->egidsType.msgtl_size != 32))__builtin_expect (!! ((In3P->egidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In3P->egidsType.msgtl_name != 2) || (In3P->egidsType.msgtl_size != 32)), 0)) |
380 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
381 | #endif /* TypeCheck */ |
382 | |
383 | msgh_size_delta = (In3P->egidsType.msgtl_header.msgt_inline) ? 4 * In3P->egidsType.msgtl_number : sizeof(uid_t *); |
384 | #if TypeCheck1 |
385 | if (mig_unlikely (msgh_size < 84 + msgh_size_delta)__builtin_expect (!! (msgh_size < 84 + msgh_size_delta), 0 )) |
386 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
387 | msgh_size -= msgh_size_delta; |
388 | #endif /* TypeCheck */ |
389 | |
390 | In4P = (Request *) ((char *) In3P + msgh_size_delta - 2048); |
391 | |
392 | #if TypeCheck1 |
393 | if (mig_unlikely ((In4P->agidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In4P->agidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In4P->agidsType.msgtl_name != 2) || (In4P->agidsType.msgtl_size != 32)), 0) |
394 | (In4P->agidsType.msgtl_name != 2) ||__builtin_expect (!! ((In4P->agidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In4P->agidsType.msgtl_name != 2) || (In4P->agidsType.msgtl_size != 32)), 0) |
395 | (In4P->agidsType.msgtl_size != 32))__builtin_expect (!! ((In4P->agidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In4P->agidsType.msgtl_name != 2) || (In4P->agidsType.msgtl_size != 32)), 0)) |
396 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
397 | #endif /* TypeCheck */ |
398 | |
399 | #if TypeCheck1 |
400 | if (mig_unlikely (msgh_size != 84 + ((In4P->agidsType.msgtl_header.msgt_inline) ? 4 * In4P->agidsType.msgtl_number : sizeof(uid_t *)))__builtin_expect (!! (msgh_size != 84 + ((In4P->agidsType. msgtl_header.msgt_inline) ? 4 * In4P->agidsType.msgtl_number : sizeof(uid_t *))), 0)) |
401 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
402 | #endif /* TypeCheck */ |
403 | |
404 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
405 | handle = auth_payload_to_handle(In0P->Head.msgh_protected_payload); |
406 | else |
407 | handle = auth_port_to_handle(In0P->Head.msgh_request_portmsgh_local_port); |
408 | |
409 | OutP->RetCode = S_auth_makeauth(handle, (In0P->other_handlesType.msgtl_header.msgt_inline) ? In0P->other_handles : *((mach_port_t **)In0P->other_handles), In0P->other_handlesType.msgtl_number, (In1P->euidsType.msgtl_header.msgt_inline) ? In1P->euids : *((uid_t **)In1P->euids), In1P->euidsType.msgtl_number, (In2P->auidsType.msgtl_header.msgt_inline) ? In2P->auids : *((uid_t **)In2P->auids), In2P->auidsType.msgtl_number, (In3P->egidsType.msgtl_header.msgt_inline) ? In3P->egids : *((uid_t **)In3P->egids), In3P->egidsType.msgtl_number, (In4P->agidsType.msgtl_header.msgt_inline) ? In4P->agids : *((uid_t **)In4P->agids), In4P->agidsType.msgtl_number, &OutP->newhandle); |
410 | if (OutP->RetCode == KERN_SUCCESS0) |
411 | if (!In4P->agidsType.msgtl_header.msgt_inline) |
412 | __mig_deallocate(* (vm_offset_t *) In4P->agids, 4 * In4P->agidsType.msgtl_number); |
413 | if (OutP->RetCode == KERN_SUCCESS0) |
414 | if (!In3P->egidsType.msgtl_header.msgt_inline) |
415 | __mig_deallocate(* (vm_offset_t *) In3P->egids, 4 * In3P->egidsType.msgtl_number); |
416 | if (OutP->RetCode == KERN_SUCCESS0) |
417 | if (!In2P->auidsType.msgtl_header.msgt_inline) |
418 | __mig_deallocate(* (vm_offset_t *) In2P->auids, 4 * In2P->auidsType.msgtl_number); |
419 | if (OutP->RetCode == KERN_SUCCESS0) |
420 | if (!In1P->euidsType.msgtl_header.msgt_inline) |
421 | __mig_deallocate(* (vm_offset_t *) In1P->euids, 4 * In1P->euidsType.msgtl_number); |
422 | if (OutP->RetCode == KERN_SUCCESS0) |
423 | if (!In0P->other_handlesType.msgtl_header.msgt_inline) |
424 | __mig_deallocate(* (vm_offset_t *) In0P->other_handles, 4 * In0P->other_handlesType.msgtl_number); |
425 | end_using_authhandle(handle); |
426 | if (OutP->RetCode != KERN_SUCCESS0) |
427 | return; |
428 | |
429 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
430 | OutP->Head.msgh_size = 40; |
431 | |
432 | OutP->newhandleType = newhandleType; |
433 | } |
434 | |
435 | /* Default implementation of S_auth_makeauth */ |
436 | #ifdef MIG_EOPNOTSUPP |
437 | kern_return_t __attribute__ ((weak)) |
438 | S_auth_makeauth |
439 | ( |
440 | authhandle_t handle, |
441 | portarray_t other_handles, |
442 | mach_msg_type_number_t other_handlesCnt, |
443 | idarray_t euids, |
444 | mach_msg_type_number_t euidsCnt, |
445 | idarray_t auids, |
446 | mach_msg_type_number_t auidsCnt, |
447 | idarray_t egids, |
448 | mach_msg_type_number_t egidsCnt, |
449 | idarray_t agids, |
450 | mach_msg_type_number_t agidsCnt, |
451 | mach_port_t *newhandle |
452 | ) { return MIG_EOPNOTSUPP; } |
453 | #endif /* MIG_EOPNOTSUPP */ |
454 | |
455 | /* Routine auth_user_authenticate */ |
456 | mig_internalstatic void _Xauth_user_authenticate |
457 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
458 | { |
459 | typedef struct { |
460 | mach_msg_header_t Head; |
461 | mach_msg_type_t rendezvousType; |
462 | mach_port_t rendezvous; |
463 | } Request; |
464 | |
465 | typedef struct { |
466 | mach_msg_header_t Head; |
467 | mach_msg_type_t RetCodeType; |
468 | kern_return_t RetCode; |
469 | mach_msg_type_t newportType; |
470 | mach_port_t newport; |
471 | } Reply; |
472 | |
473 | Request *In0P = (Request *) InHeadP; |
474 | Reply *OutP = (Reply *) OutHeadP; |
475 | mig_external kern_return_t S_auth_user_authenticate |
476 | (authhandle_t handle, mach_port_t reply, mach_msg_type_name_t replyPoly, mach_port_t rendezvous, mach_port_t *newport, mach_msg_type_name_t *newportPoly); |
477 | |
478 | boolean_t msgh_simple = msgh_simple; |
479 | const mach_msg_type_t rendezvousCheck = { |
480 | /* msgt_name = */ 17, |
481 | /* msgt_size = */ 32, |
482 | /* msgt_number = */ 1, |
483 | /* msgt_inline = */ TRUE((boolean_t) 1), |
484 | /* msgt_longform = */ FALSE((boolean_t) 0), |
485 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
486 | /* msgt_unused = */ 0 |
487 | }; |
488 | |
489 | const mach_msg_type_t newportType = { |
490 | /* msgt_name = */ -1, |
491 | /* msgt_size = */ 32, |
492 | /* msgt_number = */ 1, |
493 | /* msgt_inline = */ TRUE((boolean_t) 1), |
494 | /* msgt_longform = */ FALSE((boolean_t) 0), |
495 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
496 | /* msgt_unused = */ 0 |
497 | }; |
498 | |
499 | authhandle_t handle; |
500 | mach_msg_type_name_t newportPoly; |
501 | |
502 | #if TypeCheck1 |
503 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
504 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
505 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
506 | #endif /* TypeCheck */ |
507 | |
508 | #if TypeCheck1 |
509 | if (BAD_TYPECHECK(&In0P->rendezvousType, &rendezvousCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rendezvousType); _c.t = * (&rendezvousCheck);_t.w != _c.w; })), 0)) |
510 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
511 | #endif /* TypeCheck */ |
512 | |
513 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
514 | handle = auth_payload_to_handle(In0P->Head.msgh_protected_payload); |
515 | else |
516 | handle = auth_port_to_handle(In0P->Head.msgh_request_portmsgh_local_port); |
517 | |
518 | OutP->RetCode = S_auth_user_authenticate(handle, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->rendezvous, &OutP->newport, &newportPoly); |
519 | end_using_authhandle(handle); |
520 | if (OutP->RetCode != KERN_SUCCESS0) |
521 | return; |
522 | |
523 | msgh_simple = TRUE((boolean_t) 1); |
524 | OutP->Head.msgh_size = 40; |
525 | |
526 | OutP->newportType = newportType; |
527 | |
528 | if (MACH_MSG_TYPE_PORT_ANY(newportPoly)(((newportPoly) >= 16) && ((newportPoly) <= 21) )) |
529 | msgh_simple = FALSE((boolean_t) 0); |
530 | |
531 | OutP->newportType.msgt_name = newportPoly; |
532 | |
533 | if (!msgh_simple) |
534 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
535 | } |
536 | |
537 | /* Default implementation of S_auth_user_authenticate */ |
538 | #ifdef MIG_EOPNOTSUPP |
539 | kern_return_t __attribute__ ((weak)) |
540 | S_auth_user_authenticate |
541 | ( |
542 | authhandle_t handle, |
543 | mach_port_t reply, |
544 | mach_msg_type_name_t replyPoly, |
545 | mach_port_t rendezvous, |
546 | mach_port_t *newport, |
547 | mach_msg_type_name_t *newportPoly |
548 | ) { return MIG_EOPNOTSUPP; } |
549 | #endif /* MIG_EOPNOTSUPP */ |
550 | |
551 | /* Routine auth_server_authenticate */ |
552 | mig_internalstatic void _Xauth_server_authenticate |
553 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
554 | { |
555 | typedef struct { |
556 | mach_msg_header_t Head; |
557 | mach_msg_type_t rendezvousType; |
558 | mach_port_t rendezvous; |
559 | mach_msg_type_t newportType; |
560 | mach_port_t newport; |
561 | } Request; |
562 | |
563 | typedef struct { |
564 | mach_msg_header_t Head; |
565 | mach_msg_type_t RetCodeType; |
566 | kern_return_t RetCode; |
567 | mach_msg_type_long_t euidsType; |
568 | uid_t euids[512]; |
569 | mach_msg_type_long_t auidsType; |
570 | uid_t auids[512]; |
571 | mach_msg_type_long_t egidsType; |
572 | uid_t egids[512]; |
573 | mach_msg_type_long_t agidsType; |
574 | uid_t agids[512]; |
575 | } Reply; |
576 | |
577 | Request *In0P = (Request *) InHeadP; |
578 | Reply *OutP = (Reply *) OutHeadP; |
579 | mig_external kern_return_t S_auth_server_authenticate |
580 | (authhandle_t handle, mach_port_t reply, mach_msg_type_name_t replyPoly, mach_port_t rendezvous, mach_port_t newport, mach_msg_type_name_t newportPoly, idarray_t *euids, mach_msg_type_number_t *euidsCnt, idarray_t *auids, mach_msg_type_number_t *auidsCnt, idarray_t *egids, mach_msg_type_number_t *egidsCnt, idarray_t *agids, mach_msg_type_number_t *agidsCnt); |
581 | |
582 | boolean_t msgh_simple = msgh_simple; |
583 | unsigned int msgh_size; |
584 | unsigned int msgh_size_delta; |
585 | |
586 | const mach_msg_type_t rendezvousCheck = { |
587 | /* msgt_name = */ 17, |
588 | /* msgt_size = */ 32, |
589 | /* msgt_number = */ 1, |
590 | /* msgt_inline = */ TRUE((boolean_t) 1), |
591 | /* msgt_longform = */ FALSE((boolean_t) 0), |
592 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
593 | /* msgt_unused = */ 0 |
594 | }; |
595 | |
596 | const mach_msg_type_long_t euidsType = { |
597 | { |
598 | /* msgt_name = */ 0, |
599 | /* msgt_size = */ 0, |
600 | /* msgt_number = */ 0, |
601 | /* msgt_inline = */ TRUE((boolean_t) 1), |
602 | /* msgt_longform = */ TRUE((boolean_t) 1), |
603 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
604 | /* msgt_unused = */ 0 |
605 | }, |
606 | /* msgtl_name = */ 2, |
607 | /* msgtl_size = */ 32, |
608 | /* msgtl_number = */ 512, |
609 | }; |
610 | |
611 | const mach_msg_type_long_t auidsType = { |
612 | { |
613 | /* msgt_name = */ 0, |
614 | /* msgt_size = */ 0, |
615 | /* msgt_number = */ 0, |
616 | /* msgt_inline = */ TRUE((boolean_t) 1), |
617 | /* msgt_longform = */ TRUE((boolean_t) 1), |
618 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
619 | /* msgt_unused = */ 0 |
620 | }, |
621 | /* msgtl_name = */ 2, |
622 | /* msgtl_size = */ 32, |
623 | /* msgtl_number = */ 512, |
624 | }; |
625 | |
626 | const mach_msg_type_long_t egidsType = { |
627 | { |
628 | /* msgt_name = */ 0, |
629 | /* msgt_size = */ 0, |
630 | /* msgt_number = */ 0, |
631 | /* msgt_inline = */ TRUE((boolean_t) 1), |
632 | /* msgt_longform = */ TRUE((boolean_t) 1), |
633 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
634 | /* msgt_unused = */ 0 |
635 | }, |
636 | /* msgtl_name = */ 2, |
637 | /* msgtl_size = */ 32, |
638 | /* msgtl_number = */ 512, |
639 | }; |
640 | |
641 | const mach_msg_type_long_t agidsType = { |
642 | { |
643 | /* msgt_name = */ 0, |
644 | /* msgt_size = */ 0, |
645 | /* msgt_number = */ 0, |
646 | /* msgt_inline = */ TRUE((boolean_t) 1), |
647 | /* msgt_longform = */ TRUE((boolean_t) 1), |
648 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
649 | /* msgt_unused = */ 0 |
650 | }, |
651 | /* msgtl_name = */ 2, |
652 | /* msgtl_size = */ 32, |
653 | /* msgtl_number = */ 512, |
654 | }; |
655 | |
656 | authhandle_t handle; |
657 | mach_msg_type_number_t euidsCnt; |
658 | uid_t auids[512]; |
659 | mach_msg_type_number_t auidsCnt; |
660 | uid_t egids[512]; |
661 | mach_msg_type_number_t egidsCnt; |
662 | uid_t agids[512]; |
663 | mach_msg_type_number_t agidsCnt; |
664 | |
665 | uid_t *euidsP; |
666 | uid_t *auidsP; |
667 | uid_t *egidsP; |
668 | uid_t *agidsP; |
669 | |
670 | #if TypeCheck1 |
671 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
672 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
673 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
674 | #endif /* TypeCheck */ |
675 | |
676 | #if TypeCheck1 |
677 | if (BAD_TYPECHECK(&In0P->rendezvousType, &rendezvousCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rendezvousType); _c.t = * (&rendezvousCheck);_t.w != _c.w; })), 0)) |
678 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
679 | #endif /* TypeCheck */ |
680 | |
681 | #if TypeCheck1 |
682 | if (mig_unlikely ((In0P->newportType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->newportType.msgt_inline != (( boolean_t) 1)) || (In0P->newportType.msgt_longform != ((boolean_t ) 0)) || (In0P->newportType.msgt_number != 1) || (In0P-> newportType.msgt_size != 32)), 0) |
683 | (In0P->newportType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->newportType.msgt_inline != (( boolean_t) 1)) || (In0P->newportType.msgt_longform != ((boolean_t ) 0)) || (In0P->newportType.msgt_number != 1) || (In0P-> newportType.msgt_size != 32)), 0) |
684 | (In0P->newportType.msgt_number != 1) ||__builtin_expect (!! ((In0P->newportType.msgt_inline != (( boolean_t) 1)) || (In0P->newportType.msgt_longform != ((boolean_t ) 0)) || (In0P->newportType.msgt_number != 1) || (In0P-> newportType.msgt_size != 32)), 0) |
685 | (In0P->newportType.msgt_size != 32))__builtin_expect (!! ((In0P->newportType.msgt_inline != (( boolean_t) 1)) || (In0P->newportType.msgt_longform != ((boolean_t ) 0)) || (In0P->newportType.msgt_number != 1) || (In0P-> newportType.msgt_size != 32)), 0)) |
686 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
687 | #endif /* TypeCheck */ |
688 | |
689 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
690 | handle = auth_payload_to_handle(In0P->Head.msgh_protected_payload); |
691 | else |
692 | handle = auth_port_to_handle(In0P->Head.msgh_request_portmsgh_local_port); |
693 | |
694 | euidsP = OutP->euids; |
695 | euidsCnt = 512; |
696 | |
697 | auidsP = auids; |
698 | auidsCnt = 512; |
699 | |
700 | egidsP = egids; |
701 | egidsCnt = 512; |
702 | |
703 | agidsP = agids; |
704 | agidsCnt = 512; |
705 | |
706 | OutP->RetCode = S_auth_server_authenticate(handle, In0P->Head.msgh_reply_portmsgh_remote_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->rendezvous, In0P->newport, In0P->newportType.msgt_name, &euidsP, &euidsCnt, &auidsP, &auidsCnt, &egidsP, &egidsCnt, &agidsP, &agidsCnt); |
707 | end_using_authhandle(handle); |
708 | if (OutP->RetCode != KERN_SUCCESS0) |
709 | return; |
710 | |
711 | msgh_simple = TRUE((boolean_t) 1); |
712 | |
713 | OutP->euidsType = euidsType; |
714 | if (euidsP != OutP->euids) { |
715 | OutP->euidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
716 | *((uid_t **)OutP->euids) = euidsP; |
717 | msgh_simple = FALSE((boolean_t) 0); |
718 | } |
719 | |
720 | OutP->euidsType.msgtl_number = euidsCnt; |
721 | msgh_size_delta = (OutP->euidsType.msgtl_header.msgt_inline) ? 4 * euidsCnt : sizeof(uid_t *); |
722 | msgh_size = 80 + msgh_size_delta; |
723 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
724 | |
725 | OutP->auidsType = auidsType; |
726 | |
727 | if (auidsP != auids) { |
728 | OutP->auidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
729 | *((uid_t **)OutP->auids) = auidsP; |
730 | msgh_simple = FALSE((boolean_t) 0); |
731 | } |
732 | else { |
733 | memcpy(OutP->auids, auids, 4 * auidsCnt); |
734 | } |
735 | |
736 | OutP->auidsType.msgtl_number = auidsCnt; |
737 | msgh_size_delta = (OutP->auidsType.msgtl_header.msgt_inline) ? 4 * auidsCnt : sizeof(uid_t *); |
738 | msgh_size += msgh_size_delta; |
739 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
740 | |
741 | OutP->egidsType = egidsType; |
742 | |
743 | if (egidsP != egids) { |
744 | OutP->egidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
745 | *((uid_t **)OutP->egids) = egidsP; |
746 | msgh_simple = FALSE((boolean_t) 0); |
747 | } |
748 | else { |
749 | memcpy(OutP->egids, egids, 4 * egidsCnt); |
750 | } |
751 | |
752 | OutP->egidsType.msgtl_number = egidsCnt; |
753 | msgh_size_delta = (OutP->egidsType.msgtl_header.msgt_inline) ? 4 * egidsCnt : sizeof(uid_t *); |
754 | msgh_size += msgh_size_delta; |
755 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
756 | |
757 | OutP->agidsType = agidsType; |
758 | |
759 | if (agidsP != agids) { |
760 | OutP->agidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
761 | *((uid_t **)OutP->agids) = agidsP; |
762 | msgh_simple = FALSE((boolean_t) 0); |
763 | } |
764 | else { |
765 | memcpy(OutP->agids, agids, 4 * agidsCnt); |
766 | } |
767 | |
768 | OutP->agidsType.msgtl_number = agidsCnt; |
769 | msgh_size += (OutP->agidsType.msgtl_header.msgt_inline) ? 4 * agidsCnt : sizeof(uid_t *); |
770 | |
771 | OutP = (Reply *) OutHeadP; |
772 | if (!msgh_simple) |
773 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
774 | OutP->Head.msgh_size = msgh_size; |
775 | } |
776 | |
777 | /* Default implementation of S_auth_server_authenticate */ |
778 | #ifdef MIG_EOPNOTSUPP |
779 | kern_return_t __attribute__ ((weak)) |
780 | S_auth_server_authenticate |
781 | ( |
782 | authhandle_t handle, |
783 | mach_port_t reply, |
784 | mach_msg_type_name_t replyPoly, |
785 | mach_port_t rendezvous, |
786 | mach_port_t newport, |
787 | mach_msg_type_name_t newportPoly, |
788 | idarray_t *euids, |
789 | mach_msg_type_number_t *euidsCnt, |
790 | idarray_t *auids, |
791 | mach_msg_type_number_t *auidsCnt, |
792 | idarray_t *egids, |
793 | mach_msg_type_number_t *egidsCnt, |
794 | idarray_t *agids, |
795 | mach_msg_type_number_t *agidsCnt |
796 | ) { return MIG_EOPNOTSUPP; } |
797 | #endif /* MIG_EOPNOTSUPP */ |
798 | |
799 | mig_routine_t auth_server_routines[] = { |
800 | _Xauth_getids, |
801 | _Xauth_makeauth, |
802 | _Xauth_user_authenticate, |
803 | _Xauth_server_authenticate, |
804 | }; |
805 | |
806 | mig_external boolean_t auth_server |
807 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
808 | { |
809 | mach_msg_header_t *InP = InHeadP; |
810 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
811 | |
812 | const mach_msg_type_t RetCodeType = { |
813 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
814 | /* msgt_size = */ 32, |
815 | /* msgt_number = */ 1, |
816 | /* msgt_inline = */ TRUE((boolean_t) 1), |
817 | /* msgt_longform = */ FALSE((boolean_t) 0), |
818 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
819 | /* msgt_unused = */ 0 |
820 | }; |
821 | |
822 | mig_routine_t routine; |
823 | |
824 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
825 | OutP->Head.msgh_size = sizeof *OutP; |
826 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
827 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
828 | OutP->Head.msgh_seqno = 0; |
829 | OutP->Head.msgh_id = InP->msgh_id + 100; |
830 | |
831 | OutP->RetCodeType = RetCodeType; |
832 | |
833 | if ((InP->msgh_id > 25003) || (InP->msgh_id < 25000) || |
834 | ((routine = auth_server_routines[InP->msgh_id - 25000]) == 0)) { |
835 | OutP->RetCode = MIG_BAD_ID-303; |
836 | return FALSE((boolean_t) 0); |
837 | } |
838 | (*routine) (InP, &OutP->Head); |
839 | return TRUE((boolean_t) 1); |
840 | } |
841 | |
842 | mig_external mig_routine_t auth_server_routine |
843 | (const mach_msg_header_t *InHeadP) |
844 | { |
845 | int msgh_id; |
846 | |
847 | msgh_id = InHeadP->msgh_id - 25000; |
848 | |
849 | if ((msgh_id > 3) || (msgh_id < 0)) |
850 | return 0; |
851 | |
852 | return auth_server_routines[msgh_id]; |
853 | } |
854 |