GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/rpc.lockd/nlm_prot_svc.c Lines: 0 126 0.0 %
Date: 2017-11-13 Branches: 0 79 0.0 %

Line Branch Exec Source
1
/*
2
 * Please do not edit this file.
3
 * It was generated using rpcgen.
4
 */
5
6
#include "nlm_prot.h"
7
#include <unistd.h>
8
#include <stdio.h>
9
#include <stdlib.h>/* getenv, exit */
10
#include <rpc/pmap_clnt.h> /* for pmap_unset */
11
#include <string.h> /* strcmp */
12
#include <netdb.h>
13
#include <signal.h>
14
#include <sys/ttycom.h>/* TIOCNOTTY */
15
#ifdef __cplusplus
16
#include <sysent.h> /* getdtablesize, open */
17
#endif /* __cplusplus */
18
#include <memory.h>
19
#include <sys/socket.h>
20
#include <netinet/in.h>
21
#include <syslog.h>
22
#include <errno.h>
23
24
#ifdef __STDC__
25
#define SIG_PF void(*)(int)
26
#endif
27
28
#ifdef DEBUG
29
#define RPC_SVC_FG
30
#endif
31
32
#define _RPCSVC_CLOSEDOWN 120
33
extern int _rpcpmstart;		/* Started by a port monitor ? */
34
extern int _rpcfdtype;		/* Whether Stream or Datagram ? */
35
extern int _rpcsvcdirty;	/* Still serving ? */
36
37
void	nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
38
39
void
40
nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
41
{
42
	union {
43
		struct nlm_sm_status nlm_sm_notify_0_arg;
44
	} argument;
45
	char *result;
46
	xdrproc_t xdr_argument, xdr_result;
47
	char *(*local)(char *, struct svc_req *);
48
49
	_rpcsvcdirty = 1;
50
	switch (rqstp->rq_proc) {
51
	case NULLPROC:
52
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
53
		_rpcsvcdirty = 0;
54
		return;
55
56
	case NLM_SM_NOTIFY:
57
		xdr_argument = (xdrproc_t) xdr_nlm_sm_status;
58
		xdr_result = (xdrproc_t) xdr_void;
59
		local = (char *(*)(char *, struct svc_req *)) nlm_sm_notify_0_svc;
60
		break;
61
62
	default:
63
		svcerr_noproc(transp);
64
		_rpcsvcdirty = 0;
65
		return;
66
	}
67
	(void) memset((char *)&argument, 0, sizeof (argument));
68
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
69
		svcerr_decode(transp);
70
		_rpcsvcdirty = 0;
71
		return;
72
	}
73
	result = (*local)((char *)&argument, rqstp);
74
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
75
		svcerr_systemerr(transp);
76
	}
77
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
78
		syslog(LOG_ERR, "%s", "unable to free arguments");
79
		exit(1);
80
	}
81
	_rpcsvcdirty = 0;
82
	return;
