ReactOS 0.4.16-dev-340-g0540c21
rpcb_st_xdr.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009, Sun Microsystems, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28/*
29 * Copyright 1991 Sun Microsystems, Inc.
30 * rpcb_stat_xdr.c
31 */
32
33/*
34 * This file was generated from rpcb_prot.x, but includes only those
35 * routines used with the rpcbind stats facility.
36 */
37
38//#include <sys/cdefs.h>
39
40#include <wintirpc.h>
41#include <rpc/rpc.h>
42#ifdef __REACTOS__ // CVE-2017-8779
43#include "rpc_com.h"
44#endif
45
46/* Link list of all the stats about getport and getaddr */
47
50 XDR *xdrs;
51 rpcbs_addrlist *objp;
52{
53
54 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
55 return (FALSE);
56 }
57 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
58 return (FALSE);
59 }
60 if (!xdr_int(xdrs, &objp->success)) {
61 return (FALSE);
62 }
63 if (!xdr_int(xdrs, &objp->failure)) {
64 return (FALSE);
65 }
66#ifdef __REACTOS__ // CVE-2017-8779
67 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
68#else
69 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
70#endif
71 return (FALSE);
72 }
73
74 if (!xdr_pointer(xdrs, (char **)&objp->next,
77 return (FALSE);
78 }
79
80 return (TRUE);
81}
82
83/* Link list of all the stats about rmtcall */
84
87 XDR *xdrs;
89{
90 int32_t *buf;
91
92 if (xdrs->x_op == XDR_ENCODE) {
94 if (buf == NULL) {
95 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
96 return (FALSE);
97 }
98 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
99 return (FALSE);
100 }
101 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
102 return (FALSE);
103 }
104 if (!xdr_int(xdrs, &objp->success)) {
105 return (FALSE);
106 }
107 if (!xdr_int(xdrs, &objp->failure)) {
108 return (FALSE);
109 }
110 if (!xdr_int(xdrs, &objp->indirect)) {
111 return (FALSE);
112 }
113 } else {
114 IXDR_PUT_U_INT32(buf, objp->prog);
115 IXDR_PUT_U_INT32(buf, objp->vers);
116 IXDR_PUT_U_INT32(buf, objp->proc);
117 IXDR_PUT_INT32(buf, objp->success);
118 IXDR_PUT_INT32(buf, objp->failure);
120 }
121#ifdef __REACTOS__ // CVE-2017-8779
122 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
123#else
124 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
125#endif
126 return (FALSE);
127 }
128 if (!xdr_pointer(xdrs, (char **)&objp->next,
131 return (FALSE);
132 }
133 return (TRUE);
134 } else if (xdrs->x_op == XDR_DECODE) {
135 buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
136 if (buf == NULL) {
137 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
138 return (FALSE);
139 }
140 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
141 return (FALSE);
142 }
143 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
144 return (FALSE);
145 }
146 if (!xdr_int(xdrs, &objp->success)) {
147 return (FALSE);
148 }
149 if (!xdr_int(xdrs, &objp->failure)) {
150 return (FALSE);
151 }
152 if (!xdr_int(xdrs, &objp->indirect)) {
153 return (FALSE);
154 }
155 } else {
159 objp->success = (int)IXDR_GET_INT32(buf);
160 objp->failure = (int)IXDR_GET_INT32(buf);
161 objp->indirect = (int)IXDR_GET_INT32(buf);
162 }
163#ifdef __REACTOS__ // CVE-2017-8779
164 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
165#else
166 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
167#endif
168 return (FALSE);
169 }
170 if (!xdr_pointer(xdrs, (char **)&objp->next,
171 sizeof (rpcbs_rmtcalllist),
173 return (FALSE);
174 }
175 return (TRUE);
176 }
177 if (!xdr_u_int32_t(xdrs, &objp->prog)) {
178 return (FALSE);
179 }
180 if (!xdr_u_int32_t(xdrs, &objp->vers)) {
181 return (FALSE);
182 }
183 if (!xdr_u_int32_t(xdrs, &objp->proc)) {
184 return (FALSE);
185 }
186 if (!xdr_int(xdrs, &objp->success)) {
187 return (FALSE);
188 }
189 if (!xdr_int(xdrs, &objp->failure)) {
190 return (FALSE);
191 }
192 if (!xdr_int(xdrs, &objp->indirect)) {
193 return (FALSE);
194 }
195#ifdef __REACTOS__ // CVE-2017-8779
196 if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
197#else
198 if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
199#endif
200 return (FALSE);
201 }
202 if (!xdr_pointer(xdrs, (char **)&objp->next,
203 sizeof (rpcbs_rmtcalllist),
205 return (FALSE);
206 }
207 return (TRUE);
208}
209
210bool_t
211xdr_rpcbs_proc(xdrs, objp)
212 XDR *xdrs;
213 rpcbs_proc objp;
214{
215 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
216 sizeof (int), (xdrproc_t)xdr_int)) {
217 return (FALSE);
218 }
219 return (TRUE);
220}
221
222bool_t
224 XDR *xdrs;
225 rpcbs_addrlist_ptr *objp;
226{
227 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
229 return (FALSE);
230 }
231 return (TRUE);
232}
233
234bool_t
236 XDR *xdrs;
238{
239 if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
241 return (FALSE);
242 }
243 return (TRUE);
244}
245
246bool_t
247xdr_rpcb_stat(xdrs, objp)
248 XDR *xdrs;
249 rpcb_stat *objp;
250{
251
252 if (!xdr_rpcbs_proc(xdrs, objp->info)) {
253 return (FALSE);
254 }
255 if (!xdr_int(xdrs, &objp->setinfo)) {
256 return (FALSE);
257 }
258 if (!xdr_int(xdrs, &objp->unsetinfo)) {
259 return (FALSE);
260 }
261 if (!xdr_rpcbs_addrlist_ptr(xdrs, &objp->addrinfo)) {
262 return (FALSE);
263 }
264 if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, &objp->rmtinfo)) {
265 return (FALSE);
266 }
267 return (TRUE);
268}
269
270/*
271 * One rpcb_stat structure is returned for each version of rpcbind
272 * being monitored.
273 */
274bool_t
276 XDR *xdrs;
277 rpcb_stat_byvers objp;
278{
279 if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
280 sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
281 return (FALSE);
282 }
283 return (TRUE);
284}
bool_t xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
Definition: xdr.c:678
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
bool_t xdr_int(XDR *xdrs, int *ip)
Definition: xdr.c:103
UINT32 u_int
Definition: types.h:82
#define NULL
Definition: types.h:112
u_int32_t rpcprog_t
Definition: types.h:104
int32_t bool_t
Definition: types.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
INT32 int32_t
Definition: types.h:71
u_int32_t rpcvers_t
Definition: types.h:105
u_int32_t rpcproc_t
Definition: types.h:106
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
bool_t xdr_rpcb_stat_byvers()
bool_t xdr_rpcbs_proc()
#define IXDR_PUT_INT32(buf, v)
Definition: rpcb_prot.h:15
bool_t xdr_rpcb_stat()
int rpcbs_proc[RPCBSTAT_HIGHPROC]
Definition: rpcb_prot.h:405
bool_t xdr_rpcbs_addrlist_ptr()
rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]
Definition: rpcb_prot.h:458
#define IXDR_GET_U_INT32(buf)
Definition: rpcb_prot.h:18
#define IXDR_GET_INT32(buf)
Definition: rpcb_prot.h:12
bool_t xdr_rpcbs_rmtcalllist()
bool_t xdr_rpcbs_addrlist()
#define RPCBVERS_STAT
Definition: rpcb_prot.h:358
#define RPCBSTAT_HIGHPROC
Definition: rpcb_prot.h:357
#define IXDR_PUT_U_INT32(buf, v)
Definition: rpcb_prot.h:21
bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
Definition: rpcb_st_xdr.c:235
#define RPC_MAXDATASIZE
Definition: rpc_com.h:51
Definition: xdr.h:103
enum xdr_op x_op
Definition: xdr.h:104
rpcvers_t vers
Definition: rpcb_prot.h:367
struct rpcbs_addrlist * next
Definition: rpcb_prot.h:371
rpcprog_t prog
Definition: rpcb_prot.h:366
char * netid
Definition: rpcb_prot.h:370
rpcproc_t proc
Definition: rpcb_prot.h:388
rpcprog_t prog
Definition: rpcb_prot.h:386
rpcvers_t vers
Definition: rpcb_prot.h:387
struct rpcbs_rmtcalllist * next
Definition: rpcb_prot.h:393
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define XDR_INLINE(xdrs, len)
Definition: xdr.h:209
@ XDR_DECODE
Definition: xdr.h:86
@ XDR_ENCODE
Definition: xdr.h:85
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
#define BYTES_PER_XDR_UNIT
Definition: xdr.h:93
bool_t xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize, xdrproc_t xdr_elem)
Definition: xdr_array.c:139
bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)