1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include "gssd.h"
#include <stdio.h>
#include <stdlib.h> /* getenv, exit */
#include <signal.h>
#include <sys/types.h>
#include <memory.h>
#include <stropts.h>
#include <sys/resource.h> /* rlimit */
#include <syslog.h>
#ifdef DEBUG
#define RPC_SVC_FG
#endif
#define _RPCSVC_CLOSEDOWN 120
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* RPC protocol information for gssd, the usermode daemon that
* assists the kernel with gssapi. It is gssd that executes all
* gssapi calls except for some such as gss_sign(), and
* gss_verify(), which are executed in the kernel itself.
*
* File generated from gssd.x
*/
#define NO 0
#define YES 1
#define FOREVER 1
#include <sys/types.h>
#include <sys/time.h>
#include <rpc/auth_sys.h>
#ifndef _KERNEL
#include <locale.h>
#endif /* not _KERNEL */
#ifdef _KERNEL
extern void killgssd_handle(CLIENT *);
extern CLIENT *getgssd_handle(void);
#endif /* _KERNEL */
/* gss_indicate_mechs_arg is void. This appears in the rpc call def */
extern int _rpcpmstart; /* Started by a port monitor ? */
/* States a server can be in wrt request */
#define _IDLE 0
#define _SERVED 1
/* LINTED static unused if no main */
static int _rpcsvcstate = _IDLE; /* Set when a request is serviced */
static int _rpcsvccount = 0; /* Number of requests being serviced */
extern mutex_t _svcstate_lock; /* lock for _rpcsvcstate, _rpcsvccount */
#if defined(RPC_MSGOUT)
extern void RPC_MSGOUT();
#else /* defined(RPC_MSGOUT) */
static void
RPC_MSGOUT(fmt, msg)
char *fmt;
char *msg;
{
#ifdef RPC_SVC_FG
if (_rpcpmstart)
syslog(LOG_ERR, fmt, msg);
else {
(void) fprintf(stderr, fmt, msg);
(void) putc('\n', stderr);
}
#else
syslog(LOG_ERR, fmt, msg);
#endif
}
#endif /* defined(RPC_MSGOUT) */
void
gssprog_1(rqstp, transp)
struct svc_req *rqstp;
register SVCXPRT *transp;
{
union {
gss_acquire_cred_arg gss_acquire_cred_1_arg;
gss_release_cred_arg gss_release_cred_1_arg;
gss_init_sec_context_arg gss_init_sec_context_1_arg;
gss_accept_sec_context_arg gss_accept_sec_context_1_arg;
gss_process_context_token_arg gss_process_context_token_1_arg;
gss_delete_sec_context_arg gss_delete_sec_context_1_arg;
gss_context_time_arg gss_context_time_1_arg;
gss_sign_arg gss_sign_1_arg;
gss_verify_arg gss_verify_1_arg;
gss_display_status_arg gss_display_status_1_arg;
gss_inquire_cred_arg gss_inquire_cred_1_arg;
gss_seal_arg gss_seal_1_arg;
gss_unseal_arg gss_unseal_1_arg;
gsscred_expname_to_unix_cred_arg gsscred_expname_to_unix_cred_1_arg;
gsscred_name_to_unix_cred_arg gsscred_name_to_unix_cred_1_arg;
gss_get_group_info_arg gss_get_group_info_1_arg;
gss_get_kmod_arg gss_get_kmod_1_arg;
gss_export_sec_context_arg gss_export_sec_context_1_arg;
gss_import_sec_context_arg gss_import_sec_context_1_arg;
gss_add_cred_arg gss_add_cred_1_arg;
gss_inquire_cred_by_mech_arg gss_inquire_cred_by_mech_1_arg;
} argument;
union {
gss_acquire_cred_res gss_acquire_cred_1_res;
gss_release_cred_res gss_release_cred_1_res;
gss_init_sec_context_res gss_init_sec_context_1_res;
gss_accept_sec_context_res gss_accept_sec_context_1_res;
gss_process_context_token_res gss_process_context_token_1_res;
gss_delete_sec_context_res gss_delete_sec_context_1_res;
gss_context_time_res gss_context_time_1_res;
gss_sign_res gss_sign_1_res;
gss_verify_res gss_verify_1_res;
gss_display_status_res gss_display_status_1_res;
gss_indicate_mechs_res gss_indicate_mechs_1_res;
gss_inquire_cred_res gss_inquire_cred_1_res;
gss_seal_res gss_seal_1_res;
gss_unseal_res gss_unseal_1_res;
gsscred_expname_to_unix_cred_res gsscred_expname_to_unix_cred_1_res;
gsscred_name_to_unix_cred_res gsscred_name_to_unix_cred_1_res;
gss_get_group_info_res gss_get_group_info_1_res;
gss_get_kmod_res gss_get_kmod_1_res;
gss_export_sec_context_res gss_export_sec_context_1_res;
gss_import_sec_context_res gss_import_sec_context_1_res;
gss_add_cred_res gss_add_cred_1_res;
gss_inquire_cred_by_mech_res gss_inquire_cred_by_mech_1_res;
} result;
bool_t retval;
bool_t (*_xdr_argument)(), (*_xdr_result)();
bool_t (*local)();
(void) mutex_lock(&_svcstate_lock);
_rpcsvccount++;
(void) mutex_unlock(&_svcstate_lock);
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply(transp, xdr_void,
NULL);
(void) mutex_lock(&_svcstate_lock);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
(void) mutex_unlock(&_svcstate_lock);
return; /* CSTYLED */
case GSS_ACQUIRE_CRED:
_xdr_argument = xdr_gss_acquire_cred_arg;
_xdr_result = xdr_gss_acquire_cred_res;
local = (bool_t (*)())
gss_acquire_cred_1_svc;
break;
case GSS_RELEASE_CRED:
_xdr_argument = xdr_gss_release_cred_arg;
_xdr_result = xdr_gss_release_cred_res;
local = (bool_t (*)())
gss_release_cred_1_svc;
break;
case GSS_INIT_SEC_CONTEXT:
_xdr_argument = xdr_gss_init_sec_context_arg;
_xdr_result = xdr_gss_init_sec_context_res;
local = (bool_t (*)())
gss_init_sec_context_1_svc;
break;
case GSS_ACCEPT_SEC_CONTEXT:
_xdr_argument = xdr_gss_accept_sec_context_arg;
_xdr_result = xdr_gss_accept_sec_context_res;
local = (bool_t (*)())
gss_accept_sec_context_1_svc;
break;
case GSS_PROCESS_CONTEXT_TOKEN:
_xdr_argument = xdr_gss_process_context_token_arg;
_xdr_result = xdr_gss_process_context_token_res;
local = (bool_t (*)())
gss_process_context_token_1_svc;
break;
case GSS_DELETE_SEC_CONTEXT:
_xdr_argument = xdr_gss_delete_sec_context_arg;
_xdr_result = xdr_gss_delete_sec_context_res;
local = (bool_t (*)())
gss_delete_sec_context_1_svc;
break;
case GSS_CONTEXT_TIME:
_xdr_argument = xdr_gss_context_time_arg;
_xdr_result = xdr_gss_context_time_res;
local = (bool_t (*)())
gss_context_time_1_svc;
break;
case GSS_SIGN:
_xdr_argument = xdr_gss_sign_arg;
_xdr_result = xdr_gss_sign_res;
local = (bool_t (*)())
gss_sign_1_svc;
break;
case GSS_VERIFY:
_xdr_argument = xdr_gss_verify_arg;
_xdr_result = xdr_gss_verify_res;
local = (bool_t (*)())
gss_verify_1_svc;
break;
case GSS_DISPLAY_STATUS:
_xdr_argument = xdr_gss_display_status_arg;
_xdr_result = xdr_gss_display_status_res;
local = (bool_t (*)())
gss_display_status_1_svc;
break;
case GSS_INDICATE_MECHS:
_xdr_argument = xdr_void;
_xdr_result = xdr_gss_indicate_mechs_res;
local = (bool_t (*)())
gss_indicate_mechs_1_svc;
break;
case GSS_INQUIRE_CRED:
_xdr_argument = xdr_gss_inquire_cred_arg;
_xdr_result = xdr_gss_inquire_cred_res;
local = (bool_t (*)())
gss_inquire_cred_1_svc;
break;
case GSS_SEAL:
_xdr_argument = xdr_gss_seal_arg;
_xdr_result = xdr_gss_seal_res;
local = (bool_t (*)())
gss_seal_1_svc;
break;
case GSS_UNSEAL:
_xdr_argument = xdr_gss_unseal_arg;
_xdr_result = xdr_gss_unseal_res;
local = (bool_t (*)())
gss_unseal_1_svc;
break;
case GSSCRED_EXPNAME_TO_UNIX_CRED:
_xdr_argument = xdr_gsscred_expname_to_unix_cred_arg;
_xdr_result = xdr_gsscred_expname_to_unix_cred_res;
local = (bool_t (*)())
gsscred_expname_to_unix_cred_1_svc;
break;
case GSSCRED_NAME_TO_UNIX_CRED:
_xdr_argument = xdr_gsscred_name_to_unix_cred_arg;
_xdr_result = xdr_gsscred_name_to_unix_cred_res;
local = (bool_t (*)())
gsscred_name_to_unix_cred_1_svc;
break;
case GSS_GET_GROUP_INFO:
_xdr_argument = xdr_gss_get_group_info_arg;
_xdr_result = xdr_gss_get_group_info_res;
local = (bool_t (*)())
gss_get_group_info_1_svc;
break;
case GSS_GET_KMOD:
_xdr_argument = xdr_gss_get_kmod_arg;
_xdr_result = xdr_gss_get_kmod_res;
local = (bool_t (*)())
gss_get_kmod_1_svc;
break;
case GSS_EXPORT_SEC_CONTEXT:
_xdr_argument = xdr_gss_export_sec_context_arg;
_xdr_result = xdr_gss_export_sec_context_res;
local = (bool_t (*)())
gss_export_sec_context_1_svc;
break;
case GSS_IMPORT_SEC_CONTEXT:
_xdr_argument = xdr_gss_import_sec_context_arg;
_xdr_result = xdr_gss_import_sec_context_res;
local = (bool_t (*)())
gss_import_sec_context_1_svc;
break;
case GSS_ADD_CRED:
_xdr_argument = xdr_gss_add_cred_arg;
_xdr_result = xdr_gss_add_cred_res;
local = (bool_t (*)())
gss_add_cred_1_svc;
break;
case GSS_INQUIRE_CRED_BY_MECH:
_xdr_argument = xdr_gss_inquire_cred_by_mech_arg;
_xdr_result = xdr_gss_inquire_cred_by_mech_res;
local = (bool_t (*)())
gss_inquire_cred_by_mech_1_svc;
break;
default:
svcerr_noproc(transp);
(void) mutex_lock(&_svcstate_lock);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
(void) mutex_unlock(&_svcstate_lock);
return; /* CSTYLED */
}
(void) memset((char *)&argument, 0, sizeof (argument));
if (!svc_getargs(transp, _xdr_argument, (caddr_t)&argument)) {
svcerr_decode(transp);
(void) mutex_lock(&_svcstate_lock);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
(void) mutex_unlock(&_svcstate_lock);
return; /* CSTYLED */
}
retval = (bool_t)(*local)(&argument, &result, rqstp);
if (_xdr_result && retval > 0 &&
!svc_sendreply(transp, _xdr_result, (char *)&result)) {
svcerr_systemerr(transp);
}
if (!svc_freeargs(transp, _xdr_argument, (caddr_t)&argument)) {
RPC_MSGOUT("%s",
"unable to free arguments");
exit(1);
}
if (_xdr_result != NULL) {
if (!gssprog_1_freeresult(transp, _xdr_result,
(caddr_t)&result))
RPC_MSGOUT("%s",
"unable to free results");
}
(void) mutex_lock(&_svcstate_lock);
_rpcsvccount--;
_rpcsvcstate = _SERVED;
(void) mutex_unlock(&_svcstate_lock);
return; /* CSTYLED */
}
|