83
}
84
85
void	nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
86
87
void
88
nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
89
{
90
	union {
91
		struct nlm_testargs nlm_test_1_arg;
92
		struct nlm_lockargs nlm_lock_1_arg;
93
		struct nlm_cancargs nlm_cancel_1_arg;
94
		struct nlm_unlockargs nlm_unlock_1_arg;
95
		struct nlm_testargs nlm_granted_1_arg;
96
		struct nlm_testargs nlm_test_msg_1_arg;
97
		struct nlm_lockargs nlm_lock_msg_1_arg;
98
		struct nlm_cancargs nlm_cancel_msg_1_arg;
99
		struct nlm_unlockargs nlm_unlock_msg_1_arg;
100
		struct nlm_testargs nlm_granted_msg_1_arg;
101
		nlm_testres nlm_test_res_1_arg;
102
		nlm_res nlm_lock_res_1_arg;
103
		nlm_res nlm_cancel_res_1_arg;
104
		nlm_res nlm_unlock_res_1_arg;
105
		nlm_res nlm_granted_res_1_arg;
106
	} argument;
107
	char *result;
108
	xdrproc_t xdr_argument, xdr_result;
109
	char *(*local)(char *, struct svc_req *);
110
111
	_rpcsvcdirty = 1;
112
	switch (rqstp->rq_proc) {
113
	case NULLPROC:
114
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
115
		_rpcsvcdirty = 0;
116
		return;
117
118
	case NLM_TEST:
119
		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
120
		xdr_result = (xdrproc_t) xdr_nlm_testres;
121
		local = (char *(*)(char *, struct svc_req *)) nlm_test_1_svc;
122
		break;
123
124
	case NLM_LOCK:
125
		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
126
		xdr_result = (xdrproc_t) xdr_nlm_res;
127
		local = (char *(*)(char *, struct svc_req *)) nlm_lock_1_svc;
128
		break;
129
130
	case NLM_CANCEL:
131
		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
132
		xdr_result = (xdrproc_t) xdr_nlm_res;
133
		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_1_svc;
134
		break;
135
136
	case NLM_UNLOCK:
137
		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
138
		xdr_result = (xdrproc_t) xdr_nlm_res;
139
		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc;
140
		break;
141
142
	case NLM_GRANTED:
143
		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
144
		xdr_result = (xdrproc_t) xdr_nlm_res;
145
		local = (char *(*)(char *, struct svc_req *)) nlm_granted_1_svc;
146
		break;
147
148
	case NLM_TEST_MSG:
149
		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
150
		xdr_result = (xdrproc_t) xdr_void;
151
		local = (char *(*)(char *, struct svc_req *)) nlm_test_msg_1_svc;
152
		break;
153
154
	case NLM_LOCK_MSG:
155
		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
156
		xdr_result = (xdrproc_t) xdr_void;
157
		local = (char *(*)(char *, struct svc_req *)) nlm_lock_msg_1_svc;
158
		break;
159
160
	case NLM_CANCEL_MSG:
161
		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
162
		xdr_result = (xdrproc_t) xdr_void;
163
		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_msg_1_svc;
164
		break;
165
166
	case NLM_UNLOCK_MSG:
167
		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
168
		xdr_result = (xdrproc_t) xdr_void;
169
		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc;
170
		break;
171
172
	case NLM_GRANTED_MSG:
173
		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
174
		xdr_result = (xdrproc_t) xdr_void;
175
		local = (char *(*)(char *, struct svc_req *)) nlm_granted_msg_1_svc;
176
		break;
177
178
	case NLM_TEST_RES:
179
		xdr_argument = (xdrproc_t) xdr_nlm_testres;
180
		xdr_result = (xdrproc_t) xdr_void;
181
		local = (char *(*)(char *, struct svc_req *)) nlm_test_res_1_svc;
182
		break;
183
184
	case NLM_LOCK_RES:
185
		xdr_argument = (xdrproc_t) xdr_nlm_res;
186
		xdr_result = (xdrproc_t) xdr_void;
187
		local = (char *(*)(char *, struct svc_req *)) nlm_lock_res_1_svc;
188
		break;
189
190
	case NLM_CANCEL_RES:
191
		xdr_argument = (xdrproc_t) xdr_nlm_res;
192
		xdr_result = (xdrproc_t) xdr_void;
193
		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_res_1_svc;
194
		break;
195
196
	case NLM_UNLOCK_RES:
197
		xdr_argument = (xdrproc_t) xdr_nlm_res;
198
		xdr_result = (xdrproc_t) xdr_void;
199
		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_res_1_svc;
200
		break;
201
202
	case NLM_GRANTED_RES:
203
		xdr_argument = (xdrproc_t) xdr_nlm_res;
204
		xdr_result = (xdrproc_t) xdr_void;
205
		local = (char *(*)(char *, struct svc_req *)) nlm_granted_res_1_svc;
206
		break;
207
208
	default:
209
		svcerr_noproc(transp);
210
		_rpcsvcdirty = 0;
211
		return;
212
	}
213
	(void) memset((char *)&argument, 0, sizeof (argument));
214
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
215
		svcerr_decode(transp);
216
		_rpcsvcdirty = 0;
217
		return;
218
	}
219
	result = (*local)((char *)&argument, rqstp);
220
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
221
		svcerr_systemerr(transp);
222
	}
223
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
224
		syslog(LOG_ERR, "%s", "unable to free arguments");
225
		exit(1);
226
	}
227
	_rpcsvcdirty = 0;
228
	return;
