ReactOS  0.4.15-dev-509-g96a357b
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 
48 bool_t
49 xdr_rpcbs_addrlist(xdrs, objp)
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 
85 bool_t
87  XDR *xdrs;
88  rpcbs_rmtcalllist *objp;
89 {
90  int32_t *buf;
91 
92  if (xdrs->x_op == XDR_ENCODE) {
93  buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
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);
119  IXDR_PUT_INT32(buf, objp->indirect);
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 
210 bool_t
211 xdr_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 
222 bool_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 
234 bool_t
236  XDR *xdrs;
237  rpcbs_rmtcalllist_ptr *objp;
238 {
239  if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
241  return (FALSE);
242  }
243  return (TRUE);
244 }
245 
246 bool_t
247 xdr_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  */
274 bool_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 }
#define IXDR_PUT_INT32(buf, v)
Definition: rpcb_prot.h:15
u_int32_t rpcproc_t
Definition: types.h:106
bool_t xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
Definition: rpcb_st_xdr.c:49
#define TRUE
Definition: types.h:120
rpcproc_t proc
Definition: rpcb_prot.h:388
u_int32_t rpcvers_t
Definition: types.h:105
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int32_t bool_t
Definition: types.h:101
#define IXDR_GET_INT32(buf)
Definition: rpcb_prot.h:12
rpcvers_t vers
Definition: rpcb_prot.h:367
bool_t xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
Definition: xdr.c:678
#define IXDR_GET_U_INT32(buf)
Definition: rpcb_prot.h:18
rpcbs_proc info
Definition: rpcb_prot.h:437
struct rpcbs_rmtcalllist rpcbs_rmtcalllist
Definition: rpcb_prot.h:395
Definition: xdr.h:103
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
bool_t xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
Definition: rpcb_st_xdr.c:86
#define RPCBVERS_STAT
Definition: rpcb_prot.h:358
smooth NULL
Definition: ftsmooth.c:416
char * netid
Definition: rpcb_prot.h:370
#define IXDR_PUT_U_INT32(buf, v)
Definition: rpcb_prot.h:21
bool_t xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
Definition: rpcb_st_xdr.c:223
int setinfo
Definition: rpcb_prot.h:438
struct rpcbs_addrlist * next
Definition: rpcb_prot.h:371
bool_t xdr_int(XDR *xdrs, int *ip)
Definition: xdr.c:103
bool_t xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
Definition: rpcb_st_xdr.c:247
bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
Definition: rpcb_st_xdr.c:235
enum xdr_op x_op
Definition: xdr.h:104
u_int32_t rpcprog_t
Definition: types.h:104
bool_t xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
Definition: rpcb_st_xdr.c:211
bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)
rpcbs_rmtcalllist_ptr rmtinfo
Definition: rpcb_prot.h:441
Definition: xdr.h:85
#define XDR_INLINE(xdrs, len)
Definition: xdr.h:209
INT32 int32_t
Definition: types.h:71
rpcvers_t vers
Definition: rpcb_prot.h:387
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
UINT32 u_int
Definition: types.h:82
int unsetinfo
Definition: rpcb_prot.h:439
rpcprog_t prog
Definition: rpcb_prot.h:386
rpcprog_t prog
Definition: rpcb_prot.h:366
bool_t xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize, xdrproc_t xdr_elem)
Definition: xdr_array.c:139
#define RPC_MAXDATASIZE
Definition: rpc_com.h:51
Definition: xdr.h:86
struct rpcbs_rmtcalllist * next
Definition: rpcb_prot.h:393
int rpcbs_proc[RPCBSTAT_HIGHPROC]
Definition: rpcb_prot.h:405
rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]
Definition: rpcb_prot.h:458
#define RPCBSTAT_HIGHPROC
Definition: rpcb_prot.h:357
rpcbs_addrlist_ptr addrinfo
Definition: rpcb_prot.h:440
bool_t xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
Definition: rpcb_st_xdr.c:275
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define BYTES_PER_XDR_UNIT
Definition: xdr.h:93