pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for libtirpc cleanup, 2025-09-02
Posted by Anonymous on Tue 2nd Sep 2025 19:07
raw | new post

  1. From 27cdc01373ec58da876cb790d696f3bce5fbb8b1 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 2 Sep 2025 19:15:33 +0200
  4. Subject: [PATCH 1/2] libtirpc: Use #ifdef _WIN32 instead of C++ comments to do
  5.  conditional includes
  6.  
  7. Use #ifdef _WIN32 instead of C++ comments to do conditional includes.
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11. libtirpc/src/asprintf.c        |  2 +-
  12.  libtirpc/src/auth_des.c        | 24 +++++++++++++------
  13.  libtirpc/src/auth_gss.c        |  4 +++-
  14.  libtirpc/src/auth_none.c       |  6 +++--
  15.  libtirpc/src/auth_sspi.c       |  4 +++-
  16.  libtirpc/src/auth_time.c       | 26 +++++++++++++--------
  17.  libtirpc/src/auth_unix.c       | 16 +++++++++----
  18.  libtirpc/src/authdes_prot.c    |  4 +++-
  19.  libtirpc/src/authsspi_prot.c   |  8 +++++--
  20.  libtirpc/src/authunix_prot.c   |  4 +++-
  21.  libtirpc/src/bindresvport.c    | 10 ++++----
  22.  libtirpc/src/clnt_bcast.c      | 42 ++++++++++++++++++++++------------
  23.  libtirpc/src/clnt_dg.c         | 28 +++++++++++++++--------
  24.  libtirpc/src/clnt_generic.c    | 24 +++++++++++++------
  25.  libtirpc/src/clnt_raw.c        |  4 +++-
  26.  libtirpc/src/clnt_simple.c     | 16 +++++++++----
  27.  libtirpc/src/clnt_vc.c         | 30 +++++++++++++++---------
  28.  libtirpc/src/crypt_client.c    |  8 +++++--
  29.  libtirpc/src/des_crypt.c       |  4 +++-
  30.  libtirpc/src/des_soft.c        |  4 +++-
  31.  libtirpc/src/getnetconfig.c    | 12 +++++++---
  32.  libtirpc/src/getnetpath.c      | 10 +++++---
  33.  libtirpc/src/getpeereid.c      | 16 +++++++++----
  34.  libtirpc/src/getpublickey.c    |  4 +++-
  35.  libtirpc/src/getrpcent.c       | 10 +++++---
  36.  libtirpc/src/getrpcport.c      |  8 +++++--
  37.  libtirpc/src/key_call.c        |  4 +++-
  38.  libtirpc/src/key_prot_xdr.c    |  4 ++--
  39.  libtirpc/src/mt_misc.c         | 10 +++++---
  40.  libtirpc/src/netname.c         |  8 +++++--
  41.  libtirpc/src/pmap_clnt.c       | 12 +++++++---
  42.  libtirpc/src/pmap_getmaps.c    | 25 +++++++++++++-------
  43.  libtirpc/src/pmap_getport.c    | 12 ++++++----
  44.  libtirpc/src/pmap_rmt.c        | 26 +++++++++++++--------
  45.  libtirpc/src/rpc_callmsg.c     |  4 +++-
  46.  libtirpc/src/rpc_com.h         |  4 +++-
  47.  libtirpc/src/rpc_dtablesize.c  |  6 +++--
  48.  libtirpc/src/rpc_generic.c     | 34 +++++++++++++++++----------
  49.  libtirpc/src/rpc_prot.c        |  4 +++-
  50.  libtirpc/src/rpc_soc.c         | 18 +++++++++++----
  51.  libtirpc/src/rpcb_clnt.c       | 22 +++++++++++-------
  52.  libtirpc/src/rpcb_prot.c       |  2 +-
  53.  libtirpc/src/rpcb_st_xdr.c     |  6 +++--
  54.  libtirpc/src/rpcdname.c        |  8 +++++--
  55.  libtirpc/src/rtime.c           | 22 ++++++++++++------
  56.  libtirpc/src/svc.c             |  8 +++++--
  57.  libtirpc/src/svc_auth.c        |  4 +++-
  58.  libtirpc/src/svc_auth_des.c    | 14 ++++++++----
  59.  libtirpc/src/svc_auth_unix.c   |  4 +++-
  60.  libtirpc/src/svc_dg.c          | 20 ++++++++++++----
  61.  libtirpc/src/svc_generic.c     | 16 +++++++++----
  62.  libtirpc/src/svc_raw.c         |  4 +++-
  63.  libtirpc/src/svc_run.c         | 16 +++++++++----
  64.  libtirpc/src/svc_simple.c      | 13 ++++++++---
  65.  libtirpc/src/svc_vc.c          | 32 +++++++++++++++++---------
  66.  libtirpc/src/wintirpc.c        |  3 ++-
  67.  libtirpc/src/xdr.c             |  4 +++-
  68.  libtirpc/src/xdr_array.c       | 10 +++++---
  69.  libtirpc/src/xdr_float.c       |  8 +++++--
  70.  libtirpc/src/xdr_mem.c         |  8 +++++--
  71.  libtirpc/src/xdr_rec.c         | 22 +++++++++++++-----
  72.  libtirpc/src/xdr_reference.c   | 10 +++++---
  73.  libtirpc/src/xdr_sizeof.c      |  4 +++-
  74.  libtirpc/src/xdr_stdio.c       |  8 +++++--
  75.  libtirpc/tirpc/misc/event.h    |  4 +++-
  76.  libtirpc/tirpc/netconfig.h     |  6 +++--
  77.  libtirpc/tirpc/reentrant.h     |  7 ++++--
  78.  libtirpc/tirpc/rpc/auth.h      | 10 +++++---
  79.  libtirpc/tirpc/rpc/auth_unix.h |  4 +++-
  80.  libtirpc/tirpc/rpc/clnt.h      | 16 +++++++++----
  81.  libtirpc/tirpc/rpc/clnt_soc.h  |  4 +++-
  82.  libtirpc/tirpc/rpc/des_crypt.h |  4 +++-
  83.  libtirpc/tirpc/rpc/pmap_clnt.h |  4 +++-
  84.  libtirpc/tirpc/rpc/pmap_prot.h |  5 +++-
  85.  libtirpc/tirpc/rpc/pmap_rmt.h  |  4 +++-
  86.  libtirpc/tirpc/rpc/rpc.h       |  6 +++--
  87.  libtirpc/tirpc/rpc/rpc_com.h   |  4 +++-
  88.  libtirpc/tirpc/rpc/svc.h       |  4 +++-
  89.  libtirpc/tirpc/rpc/svc_soc.h   |  4 +++-
  90.  libtirpc/tirpc/rpc/types.h     | 18 ++++++++++-----
  91.  libtirpc/tirpc/rpc/xdr.h       | 10 +++++---
  92.  libtirpc/tirpc/spinlock.h      |  4 +++-
  93.  82 files changed, 618 insertions(+), 267 deletions(-)
  94.  
  95. diff --git a/libtirpc/src/asprintf.c b/libtirpc/src/asprintf.c
  96. index 45fa7ee..a8ce50f 100644
  97. --- a/libtirpc/src/asprintf.c
  98. +++ b/libtirpc/src/asprintf.c
  99. @@ -16,11 +16,11 @@
  100.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  101.   */
  102.  
  103. -//extern int vsnprintf();
  104.  #ifdef _WIN32
  105.  #include <wintirpc.h>
  106.  #include <stdarg.h>
  107.  #else
  108. +extern int vsnprintf();
  109.  #include <varargs.h>
  110.  #endif /* _WIN32 */
  111.  #include <stdio.h>
  112. diff --git a/libtirpc/src/auth_des.c b/libtirpc/src/auth_des.c
  113. index 76bb9a4..41357c7 100644
  114. --- a/libtirpc/src/auth_des.c
  115. +++ b/libtirpc/src/auth_des.c
  116. @@ -33,30 +33,40 @@
  117.   */
  118.  
  119.  #include <wintirpc.h>
  120. -//#include <pthread.h>
  121. +#ifndef _WIN32
  122. +#include <pthread.h>
  123. +#endif /* !_WIN32 */
  124.  #include <reentrant.h>
  125. -//#include <err.h>
  126. +#ifndef _WIN32
  127. +#include <err.h>
  128. +#endif /* !_WIN32 */
  129.  #include <errno.h>
  130.  #include <string.h>
  131.  #include <stdlib.h>
  132. -//#include <unistd.h>
  133. -//#include <sys/cdefs.h>
  134. +#ifndef _WIN32
  135. +#include <unistd.h>
  136. +#include <sys/cdefs.h>
  137. +#endif /* !_WIN32 */
  138.  #include <rpc/des_crypt.h>
  139.  #ifndef _WIN32
  140.  #include <syslog.h>
  141. -#endif
  142. +#endif /* !_WIN32 */
  143.  #include <rpc/types.h>
  144.  #include <rpc/auth.h>
  145.  #include <rpc/auth_des.h>
  146.  #include <rpc/clnt.h>
  147.  #include <rpc/xdr.h>
  148. -//#include <sys/socket.h>
  149. +#ifndef _WIN32
  150. +#include <sys/socket.h>
  151. +#endif /* !_WIN32 */
  152.  #undef NIS
  153.  #include <rpcsvc/nis.h>
  154.  
  155.  #if defined(LIBC_SCCS) && !defined(lint)
  156.  #endif
  157. -//#include <sys/cdefs.h>
  158. +#ifndef _WIN32
  159. +#include <sys/cdefs.h>
  160. +#endif /* !_WIN32 */
  161.  
  162.  #define USEC_PER_SEC           1000000
  163.  #define RTIME_TIMEOUT          5       /* seconds to wait for sync */
  164. diff --git a/libtirpc/src/auth_gss.c b/libtirpc/src/auth_gss.c
  165. index 89d4628..c7ea358 100644
  166. --- a/libtirpc/src/auth_gss.c
  167. +++ b/libtirpc/src/auth_gss.c
  168. @@ -38,7 +38,9 @@
  169.  
  170.  #include <stdio.h>
  171.  #include <stdlib.h>
  172. -//#include <unistd.h>
  173. +#ifndef _WIN32
  174. +#include <unistd.h>
  175. +#endif /* !_WIN32 */
  176.  #include <string.h>
  177.  #include <errno.h>
  178.  #include <rpc/types.h>
  179. diff --git a/libtirpc/src/auth_none.c b/libtirpc/src/auth_none.c
  180. index 64a9112..6719fce 100644
  181. --- a/libtirpc/src/auth_none.c
  182. +++ b/libtirpc/src/auth_none.c
  183. @@ -31,7 +31,7 @@
  184.  static char *sccsid = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
  185.  static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
  186.  #endif
  187. -//#include <sys/cdefs.h>
  188. +#include <sys/cdefs.h>
  189.  __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obrien Exp $");
  190.  */
  191.  
  192. @@ -66,7 +66,9 @@ __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obri
  193.   */
  194.  
  195.  #include <wintirpc.h>
  196. -//#include <pthread.h>
  197. +#ifndef _WIN32
  198. +#include <pthread.h>
  199. +#endif /* !_WIN32 */
  200.  #include <reentrant.h>
  201.  #include <assert.h>
  202.  #include <stdlib.h>
  203. diff --git a/libtirpc/src/auth_sspi.c b/libtirpc/src/auth_sspi.c
  204. index f570dec..a7700cd 100644
  205. --- a/libtirpc/src/auth_sspi.c
  206. +++ b/libtirpc/src/auth_sspi.c
  207. @@ -22,7 +22,9 @@
  208.  #include <wintirpc.h>
  209.  #include <stdio.h>
  210.  #include <stdlib.h>
  211. -//#include <unistd.h>
  212. +#ifndef _WIN32
  213. +#include <unistd.h>
  214. +#endif /* !_WIN32 */
  215.  #include <string.h>
  216.  #include <errno.h>
  217.  #include <rpc/types.h>
  218. diff --git a/libtirpc/src/auth_time.c b/libtirpc/src/auth_time.c
  219. index 9eef6ef..43ef5fc 100644
  220. --- a/libtirpc/src/auth_time.c
  221. +++ b/libtirpc/src/auth_time.c
  222. @@ -25,26 +25,34 @@
  223.   *     needed to deal with TCP connections.
  224.   */
  225.  
  226. -//#include <sys/cdefs.h>
  227. +#ifndef _WIN32
  228. +#include <sys/cdefs.h>
  229. +#endif /* !_WIN32 */
  230.  #include <wintirpc.h>
  231.  #ifndef _WIN32
  232.  #include <syslog.h>
  233.  #endif
  234.  #include <string.h>
  235.  #include <stdlib.h>
  236. -//#include <unistd.h>
  237. -//#include <netdb.h>
  238. -//#include <sys/signal.h>
  239. +#ifndef _WIN32
  240. +#include <unistd.h>
  241. +#include <netdb.h>
  242. +#include <sys/signal.h>
  243. +#endif /* !_WIN32 */
  244.  #include <errno.h>
  245. -//#include <sys/socket.h>
  246. -//#include <netinet/in.h>
  247. -//#include <arpa/inet.h>
  248. +#ifndef _WIN32
  249. +#include <sys/socket.h>
  250. +#include <netinet/in.h>
  251. +#include <arpa/inet.h>
  252. +#endif /* !_WIN32 */
  253.  
  254.  #include <rpc/rpc.h>
  255.  #include <rpc/rpc_com.h>
  256.  #include <rpc/rpcb_prot.h>
  257. -//#include <clnt_soc.h>
  258. -//#include <sys/select.h>
  259. +#ifndef _WIN32
  260. +#include <clnt_soc.h>
  261. +#include <sys/select.h>
  262. +#endif /* !_WIN32 */
  263.  #undef NIS
  264.  #include <rpcsvc/nis.h>
  265.  
  266. diff --git a/libtirpc/src/auth_unix.c b/libtirpc/src/auth_unix.c
  267. index a1835da..66b413a 100644
  268. --- a/libtirpc/src/auth_unix.c
  269. +++ b/libtirpc/src/auth_unix.c
  270. @@ -26,7 +26,9 @@
  271.   * POSSIBILITY OF SUCH DAMAGE.
  272.   */
  273.  
  274. -//#include <sys/cdefs.h>
  275. +#ifndef _WIN32
  276. +#include <sys/cdefs.h>
  277. +#endif /* !_WIN32 */
  278.  
  279.  /*
  280.   * auth_unix.c, Implements UNIX style authentication parameters.
  281. @@ -64,9 +66,13 @@
  282.   */
  283.  
  284.  #include <wintirpc.h>
  285. -//#include <pthread.h>
  286. +#ifndef _WIN32
  287. +#include <pthread.h>
  288. +#endif /* !_WIN32 */
  289.  #include <reentrant.h>
  290. -//#include <sys/param.h>
  291. +#ifndef _WIN32
  292. +#include <sys/param.h>
  293. +#endif /* !_WIN32 */
  294.  
  295.  #ifndef _WIN32
  296.  #include <assert.h>
  297. @@ -74,7 +80,9 @@
  298.  #endif /* !_WIN32 */
  299.  #include <stdio.h>
  300.  #include <stdlib.h>
  301. -//#include <unistd.h>
  302. +#ifndef _WIN32
  303. +#include <unistd.h>
  304. +#endif /* !_WIN32 */
  305.  #include <string.h>
  306.  
  307.  #include <rpc/types.h>
  308. diff --git a/libtirpc/src/authdes_prot.c b/libtirpc/src/authdes_prot.c
  309. index 4917e17..064c31f 100644
  310. --- a/libtirpc/src/authdes_prot.c
  311. +++ b/libtirpc/src/authdes_prot.c
  312. @@ -1,4 +1,6 @@
  313. -//#include <sys/cdefs.h>
  314. +#ifndef _WIN32
  315. +#include <sys/cdefs.h>
  316. +#endif /* !_WIN32 */
  317.  /*
  318.   * Copyright (c) 2009, Sun Microsystems, Inc.
  319.   * All rights reserved.
  320. diff --git a/libtirpc/src/authsspi_prot.c b/libtirpc/src/authsspi_prot.c
  321. index d0dafcb..1e25796 100644
  322. --- a/libtirpc/src/authsspi_prot.c
  323. +++ b/libtirpc/src/authsspi_prot.c
  324. @@ -1,8 +1,10 @@
  325.  /* NFSv4.1 client for Windows
  326. - * Copyright (C) 2012 The Regents of the University of Michigan
  327. + * Copyright (C) 2012 The Regents of the University of Michigan
  328. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  329.   *
  330.   * Olga Kornievskaia <aglo@umich.edu>
  331.   * Casey Bodley <cbodley@umich.edu>
  332. + * Roland Mainz <roland.mainz@nrubsig.org>
  333.   *
  334.   * This library is free software; you can redistribute it and/or modify it
  335.   * under the terms of the GNU Lesser General Public License as published by
  336. @@ -23,7 +25,9 @@
  337.  #include <stdio.h>
  338.  #include <stdlib.h>
  339.  #include <stdarg.h>
  340. -//#include <rpc/types.h>
  341. +#ifndef _WIN32
  342. +#include <rpc/types.h>
  343. +#endif /* !_WIN32 */
  344.  #include <rpc/xdr.h>
  345.  #include <rpc/auth.h>
  346.  #include <rpc/auth_sspi.h>
  347. diff --git a/libtirpc/src/authunix_prot.c b/libtirpc/src/authunix_prot.c
  348. index 841102e..181c1f3 100644
  349. --- a/libtirpc/src/authunix_prot.c
  350. +++ b/libtirpc/src/authunix_prot.c
  351. @@ -26,7 +26,9 @@
  352.   * POSSIBILITY OF SUCH DAMAGE.
  353.   */
  354.  
  355. -//#include <sys/cdefs.h>
  356. +#ifndef _WIN32
  357. +#include <sys/cdefs.h>
  358. +#endif /* !_WIN32 */
  359.  
  360.  /*
  361.   * authunix_prot.c
  362. diff --git a/libtirpc/src/bindresvport.c b/libtirpc/src/bindresvport.c
  363. index e4418df..1f76ddc 100644
  364. --- a/libtirpc/src/bindresvport.c
  365. +++ b/libtirpc/src/bindresvport.c
  366. @@ -27,7 +27,9 @@
  367.   * POSSIBILITY OF SUCH DAMAGE.
  368.   */
  369.  
  370. -//#include <sys/cdefs.h>
  371. +#ifndef _WIN32
  372. +#include <sys/cdefs.h>
  373. +#endif /* !_WIN32 */
  374.  
  375.  /*
  376.   * Copyright (c) 1987 by Sun Microsystems, Inc.
  377. @@ -41,13 +43,13 @@
  378.  #ifndef _WIN32
  379.  #include <sys/socket.h>
  380.  #include <netinet/in.h>
  381. -#endif
  382. +#endif /* !_WIN32 */
  383.  
  384.  #include <errno.h>
  385.  #include <string.h>
  386.  #ifndef _WIN32
  387.  #include <unistd.h>
  388. -#endif
  389. +#endif /* !_WIN32 */
  390.  
  391.  #include <rpc/rpc.h>
  392.  
  393. @@ -55,7 +57,7 @@
  394.  #include <winsock2.h>
  395.  #include <mstcpip.h>
  396.  #include <ws2ipdef.h>
  397. -#endif
  398. +#endif /* _WIN32 */
  399.  
  400.  /*
  401.   * Bind a socket to a privileged IP port
  402. diff --git a/libtirpc/src/clnt_bcast.c b/libtirpc/src/clnt_bcast.c
  403. index b799a65..a69367a 100644
  404. --- a/libtirpc/src/clnt_bcast.c
  405. +++ b/libtirpc/src/clnt_bcast.c
  406. @@ -28,7 +28,9 @@
  407.  /*
  408.   * Copyright (c) 1986-1991 by Sun Microsystems Inc.
  409.   */
  410. -//#include <sys/cdefs.h>
  411. +#ifndef _WIN32
  412. +#include <sys/cdefs.h>
  413. +#endif /* !_WIN32 */
  414.  
  415.  /*
  416.   * clnt_bcast.c
  417. @@ -41,17 +43,25 @@
  418.   */
  419.  
  420.  #include <wintirpc.h>
  421. -//#include <sys/socket.h>
  422. +#ifndef _WIN32
  423. +#include <sys/socket.h>
  424. +#endif /* !_WIN32 */
  425.  #include <sys/types.h>
  426. -//#include <sys/queue.h>
  427. +#ifndef _WIN32
  428. +#include <sys/queue.h>
  429. +#endif /* !_WIN32 */
  430.  
  431.  /* new queue functions */
  432. -//#include <misc/queue.h>
  433. -
  434. -//#include <net/if.h>
  435. -//#include <netinet/in.h>
  436. -//#include <ifaddrs.h>
  437. -//#include <sys/poll.h>
  438. +#ifndef _WIN32
  439. +#include <misc/queue.h>
  440. +#endif /* !_WIN32 */
  441. +
  442. +#ifndef _WIN32
  443. +#include <net/if.h>
  444. +#include <netinet/in.h>
  445. +#include <ifaddrs.h>
  446. +#include <sys/poll.h>
  447. +#endif /* !_WIN32 */
  448.  #include <rpc/rpc.h>
  449.  #ifdef PORTMAP
  450.  #include <rpc/pmap_prot.h>
  451. @@ -59,16 +69,20 @@
  452.  #include <rpc/pmap_rmt.h>
  453.  #endif                         /* PORTMAP */
  454.  #include <rpc/nettype.h>
  455. -//#include <arpa/inet.h>
  456. -//#define RPC_DEBUG 1
  457. +#ifndef _WIN32
  458. +#include <arpa/inet.h>
  459. +#define RPC_DEBUG 1
  460. +#endif /* !_WIN32 */
  461.  #ifdef RPC_DEBUG
  462.  #include <stdio.h>
  463.  #endif
  464.  #include <errno.h>
  465.  #include <stdlib.h>
  466. -//#include <unistd.h>
  467. -//#include <netdb.h>
  468. -//#include <err.h>
  469. +#ifndef _WIN32
  470. +#include <unistd.h>
  471. +#include <netdb.h>
  472. +#include <err.h>
  473. +#endif /* !_WIN32 */
  474.  #include <string.h>
  475.  
  476.  #include "rpc_com.h"
  477. diff --git a/libtirpc/src/clnt_dg.c b/libtirpc/src/clnt_dg.c
  478. index 418401a..0ba11e8 100644
  479. --- a/libtirpc/src/clnt_dg.c
  480. +++ b/libtirpc/src/clnt_dg.c
  481. @@ -33,26 +33,34 @@
  482.   * Implements a connectionless client side RPC.
  483.   */
  484.  #include <wintirpc.h>
  485. -//#include <pthread.h>
  486. +#ifndef _WIN32
  487. +#include <pthread.h>
  488. +#endif /* !_WIN32 */
  489.  #include <reentrant.h>
  490.  #include <sys/types.h>
  491. -//#include <sys/socket.h>
  492. -//#include <stdint.h>
  493. -//#include <sys/poll.h>
  494. +#ifndef _WIN32
  495. +#include <sys/socket.h>
  496. +#include <stdint.h>
  497. +#include <sys/poll.h>
  498.  
  499. -//#include <sys/time.h>
  500. +#include <sys/time.h>
  501.  
  502. -//#include <sys/ioctl.h>
  503. +#include <sys/ioctl.h>
  504. +#endif /* !_WIN32 */
  505.  #include <rpc/clnt.h>
  506. -//#include <arpa/inet.h>
  507. +#ifndef _WIN32
  508. +#include <arpa/inet.h>
  509. +#endif /* !_WIN32 */
  510.  #include <rpc/rpc.h>
  511.  #include <rpc/xdr.h>
  512.  #include <errno.h>
  513.  #include <stdlib.h>
  514.  #include <string.h>
  515. -//#include <signal.h>
  516. -//#include <unistd.h>
  517. -//#include <err.h>
  518. +#ifndef _WIN32
  519. +#include <signal.h>
  520. +#include <unistd.h>
  521. +#include <err.h>
  522. +#endif /* !_WIN32 */
  523.  #include "rpc_com.h"
  524.  
  525.  #ifdef _WIN32
  526. diff --git a/libtirpc/src/clnt_generic.c b/libtirpc/src/clnt_generic.c
  527. index 132833a..d4b62f1 100644
  528. --- a/libtirpc/src/clnt_generic.c
  529. +++ b/libtirpc/src/clnt_generic.c
  530. @@ -53,25 +53,35 @@
  531.   */
  532.  
  533.  #include <wintirpc.h>
  534. -//#include <pthread.h>
  535. +#ifndef _WIN32
  536. +#include <pthread.h>
  537. +#endif /* !_WIN32 */
  538.  #include <reentrant.h>
  539.  #include <sys/types.h>
  540. -//#include <sys/fcntl.h>
  541. +#ifndef _WIN32
  542. +#include <sys/fcntl.h>
  543. +#endif /* !_WIN32 */
  544.  #include <fcntl.h>
  545. -//#include <sys/socket.h>
  546. -//#include <netinet/in.h>
  547. -//#include <netinet/tcp.h>
  548. +#ifndef _WIN32
  549. +#include <sys/socket.h>
  550. +#include <netinet/in.h>
  551. +#include <netinet/tcp.h>
  552. +#endif /* !_WIN32 */
  553.  #include <stdio.h>
  554.  #include <errno.h>
  555.  #include <string.h>
  556.  #include <stdlib.h>
  557. -//#include <netdb.h>
  558. +#ifndef _WIN32
  559. +#include <netdb.h>
  560. +#endif /* !_WIN32 */
  561.  #ifndef _WIN32
  562.  #include <syslog.h>
  563.  #endif
  564.  #include <rpc/rpc.h>
  565.  #include <rpc/nettype.h>
  566. -//#include <unistd.h>
  567. +#ifndef _WIN32
  568. +#include <unistd.h>
  569. +#endif /* !_WIN32 */
  570.  #include "rpc_com.h"
  571.  
  572.  extern bool_t __rpc_is_local_host(const char *);
  573. diff --git a/libtirpc/src/clnt_raw.c b/libtirpc/src/clnt_raw.c
  574. index 245b7cf..5a9ba46 100644
  575. --- a/libtirpc/src/clnt_raw.c
  576. +++ b/libtirpc/src/clnt_raw.c
  577. @@ -37,7 +37,9 @@
  578.   * any interference from the kernel.
  579.   */
  580.  #include <wintirpc.h>
  581. -//#include <pthread.h>
  582. +#ifndef _WIN32
  583. +#include <pthread.h>
  584. +#endif /* !_WIN32 */
  585.  #include <reentrant.h>
  586.  #ifndef _WIN32
  587.  #include <assert.h>
  588. diff --git a/libtirpc/src/clnt_simple.c b/libtirpc/src/clnt_simple.c
  589. index ae4f320..ae1f2bb 100644
  590. --- a/libtirpc/src/clnt_simple.c
  591. +++ b/libtirpc/src/clnt_simple.c
  592. @@ -29,23 +29,31 @@
  593.   * Copyright (c) 1986-1991 by Sun Microsystems Inc.
  594.   */
  595.  
  596. -//#include <sys/cdefs.h>
  597. +#ifndef _WIN32
  598. +#include <sys/cdefs.h>
  599. +#endif /* !_WIN32 */
  600.  
  601.  /*
  602.   * clnt_simple.c
  603.   * Simplified front end to client rpc.
  604.   */
  605.  #include <wintirpc.h>
  606. -//#include <pthread.h>
  607. +#ifndef _WIN32
  608. +#include <pthread.h>
  609. +#endif /* !_WIN32 */
  610.  #include <reentrant.h>
  611. -//#include <sys/param.h>
  612. +#ifndef _WIN32
  613. +#include <sys/param.h>
  614. +#endif /* !_WIN32 */
  615.  #include <stdio.h>
  616.  #include <errno.h>
  617.  #include <rpc/rpc.h>
  618.  #include <string.h>
  619.  #include <stdlib.h>
  620.  #include <fcntl.h>
  621. -//#include <unistd.h>
  622. +#ifndef _WIN32
  623. +#include <unistd.h>
  624. +#endif /* !_WIN32 */
  625.  
  626.  #include <rpc/clnt.h>
  627.  
  628. diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
  629. index b72522c..b14382a 100644
  630. --- a/libtirpc/src/clnt_vc.c
  631. +++ b/libtirpc/src/clnt_vc.c
  632. @@ -69,27 +69,35 @@
  633.   */
  634.  
  635.  #include <wintirpc.h>
  636. -//#include <pthread.h>
  637. +#ifndef _WIN32
  638. +#include <pthread.h>
  639. +#endif /* !_WIN32 */
  640.  
  641.  #include <reentrant.h>
  642.  #include <sys/types.h>
  643. -//#include <sys/poll.h>
  644.  #ifndef _WIN32
  645. +#include <sys/poll.h>
  646.  #include <sys/syslog.h>
  647. -#endif
  648. -//#include <sys/un.h>
  649. -//#include <sys/uio.h>
  650. -//#include <sys/socket.h>
  651. -//#include <arpa/inet.h>
  652. +#include <sys/un.h>
  653. +#include <sys/uio.h>
  654. +#include <sys/socket.h>
  655. +#include <arpa/inet.h>
  656. +#endif /* !_WIN32 */
  657.  #include <assert.h>
  658. -//#include <err.h>
  659. +#ifndef _WIN32
  660. +#include <err.h>
  661. +#endif /* !_WIN32 */
  662.  #include <errno.h>
  663. -//#include <netdb.h>
  664. +#ifndef _WIN32
  665. +#include <netdb.h>
  666. +#endif /* !_WIN32 */
  667.  #include <stdio.h>
  668.  #include <stdlib.h>
  669.  #include <string.h>
  670. -//#include <unistd.h>
  671. -//#include <signal.h>
  672. +#ifndef _WIN32
  673. +#include <unistd.h>
  674. +#include <signal.h>
  675. +#endif /* !_WIN32 */
  676.  #include <time.h>
  677.  
  678.  #include <rpc/rpc.h>
  679. diff --git a/libtirpc/src/crypt_client.c b/libtirpc/src/crypt_client.c
  680. index 73fa320..3e057af 100644
  681. --- a/libtirpc/src/crypt_client.c
  682. +++ b/libtirpc/src/crypt_client.c
  683. @@ -30,10 +30,14 @@
  684.   * SUCH DAMAGE.
  685.   */
  686.  
  687. -//#include <sys/cdefs.h>
  688. +#ifndef _WIN32
  689. +#include <sys/cdefs.h>
  690. +#endif /* !_WIN32 */
  691.  
  692.  #include <wintirpc.h>
  693. -//#include <err.h>
  694. +#ifndef _WIN32
  695. +#include <err.h>
  696. +#endif /* !_WIN32 */
  697.  #include <sys/types.h>
  698.  #include <rpc/des_crypt.h>
  699.  #include <rpc/des.h>
  700. diff --git a/libtirpc/src/des_crypt.c b/libtirpc/src/des_crypt.c
  701. index 89f7266..88a88a4 100644
  702. --- a/libtirpc/src/des_crypt.c
  703. +++ b/libtirpc/src/des_crypt.c
  704. @@ -40,7 +40,9 @@
  705.  static char sccsid[] = "@(#)des_crypt.c        2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
  706.  #endif
  707.  #endif
  708. -//#include <sys/cdefs.h>
  709. +#ifndef _WIN32
  710. +#include <sys/cdefs.h>
  711. +#endif /* !_WIN32 */
  712.  
  713.  static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * );
  714.  int (*__des_crypt_LOCAL)() = 0;
  715. diff --git a/libtirpc/src/des_soft.c b/libtirpc/src/des_soft.c
  716. index 0e95334..39d0647 100644
  717. --- a/libtirpc/src/des_soft.c
  718. +++ b/libtirpc/src/des_soft.c
  719. @@ -1,4 +1,6 @@
  720. -//#include <sys/cdefs.h>
  721. +#ifndef _WIN32
  722. +#include <sys/cdefs.h>
  723. +#endif /* !_WIN32 */
  724.  
  725.  /*
  726.   * Copyright (c) 2009, Sun Microsystems, Inc.
  727. diff --git a/libtirpc/src/getnetconfig.c b/libtirpc/src/getnetconfig.c
  728. index 6e7eb42..fd5b08e 100644
  729. --- a/libtirpc/src/getnetconfig.c
  730. +++ b/libtirpc/src/getnetconfig.c
  731. @@ -31,9 +31,13 @@
  732.   */
  733.  
  734.  #include <wintirpc.h>
  735. -//#include <pthread.h>
  736. +#ifndef _WIN32
  737. +#include <pthread.h>
  738. +#endif /* !_WIN32 */
  739.  #include <reentrant.h>
  740. -//#include <sys/cdefs.h>
  741. +#ifndef _WIN32
  742. +#include <sys/cdefs.h>
  743. +#endif /* !_WIN32 */
  744.  #include <stdio.h>
  745.  #include <errno.h>
  746.  #include <netconfig.h>
  747. @@ -41,7 +45,9 @@
  748.  #include <stdlib.h>
  749.  #include <string.h>
  750.  #include <rpc/rpc.h>
  751. -//#include <unistd.h>
  752. +#ifndef _WIN32
  753. +#include <unistd.h>
  754. +#endif /* !_WIN32 */
  755.  #include "rpc_com.h"
  756.  
  757.  
  758. diff --git a/libtirpc/src/getnetpath.c b/libtirpc/src/getnetpath.c
  759. index a548fb6..47d5d3f 100644
  760. --- a/libtirpc/src/getnetpath.c
  761. +++ b/libtirpc/src/getnetpath.c
  762. @@ -25,13 +25,17 @@
  763.   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  764.   * POSSIBILITY OF SUCH DAMAGE.
  765.   */
  766. -//#include <sys/cdefs.h>
  767. +#ifndef _WIN32
  768. +#include <sys/cdefs.h>
  769. +#endif /* !_WIN32 */
  770.  
  771.  /*
  772.   * Copyright (c) 1989 by Sun Microsystems, Inc.
  773.   */
  774.  
  775. -//#include <sys/cdefs.h>
  776. +#ifndef _WIN32
  777. +#include <sys/cdefs.h>
  778. +#endif /* !_WIN32 */
  779.  #include <wintirpc.h>
  780.  #include <stdio.h>
  781.  #include <errno.h>
  782. @@ -40,7 +44,7 @@
  783.  #include <string.h>
  784.  #ifndef _WIN32
  785.  #include <syslog.h>
  786. -#endif
  787. +#endif /* !_WIN32 */
  788.  
  789.  /*
  790.   * internal structure to keep track of a netpath "session"
  791. diff --git a/libtirpc/src/getpeereid.c b/libtirpc/src/getpeereid.c
  792. index c328b9c..1b078be 100644
  793. --- a/libtirpc/src/getpeereid.c
  794. +++ b/libtirpc/src/getpeereid.c
  795. @@ -24,15 +24,21 @@
  796.   * SUCH DAMAGE.
  797.   */
  798.  
  799. -//#include <sys/cdefs.h>
  800. +#ifndef _WIN32
  801. +#include <sys/cdefs.h>
  802. +#endif /* !_WIN32 */
  803.  #include <wintirpc.h>
  804.  #include <rpc/types.h>
  805. -//#include <sys/param.h>
  806. -//#include <sys/socket.h>
  807. -//#include <sys/un.h>
  808. +#ifndef _WIN32
  809. +#include <sys/param.h>
  810. +#include <sys/socket.h>
  811. +#include <sys/un.h>
  812. +#endif /* !_WIN32 */
  813.  
  814.  #include <errno.h>
  815. -//#include <unistd.h>
  816. +#ifndef _WIN32
  817. +#include <unistd.h>
  818. +#endif /* !_WIN32 */
  819.  
  820.  #ifdef _WIN32
  821.  int
  822. diff --git a/libtirpc/src/getpublickey.c b/libtirpc/src/getpublickey.c
  823. index e0e555a..212a4cb 100644
  824. --- a/libtirpc/src/getpublickey.c
  825. +++ b/libtirpc/src/getpublickey.c
  826. @@ -40,7 +40,9 @@
  827.  #include <wintirpc.h>
  828.  #ifndef _WIN32
  829.  #include <stdio.h>
  830. -//#include <pwd.h>
  831. +#ifndef _WIN32
  832. +#include <pwd.h>
  833. +#endif /* !_WIN32 */
  834.  #include <rpc/rpc.h>
  835.  #include <rpc/key_prot.h>
  836.  #include <rpcsvc/yp_prot.h>
  837. diff --git a/libtirpc/src/getrpcent.c b/libtirpc/src/getrpcent.c
  838. index 56cdcea..c4d51a5 100644
  839. --- a/libtirpc/src/getrpcent.c
  840. +++ b/libtirpc/src/getrpcent.c
  841. @@ -33,11 +33,15 @@
  842.  #include <wintirpc.h>
  843.  #include <sys/types.h>
  844.  
  845. -//#include <netinet/in.h>
  846. -//#include <arpa/inet.h>
  847. +#ifndef _WIN32
  848. +#include <netinet/in.h>
  849. +#include <arpa/inet.h>
  850. +#endif /* !_WIN32 */
  851.  
  852.  #include <assert.h>
  853. -//#include <netdb.h>
  854. +#ifndef _WIN32
  855. +#include <netdb.h>
  856. +#endif /* !_WIN32 */
  857.  #include <stdio.h>
  858.  #include <stdlib.h>
  859.  #include <string.h>
  860. diff --git a/libtirpc/src/getrpcport.c b/libtirpc/src/getrpcport.c
  861. index 4c0d644..af524b5 100644
  862. --- a/libtirpc/src/getrpcport.c
  863. +++ b/libtirpc/src/getrpcport.c
  864. @@ -33,10 +33,14 @@
  865.  
  866.  #include <wintirpc.h>
  867.  #include <sys/types.h>
  868. -//#include <sys/socket.h>
  869. +#ifndef _WIN32
  870. +#include <sys/socket.h>
  871. +#endif /* !_WIN32 */
  872.  
  873.  #include <assert.h>
  874. -//#include <netdb.h>
  875. +#ifndef _WIN32
  876. +#include <netdb.h>
  877. +#endif /* !_WIN32 */
  878.  #include <stdio.h>
  879.  #include <string.h>
  880.  
  881. diff --git a/libtirpc/src/key_call.c b/libtirpc/src/key_call.c
  882. index 456196c..130971a 100644
  883. --- a/libtirpc/src/key_call.c
  884. +++ b/libtirpc/src/key_call.c
  885. @@ -30,7 +30,9 @@
  886.   */
  887.  
  888.  
  889. -//#include <sys/cdefs.h>
  890. +#ifndef _WIN32
  891. +#include <sys/cdefs.h>
  892. +#endif /* !_WIN32 */
  893.  
  894.  /*
  895.   * key_call.c, Interface to keyserver
  896. diff --git a/libtirpc/src/key_prot_xdr.c b/libtirpc/src/key_prot_xdr.c
  897. index 451fd67..08ac79b 100644
  898. --- a/libtirpc/src/key_prot_xdr.c
  899. +++ b/libtirpc/src/key_prot_xdr.c
  900. @@ -40,7 +40,7 @@
  901.   */
  902.  /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
  903.  
  904. -//#include <sys/cdefs.h>
  905. +#include <sys/cdefs.h>
  906.  
  907.  /*
  908.   * Compiled from key_prot.x using rpcgen.
  909. @@ -176,4 +176,4 @@ xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
  910.         }
  911.         return (TRUE);
  912.  }
  913. -#endif
  914. \ No newline at end of file
  915. +#endif /* !_WIN32 */
  916. \ No newline at end of file
  917. diff --git a/libtirpc/src/mt_misc.c b/libtirpc/src/mt_misc.c
  918. index 60038cf..46d0faf 100644
  919. --- a/libtirpc/src/mt_misc.c
  920. +++ b/libtirpc/src/mt_misc.c
  921. @@ -1,10 +1,14 @@
  922.  #include <wintirpc.h>
  923.  
  924. -//#include <sys/cdefs.h>
  925. -//#include <pthread.h>
  926. +#ifndef _WIN32
  927. +#include <sys/cdefs.h>
  928. +#include <pthread.h>
  929. +#endif /* !_WIN32 */
  930.  #include <reentrant.h>
  931.  #include <rpc/rpc.h>
  932. -//#include <sys/time.h>
  933. +#ifndef _WIN32
  934. +#include <sys/time.h>
  935. +#endif /* !_WIN32 */
  936.  #include <stdlib.h>
  937.  #include <string.h>
  938.  
  939. diff --git a/libtirpc/src/netname.c b/libtirpc/src/netname.c
  940. index cbf2396..7d183b0 100644
  941. --- a/libtirpc/src/netname.c
  942. +++ b/libtirpc/src/netname.c
  943. @@ -35,7 +35,9 @@
  944.   */
  945.  
  946.  #include <wintirpc.h>
  947. -//#include <sys/param.h>
  948. +#ifndef _WIN32
  949. +#include <sys/param.h>
  950. +#endif /* !_WIN32 */
  951.  #include <rpc/rpc.h>
  952.  #include "rpc_com.h"
  953.  #ifdef YP
  954. @@ -47,7 +49,9 @@
  955.  #include <stdio.h>
  956.  #include <stdlib.h>
  957.  #include <string.h>
  958. -//#include <unistd.h>
  959. +#ifndef _WIN32
  960. +#include <unistd.h>
  961. +#endif /* !_WIN32 */
  962.  
  963.  #ifndef MAXHOSTNAMELEN
  964.  #define MAXHOSTNAMELEN 256
  965. diff --git a/libtirpc/src/pmap_clnt.c b/libtirpc/src/pmap_clnt.c
  966. index e5ed30b..5b6c151 100644
  967. --- a/libtirpc/src/pmap_clnt.c
  968. +++ b/libtirpc/src/pmap_clnt.c
  969. @@ -26,7 +26,9 @@
  970.   * POSSIBILITY OF SUCH DAMAGE.
  971.   */
  972.  
  973. -//#include <sys/cdefs.h>
  974. +#ifndef _WIN32
  975. +#include <sys/cdefs.h>
  976. +#endif /* !_WIN32 */
  977.  
  978.  /*
  979.   * pmap_clnt.c
  980. @@ -38,13 +40,17 @@
  981.  #include <wintirpc.h>
  982.  #include <sys/types.h>
  983.  #include <sys/stat.h>
  984. -//#include <unistd.h>
  985. +#ifndef _WIN32
  986. +#include <unistd.h>
  987. +#endif /* !_WIN32 */
  988.  
  989.  #include <rpc/rpc.h>
  990.  #include <rpc/pmap_prot.h>
  991.  #include <rpc/pmap_clnt.h>
  992.  #include <rpc/nettype.h>
  993. -//#include <netinet/in.h>
  994. +#ifndef _WIN32
  995. +#include <netinet/in.h>
  996. +#endif /* !_WIN32 */
  997.  
  998.  #include <stdio.h>
  999.  #include <stdlib.h>
  1000. diff --git a/libtirpc/src/pmap_getmaps.c b/libtirpc/src/pmap_getmaps.c
  1001. index eb236d3..a2280a3 100644
  1002. --- a/libtirpc/src/pmap_getmaps.c
  1003. +++ b/libtirpc/src/pmap_getmaps.c
  1004. @@ -26,7 +26,9 @@
  1005.   * POSSIBILITY OF SUCH DAMAGE.
  1006.   */
  1007.  
  1008. -//#include <sys/cdefs.h>
  1009. +#ifndef _WIN32
  1010. +#include <sys/cdefs.h>
  1011. +#endif /* !_WIN32 */
  1012.  
  1013.  /*
  1014.   * pmap_getmap.c
  1015. @@ -38,22 +40,29 @@
  1016.  
  1017.  #include <wintirpc.h>
  1018.  #include <sys/types.h>
  1019. -//#include <sys/socket.h>
  1020. -//#include <sys/ioctl.h>
  1021. +#ifndef _WIN32
  1022. +#include <sys/socket.h>
  1023. +#include <sys/ioctl.h>
  1024.  
  1025. -//#include <arpa/inet.h>
  1026. -//#include <net/if.h>
  1027. +#include <arpa/inet.h>
  1028. +#include <net/if.h>
  1029. +#endif /* !_WIN32 */
  1030.  
  1031.  #include <assert.h>
  1032.  #include <errno.h>
  1033. -//#include <netdb.h>
  1034. +#ifndef _WIN32
  1035. +#endif /* !_WIN32 */
  1036.  #include <stdio.h>
  1037. -//#include <unistd.h>
  1038. +#ifndef _WIN32
  1039. +#include <unistd.h>
  1040. +#endif /* !_WIN32 */
  1041.  
  1042.  #include <rpc/rpc.h>
  1043.  #include <rpc/pmap_prot.h>
  1044.  #include <rpc/pmap_clnt.h>
  1045. -//#include <clnt_soc.h>
  1046. +#ifndef _WIN32
  1047. +#include <clnt_soc.h>
  1048. +#endif /* !_WIN32 */
  1049.  #define NAMELEN 255
  1050.  #define MAX_BROADCAST_SIZE 1400
  1051.  
  1052. diff --git a/libtirpc/src/pmap_getport.c b/libtirpc/src/pmap_getport.c
  1053. index 7ecd6e9..9839515 100644
  1054. --- a/libtirpc/src/pmap_getport.c
  1055. +++ b/libtirpc/src/pmap_getport.c
  1056. @@ -28,13 +28,17 @@
  1057.  
  1058.  #include <wintirpc.h>
  1059.  #include <sys/types.h>
  1060. -//#include <sys/socket.h>
  1061. +#ifndef _WIN32
  1062. +#include <sys/socket.h>
  1063.  
  1064. -//#include <arpa/inet.h>
  1065. -//#include <net/if.h>
  1066. +#include <arpa/inet.h>
  1067. +#include <net/if.h>
  1068. +#endif /* !_WIN32 */
  1069.  
  1070.  #include <assert.h>
  1071. -//#include <unistd.h>
  1072. +#ifndef _WIN32
  1073. +#include <unistd.h>
  1074. +#endif /* !_WIN32 */
  1075.  
  1076.  #include <rpc/rpc.h>
  1077.  #include <rpc/pmap_prot.h>
  1078. diff --git a/libtirpc/src/pmap_rmt.c b/libtirpc/src/pmap_rmt.c
  1079. index 61477cc..269e7dc 100644
  1080. --- a/libtirpc/src/pmap_rmt.c
  1081. +++ b/libtirpc/src/pmap_rmt.c
  1082. @@ -36,20 +36,26 @@
  1083.  
  1084.  #include <wintirpc.h>
  1085.  #include <sys/types.h>
  1086. -//#include <sys/ioctl.h>
  1087. -//#include <sys/poll.h>
  1088. -//#include <sys/socket.h>
  1089. +#ifndef _WIN32
  1090. +#include <sys/ioctl.h>
  1091. +#include <sys/poll.h>
  1092. +#include <sys/socket.h>
  1093.  
  1094. -//#include <net/if.h>
  1095. -//#include <netinet/in.h>
  1096. -//#include <arpa/inet.h>
  1097. +#include <net/if.h>
  1098. +#include <netinet/in.h>
  1099. +#include <arpa/inet.h>
  1100. +#endif /* !_WIN32 */
  1101.  
  1102.  #include <assert.h>
  1103. -//#include <err.h>
  1104. +#ifndef _WIN32
  1105. +#include <err.h>
  1106. +#endif /* !_WIN32 */
  1107.  #include <errno.h>
  1108.  #include <stdio.h>
  1109.  #include <string.h>
  1110. -//#include <unistd.h>
  1111. +#ifndef _WIN32
  1112. +#include <unistd.h>
  1113. +#endif /* !_WIN32 */
  1114.  
  1115.  #include <rpc/rpc.h>
  1116.  #include <rpc/pmap_prot.h>
  1117. @@ -57,7 +63,9 @@
  1118.  #include <rpc/pmap_rmt.h>
  1119.  
  1120.  // For the clnttcp_create function
  1121. -//#include <clnt_soc.h>
  1122. +#ifndef _WIN32
  1123. +#include <clnt_soc.h>
  1124. +#endif /* !_WIN32 */
  1125.  
  1126.  
  1127.  static const struct timeval timeout = { 3, 0 };
  1128. diff --git a/libtirpc/src/rpc_callmsg.c b/libtirpc/src/rpc_callmsg.c
  1129. index f18b606..b40c870 100644
  1130. --- a/libtirpc/src/rpc_callmsg.c
  1131. +++ b/libtirpc/src/rpc_callmsg.c
  1132. @@ -41,7 +41,9 @@
  1133.  #include <rpc/rpc.h>
  1134.  #include <rpc/xdr.h>
  1135.  
  1136. -//#include <sys/select.h>
  1137. +#ifndef _WIN32
  1138. +#include <sys/select.h>
  1139. +#endif /* !_WIN32 */
  1140.  
  1141.  /*
  1142.   * XDR a call message
  1143. diff --git a/libtirpc/src/rpc_com.h b/libtirpc/src/rpc_com.h
  1144. index ff9db44..28bb986 100644
  1145. --- a/libtirpc/src/rpc_com.h
  1146. +++ b/libtirpc/src/rpc_com.h
  1147. @@ -40,7 +40,9 @@
  1148.  #ifndef _TIRPC_RPCCOM_H
  1149.  #define        _TIRPC_RPCCOM_H
  1150.  
  1151. -//#include <sys/cdefs.h>
  1152. +#ifndef _WIN32
  1153. +#include <sys/cdefs.h>
  1154. +#endif /* !_WIN32 */
  1155.  
  1156.  /* #pragma ident       "@(#)rpc_com.h  1.11    93/07/05 SMI" */
  1157.  
  1158. diff --git a/libtirpc/src/rpc_dtablesize.c b/libtirpc/src/rpc_dtablesize.c
  1159. index 0541f58..48f05a5 100644
  1160. --- a/libtirpc/src/rpc_dtablesize.c
  1161. +++ b/libtirpc/src/rpc_dtablesize.c
  1162. @@ -27,9 +27,11 @@
  1163.   */
  1164.  
  1165.  #include <wintirpc.h>
  1166. -//#include <unistd.h>
  1167. +#ifndef _WIN32
  1168. +#include <unistd.h>
  1169.  
  1170. -//#include <sys/select.h>
  1171. +#include <sys/select.h>
  1172. +#endif /* !_WIN32 */
  1173.  
  1174.  int _rpc_dtablesize(void);     /* XXX */
  1175.  
  1176. diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
  1177. index 75a5a15..23ac77f 100644
  1178. --- a/libtirpc/src/rpc_generic.c
  1179. +++ b/libtirpc/src/rpc_generic.c
  1180. @@ -29,28 +29,38 @@
  1181.   * Copyright (c) 1986-1991 by Sun Microsystems Inc.
  1182.   */
  1183.  
  1184. -//#include <sys/cdefs.h>
  1185. +#ifndef _WIN32
  1186. +#include <sys/cdefs.h>
  1187. +#endif /* !_WIN32 */
  1188.  
  1189.  /*
  1190.   * rpc_generic.c, Miscl routines for RPC.
  1191.   *
  1192.   */
  1193.  #include <wintirpc.h>
  1194. -//#include <pthread.h>
  1195. +#ifndef _WIN32
  1196. +#include <pthread.h>
  1197. +#endif /* !_WIN32 */
  1198.  #include <reentrant.h>
  1199.  #include <sys/types.h>
  1200. -//#include <sys/param.h>
  1201. -//#include <sys/socket.h>
  1202. -//#include <sys/time.h>
  1203. -//#include <sys/un.h>
  1204. -//#include <sys/resource.h>
  1205. -//#include <netinet/in.h>
  1206. -//#include <arpa/inet.h>
  1207. +#ifndef _WIN32
  1208. +#include <sys/param.h>
  1209. +#include <sys/socket.h>
  1210. +#include <sys/time.h>
  1211. +#include <sys/un.h>
  1212. +#include <sys/resource.h>
  1213. +#include <netinet/in.h>
  1214. +#include <arpa/inet.h>
  1215. +#endif /* !_WIN32 */
  1216.  #include <rpc/rpc.h>
  1217. -//#include <ctype.h>
  1218. -//#include <stddef.h>
  1219. +#ifndef _WIN32
  1220. +#include <ctype.h>
  1221. +#include <stddef.h>
  1222. +#endif /* !_WIN32 */
  1223.  #include <stdio.h>
  1224. -//#include <netdb.h>
  1225. +#ifndef _WIN32
  1226. +#include <netdb.h>
  1227. +#endif /* !_WIN32 */
  1228.  #include <netconfig.h>
  1229.  #include <stdlib.h>
  1230.  #include <string.h>
  1231. diff --git a/libtirpc/src/rpc_prot.c b/libtirpc/src/rpc_prot.c
  1232. index 2605614..e5bdcf6 100644
  1233. --- a/libtirpc/src/rpc_prot.c
  1234. +++ b/libtirpc/src/rpc_prot.c
  1235. @@ -63,7 +63,9 @@
  1236.   */
  1237.  
  1238.  #include <wintirpc.h>
  1239. -//#include <sys/param.h>
  1240. +#ifndef _WIN32
  1241. +#include <sys/param.h>
  1242. +#endif /* !_WIN32 */
  1243.  
  1244.  #include <assert.h>
  1245.  
  1246. diff --git a/libtirpc/src/rpc_soc.c b/libtirpc/src/rpc_soc.c
  1247. index 2eaca7e..98b0118 100644
  1248. --- a/libtirpc/src/rpc_soc.c
  1249. +++ b/libtirpc/src/rpc_soc.c
  1250. @@ -44,10 +44,14 @@
  1251.   * of TLI/Streams
  1252.   */
  1253.  #include <wintirpc.h>
  1254. -//#include <pthread.h>
  1255. +#ifndef _WIN32
  1256. +#include <pthread.h>
  1257. +#endif /* !_WIN32 */
  1258.  #include <reentrant.h>
  1259.  #include <sys/types.h>
  1260. -//#include <sys/socket.h>
  1261. +#ifndef _WIN32
  1262. +#include <sys/socket.h>
  1263. +#endif /* !_WIN32 */
  1264.  #include <stdio.h>
  1265.  #include <rpc/rpc.h>
  1266.  #include <rpc/pmap_clnt.h>
  1267. @@ -56,12 +60,16 @@
  1268.  #ifndef _WIN32
  1269.  #include <syslog.h>
  1270.  #endif
  1271. -//#include <netinet/in.h>
  1272. -//#include <netdb.h>
  1273. +#ifndef _WIN32
  1274. +#include <netinet/in.h>
  1275. +#include <netdb.h>
  1276. +#endif /* !_WIN32 */
  1277.  #include <errno.h>
  1278.  #include <stdlib.h>
  1279.  #include <string.h>
  1280. -//#include <unistd.h>
  1281. +#ifndef _WIN32
  1282. +#include <unistd.h>
  1283. +#endif /* !_WIN32 */
  1284.  
  1285.  #include "rpc_com.h"
  1286.  
  1287. diff --git a/libtirpc/src/rpcb_clnt.c b/libtirpc/src/rpcb_clnt.c
  1288. index 6ab9055..a168f67 100644
  1289. --- a/libtirpc/src/rpcb_clnt.c
  1290. +++ b/libtirpc/src/rpcb_clnt.c
  1291. @@ -36,29 +36,35 @@
  1292.   * Copyright (C) 1988, Sun Microsystems, Inc.
  1293.   */
  1294.  #include <wintirpc.h>
  1295. -//#include <pthread.h>
  1296. +#ifndef _WIN32
  1297. +#include <pthread.h>
  1298. +#endif /* !_WIN32 */
  1299.  #include <reentrant.h>
  1300.  #include <sys/types.h>
  1301. -//#include <sys/socket.h>
  1302. -//#include <sys/un.h>
  1303. -//#include <sys/utsname.h>
  1304. +#ifndef _WIN32
  1305. +#include <sys/socket.h>
  1306. +#include <sys/un.h>
  1307. +#include <sys/utsname.h>
  1308. +#endif /* !_WIN32 */
  1309.  #include <rpc/rpc.h>
  1310.  #include <rpc/rpcb_prot.h>
  1311.  #include <rpc/nettype.h>
  1312.  #include <netconfig.h>
  1313.  #ifdef PORTMAP
  1314. -//#include <netinet/in.h>              /* FOR IPPROTO_TCP/UDP definitions */
  1315. +#ifndef _WIN32
  1316. +#include <netinet/in.h>                /* FOR IPPROTO_TCP/UDP definitions */
  1317. +#endif /* !_WIN32 */
  1318.  #include <rpc/pmap_prot.h>
  1319.  #endif                         /* PORTMAP */
  1320.  #include <stdio.h>
  1321.  #include <errno.h>
  1322.  #include <stdlib.h>
  1323.  #include <string.h>
  1324. -//#include <unistd.h>
  1325. -//#include <netdb.h>
  1326.  #ifndef _WIN32
  1327. +#include <unistd.h>
  1328. +#include <netdb.h>
  1329.  #include <syslog.h>
  1330. -#endif
  1331. +#endif /* !_WIN32 */
  1332.  
  1333.  #include "rpc_com.h"
  1334.  
  1335. diff --git a/libtirpc/src/rpcb_prot.c b/libtirpc/src/rpcb_prot.c
  1336. index c789b2f..6b8d38b 100644
  1337. --- a/libtirpc/src/rpcb_prot.c
  1338. +++ b/libtirpc/src/rpcb_prot.c
  1339. @@ -44,7 +44,7 @@
  1340.  #include <rpc/rpcb_prot.h>
  1341.  #ifdef _WIN32 // CVE-2017-8779
  1342.  #include "rpc_com.h"
  1343. -#endif
  1344. +#endif /* _WIN32 */
  1345.  
  1346.  bool_t
  1347.  xdr_rpcb(
  1348. diff --git a/libtirpc/src/rpcb_st_xdr.c b/libtirpc/src/rpcb_st_xdr.c
  1349. index e5a431c..adca935 100644
  1350. --- a/libtirpc/src/rpcb_st_xdr.c
  1351. +++ b/libtirpc/src/rpcb_st_xdr.c
  1352. @@ -35,13 +35,15 @@
  1353.   * routines used with the rpcbind stats facility.
  1354.   */
  1355.  
  1356. -//#include <sys/cdefs.h>
  1357. +#ifndef _WIN32
  1358. +#include <sys/cdefs.h>
  1359. +#endif /* !_WIN32 */
  1360.  
  1361.  #include <wintirpc.h>
  1362.  #include <rpc/rpc.h>
  1363.  #ifdef _WIN32 // CVE-2017-8779
  1364.  #include "rpc_com.h"
  1365. -#endif
  1366. +#endif /* _WIN32 */
  1367.  
  1368.  /* Link list of all the stats about getport and getaddr */
  1369.  
  1370. diff --git a/libtirpc/src/rpcdname.c b/libtirpc/src/rpcdname.c
  1371. index 37617c5..bf5440d 100644
  1372. --- a/libtirpc/src/rpcdname.c
  1373. +++ b/libtirpc/src/rpcdname.c
  1374. @@ -25,7 +25,9 @@
  1375.   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  1376.   * POSSIBILITY OF SUCH DAMAGE.
  1377.   */
  1378. -//#include <sys/cdefs.h>
  1379. +#ifndef _WIN32
  1380. +#include <sys/cdefs.h>
  1381. +#endif /* !_WIN32 */
  1382.  
  1383.  /*
  1384.   * rpcdname.c
  1385. @@ -34,7 +36,9 @@
  1386.  
  1387.  #include <wintirpc.h>
  1388.  #include <stdlib.h>
  1389. -//#include <unistd.h>
  1390. +#ifndef _WIN32
  1391. +#include <unistd.h>
  1392. +#endif /* !_WIN32 */
  1393.  #include <string.h>
  1394.  
  1395.  static char *default_domain = NULL;
  1396. diff --git a/libtirpc/src/rtime.c b/libtirpc/src/rtime.c
  1397. index 4a6ac15..7894361 100644
  1398. --- a/libtirpc/src/rtime.c
  1399. +++ b/libtirpc/src/rtime.c
  1400. @@ -41,18 +41,26 @@
  1401.   * what unix uses.
  1402.   */
  1403.  #include <wintirpc.h>
  1404. -//#include <pthread.h>
  1405. +#ifndef _WIN32
  1406. +#include <pthread.h>
  1407. +#endif /* !_WIN32 */
  1408.  #include <stdlib.h>
  1409.  #include <string.h>
  1410. -//#include <unistd.h>
  1411. +#ifndef _WIN32
  1412. +#include <unistd.h>
  1413. +#endif /* !_WIN32 */
  1414.  #include <errno.h>
  1415.  #include <sys/types.h>
  1416. -//#include <sys/socket.h>
  1417. -//#include <sys/time.h>
  1418. -//#include <netinet/in.h>
  1419. +#ifndef _WIN32
  1420. +#include <sys/socket.h>
  1421. +#include <sys/time.h>
  1422. +#include <netinet/in.h>
  1423. +#endif /* !_WIN32 */
  1424.  #include <stdio.h>
  1425. -//#include <netdb.h>
  1426. -//#include <sys/select.h>
  1427. +#ifndef _WIN32
  1428. +#include <netdb.h>
  1429. +#include <sys/select.h>
  1430. +#endif /* !_WIN32 */
  1431.  
  1432.  extern int _rpc_dtablesize( void );
  1433.  
  1434. diff --git a/libtirpc/src/svc.c b/libtirpc/src/svc.c
  1435. index e2fa30a..8c5a210 100644
  1436. --- a/libtirpc/src/svc.c
  1437. +++ b/libtirpc/src/svc.c
  1438. @@ -37,11 +37,15 @@
  1439.   * Copyright (C) 1984, Sun Microsystems, Inc.
  1440.   */
  1441.  #include <wintirpc.h>
  1442. -//#include <pthread.h>
  1443. +#ifndef _WIN32
  1444. +#include <pthread.h>
  1445. +#endif /* !_WIN32 */
  1446.  
  1447.  #include <reentrant.h>
  1448.  #include <sys/types.h>
  1449. -//#include <sys/poll.h>
  1450. +#ifndef _WIN32
  1451. +#include <sys/poll.h>
  1452. +#endif /* !_WIN32 */
  1453.  #include <assert.h>
  1454.  #include <errno.h>
  1455.  #include <stdlib.h>
  1456. diff --git a/libtirpc/src/svc_auth.c b/libtirpc/src/svc_auth.c
  1457. index 0651b3e..b6e9f68 100644
  1458. --- a/libtirpc/src/svc_auth.c
  1459. +++ b/libtirpc/src/svc_auth.c
  1460. @@ -35,7 +35,9 @@
  1461.   *
  1462.   */
  1463.  #include <wintirpc.h>
  1464. -//#include <pthread.h>
  1465. +#ifndef _WIN32
  1466. +#include <pthread.h>
  1467. +#endif /* !_WIN32 */
  1468.  #include <reentrant.h>
  1469.  #include <sys/types.h>
  1470.  #include <rpc/rpc.h>
  1471. diff --git a/libtirpc/src/svc_auth_des.c b/libtirpc/src/svc_auth_des.c
  1472. index 75736a6..73fb004 100644
  1473. --- a/libtirpc/src/svc_auth_des.c
  1474. +++ b/libtirpc/src/svc_auth_des.c
  1475. @@ -45,15 +45,21 @@
  1476.   *
  1477.   */
  1478.  #include <wintirpc.h>
  1479. -//#include <pthread.h>
  1480. +#ifndef _WIN32
  1481. +#include <pthread.h>
  1482. +#endif /* !_WIN32 */
  1483.  #include <reentrant.h>
  1484.  #include <string.h>
  1485.  #include <stdlib.h>
  1486.  #include <stdio.h>
  1487. -//#include <unistd.h>
  1488. +#ifndef _WIN32
  1489. +#include <unistd.h>
  1490. +#endif /* !_WIN32 */
  1491.  #include <rpc/des_crypt.h>
  1492. -//#include <sys/param.h>
  1493. -//#include <netinet/in.h>
  1494. +#ifndef _WIN32
  1495. +#include <sys/param.h>
  1496. +#include <netinet/in.h>
  1497. +#endif /* !_WIN32 */
  1498.  #include <rpc/types.h>
  1499.  #include <rpc/xdr.h>
  1500.  #include <rpc/auth.h>
  1501. diff --git a/libtirpc/src/svc_auth_unix.c b/libtirpc/src/svc_auth_unix.c
  1502. index 90c59bd..27598e6 100644
  1503. --- a/libtirpc/src/svc_auth_unix.c
  1504. +++ b/libtirpc/src/svc_auth_unix.c
  1505. @@ -37,7 +37,9 @@
  1506.   * Copyright (C) 1984, Sun Microsystems, Inc.
  1507.   */
  1508.  #include <wintirpc.h>
  1509. -//#include <pthread.h>
  1510. +#ifndef _WIN32
  1511. +#include <pthread.h>
  1512. +#endif /* !_WIN32 */
  1513.  #include <assert.h>
  1514.  #include <stdio.h>
  1515.  #include <string.h>
  1516. diff --git a/libtirpc/src/svc_dg.c b/libtirpc/src/svc_dg.c
  1517. index d07d569..d172dfd 100644
  1518. --- a/libtirpc/src/svc_dg.c
  1519. +++ b/libtirpc/src/svc_dg.c
  1520. @@ -31,7 +31,9 @@
  1521.   * Copyright (c) 1986-1991 by Sun Microsystems Inc.
  1522.   */
  1523.  
  1524. -//#include <sys/cdefs.h>
  1525. +#ifndef _WIN32
  1526. +#include <sys/cdefs.h>
  1527. +#endif /* !_WIN32 */
  1528.  
  1529.  /*
  1530.   * svc_dg.c, Server side for connectionless RPC.
  1531. @@ -39,14 +41,20 @@
  1532.   * Does some caching in the hopes of achieving execute-at-most-once semantics.
  1533.   */
  1534.  #include <wintirpc.h>
  1535. -//#include <pthread.h>
  1536. +#ifndef _WIN32
  1537. +#include <pthread.h>
  1538. +#endif /* !_WIN32 */
  1539.  #include <reentrant.h>
  1540.  #include <sys/types.h>
  1541. -//#include <sys/socket.h>
  1542. +#ifndef _WIN32
  1543. +#include <sys/socket.h>
  1544. +#endif /* !_WIN32 */
  1545.  #include <rpc/rpc.h>
  1546.  #include <rpc/svc_dg.h>
  1547.  #include <errno.h>
  1548. -//#include <unistd.h>
  1549. +#ifndef _WIN32
  1550. +#include <unistd.h>
  1551. +#endif /* !_WIN32 */
  1552.  #include <stdio.h>
  1553.  #include <stdlib.h>
  1554.  #include <string.h>
  1555. @@ -54,7 +62,9 @@
  1556.  #include <netconfig.h>
  1557.  #include <netdir.h>
  1558.  #endif
  1559. -//#include <err.h>
  1560. +#ifndef _WIN32
  1561. +#include <err.h>
  1562. +#endif /* !_WIN32 */
  1563.  
  1564.  #include "rpc_com.h"
  1565.  
  1566. diff --git a/libtirpc/src/svc_generic.c b/libtirpc/src/svc_generic.c
  1567. index 762123b..5a0e65e 100644
  1568. --- a/libtirpc/src/svc_generic.c
  1569. +++ b/libtirpc/src/svc_generic.c
  1570. @@ -36,19 +36,25 @@
  1571.   *
  1572.   */
  1573.  #include <wintirpc.h>
  1574. -//#include <pthread.h>
  1575. +#ifndef _WIN32
  1576. +#include <pthread.h>
  1577. +#endif /* !_WIN32 */
  1578.  #include <reentrant.h>
  1579.  #include <sys/types.h>
  1580. -//#include <sys/socket.h>
  1581. -//#include <netinet/in.h>
  1582. +#ifndef _WIN32
  1583. +#include <sys/socket.h>
  1584. +#include <netinet/in.h>
  1585. +#endif /* !_WIN32 */
  1586.  #include <rpc/rpc.h>
  1587.  #include <rpc/nettype.h>
  1588.  #include <stdio.h>
  1589.  #include <errno.h>
  1590.  #include <stdlib.h>
  1591.  #include <string.h>
  1592. -//#include <unistd.h>
  1593. -//#include <err.h>
  1594. +#ifndef _WIN32
  1595. +#include <unistd.h>
  1596. +#include <err.h>
  1597. +#endif /* !_WIN32 */
  1598.  
  1599.  #include "rpc_com.h"
  1600.  #include <rpc/svc.h>
  1601. diff --git a/libtirpc/src/svc_raw.c b/libtirpc/src/svc_raw.c
  1602. index 55e29ac..d3e2e97 100644
  1603. --- a/libtirpc/src/svc_raw.c
  1604. +++ b/libtirpc/src/svc_raw.c
  1605. @@ -38,7 +38,9 @@
  1606.   *
  1607.   */
  1608.  #include <wintirpc.h>
  1609. -//#include <pthread.h>
  1610. +#ifndef _WIN32
  1611. +#include <pthread.h>
  1612. +#endif /* !_WIN32 */
  1613.  #include <reentrant.h>
  1614.  #include <rpc/rpc.h>
  1615.  #include <sys/types.h>
  1616. diff --git a/libtirpc/src/svc_run.c b/libtirpc/src/svc_run.c
  1617. index a525a35..bfab92e 100644
  1618. --- a/libtirpc/src/svc_run.c
  1619. +++ b/libtirpc/src/svc_run.c
  1620. @@ -31,18 +31,26 @@
  1621.   * Wait for input, call server program.
  1622.   */
  1623.  #include <wintirpc.h>
  1624. -//#include <pthread.h>
  1625. +#ifndef _WIN32
  1626. +#include <pthread.h>
  1627. +#endif /* !_WIN32 */
  1628.  #include <reentrant.h>
  1629. -//#include <err.h>
  1630. +#ifndef _WIN32
  1631. +#include <err.h>
  1632. +#endif /* !_WIN32 */
  1633.  #include <errno.h>
  1634.  #include <rpc/rpc.h>
  1635.  #include <stdio.h>
  1636.  #include <string.h>
  1637. -//#include <unistd.h>
  1638. +#ifndef _WIN32
  1639. +#include <unistd.h>
  1640. +#endif /* !_WIN32 */
  1641.  
  1642.  #include <rpc/rpc.h>
  1643.  #include "rpc_com.h"
  1644. -//#include <sys/select.h>
  1645. +#ifndef _WIN32
  1646. +#include <sys/select.h>
  1647. +#endif /* !_WIN32 */
  1648.  
  1649.  void
  1650.  svc_run()
  1651. diff --git a/libtirpc/src/svc_simple.c b/libtirpc/src/svc_simple.c
  1652. index 925089c..f4bc47a 100644
  1653. --- a/libtirpc/src/svc_simple.c
  1654. +++ b/libtirpc/src/svc_simple.c
  1655. @@ -29,7 +29,9 @@
  1656.   * Copyright (c) 1986-1991 by Sun Microsystems Inc.
  1657.   */
  1658.  
  1659. -//#include <sys/cdefs.h>
  1660. +#ifndef _WIN32
  1661. +#include <sys/cdefs.h>
  1662. +#endif /* !_WIN32 */
  1663.  
  1664.  /*
  1665.   * svc_simple.c
  1666. @@ -43,7 +45,9 @@
  1667.   * for the given prognum and procnum.
  1668.   */
  1669.  #include <wintirpc.h>
  1670. -//#include <pthread.h>
  1671. +#ifndef _WIN32
  1672. +#include <pthread.h>
  1673. +#endif /* !_WIN32 */
  1674.  #include <reentrant.h>
  1675.  #include <sys/types.h>
  1676.  #include <rpc/rpc.h>
  1677. @@ -51,7 +55,10 @@
  1678.  #include <stdio.h>
  1679.  #include <stdlib.h>
  1680.  #include <string.h>
  1681. -//#include <err.h>
  1682. +#include <wintirpc.h>
  1683. +#ifndef _WIN32
  1684. +#include <err.h>
  1685. +#endif /* !_WIN32 */
  1686.  
  1687.  #include "rpc_com.h"
  1688.  
  1689. diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
  1690. index 05640e7..e6e8355 100644
  1691. --- a/libtirpc/src/svc_vc.c
  1692. +++ b/libtirpc/src/svc_vc.c
  1693. @@ -27,7 +27,9 @@
  1694.   * POSSIBILITY OF SUCH DAMAGE.
  1695.   */
  1696.  
  1697. -//#include <sys/cdefs.h>
  1698. +#ifndef _WIN32
  1699. +#include <sys/cdefs.h>
  1700. +#endif /* !_WIN32 */
  1701.  
  1702.  /*
  1703.   * svc_vc.c, Server side for Connection Oriented based RPC.
  1704. @@ -37,17 +39,23 @@
  1705.   * and a record/tcp stream.
  1706.   */
  1707.  #include <wintirpc.h>
  1708. -//#include <pthread.h>
  1709. +#ifndef _WIN32
  1710. +#include <pthread.h>
  1711. +#endif /* !_WIN32 */
  1712.  #include <reentrant.h>
  1713. -//#include <sys/socket.h>
  1714. +#ifndef _WIN32
  1715. +#include <sys/socket.h>
  1716. +#endif /* !_WIN32 */
  1717.  #include <sys/types.h>
  1718. -//#include <sys/param.h>
  1719. -//#include <sys/poll.h>
  1720. -//#include <sys/un.h>
  1721. -//#include <sys/time.h>
  1722. -//#include <sys/uio.h>
  1723. -//#include <netinet/in.h>
  1724. -//#include <netinet/tcp.h>
  1725. +#ifndef _WIN32
  1726. +#include <sys/param.h>
  1727. +#include <sys/poll.h>
  1728. +#include <sys/un.h>
  1729. +#include <sys/time.h>
  1730. +#include <sys/uio.h>
  1731. +#include <netinet/in.h>
  1732. +#include <netinet/tcp.h>
  1733. +#endif /* !_WIN32 */
  1734.  
  1735.  #ifndef _WIN32
  1736.  #include <assert.h>
  1737. @@ -58,7 +66,9 @@
  1738.  #include <stdio.h>
  1739.  #include <stdlib.h>
  1740.  #include <string.h>
  1741. -//#include <unistd.h>
  1742. +#ifndef _WIN32
  1743. +#include <unistd.h>
  1744. +#endif /* !_WIN32 */
  1745.  
  1746.  #include <rpc/rpc.h>
  1747.  
  1748. diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
  1749. index d9f4d4c..81acb3c 100644
  1750. --- a/libtirpc/src/wintirpc.c
  1751. +++ b/libtirpc/src/wintirpc.c
  1752. @@ -1,5 +1,6 @@
  1753.  /* NFSv4.1 client for Windows
  1754. - * Copyright (C) 2012 The Regents of the University of Michigan
  1755. + * Copyright (C) 2012 The Regents of the University of Michigan
  1756. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  1757.   *
  1758.   * Olga Kornievskaia <aglo@umich.edu>
  1759.   * Casey Bodley <cbodley@umich.edu>
  1760. diff --git a/libtirpc/src/xdr.c b/libtirpc/src/xdr.c
  1761. index 51e58ac..464ff71 100644
  1762. --- a/libtirpc/src/xdr.c
  1763. +++ b/libtirpc/src/xdr.c
  1764. @@ -38,7 +38,9 @@
  1765.   */
  1766.  
  1767.  #include <wintirpc.h>
  1768. -//#include <err.h>
  1769. +#ifndef _WIN32
  1770. +#include <err.h>
  1771. +#endif /* !_WIN32 */
  1772.  #include <stdio.h>
  1773.  #include <stdlib.h>
  1774.  #include <string.h>
  1775. diff --git a/libtirpc/src/xdr_array.c b/libtirpc/src/xdr_array.c
  1776. index 0f68b9d..b78be10 100644
  1777. --- a/libtirpc/src/xdr_array.c
  1778. +++ b/libtirpc/src/xdr_array.c
  1779. @@ -27,7 +27,9 @@
  1780.   * POSSIBILITY OF SUCH DAMAGE.
  1781.   */
  1782.  
  1783. -//#include <sys/cdefs.h>
  1784. +#ifndef _WIN32
  1785. +#include <sys/cdefs.h>
  1786. +#endif /* !_WIN32 */
  1787.  
  1788.  /*
  1789.   * xdr_array.c, Generic XDR routines impelmentation.
  1790. @@ -40,8 +42,10 @@
  1791.  
  1792.  #include <wintirpc.h>
  1793.  #include "namespace.h"
  1794. -//#include <err.h>
  1795. -//#include <limits.h>
  1796. +#ifndef _WIN32
  1797. +#include <err.h>
  1798. +#include <limits.h>
  1799. +#endif /* !_WIN32 */
  1800.  #include <stdio.h>
  1801.  #include <stdlib.h>
  1802.  #include <string.h>
  1803. diff --git a/libtirpc/src/xdr_float.c b/libtirpc/src/xdr_float.c
  1804. index 095236e..6410b22 100644
  1805. --- a/libtirpc/src/xdr_float.c
  1806. +++ b/libtirpc/src/xdr_float.c
  1807. @@ -27,7 +27,9 @@
  1808.   * POSSIBILITY OF SUCH DAMAGE.
  1809.   */
  1810.  
  1811. -//#include <sys/cdefs.h>
  1812. +#ifndef _WIN32
  1813. +#include <sys/cdefs.h>
  1814. +#endif /* !_WIN32 */
  1815.  
  1816.  /*
  1817.   * xdr_float.c, Generic XDR routines implementation.
  1818. @@ -42,7 +44,9 @@
  1819.  #include <wintirpc.h>
  1820.  #include "namespace.h"
  1821.  #include <sys/types.h>
  1822. -//#include <sys/param.h>
  1823. +#ifndef _WIN32
  1824. +#include <sys/param.h>
  1825. +#endif /* !_WIN32 */
  1826.  
  1827.  #include <stdio.h>
  1828.  
  1829. diff --git a/libtirpc/src/xdr_mem.c b/libtirpc/src/xdr_mem.c
  1830. index 59a2ac0..4553c41 100644
  1831. --- a/libtirpc/src/xdr_mem.c
  1832. +++ b/libtirpc/src/xdr_mem.c
  1833. @@ -26,7 +26,9 @@
  1834.   * POSSIBILITY OF SUCH DAMAGE.
  1835.   */
  1836.  
  1837. -//#include <sys/cdefs.h>
  1838. +#ifndef _WIN32
  1839. +#include <sys/cdefs.h>
  1840. +#endif /* !_WIN32 */
  1841.  
  1842.  /*
  1843.   * xdr_mem.h, XDR implementation using memory buffers.
  1844. @@ -43,7 +45,9 @@
  1845.  #include "namespace.h"
  1846.  #include <sys/types.h>
  1847.  
  1848. -//#include <netinet/in.h>
  1849. +#ifndef _WIN32
  1850. +#include <netinet/in.h>
  1851. +#endif /* !_WIN32 */
  1852.  
  1853.  #include <string.h>
  1854.  
  1855. diff --git a/libtirpc/src/xdr_rec.c b/libtirpc/src/xdr_rec.c
  1856. index 5fe0cfc..16ee72a 100644
  1857. --- a/libtirpc/src/xdr_rec.c
  1858. +++ b/libtirpc/src/xdr_rec.c
  1859. @@ -26,8 +26,10 @@
  1860.   * POSSIBILITY OF SUCH DAMAGE.
  1861.   */
  1862.  
  1863. -//#include <sys/cdefs.h>
  1864. -//#include <sys/cdefs.h>
  1865. +#ifndef _WIN32
  1866. +#include <sys/cdefs.h>
  1867. +#include <sys/cdefs.h>
  1868. +#endif /* !_WIN32 */
  1869.  
  1870.  /*
  1871.   * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
  1872. @@ -47,10 +49,12 @@
  1873.   */
  1874.  
  1875.  /* NFSv4.1 client for Windows
  1876. - * Copyright (C) 2012 The Regents of the University of Michigan
  1877. + * Copyright (C) 2012 The Regents of the University of Michigan
  1878. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  1879.   *
  1880.   * Olga Kornievskaia <aglo@umich.edu>
  1881.   * Casey Bodley <cbodley@umich.edu>
  1882. + * Roland Mainz <roland.mainz@nrubsig.org>
  1883.   *
  1884.   * This library is free software; you can redistribute it and/or modify it
  1885.   * under the terms of the GNU Lesser General Public License as published by
  1886. @@ -71,9 +75,13 @@
  1887.  #include <io.h>
  1888.  #include <sys/types.h>
  1889.  
  1890. -//#include <netinet/in.h>
  1891. +#ifndef _WIN32
  1892. +#include <netinet/in.h>
  1893. +#endif /* !_WIN32 */
  1894.  
  1895. -//#include <err.h>
  1896. +#ifndef _WIN32
  1897. +#include <err.h>
  1898. +#endif /* !_WIN32 */
  1899.  #include <stdio.h>
  1900.  #include <stdlib.h>
  1901.  #include <string.h>
  1902. @@ -86,7 +94,9 @@
  1903.  #include <rpc/clnt.h>
  1904.  #include <stddef.h>
  1905.  #include "rpc_com.h"
  1906. -//#include <unistd.h>
  1907. +#ifndef _WIN32
  1908. +#include <unistd.h>
  1909. +#endif /* !_WIN32 */
  1910.  static bool_t  xdrrec_getlong(XDR *, long *);
  1911.  static bool_t  xdrrec_putlong(XDR *, const long *);
  1912.  static bool_t  xdrrec_getbytes(XDR *, char *, u_int);
  1913. diff --git a/libtirpc/src/xdr_reference.c b/libtirpc/src/xdr_reference.c
  1914. index 601a27a..00dd283 100644
  1915. --- a/libtirpc/src/xdr_reference.c
  1916. +++ b/libtirpc/src/xdr_reference.c
  1917. @@ -26,8 +26,10 @@
  1918.   * POSSIBILITY OF SUCH DAMAGE.
  1919.   */
  1920.  
  1921. -//#include <sys/cdefs.h>
  1922. -//#include <sys/cdefs.h>
  1923. +#ifndef _WIN32
  1924. +#include <sys/cdefs.h>
  1925. +#include <sys/cdefs.h>
  1926. +#endif /* !_WIN32 */
  1927.  
  1928.  /*
  1929.   * xdr_reference.c, Generic XDR routines impelmentation.
  1930. @@ -40,7 +42,9 @@
  1931.  
  1932.  #include <wintirpc.h>
  1933.  #include "namespace.h"
  1934. -//#include <err.h>
  1935. +#ifndef _WIN32
  1936. +#include <err.h>
  1937. +#endif /* !_WIN32 */
  1938.  #include <stdio.h>
  1939.  #include <stdlib.h>
  1940.  #include <string.h>
  1941. diff --git a/libtirpc/src/xdr_sizeof.c b/libtirpc/src/xdr_sizeof.c
  1942. index 69243c1..1ad25fc 100644
  1943. --- a/libtirpc/src/xdr_sizeof.c
  1944. +++ b/libtirpc/src/xdr_sizeof.c
  1945. @@ -34,7 +34,9 @@
  1946.   * when serialized using XDR.
  1947.   */
  1948.  
  1949. -//#include <sys/cdefs.h>
  1950. +#ifndef _WIN32
  1951. +#include <sys/cdefs.h>
  1952. +#endif /* !_WIN32 */
  1953.  
  1954.  #include <wintirpc.h>
  1955.  #include "namespace.h"
  1956. diff --git a/libtirpc/src/xdr_stdio.c b/libtirpc/src/xdr_stdio.c
  1957. index 4052860..1da79a8 100644
  1958. --- a/libtirpc/src/xdr_stdio.c
  1959. +++ b/libtirpc/src/xdr_stdio.c
  1960. @@ -26,7 +26,9 @@
  1961.   * POSSIBILITY OF SUCH DAMAGE.
  1962.   */
  1963.  
  1964. -//#include <sys/cdefs.h>
  1965. +#ifndef _WIN32
  1966. +#include <sys/cdefs.h>
  1967. +#endif /* !_WIN32 */
  1968.  
  1969.  /*
  1970.   * xdr_stdio.c, XDR implementation on standard i/o file.
  1971. @@ -42,7 +44,9 @@
  1972.  #include "namespace.h"
  1973.  #include <stdio.h>
  1974.  
  1975. -//#include <arpa/inet.h>
  1976. +#ifndef _WIN32
  1977. +#include <arpa/inet.h>
  1978. +#endif /* !_WIN32 */
  1979.  #include <rpc/types.h>
  1980.  #include <rpc/xdr.h>
  1981.  #include "un-namespace.h"
  1982. diff --git a/libtirpc/tirpc/misc/event.h b/libtirpc/tirpc/misc/event.h
  1983. index ca21c2f..7875ca8 100644
  1984. --- a/libtirpc/tirpc/misc/event.h
  1985. +++ b/libtirpc/tirpc/misc/event.h
  1986. @@ -186,7 +186,9 @@ extern int  kqueue_del_filteropts(int filt);
  1987.  
  1988.  #else  /* !_KERNEL */
  1989.  
  1990. -//#include <sys/cdefs.h>
  1991. +#ifndef _WIN32
  1992. +#include <sys/cdefs.h>
  1993. +#endif /* !_WIN32 */
  1994.  struct timespec;
  1995.  
  1996.  __BEGIN_DECLS
  1997. diff --git a/libtirpc/tirpc/netconfig.h b/libtirpc/tirpc/netconfig.h
  1998. index 9182b5d..6ebb70d 100644
  1999. --- a/libtirpc/tirpc/netconfig.h
  2000. +++ b/libtirpc/tirpc/netconfig.h
  2001. @@ -1,9 +1,11 @@
  2002.  #ifndef _NETCONFIG_H_
  2003.  #define _NETCONFIG_H_
  2004.  
  2005. -//#include <features.h>
  2006. +#ifndef _WIN32
  2007. +#include <features.h>
  2008. +#endif /* !_WIN32 */
  2009.  
  2010. -// XXX Should be in, or come from, the registry!!!
  2011. +/* XXX Should be in, or come from, the registry!!! */
  2012.  #define NETCONFIG "c:\\etc\\netconfig"
  2013.  #define NETPATH          "NETPATH"
  2014.  
  2015. diff --git a/libtirpc/tirpc/reentrant.h b/libtirpc/tirpc/reentrant.h
  2016. index 08024db..a157b2e 100644
  2017. --- a/libtirpc/tirpc/reentrant.h
  2018. +++ b/libtirpc/tirpc/reentrant.h
  2019. @@ -88,7 +88,8 @@
  2020.   */
  2021.  
  2022.  /* NFSv4.1 client for Windows
  2023. - * Copyright (C) 2012 The Regents of the University of Michigan
  2024. + * Copyright (C) 2012 The Regents of the University of Michigan
  2025. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  2026.   *
  2027.   * Olga Kornievskaia <aglo@umich.edu>
  2028.   * Casey Bodley <cbodley@umich.edu>
  2029. @@ -111,7 +112,9 @@
  2030.  
  2031.  #ifndef _REENTRANT_H
  2032.  #define _REENTRANT_H
  2033. -//#include <pthread.h>
  2034. +#ifndef _WIN32
  2035. +#include <pthread.h>
  2036. +#endif /* !_WIN32 */
  2037.  #include <libc_private.h>
  2038.  
  2039.  #include <stdlib.h>
  2040. diff --git a/libtirpc/tirpc/rpc/auth.h b/libtirpc/tirpc/rpc/auth.h
  2041. index bfea084..2dbafe6 100644
  2042. --- a/libtirpc/tirpc/rpc/auth.h
  2043. +++ b/libtirpc/tirpc/rpc/auth.h
  2044. @@ -44,10 +44,12 @@
  2045.   */
  2046.  
  2047.  /* NFSv4.1 client for Windows
  2048. - * Copyright (C) 2012 The Regents of the University of Michigan
  2049. + * Copyright (C) 2012 The Regents of the University of Michigan
  2050. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  2051.   *
  2052.   * Olga Kornievskaia <aglo@umich.edu>
  2053.   * Casey Bodley <cbodley@umich.edu>
  2054. + * Roland Mainz <roland.mainz@nrubsig.org>
  2055.   *
  2056.   * This library is free software; you can redistribute it and/or modify it
  2057.   * under the terms of the GNU Lesser General Public License as published by
  2058. @@ -69,8 +71,10 @@
  2059.  
  2060.  #include <rpc/xdr.h>
  2061.  #include <rpc/clnt_stat.h>
  2062. -//#include <sys/cdefs.h>
  2063. -//#include <sys/socket.h>
  2064. +#ifndef _WIN32
  2065. +#include <sys/cdefs.h>
  2066. +#include <sys/socket.h>
  2067. +#endif /* !_WIN32 */
  2068.  #include <sys/types.h>
  2069.  
  2070.  
  2071. diff --git a/libtirpc/tirpc/rpc/auth_unix.h b/libtirpc/tirpc/rpc/auth_unix.h
  2072. index 2adf21a..9d9f059 100644
  2073. --- a/libtirpc/tirpc/rpc/auth_unix.h
  2074. +++ b/libtirpc/tirpc/rpc/auth_unix.h
  2075. @@ -45,7 +45,9 @@
  2076.  
  2077.  #ifndef _TIRPC_AUTH_UNIX_H
  2078.  #define _TIRPC_AUTH_UNIX_H
  2079. -//#include <sys/cdefs.h>
  2080. +#ifndef _WIN32
  2081. +#include <sys/cdefs.h>
  2082. +#endif /* !_WIN32 */
  2083.  
  2084.  /* The machine name is part of a credential; it may not exceed 255 bytes */
  2085.  #define MAX_MACHINE_NAME 255
  2086. diff --git a/libtirpc/tirpc/rpc/clnt.h b/libtirpc/tirpc/rpc/clnt.h
  2087. index f511f8b..6d5e353 100644
  2088. --- a/libtirpc/tirpc/rpc/clnt.h
  2089. +++ b/libtirpc/tirpc/rpc/clnt.h
  2090. @@ -40,10 +40,12 @@
  2091.   */
  2092.  
  2093.  /* NFSv4.1 client for Windows
  2094. - * Copyright (C) 2012 The Regents of the University of Michigan
  2095. + * Copyright (C) 2012 The Regents of the University of Michigan
  2096. + * Copyright (C) 2023-25 Roland Mainz <roland.mainz@nrubsig.org>
  2097.   *
  2098.   * Olga Kornievskaia <aglo@umich.edu>
  2099.   * Casey Bodley <cbodley@umich.edu>
  2100. + * Roland Mainz <roland.mainz@nrubsig.org>
  2101.   *
  2102.   * This library is free software; you can redistribute it and/or modify it
  2103.   * under the terms of the GNU Lesser General Public License as published by
  2104. @@ -63,13 +65,17 @@
  2105.  #ifndef _TIRPC_CLNT_H_
  2106.  #define _TIRPC_CLNT_H_
  2107.  
  2108. -//#include <rpc/clnt_stat.h>
  2109. +#ifndef _WIN32
  2110. +#include <rpc/clnt_stat.h>
  2111. +#endif /* !_WIN32 */
  2112.  #include "clnt_stat.h"
  2113.  #include <rpc/auth.h>
  2114.  
  2115. -//#include <sys/cdefs.h>
  2116. -//#include <netconfig.h>
  2117. -//#include <sys/un.h>
  2118. +#ifndef _WIN32
  2119. +#include <sys/cdefs.h>
  2120. +#include <netconfig.h>
  2121. +#include <sys/un.h>
  2122. +#endif /* !_WIN32 */
  2123.  
  2124.  /*
  2125.   * Well-known IPV6 RPC broadcast address.
  2126. diff --git a/libtirpc/tirpc/rpc/clnt_soc.h b/libtirpc/tirpc/rpc/clnt_soc.h
  2127. index 4cf4d78..172ef61 100644
  2128. --- a/libtirpc/tirpc/rpc/clnt_soc.h
  2129. +++ b/libtirpc/tirpc/rpc/clnt_soc.h
  2130. @@ -46,7 +46,9 @@
  2131.   * with TS-RPC.
  2132.   */
  2133.  
  2134. -//#include <sys/cdefs.h>
  2135. +#ifndef _WIN32
  2136. +#include <sys/cdefs.h>
  2137. +#endif /* !_WIN32 */
  2138.  
  2139.  #define UDPMSGSIZE      8800    /* rpc imposed limit on udp msg size */  
  2140.  
  2141. diff --git a/libtirpc/tirpc/rpc/des_crypt.h b/libtirpc/tirpc/rpc/des_crypt.h
  2142. index d4bd825..d7be062 100644
  2143. --- a/libtirpc/tirpc/rpc/des_crypt.h
  2144. +++ b/libtirpc/tirpc/rpc/des_crypt.h
  2145. @@ -43,7 +43,9 @@
  2146.  #ifndef _DES_DES_CRYPT_H
  2147.  #define _DES_DES_CRYPT_H
  2148.  
  2149. -//#include <sys/cdefs.h>
  2150. +#ifndef _WIN32
  2151. +#include <sys/cdefs.h>
  2152. +#endif /* !_WIN32 */
  2153.  #include <rpc/rpc.h>
  2154.  
  2155.  #define DES_MAXDATA 8192       /* max bytes encrypted in one call */
  2156. diff --git a/libtirpc/tirpc/rpc/pmap_clnt.h b/libtirpc/tirpc/rpc/pmap_clnt.h
  2157. index 98ac4fd..9df2e44 100644
  2158. --- a/libtirpc/tirpc/rpc/pmap_clnt.h
  2159. +++ b/libtirpc/tirpc/rpc/pmap_clnt.h
  2160. @@ -63,7 +63,9 @@
  2161.  
  2162.  #ifndef _RPC_PMAP_CLNT_H_
  2163.  #define _RPC_PMAP_CLNT_H_
  2164. -//#include <sys/cdefs.h>
  2165. +#ifndef _WIN32
  2166. +#include <sys/cdefs.h>
  2167. +#endif /* !_WIN32 */
  2168.  
  2169.  __BEGIN_DECLS
  2170.  extern bool_t          pmap_set(u_long, u_long, int, int);
  2171. diff --git a/libtirpc/tirpc/rpc/pmap_prot.h b/libtirpc/tirpc/rpc/pmap_prot.h
  2172. index 27fae0c..3389b51 100644
  2173. --- a/libtirpc/tirpc/rpc/pmap_prot.h
  2174. +++ b/libtirpc/tirpc/rpc/pmap_prot.h
  2175. @@ -71,7 +71,10 @@
  2176.  
  2177.  #ifndef _RPC_PMAP_PROT_H
  2178.  #define _RPC_PMAP_PROT_H
  2179. -//#include <sys/cdefs.h>
  2180. +
  2181. +#ifndef _WIN32
  2182. +#include <sys/cdefs.h>
  2183. +#endif /* !_WIN32 */
  2184.  
  2185.  #define PMAPPORT               ((u_short)111)
  2186.  #define PMAPPROG               ((u_long)100000)
  2187. diff --git a/libtirpc/tirpc/rpc/pmap_rmt.h b/libtirpc/tirpc/rpc/pmap_rmt.h
  2188. index bb9591d..02b4ba3 100644
  2189. --- a/libtirpc/tirpc/rpc/pmap_rmt.h
  2190. +++ b/libtirpc/tirpc/rpc/pmap_rmt.h
  2191. @@ -41,7 +41,9 @@
  2192.  
  2193.  #ifndef _RPC_PMAP_RMT_H
  2194.  #define _RPC_PMAP_RMT_H
  2195. -//#include <sys/cdefs.h>
  2196. +#ifndef _WIN32
  2197. +#include <sys/cdefs.h>
  2198. +#endif /* !_WIN32 */
  2199.  
  2200.  struct rmtcallargs {
  2201.         u_long prog, vers, proc, arglen;
  2202. diff --git a/libtirpc/tirpc/rpc/rpc.h b/libtirpc/tirpc/rpc/rpc.h
  2203. index e136149..6759fc5 100644
  2204. --- a/libtirpc/tirpc/rpc/rpc.h
  2205. +++ b/libtirpc/tirpc/rpc/rpc.h
  2206. @@ -37,8 +37,10 @@
  2207.  
  2208.  #include <rpc/types.h>         /* some typedefs */
  2209.  #include "winsock2.h"
  2210. -//#include <sys/socket.h>
  2211. -//#include <netinet/in.h>
  2212. +#ifndef _WIN32
  2213. +#include <sys/socket.h>
  2214. +#include <netinet/in.h>
  2215. +#endif /* !_WIN32 */
  2216.  
  2217.  /* external data representation interfaces */
  2218.  #include <rpc/xdr.h>           /* generic (de)serializer */
  2219. diff --git a/libtirpc/tirpc/rpc/rpc_com.h b/libtirpc/tirpc/rpc/rpc_com.h
  2220. index 096cf23..37f36a5 100644
  2221. --- a/libtirpc/tirpc/rpc/rpc_com.h
  2222. +++ b/libtirpc/tirpc/rpc/rpc_com.h
  2223. @@ -41,7 +41,9 @@
  2224.  #ifndef _RPC_RPCCOM_H
  2225.  #define        _RPC_RPCCOM_H
  2226.  
  2227. -//#include <sys/cdefs.h>
  2228. +#ifndef _WIN32
  2229. +#include <sys/cdefs.h>
  2230. +#endif /* !_WIN32 */
  2231.  
  2232.  /* #pragma ident       "@(#)rpc_com.h  1.11    93/07/05 SMI" */
  2233.  
  2234. diff --git a/libtirpc/tirpc/rpc/svc.h b/libtirpc/tirpc/rpc/svc.h
  2235. index 6f83fd5..b523d3b 100644
  2236. --- a/libtirpc/tirpc/rpc/svc.h
  2237. +++ b/libtirpc/tirpc/rpc/svc.h
  2238. @@ -40,7 +40,9 @@
  2239.  
  2240.  #ifndef _TIRPC_SVC_H
  2241.  #define _TIRPC_SVC_H
  2242. -//#include <sys/cdefs.h>
  2243. +#ifndef _WIN32
  2244. +#include <sys/cdefs.h>
  2245. +#endif /* !_WIN32 */
  2246.  
  2247.  /*
  2248.   * This interface must manage two items concerning remote procedure calling:
  2249. diff --git a/libtirpc/tirpc/rpc/svc_soc.h b/libtirpc/tirpc/rpc/svc_soc.h
  2250. index d21f1ab..2bbfddb 100644
  2251. --- a/libtirpc/tirpc/rpc/svc_soc.h
  2252. +++ b/libtirpc/tirpc/rpc/svc_soc.h
  2253. @@ -38,7 +38,9 @@
  2254.  
  2255.  #ifndef _RPC_SVC_SOC_H
  2256.  #define _RPC_SVC_SOC_H
  2257. -//#include <sys/cdefs.h>
  2258. +#ifndef _WIN32
  2259. +#include <sys/cdefs.h>
  2260. +#endif /* !_WIN32 */
  2261.  
  2262.  /* #pragma ident   "@(#)svc_soc.h  1.11    94/04/25 SMI" */
  2263.  /*      svc_soc.h 1.8 89/05/01 SMI      */
  2264. diff --git a/libtirpc/tirpc/rpc/types.h b/libtirpc/tirpc/rpc/types.h
  2265. index 2f595f7..4abeceb 100644
  2266. --- a/libtirpc/tirpc/rpc/types.h
  2267. +++ b/libtirpc/tirpc/rpc/types.h
  2268. @@ -67,8 +67,10 @@
  2269.  #endif /* !_WIN32 */
  2270.  
  2271.  #ifdef _WIN32
  2272. -// Windows mappings of data types
  2273. -// Fixed size things
  2274. +/*
  2275. + * Windows mappings of data types
  2276. + * Fixed size things
  2277. + */
  2278.  typedef signed char int8_t;
  2279.  typedef signed short int16_t;
  2280.  typedef INT32      int32_t;
  2281. @@ -82,7 +84,7 @@ typedef UINT32         uint32_t;
  2282.  typedef UINT64   u_int64_t;
  2283.  typedef UINT64   uint64_t;
  2284.  typedef PCHAR      caddr_t;
  2285. -// Scalable things
  2286. +/* Scalable things */
  2287.  typedef UCHAR    u_char;
  2288.  typedef unsigned short   u_short;
  2289.  typedef UINT32   u_int;
  2290. @@ -95,7 +97,9 @@ typedef UINT     uid_t;
  2291.  typedef UINT     gid_t;
  2292.  typedef DWORD    pid_t;
  2293.  
  2294. -//typedef SIZE_T  size_t;  //This is causing a "benign redefinition error"
  2295. +#if 0
  2296. +typedef SIZE_T  size_t;  /* This is causing a "benign redefinition error" */
  2297. +#endif
  2298.  typedef SSIZE_T ssize_t;
  2299.  #endif /* _WIN32 */
  2300.  
  2301. @@ -124,8 +128,10 @@ typedef   int32_t rpc_inline_t;
  2302.  #define mem_alloc(bsize)       calloc(1, bsize)
  2303.  #define mem_free(ptr, bsize)   free(ptr)
  2304.  
  2305. -//#include <sys/time.h>
  2306. -//#include <sys/param.h>
  2307. +#ifndef _WIN32
  2308. +#include <sys/time.h>
  2309. +#include <sys/param.h>
  2310. +#endif /* !_WIN32 */
  2311.  #include <stdlib.h>
  2312.  #include <netconfig.h>
  2313.  
  2314. diff --git a/libtirpc/tirpc/rpc/xdr.h b/libtirpc/tirpc/rpc/xdr.h
  2315. index 39782d7..be14dd6 100644
  2316. --- a/libtirpc/tirpc/rpc/xdr.h
  2317. +++ b/libtirpc/tirpc/rpc/xdr.h
  2318. @@ -40,10 +40,14 @@
  2319.  
  2320.  #ifndef _TIRPC_XDR_H
  2321.  #define _TIRPC_XDR_H
  2322. -//#include <sys/cdefs.h>
  2323. +#ifndef _WIN32
  2324. +#include <sys/cdefs.h>
  2325. +#endif /* !_WIN32 */
  2326.  #include <stdio.h>
  2327. -//#include <netinet/in.h>
  2328. -// Rajout pour la definition des types
  2329. +#ifndef _WIN32
  2330. +#include <netinet/in.h>
  2331. +#endif /* !_WIN32 */
  2332. +/* Rajout pour la definition des types */
  2333.  #include <rpc/types.h>
  2334.  
  2335.  /*
  2336. diff --git a/libtirpc/tirpc/spinlock.h b/libtirpc/tirpc/spinlock.h
  2337. index 8c65ab5..31a9103 100644
  2338. --- a/libtirpc/tirpc/spinlock.h
  2339. +++ b/libtirpc/tirpc/spinlock.h
  2340. @@ -37,7 +37,9 @@
  2341.  
  2342.  #ifndef _SPINLOCK_H_
  2343.  #define _SPINLOCK_H_
  2344. -//#include <sys/cdefs.h>
  2345. +#ifndef _WIN32
  2346. +#include <sys/cdefs.h>
  2347. +#endif /* !_WIN32 */
  2348.  #include <sys/types.h>
  2349.  
  2350.  /*
  2351. --
  2352. 2.45.4
  2353.  
  2354. From 04914f111700daddeeb7d5a4c14b743850b7d6e4 Mon Sep 17 00:00:00 2001
  2355. From: Roland Mainz <roland.mainz@nrubsig.org>
  2356. Date: Tue, 2 Sep 2025 19:23:34 +0200
  2357. Subject: [PATCH 2/2] libtirpc: Remove non-CVE code which is no longer in
  2358.  upstream libtirpc
  2359.  
  2360. Remove non-CVE code which is no longer in upstream libtirpc.
  2361.  
  2362. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  2363. ---
  2364. libtirpc/src/rpc_generic.c |  6 ------
  2365.  libtirpc/src/rpcb_prot.c   | 38 --------------------------------------
  2366.  libtirpc/src/rpcb_st_xdr.c | 18 ------------------
  2367.  libtirpc/src/svc_vc.c      | 16 ----------------
  2368.  4 files changed, 78 deletions(-)
  2369.  
  2370. diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
  2371. index 23ac77f..b9a6726 100644
  2372. --- a/libtirpc/src/rpc_generic.c
  2373. +++ b/libtirpc/src/rpc_generic.c
  2374. @@ -665,11 +665,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
  2375.  
  2376.         switch (af) {
  2377.         case AF_INET:
  2378. -#ifdef _WIN32 // CVE-2017-8779
  2379.                 if (nbuf->len < sizeof(*sin)) {
  2380.                         return NULL;
  2381.                 }
  2382. -#endif
  2383.                 sin = nbuf->buf;
  2384.                 if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf)
  2385.                     == NULL)
  2386. @@ -681,11 +679,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
  2387.                 break;
  2388.  #ifdef INET6
  2389.         case AF_INET6:
  2390. -#ifdef _WIN32 // CVE-2017-8779
  2391.                 if (nbuf->len < sizeof(*sin6)) {
  2392.                         return NULL;
  2393.                 }
  2394. -#endif
  2395.                 sin6 = nbuf->buf;
  2396.                 if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6)
  2397.                     == NULL)
  2398. @@ -732,10 +728,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
  2399.  
  2400.         port = 0;
  2401.         sin = NULL;
  2402. -#ifdef _WIN32 // CVE-2017-8779
  2403.         if (uaddr == NULL)
  2404.                 return NULL;
  2405. -#endif
  2406.         addrstr = strdup(uaddr);
  2407.         if (addrstr == NULL)
  2408.                 return NULL;
  2409. diff --git a/libtirpc/src/rpcb_prot.c b/libtirpc/src/rpcb_prot.c
  2410. index 6b8d38b..7f6c323 100644
  2411. --- a/libtirpc/src/rpcb_prot.c
  2412. +++ b/libtirpc/src/rpcb_prot.c
  2413. @@ -42,9 +42,7 @@
  2414.  #include <rpc/types.h>
  2415.  #include <rpc/xdr.h>
  2416.  #include <rpc/rpcb_prot.h>
  2417. -#ifdef _WIN32 // CVE-2017-8779
  2418.  #include "rpc_com.h"
  2419. -#endif /* _WIN32 */
  2420.  
  2421.  bool_t
  2422.  xdr_rpcb(
  2423. @@ -57,17 +55,6 @@ xdr_rpcb(
  2424.         if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
  2425.                 return (FALSE);
  2426.         }
  2427. -#ifndef _WIN32 // CVE-2017-8779
  2428. -       if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
  2429. -               return (FALSE);
  2430. -       }
  2431. -       if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) {
  2432. -               return (FALSE);
  2433. -       }
  2434. -       if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) {
  2435. -               return (FALSE);
  2436. -       }
  2437. -#else
  2438.         if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) {
  2439.                 return (FALSE);
  2440.         }
  2441. @@ -77,7 +64,6 @@ xdr_rpcb(
  2442.         if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) {
  2443.                 return (FALSE);
  2444.         }
  2445. -#endif
  2446.         return (TRUE);
  2447.  }
  2448.  
  2449. @@ -175,39 +161,21 @@ xdr_rpcb_entry(
  2450.         XDR *xdrs,
  2451.         rpcb_entry *objp)
  2452.  {
  2453. -#ifndef _WIN32 // CVE-2017-8779
  2454. -       if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
  2455. -               return (FALSE);
  2456. -       }
  2457. -       if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) {
  2458. -               return (FALSE);
  2459. -       }
  2460. -#else
  2461.         if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) {
  2462.                 return (FALSE);
  2463.         }
  2464.         if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) {
  2465.                 return (FALSE);
  2466.         }
  2467. -#endif
  2468.         if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) {
  2469.                 return (FALSE);
  2470.         }
  2471. -#ifndef _WIN32 // CVE-2017-8779
  2472. -       if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) {
  2473. -               return (FALSE);
  2474. -       }
  2475. -       if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) {
  2476. -               return (FALSE);
  2477. -       }
  2478. -#else
  2479.         if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) {
  2480.                 return (FALSE);
  2481.         }
  2482.         if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) {
  2483.                 return (FALSE);
  2484.         }
  2485. -#endif
  2486.         return (TRUE);
  2487.  }
  2488.  
  2489. @@ -326,11 +294,7 @@ xdr_rpcb_rmtcallres(
  2490.         bool_t dummy;
  2491.         struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
  2492.  
  2493. -#ifdef _WIN32 // CVE-2017-8779
  2494.         if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) {
  2495. -#else
  2496. -       if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) {
  2497. -#endif
  2498.                 return (FALSE);
  2499.         }
  2500.         if (!xdr_u_int(xdrs, &objp->results.results_len)) {
  2501. @@ -350,13 +314,11 @@ xdr_netbuf(
  2502.         if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) {
  2503.                 return (FALSE);
  2504.         }
  2505. -#ifdef _WIN32 // CVE-2017-8779
  2506.  
  2507.         if (objp->maxlen > RPC_MAXDATASIZE) {
  2508.                 return (FALSE);
  2509.         }
  2510.  
  2511. -#endif
  2512.         dummy = xdr_bytes(xdrs, (char **)&(objp->buf),
  2513.                         (u_int *)&(objp->len), objp->maxlen);
  2514.         return (dummy);
  2515. diff --git a/libtirpc/src/rpcb_st_xdr.c b/libtirpc/src/rpcb_st_xdr.c
  2516. index adca935..cf15bac 100644
  2517. --- a/libtirpc/src/rpcb_st_xdr.c
  2518. +++ b/libtirpc/src/rpcb_st_xdr.c
  2519. @@ -41,9 +41,7 @@
  2520.  
  2521.  #include <wintirpc.h>
  2522.  #include <rpc/rpc.h>
  2523. -#ifdef _WIN32 // CVE-2017-8779
  2524.  #include "rpc_com.h"
  2525. -#endif /* _WIN32 */
  2526.  
  2527.  /* Link list of all the stats about getport and getaddr */
  2528.  
  2529. @@ -65,11 +63,7 @@ xdr_rpcbs_addrlist(
  2530.             if (!xdr_int(xdrs, &objp->failure)) {
  2531.                 return (FALSE);
  2532.             }
  2533. -#ifdef _WIN32 // CVE-2017-8779
  2534.             if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
  2535. -#else
  2536. -           if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
  2537. -#endif
  2538.                 return (FALSE);
  2539.             }
  2540.  
  2541. @@ -120,11 +114,7 @@ xdr_rpcbs_rmtcalllist(
  2542.                 IXDR_PUT_INT32(buf, objp->failure);
  2543.                 IXDR_PUT_INT32(buf, objp->indirect);
  2544.         }
  2545. -#ifdef _WIN32 // CVE-2017-8779
  2546.         if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
  2547. -#else
  2548. -       if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
  2549. -#endif
  2550.                 return (FALSE);
  2551.         }
  2552.         if (!xdr_pointer(xdrs, (char **)&objp->next,
  2553. @@ -162,11 +152,7 @@ xdr_rpcbs_rmtcalllist(
  2554.                 objp->failure = (int)IXDR_GET_INT32(buf);
  2555.                 objp->indirect = (int)IXDR_GET_INT32(buf);
  2556.         }
  2557. -#ifdef _WIN32 // CVE-2017-8779
  2558.         if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
  2559. -#else
  2560. -       if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
  2561. -#endif
  2562.                 return (FALSE);
  2563.         }
  2564.         if (!xdr_pointer(xdrs, (char **)&objp->next,
  2565. @@ -194,11 +180,7 @@ xdr_rpcbs_rmtcalllist(
  2566.         if (!xdr_int(xdrs, &objp->indirect)) {
  2567.                 return (FALSE);
  2568.         }
  2569. -#ifdef _WIN32 // CVE-2017-8779
  2570.         if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
  2571. -#else
  2572. -       if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
  2573. -#endif
  2574.                 return (FALSE);
  2575.         }
  2576.         if (!xdr_pointer(xdrs, (char **)&objp->next,
  2577. diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
  2578. index e6e8355..df06002 100644
  2579. --- a/libtirpc/src/svc_vc.c
  2580. +++ b/libtirpc/src/svc_vc.c
  2581. @@ -324,9 +324,6 @@ rendezvous_request(
  2582.         socklen_t len;
  2583.         struct __rpc_sockinfo si;
  2584.         SVCXPRT *newxprt;
  2585. -#ifndef _WIN32 // CVE-2018-14621
  2586. -       fd_set cleanfds;
  2587. -#endif
  2588.  
  2589.         assert(xprt != NULL);
  2590.         assert(msg != NULL);
  2591. @@ -338,17 +335,6 @@ again:
  2592.             &len)) == SOCKET_ERROR) {
  2593.                 if (errno == EINTR)
  2594.                         goto again;
  2595. -#ifndef _WIN32 // CVE-2018-14621
  2596. -               /*
  2597. -                * Clean out the most idle file descriptor when we're
  2598. -                * running out.
  2599. -                */
  2600. -               if (errno == EMFILE || errno == ENFILE) {
  2601. -                       cleanfds = svc_fdset;
  2602. -                       __svc_clean_idle(&cleanfds, 0, FALSE);
  2603. -                       goto again;
  2604. -               }
  2605. -#endif
  2606.                 return (FALSE);
  2607.         }
  2608.         /*
  2609. @@ -356,10 +342,8 @@ again:
  2610.          */
  2611.  
  2612.         newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
  2613. -#ifdef _WIN32 // CVE-2018-14622
  2614.         if (!newxprt)
  2615.                 return (FALSE);
  2616. -#endif
  2617.  
  2618.         if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
  2619.                 return (FALSE);
  2620. --
  2621. 2.45.4

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at