229
}
230
231
void	nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
232
233
void
234
nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
235
{
236
	union {
237
		nlm_shareargs nlm_share_3_arg;
238
		nlm_shareargs nlm_unshare_3_arg;
239
		nlm_lockargs nlm_nm_lock_3_arg;
240
		nlm_notify nlm_free_all_3_arg;
241
	} argument;
242
	char *result;
243
	xdrproc_t xdr_argument, xdr_result;
244
	char *(*local)(char *, struct svc_req *);
245
246
	_rpcsvcdirty = 1;
247
	switch (rqstp->rq_proc) {
248
	case NULLPROC:
249
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
250
		_rpcsvcdirty = 0;
251
		return;
252
253
	case NLM_SHARE:
254
		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
255
		xdr_result = (xdrproc_t) xdr_nlm_shareres;
256
		local = (char *(*)(char *, struct svc_req *)) nlm_share_3_svc;
257
		break;
258
259
	case NLM_UNSHARE:
260
		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
261
		xdr_result = (xdrproc_t) xdr_nlm_shareres;
262
		local = (char *(*)(char *, struct svc_req *)) nlm_unshare_3_svc;
263
		break;
264
265
	case NLM_NM_LOCK:
266
		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
267
		xdr_result = (xdrproc_t) xdr_nlm_res;
268
		local = (char *(*)(char *, struct svc_req *)) nlm_nm_lock_3_svc;
269
		break;
270
271
	case NLM_FREE_ALL:
272
		xdr_argument = (xdrproc_t) xdr_nlm_notify;
273
		xdr_result = (xdrproc_t) xdr_void;
274
		local = (char *(*)(char *, struct svc_req *)) nlm_free_all_3_svc;
275
		break;
276
277
	default:
278
		svcerr_noproc(transp);
279
		_rpcsvcdirty = 0;
280
		return;
281
	}
282
	(void) memset((char *)&argument, 0, sizeof (argument));
283
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
284
		svcerr_decode(transp);
285
		_rpcsvcdirty = 0;
286
		return;
287
	}
288
	result = (*local)((char *)&argument, rqstp);
289
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
290
		svcerr_systemerr(transp);
291
	}
292
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
293
		syslog(LOG_ERR, "%s", "unable to free arguments");
294
		exit(1);
295
	}
296
	_rpcsvcdirty = 0;
297
	return;
298
}
299
300
void	nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
301
302
void
303
nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
304
{
305
	union {
306
		nlm4_testargs nlm4_test_4_arg;
307
		nlm4_lockargs nlm4_lock_4_arg;
308
		nlm4_cancargs nlm4_cancel_4_arg;
309
		nlm4_unlockargs nlm4_unlock_4_arg;
310
		nlm4_testargs nlm4_granted_4_arg;
311
		nlm4_testargs nlm4_test_msg_4_arg;
312
		nlm4_lockargs nlm4_lock_msg_4_arg;
313
		nlm4_cancargs nlm4_cancel_msg_4_arg;
314
		nlm4_unlockargs nlm4_unlock_msg_4_arg;
315
		nlm4_testargs nlm4_granted_msg_4_arg;
316
		nlm4_testres nlm4_test_res_4_arg;
317
		nlm4_res nlm4_lock_res_4_arg;
318
		nlm4_res nlm4_cancel_res_4_arg;
319
		nlm4_res nlm4_unlock_res_4_arg;
320
		nlm4_res nlm4_granted_res_4_arg;
321
		nlm4_shareargs nlm4_share_4_arg;
322
		nlm4_shareargs nlm4_unshare_4_arg;
323
		nlm4_lockargs nlm4_nm_lock_4_arg;
324
		nlm_notify nlm4_free_all_4_arg;
325
	} argument;
326
	char *result;
327
	xdrproc_t xdr_argument, xdr_result;
328
	char *(*local)(char *, struct svc_req *);
329
330
	_rpcsvcdirty = 1;
331
	switch (rqstp->rq_proc) {
332
	case NULLPROC:
333
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
334
		_rpcsvcdirty = 0;
335
		return;
336
337
	case NLM4_TEST:
338
		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
339
		xdr_result = (xdrproc_t) xdr_nlm4_testres;
340
		local = (char *(*)(char *, struct svc_req *)) nlm4_test_4_svc;
341
		break;
342
343
	case NLM4_LOCK:
344
		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
345
		xdr_result = (xdrproc_t) xdr_nlm4_res;
346
		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_4_svc;
347
		break;
348
349
	case NLM4_CANCEL:
350
		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
351
		xdr_result = (xdrproc_t) xdr_nlm4_res;
352
		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_4_svc;
353
		break;
354
355
	case NLM4_UNLOCK:
356
		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
357
		xdr_result = (xdrproc_t) xdr_nlm4_res;
358
		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_4_svc;
359
		break;
360
361
	case NLM4_GRANTED:
362
		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
363
		xdr_result = (xdrproc_t) xdr_nlm4_res;
364
		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_4_svc;
365
		break;
366
367
	case NLM4_TEST_MSG:
368
		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
369
		xdr_result = (xdrproc_t) xdr_void;
370
		local = (char *(*)(char *, struct svc_req *)) nlm4_test_msg_4_svc;
371
		break;
372
373
	case NLM4_LOCK_MSG:
374
		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
375
		xdr_result = (xdrproc_t) xdr_void;
376
		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_msg_4_svc;
377
		break;
378
379
	case NLM4_CANCEL_MSG:
380
		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
381
		xdr_result = (xdrproc_t) xdr_void;
382
		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_msg_4_svc;
383
		break;
384
385
	case NLM4_UNLOCK_MSG:
386
		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
387
		xdr_result = (xdrproc_t) xdr_void;
388
		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_msg_4_svc;
389
		break;
390
391
	case NLM4_GRANTED_MSG:
392
		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
393
		xdr_result = (xdrproc_t) xdr_void;
394
		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_msg_4_svc;
395
		break;
396
397
	case NLM4_TEST_RES:
398
		xdr_argument = (xdrproc_t) xdr_nlm4_testres;
399
		xdr_result = (xdrproc_t) xdr_void;
400
		local = (char *(*)(char *, struct svc_req *)) nlm4_test_res_4_svc;
401
		break;
402
403
	case NLM4_LOCK_RES:
404
		xdr_argument = (xdrproc_t) xdr_nlm4_res;
405
		xdr_result = (xdrproc_t) xdr_void;
406
		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_res_4_svc;
407
		break;
408
409
	case NLM4_CANCEL_RES:
410
		xdr_argument = (xdrproc_t) xdr_nlm4_res;
411
		xdr_result = (xdrproc_t) xdr_void;
412
		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_res_4_svc;
413
		break;
414
415
	case NLM4_UNLOCK_RES:
416
		xdr_argument = (xdrproc_t) xdr_nlm4_res;
417
		xdr_result = (xdrproc_t) xdr_void;
418
		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_res_4_svc;
419
		break;
420
421
	case NLM4_GRANTED_RES:
422
		xdr_argument = (xdrproc_t) xdr_nlm4_res;
423
		xdr_result = (xdrproc_t) xdr_void;
424
		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_res_4_svc;
425
		break;
426
427
	case NLM4_SHARE:
428
		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
429
		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
430
		local = (char *(*)(char *, struct svc_req *)) nlm4_share_4_svc;
431
		break;
432
433
	case NLM4_UNSHARE:
434
		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
435
		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
436
		local = (char *(*)(char *, struct svc_req *)) nlm4_unshare_4_svc;
437
		break;
438
439
	case NLM4_NM_LOCK:
440
		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
441
		xdr_result = (xdrproc_t) xdr_nlm4_res;
442
		local = (char *(*)(char *, struct svc_req *)) nlm4_nm_lock_4_svc;
443
		break;
444
445
	case NLM4_FREE_ALL:
446
		xdr_argument = (xdrproc_t) xdr_nlm_notify;
447
		xdr_result = (xdrproc_t) xdr_void;
448
		local = (char *(*)(char *, struct svc_req *)) nlm4_free_all_4_svc;
449
		break;
450
451
	default:
452
		svcerr_noproc(transp);
453
		_rpcsvcdirty = 0;
454
		return;
455
	}
456
	(void) memset((char *)&argument, 0, sizeof (argument));
457
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
458
		svcerr_decode(transp);
459
		_rpcsvcdirty = 0;
460
		return;
461
	}
462
	result = (*local)((char *)&argument, rqstp);
463
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
464
		svcerr_systemerr(transp);
465
	}
466
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
467
		syslog(LOG_ERR, "%s", "unable to free arguments");
468
		exit(1);
469
	}
470
	_rpcsvcdirty = 0;
471
	return;
472
}