- From 27cdc01373ec58da876cb790d696f3bce5fbb8b1 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 2 Sep 2025 19:15:33 +0200
- Subject: [PATCH 1/2] libtirpc: Use #ifdef _WIN32 instead of C++ comments to do
- conditional includes
- Use #ifdef _WIN32 instead of C++ comments to do conditional includes.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- libtirpc/src/asprintf.c | 2 +-
- libtirpc/src/auth_des.c | 24 +++++++++++++------
- libtirpc/src/auth_gss.c | 4 +++-
- libtirpc/src/auth_none.c | 6 +++--
- libtirpc/src/auth_sspi.c | 4 +++-
- libtirpc/src/auth_time.c | 26 +++++++++++++--------
- libtirpc/src/auth_unix.c | 16 +++++++++----
- libtirpc/src/authdes_prot.c | 4 +++-
- libtirpc/src/authsspi_prot.c | 8 +++++--
- libtirpc/src/authunix_prot.c | 4 +++-
- libtirpc/src/bindresvport.c | 10 ++++----
- libtirpc/src/clnt_bcast.c | 42 ++++++++++++++++++++++------------
- libtirpc/src/clnt_dg.c | 28 +++++++++++++++--------
- libtirpc/src/clnt_generic.c | 24 +++++++++++++------
- libtirpc/src/clnt_raw.c | 4 +++-
- libtirpc/src/clnt_simple.c | 16 +++++++++----
- libtirpc/src/clnt_vc.c | 30 +++++++++++++++---------
- libtirpc/src/crypt_client.c | 8 +++++--
- libtirpc/src/des_crypt.c | 4 +++-
- libtirpc/src/des_soft.c | 4 +++-
- libtirpc/src/getnetconfig.c | 12 +++++++---
- libtirpc/src/getnetpath.c | 10 +++++---
- libtirpc/src/getpeereid.c | 16 +++++++++----
- libtirpc/src/getpublickey.c | 4 +++-
- libtirpc/src/getrpcent.c | 10 +++++---
- libtirpc/src/getrpcport.c | 8 +++++--
- libtirpc/src/key_call.c | 4 +++-
- libtirpc/src/key_prot_xdr.c | 4 ++--
- libtirpc/src/mt_misc.c | 10 +++++---
- libtirpc/src/netname.c | 8 +++++--
- libtirpc/src/pmap_clnt.c | 12 +++++++---
- libtirpc/src/pmap_getmaps.c | 25 +++++++++++++-------
- libtirpc/src/pmap_getport.c | 12 ++++++----
- libtirpc/src/pmap_rmt.c | 26 +++++++++++++--------
- libtirpc/src/rpc_callmsg.c | 4 +++-
- libtirpc/src/rpc_com.h | 4 +++-
- libtirpc/src/rpc_dtablesize.c | 6 +++--
- libtirpc/src/rpc_generic.c | 34 +++++++++++++++++----------
- libtirpc/src/rpc_prot.c | 4 +++-
- libtirpc/src/rpc_soc.c | 18 +++++++++++----
- libtirpc/src/rpcb_clnt.c | 22 +++++++++++-------
- libtirpc/src/rpcb_prot.c | 2 +-
- libtirpc/src/rpcb_st_xdr.c | 6 +++--
- libtirpc/src/rpcdname.c | 8 +++++--
- libtirpc/src/rtime.c | 22 ++++++++++++------
- libtirpc/src/svc.c | 8 +++++--
- libtirpc/src/svc_auth.c | 4 +++-
- libtirpc/src/svc_auth_des.c | 14 ++++++++----
- libtirpc/src/svc_auth_unix.c | 4 +++-
- libtirpc/src/svc_dg.c | 20 ++++++++++++----
- libtirpc/src/svc_generic.c | 16 +++++++++----
- libtirpc/src/svc_raw.c | 4 +++-
- libtirpc/src/svc_run.c | 16 +++++++++----
- libtirpc/src/svc_simple.c | 13 ++++++++---
- libtirpc/src/svc_vc.c | 32 +++++++++++++++++---------
- libtirpc/src/wintirpc.c | 3 ++-
- libtirpc/src/xdr.c | 4 +++-
- libtirpc/src/xdr_array.c | 10 +++++---
- libtirpc/src/xdr_float.c | 8 +++++--
- libtirpc/src/xdr_mem.c | 8 +++++--
- libtirpc/src/xdr_rec.c | 22 +++++++++++++-----
- libtirpc/src/xdr_reference.c | 10 +++++---
- libtirpc/src/xdr_sizeof.c | 4 +++-
- libtirpc/src/xdr_stdio.c | 8 +++++--
- libtirpc/tirpc/misc/event.h | 4 +++-
- libtirpc/tirpc/netconfig.h | 6 +++--
- libtirpc/tirpc/reentrant.h | 7 ++++--
- libtirpc/tirpc/rpc/auth.h | 10 +++++---
- libtirpc/tirpc/rpc/auth_unix.h | 4 +++-
- libtirpc/tirpc/rpc/clnt.h | 16 +++++++++----
- libtirpc/tirpc/rpc/clnt_soc.h | 4 +++-
- libtirpc/tirpc/rpc/des_crypt.h | 4 +++-
- libtirpc/tirpc/rpc/pmap_clnt.h | 4 +++-
- libtirpc/tirpc/rpc/pmap_prot.h | 5 +++-
- libtirpc/tirpc/rpc/pmap_rmt.h | 4 +++-
- libtirpc/tirpc/rpc/rpc.h | 6 +++--
- libtirpc/tirpc/rpc/rpc_com.h | 4 +++-
- libtirpc/tirpc/rpc/svc.h | 4 +++-
- libtirpc/tirpc/rpc/svc_soc.h | 4 +++-
- libtirpc/tirpc/rpc/types.h | 18 ++++++++++-----
- libtirpc/tirpc/rpc/xdr.h | 10 +++++---
- libtirpc/tirpc/spinlock.h | 4 +++-
- 82 files changed, 618 insertions(+), 267 deletions(-)
- diff --git a/libtirpc/src/asprintf.c b/libtirpc/src/asprintf.c
- index 45fa7ee..a8ce50f 100644
- --- a/libtirpc/src/asprintf.c
- +++ b/libtirpc/src/asprintf.c
- @@ -16,11 +16,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
- -//extern int vsnprintf();
- #ifdef _WIN32
- #include <wintirpc.h>
- #include <stdarg.h>
- #else
- +extern int vsnprintf();
- #include <varargs.h>
- #endif /* _WIN32 */
- #include <stdio.h>
- diff --git a/libtirpc/src/auth_des.c b/libtirpc/src/auth_des.c
- index 76bb9a4..41357c7 100644
- --- a/libtirpc/src/auth_des.c
- +++ b/libtirpc/src/auth_des.c
- @@ -33,30 +33,40 @@
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <string.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <rpc/des_crypt.h>
- #ifndef _WIN32
- #include <syslog.h>
- -#endif
- +#endif /* !_WIN32 */
- #include <rpc/types.h>
- #include <rpc/auth.h>
- #include <rpc/auth_des.h>
- #include <rpc/clnt.h>
- #include <rpc/xdr.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #undef NIS
- #include <rpcsvc/nis.h>
- #if defined(LIBC_SCCS) && !defined(lint)
- #endif
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #define USEC_PER_SEC 1000000
- #define RTIME_TIMEOUT 5 /* seconds to wait for sync */
- diff --git a/libtirpc/src/auth_gss.c b/libtirpc/src/auth_gss.c
- index 89d4628..c7ea358 100644
- --- a/libtirpc/src/auth_gss.c
- +++ b/libtirpc/src/auth_gss.c
- @@ -38,7 +38,9 @@
- #include <stdio.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- #include <errno.h>
- #include <rpc/types.h>
- diff --git a/libtirpc/src/auth_none.c b/libtirpc/src/auth_none.c
- index 64a9112..6719fce 100644
- --- a/libtirpc/src/auth_none.c
- +++ b/libtirpc/src/auth_none.c
- @@ -31,7 +31,7 @@
- static char *sccsid = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
- static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
- #endif
- -//#include <sys/cdefs.h>
- +#include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obrien Exp $");
- */
- @@ -66,7 +66,9 @@ __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obri
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <assert.h>
- #include <stdlib.h>
- diff --git a/libtirpc/src/auth_sspi.c b/libtirpc/src/auth_sspi.c
- index f570dec..a7700cd 100644
- --- a/libtirpc/src/auth_sspi.c
- +++ b/libtirpc/src/auth_sspi.c
- @@ -22,7 +22,9 @@
- #include <wintirpc.h>
- #include <stdio.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- #include <errno.h>
- #include <rpc/types.h>
- diff --git a/libtirpc/src/auth_time.c b/libtirpc/src/auth_time.c
- index 9eef6ef..43ef5fc 100644
- --- a/libtirpc/src/auth_time.c
- +++ b/libtirpc/src/auth_time.c
- @@ -25,26 +25,34 @@
- * needed to deal with TCP connections.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- #ifndef _WIN32
- #include <syslog.h>
- #endif
- #include <string.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- -//#include <netdb.h>
- -//#include <sys/signal.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#include <netdb.h>
- +#include <sys/signal.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- -//#include <sys/socket.h>
- -//#include <netinet/in.h>
- -//#include <arpa/inet.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <netinet/in.h>
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/rpc_com.h>
- #include <rpc/rpcb_prot.h>
- -//#include <clnt_soc.h>
- -//#include <sys/select.h>
- +#ifndef _WIN32
- +#include <clnt_soc.h>
- +#include <sys/select.h>
- +#endif /* !_WIN32 */
- #undef NIS
- #include <rpcsvc/nis.h>
- diff --git a/libtirpc/src/auth_unix.c b/libtirpc/src/auth_unix.c
- index a1835da..66b413a 100644
- --- a/libtirpc/src/auth_unix.c
- +++ b/libtirpc/src/auth_unix.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * auth_unix.c, Implements UNIX style authentication parameters.
- @@ -64,9 +66,13 @@
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #ifndef _WIN32
- #include <assert.h>
- @@ -74,7 +80,9 @@
- #endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- #include <rpc/types.h>
- diff --git a/libtirpc/src/authdes_prot.c b/libtirpc/src/authdes_prot.c
- index 4917e17..064c31f 100644
- --- a/libtirpc/src/authdes_prot.c
- +++ b/libtirpc/src/authdes_prot.c
- @@ -1,4 +1,6 @@
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * Copyright (c) 2009, Sun Microsystems, Inc.
- * All rights reserved.
- diff --git a/libtirpc/src/authsspi_prot.c b/libtirpc/src/authsspi_prot.c
- index d0dafcb..1e25796 100644
- --- a/libtirpc/src/authsspi_prot.c
- +++ b/libtirpc/src/authsspi_prot.c
- @@ -1,8 +1,10 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -23,7 +25,9 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
- -//#include <rpc/types.h>
- +#ifndef _WIN32
- +#include <rpc/types.h>
- +#endif /* !_WIN32 */
- #include <rpc/xdr.h>
- #include <rpc/auth.h>
- #include <rpc/auth_sspi.h>
- diff --git a/libtirpc/src/authunix_prot.c b/libtirpc/src/authunix_prot.c
- index 841102e..181c1f3 100644
- --- a/libtirpc/src/authunix_prot.c
- +++ b/libtirpc/src/authunix_prot.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * authunix_prot.c
- diff --git a/libtirpc/src/bindresvport.c b/libtirpc/src/bindresvport.c
- index e4418df..1f76ddc 100644
- --- a/libtirpc/src/bindresvport.c
- +++ b/libtirpc/src/bindresvport.c
- @@ -27,7 +27,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * Copyright (c) 1987 by Sun Microsystems, Inc.
- @@ -41,13 +43,13 @@
- #ifndef _WIN32
- #include <sys/socket.h>
- #include <netinet/in.h>
- -#endif
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <string.h>
- #ifndef _WIN32
- #include <unistd.h>
- -#endif
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- @@ -55,7 +57,7 @@
- #include <winsock2.h>
- #include <mstcpip.h>
- #include <ws2ipdef.h>
- -#endif
- +#endif /* _WIN32 */
- /*
- * Bind a socket to a privileged IP port
- diff --git a/libtirpc/src/clnt_bcast.c b/libtirpc/src/clnt_bcast.c
- index b799a65..a69367a 100644
- --- a/libtirpc/src/clnt_bcast.c
- +++ b/libtirpc/src/clnt_bcast.c
- @@ -28,7 +28,9 @@
- /*
- * Copyright (c) 1986-1991 by Sun Microsystems Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * clnt_bcast.c
- @@ -41,17 +43,25 @@
- */
- #include <wintirpc.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <sys/types.h>
- -//#include <sys/queue.h>
- +#ifndef _WIN32
- +#include <sys/queue.h>
- +#endif /* !_WIN32 */
- /* new queue functions */
- -//#include <misc/queue.h>
- -
- -//#include <net/if.h>
- -//#include <netinet/in.h>
- -//#include <ifaddrs.h>
- -//#include <sys/poll.h>
- +#ifndef _WIN32
- +#include <misc/queue.h>
- +#endif /* !_WIN32 */
- +
- +#ifndef _WIN32
- +#include <net/if.h>
- +#include <netinet/in.h>
- +#include <ifaddrs.h>
- +#include <sys/poll.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #ifdef PORTMAP
- #include <rpc/pmap_prot.h>
- @@ -59,16 +69,20 @@
- #include <rpc/pmap_rmt.h>
- #endif /* PORTMAP */
- #include <rpc/nettype.h>
- -//#include <arpa/inet.h>
- -//#define RPC_DEBUG 1
- +#ifndef _WIN32
- +#include <arpa/inet.h>
- +#define RPC_DEBUG 1
- +#endif /* !_WIN32 */
- #ifdef RPC_DEBUG
- #include <stdio.h>
- #endif
- #include <errno.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- -//#include <netdb.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#include <netdb.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- #include "rpc_com.h"
- diff --git a/libtirpc/src/clnt_dg.c b/libtirpc/src/clnt_dg.c
- index 418401a..0ba11e8 100644
- --- a/libtirpc/src/clnt_dg.c
- +++ b/libtirpc/src/clnt_dg.c
- @@ -33,26 +33,34 @@
- * Implements a connectionless client side RPC.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- -//#include <stdint.h>
- -//#include <sys/poll.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <stdint.h>
- +#include <sys/poll.h>
- -//#include <sys/time.h>
- +#include <sys/time.h>
- -//#include <sys/ioctl.h>
- +#include <sys/ioctl.h>
- +#endif /* !_WIN32 */
- #include <rpc/clnt.h>
- -//#include <arpa/inet.h>
- +#ifndef _WIN32
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/xdr.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <signal.h>
- -//#include <unistd.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <signal.h>
- +#include <unistd.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- #ifdef _WIN32
- diff --git a/libtirpc/src/clnt_generic.c b/libtirpc/src/clnt_generic.c
- index 132833a..d4b62f1 100644
- --- a/libtirpc/src/clnt_generic.c
- +++ b/libtirpc/src/clnt_generic.c
- @@ -53,25 +53,35 @@
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/fcntl.h>
- +#ifndef _WIN32
- +#include <sys/fcntl.h>
- +#endif /* !_WIN32 */
- #include <fcntl.h>
- -//#include <sys/socket.h>
- -//#include <netinet/in.h>
- -//#include <netinet/tcp.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <netinet/in.h>
- +#include <netinet/tcp.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <errno.h>
- #include <string.h>
- #include <stdlib.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #ifndef _WIN32
- #include <syslog.h>
- #endif
- #include <rpc/rpc.h>
- #include <rpc/nettype.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- extern bool_t __rpc_is_local_host(const char *);
- diff --git a/libtirpc/src/clnt_raw.c b/libtirpc/src/clnt_raw.c
- index 245b7cf..5a9ba46 100644
- --- a/libtirpc/src/clnt_raw.c
- +++ b/libtirpc/src/clnt_raw.c
- @@ -37,7 +37,9 @@
- * any interference from the kernel.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #ifndef _WIN32
- #include <assert.h>
- diff --git a/libtirpc/src/clnt_simple.c b/libtirpc/src/clnt_simple.c
- index ae4f320..ae1f2bb 100644
- --- a/libtirpc/src/clnt_simple.c
- +++ b/libtirpc/src/clnt_simple.c
- @@ -29,23 +29,31 @@
- * Copyright (c) 1986-1991 by Sun Microsystems Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * clnt_simple.c
- * Simplified front end to client rpc.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <errno.h>
- #include <rpc/rpc.h>
- #include <string.h>
- #include <stdlib.h>
- #include <fcntl.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/clnt.h>
- diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
- index b72522c..b14382a 100644
- --- a/libtirpc/src/clnt_vc.c
- +++ b/libtirpc/src/clnt_vc.c
- @@ -69,27 +69,35 @@
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/poll.h>
- #ifndef _WIN32
- +#include <sys/poll.h>
- #include <sys/syslog.h>
- -#endif
- -//#include <sys/un.h>
- -//#include <sys/uio.h>
- -//#include <sys/socket.h>
- -//#include <arpa/inet.h>
- +#include <sys/un.h>
- +#include <sys/uio.h>
- +#include <sys/socket.h>
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- -//#include <signal.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#include <signal.h>
- +#endif /* !_WIN32 */
- #include <time.h>
- #include <rpc/rpc.h>
- diff --git a/libtirpc/src/crypt_client.c b/libtirpc/src/crypt_client.c
- index 73fa320..3e057af 100644
- --- a/libtirpc/src/crypt_client.c
- +++ b/libtirpc/src/crypt_client.c
- @@ -30,10 +30,14 @@
- * SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <sys/types.h>
- #include <rpc/des_crypt.h>
- #include <rpc/des.h>
- diff --git a/libtirpc/src/des_crypt.c b/libtirpc/src/des_crypt.c
- index 89f7266..88a88a4 100644
- --- a/libtirpc/src/des_crypt.c
- +++ b/libtirpc/src/des_crypt.c
- @@ -40,7 +40,9 @@
- static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
- #endif
- #endif
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * );
- int (*__des_crypt_LOCAL)() = 0;
- diff --git a/libtirpc/src/des_soft.c b/libtirpc/src/des_soft.c
- index 0e95334..39d0647 100644
- --- a/libtirpc/src/des_soft.c
- +++ b/libtirpc/src/des_soft.c
- @@ -1,4 +1,6 @@
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * Copyright (c) 2009, Sun Microsystems, Inc.
- diff --git a/libtirpc/src/getnetconfig.c b/libtirpc/src/getnetconfig.c
- index 6e7eb42..fd5b08e 100644
- --- a/libtirpc/src/getnetconfig.c
- +++ b/libtirpc/src/getnetconfig.c
- @@ -31,9 +31,13 @@
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <errno.h>
- #include <netconfig.h>
- @@ -41,7 +45,9 @@
- #include <stdlib.h>
- #include <string.h>
- #include <rpc/rpc.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- diff --git a/libtirpc/src/getnetpath.c b/libtirpc/src/getnetpath.c
- index a548fb6..47d5d3f 100644
- --- a/libtirpc/src/getnetpath.c
- +++ b/libtirpc/src/getnetpath.c
- @@ -25,13 +25,17 @@
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * Copyright (c) 1989 by Sun Microsystems, Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- #include <stdio.h>
- #include <errno.h>
- @@ -40,7 +44,7 @@
- #include <string.h>
- #ifndef _WIN32
- #include <syslog.h>
- -#endif
- +#endif /* !_WIN32 */
- /*
- * internal structure to keep track of a netpath "session"
- diff --git a/libtirpc/src/getpeereid.c b/libtirpc/src/getpeereid.c
- index c328b9c..1b078be 100644
- --- a/libtirpc/src/getpeereid.c
- +++ b/libtirpc/src/getpeereid.c
- @@ -24,15 +24,21 @@
- * SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- #include <rpc/types.h>
- -//#include <sys/param.h>
- -//#include <sys/socket.h>
- -//#include <sys/un.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#include <sys/socket.h>
- +#include <sys/un.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #ifdef _WIN32
- int
- diff --git a/libtirpc/src/getpublickey.c b/libtirpc/src/getpublickey.c
- index e0e555a..212a4cb 100644
- --- a/libtirpc/src/getpublickey.c
- +++ b/libtirpc/src/getpublickey.c
- @@ -40,7 +40,9 @@
- #include <wintirpc.h>
- #ifndef _WIN32
- #include <stdio.h>
- -//#include <pwd.h>
- +#ifndef _WIN32
- +#include <pwd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/key_prot.h>
- #include <rpcsvc/yp_prot.h>
- diff --git a/libtirpc/src/getrpcent.c b/libtirpc/src/getrpcent.c
- index 56cdcea..c4d51a5 100644
- --- a/libtirpc/src/getrpcent.c
- +++ b/libtirpc/src/getrpcent.c
- @@ -33,11 +33,15 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- -//#include <netinet/in.h>
- -//#include <arpa/inet.h>
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/getrpcport.c b/libtirpc/src/getrpcport.c
- index 4c0d644..af524b5 100644
- --- a/libtirpc/src/getrpcport.c
- +++ b/libtirpc/src/getrpcport.c
- @@ -33,10 +33,14 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <string.h>
- diff --git a/libtirpc/src/key_call.c b/libtirpc/src/key_call.c
- index 456196c..130971a 100644
- --- a/libtirpc/src/key_call.c
- +++ b/libtirpc/src/key_call.c
- @@ -30,7 +30,9 @@
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * key_call.c, Interface to keyserver
- diff --git a/libtirpc/src/key_prot_xdr.c b/libtirpc/src/key_prot_xdr.c
- index 451fd67..08ac79b 100644
- --- a/libtirpc/src/key_prot_xdr.c
- +++ b/libtirpc/src/key_prot_xdr.c
- @@ -40,7 +40,7 @@
- */
- /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
- -//#include <sys/cdefs.h>
- +#include <sys/cdefs.h>
- /*
- * Compiled from key_prot.x using rpcgen.
- @@ -176,4 +176,4 @@ xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
- }
- return (TRUE);
- }
- -#endif
- \ No newline at end of file
- +#endif /* !_WIN32 */
- \ No newline at end of file
- diff --git a/libtirpc/src/mt_misc.c b/libtirpc/src/mt_misc.c
- index 60038cf..46d0faf 100644
- --- a/libtirpc/src/mt_misc.c
- +++ b/libtirpc/src/mt_misc.c
- @@ -1,10 +1,14 @@
- #include <wintirpc.h>
- -//#include <sys/cdefs.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <rpc/rpc.h>
- -//#include <sys/time.h>
- +#ifndef _WIN32
- +#include <sys/time.h>
- +#endif /* !_WIN32 */
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/netname.c b/libtirpc/src/netname.c
- index cbf2396..7d183b0 100644
- --- a/libtirpc/src/netname.c
- +++ b/libtirpc/src/netname.c
- @@ -35,7 +35,9 @@
- */
- #include <wintirpc.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include "rpc_com.h"
- #ifdef YP
- @@ -47,7 +49,9 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #ifndef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
- diff --git a/libtirpc/src/pmap_clnt.c b/libtirpc/src/pmap_clnt.c
- index e5ed30b..5b6c151 100644
- --- a/libtirpc/src/pmap_clnt.c
- +++ b/libtirpc/src/pmap_clnt.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * pmap_clnt.c
- @@ -38,13 +40,17 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/pmap_prot.h>
- #include <rpc/pmap_clnt.h>
- #include <rpc/nettype.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- diff --git a/libtirpc/src/pmap_getmaps.c b/libtirpc/src/pmap_getmaps.c
- index eb236d3..a2280a3 100644
- --- a/libtirpc/src/pmap_getmaps.c
- +++ b/libtirpc/src/pmap_getmaps.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * pmap_getmap.c
- @@ -38,22 +40,29 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- -//#include <sys/ioctl.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <sys/ioctl.h>
- -//#include <arpa/inet.h>
- -//#include <net/if.h>
- +#include <arpa/inet.h>
- +#include <net/if.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- #include <errno.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#endif /* !_WIN32 */
- #include <stdio.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/pmap_prot.h>
- #include <rpc/pmap_clnt.h>
- -//#include <clnt_soc.h>
- +#ifndef _WIN32
- +#include <clnt_soc.h>
- +#endif /* !_WIN32 */
- #define NAMELEN 255
- #define MAX_BROADCAST_SIZE 1400
- diff --git a/libtirpc/src/pmap_getport.c b/libtirpc/src/pmap_getport.c
- index 7ecd6e9..9839515 100644
- --- a/libtirpc/src/pmap_getport.c
- +++ b/libtirpc/src/pmap_getport.c
- @@ -28,13 +28,17 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- -//#include <arpa/inet.h>
- -//#include <net/if.h>
- +#include <arpa/inet.h>
- +#include <net/if.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/pmap_prot.h>
- diff --git a/libtirpc/src/pmap_rmt.c b/libtirpc/src/pmap_rmt.c
- index 61477cc..269e7dc 100644
- --- a/libtirpc/src/pmap_rmt.c
- +++ b/libtirpc/src/pmap_rmt.c
- @@ -36,20 +36,26 @@
- #include <wintirpc.h>
- #include <sys/types.h>
- -//#include <sys/ioctl.h>
- -//#include <sys/poll.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/ioctl.h>
- +#include <sys/poll.h>
- +#include <sys/socket.h>
- -//#include <net/if.h>
- -//#include <netinet/in.h>
- -//#include <arpa/inet.h>
- +#include <net/if.h>
- +#include <netinet/in.h>
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <stdio.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/pmap_prot.h>
- @@ -57,7 +63,9 @@
- #include <rpc/pmap_rmt.h>
- // For the clnttcp_create function
- -//#include <clnt_soc.h>
- +#ifndef _WIN32
- +#include <clnt_soc.h>
- +#endif /* !_WIN32 */
- static const struct timeval timeout = { 3, 0 };
- diff --git a/libtirpc/src/rpc_callmsg.c b/libtirpc/src/rpc_callmsg.c
- index f18b606..b40c870 100644
- --- a/libtirpc/src/rpc_callmsg.c
- +++ b/libtirpc/src/rpc_callmsg.c
- @@ -41,7 +41,9 @@
- #include <rpc/rpc.h>
- #include <rpc/xdr.h>
- -//#include <sys/select.h>
- +#ifndef _WIN32
- +#include <sys/select.h>
- +#endif /* !_WIN32 */
- /*
- * XDR a call message
- diff --git a/libtirpc/src/rpc_com.h b/libtirpc/src/rpc_com.h
- index ff9db44..28bb986 100644
- --- a/libtirpc/src/rpc_com.h
- +++ b/libtirpc/src/rpc_com.h
- @@ -40,7 +40,9 @@
- #ifndef _TIRPC_RPCCOM_H
- #define _TIRPC_RPCCOM_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */
- diff --git a/libtirpc/src/rpc_dtablesize.c b/libtirpc/src/rpc_dtablesize.c
- index 0541f58..48f05a5 100644
- --- a/libtirpc/src/rpc_dtablesize.c
- +++ b/libtirpc/src/rpc_dtablesize.c
- @@ -27,9 +27,11 @@
- */
- #include <wintirpc.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- -//#include <sys/select.h>
- +#include <sys/select.h>
- +#endif /* !_WIN32 */
- int _rpc_dtablesize(void); /* XXX */
- diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
- index 75a5a15..23ac77f 100644
- --- a/libtirpc/src/rpc_generic.c
- +++ b/libtirpc/src/rpc_generic.c
- @@ -29,28 +29,38 @@
- * Copyright (c) 1986-1991 by Sun Microsystems Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * rpc_generic.c, Miscl routines for RPC.
- *
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/param.h>
- -//#include <sys/socket.h>
- -//#include <sys/time.h>
- -//#include <sys/un.h>
- -//#include <sys/resource.h>
- -//#include <netinet/in.h>
- -//#include <arpa/inet.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#include <sys/socket.h>
- +#include <sys/time.h>
- +#include <sys/un.h>
- +#include <sys/resource.h>
- +#include <netinet/in.h>
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- -//#include <ctype.h>
- -//#include <stddef.h>
- +#ifndef _WIN32
- +#include <ctype.h>
- +#include <stddef.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #include <netconfig.h>
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/rpc_prot.c b/libtirpc/src/rpc_prot.c
- index 2605614..e5bdcf6 100644
- --- a/libtirpc/src/rpc_prot.c
- +++ b/libtirpc/src/rpc_prot.c
- @@ -63,7 +63,9 @@
- */
- #include <wintirpc.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- diff --git a/libtirpc/src/rpc_soc.c b/libtirpc/src/rpc_soc.c
- index 2eaca7e..98b0118 100644
- --- a/libtirpc/src/rpc_soc.c
- +++ b/libtirpc/src/rpc_soc.c
- @@ -44,10 +44,14 @@
- * of TLI/Streams
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <rpc/rpc.h>
- #include <rpc/pmap_clnt.h>
- @@ -56,12 +60,16 @@
- #ifndef _WIN32
- #include <syslog.h>
- #endif
- -//#include <netinet/in.h>
- -//#include <netdb.h>
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#include <netdb.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- diff --git a/libtirpc/src/rpcb_clnt.c b/libtirpc/src/rpcb_clnt.c
- index 6ab9055..a168f67 100644
- --- a/libtirpc/src/rpcb_clnt.c
- +++ b/libtirpc/src/rpcb_clnt.c
- @@ -36,29 +36,35 @@
- * Copyright (C) 1988, Sun Microsystems, Inc.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- -//#include <sys/un.h>
- -//#include <sys/utsname.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <sys/un.h>
- +#include <sys/utsname.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/rpcb_prot.h>
- #include <rpc/nettype.h>
- #include <netconfig.h>
- #ifdef PORTMAP
- -//#include <netinet/in.h> /* FOR IPPROTO_TCP/UDP definitions */
- +#ifndef _WIN32
- +#include <netinet/in.h> /* FOR IPPROTO_TCP/UDP definitions */
- +#endif /* !_WIN32 */
- #include <rpc/pmap_prot.h>
- #endif /* PORTMAP */
- #include <stdio.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- -//#include <netdb.h>
- #ifndef _WIN32
- +#include <unistd.h>
- +#include <netdb.h>
- #include <syslog.h>
- -#endif
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- diff --git a/libtirpc/src/rpcb_prot.c b/libtirpc/src/rpcb_prot.c
- index c789b2f..6b8d38b 100644
- --- a/libtirpc/src/rpcb_prot.c
- +++ b/libtirpc/src/rpcb_prot.c
- @@ -44,7 +44,7 @@
- #include <rpc/rpcb_prot.h>
- #ifdef _WIN32 // CVE-2017-8779
- #include "rpc_com.h"
- -#endif
- +#endif /* _WIN32 */
- bool_t
- xdr_rpcb(
- diff --git a/libtirpc/src/rpcb_st_xdr.c b/libtirpc/src/rpcb_st_xdr.c
- index e5a431c..adca935 100644
- --- a/libtirpc/src/rpcb_st_xdr.c
- +++ b/libtirpc/src/rpcb_st_xdr.c
- @@ -35,13 +35,15 @@
- * routines used with the rpcbind stats facility.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- #include <rpc/rpc.h>
- #ifdef _WIN32 // CVE-2017-8779
- #include "rpc_com.h"
- -#endif
- +#endif /* _WIN32 */
- /* Link list of all the stats about getport and getaddr */
- diff --git a/libtirpc/src/rpcdname.c b/libtirpc/src/rpcdname.c
- index 37617c5..bf5440d 100644
- --- a/libtirpc/src/rpcdname.c
- +++ b/libtirpc/src/rpcdname.c
- @@ -25,7 +25,9 @@
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * rpcdname.c
- @@ -34,7 +36,9 @@
- #include <wintirpc.h>
- #include <stdlib.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- static char *default_domain = NULL;
- diff --git a/libtirpc/src/rtime.c b/libtirpc/src/rtime.c
- index 4a6ac15..7894361 100644
- --- a/libtirpc/src/rtime.c
- +++ b/libtirpc/src/rtime.c
- @@ -41,18 +41,26 @@
- * what unix uses.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- -//#include <sys/time.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <sys/time.h>
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- -//#include <netdb.h>
- -//#include <sys/select.h>
- +#ifndef _WIN32
- +#include <netdb.h>
- +#include <sys/select.h>
- +#endif /* !_WIN32 */
- extern int _rpc_dtablesize( void );
- diff --git a/libtirpc/src/svc.c b/libtirpc/src/svc.c
- index e2fa30a..8c5a210 100644
- --- a/libtirpc/src/svc.c
- +++ b/libtirpc/src/svc.c
- @@ -37,11 +37,15 @@
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/poll.h>
- +#ifndef _WIN32
- +#include <sys/poll.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- #include <errno.h>
- #include <stdlib.h>
- diff --git a/libtirpc/src/svc_auth.c b/libtirpc/src/svc_auth.c
- index 0651b3e..b6e9f68 100644
- --- a/libtirpc/src/svc_auth.c
- +++ b/libtirpc/src/svc_auth.c
- @@ -35,7 +35,9 @@
- *
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- #include <rpc/rpc.h>
- diff --git a/libtirpc/src/svc_auth_des.c b/libtirpc/src/svc_auth_des.c
- index 75736a6..73fb004 100644
- --- a/libtirpc/src/svc_auth_des.c
- +++ b/libtirpc/src/svc_auth_des.c
- @@ -45,15 +45,21 @@
- *
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <string.h>
- #include <stdlib.h>
- #include <stdio.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/des_crypt.h>
- -//#include <sys/param.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- #include <rpc/types.h>
- #include <rpc/xdr.h>
- #include <rpc/auth.h>
- diff --git a/libtirpc/src/svc_auth_unix.c b/libtirpc/src/svc_auth_unix.c
- index 90c59bd..27598e6 100644
- --- a/libtirpc/src/svc_auth_unix.c
- +++ b/libtirpc/src/svc_auth_unix.c
- @@ -37,7 +37,9 @@
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <assert.h>
- #include <stdio.h>
- #include <string.h>
- diff --git a/libtirpc/src/svc_dg.c b/libtirpc/src/svc_dg.c
- index d07d569..d172dfd 100644
- --- a/libtirpc/src/svc_dg.c
- +++ b/libtirpc/src/svc_dg.c
- @@ -31,7 +31,9 @@
- * Copyright (c) 1986-1991 by Sun Microsystems Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * svc_dg.c, Server side for connectionless RPC.
- @@ -39,14 +41,20 @@
- * Does some caching in the hopes of achieving execute-at-most-once semantics.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/svc_dg.h>
- #include <errno.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- @@ -54,7 +62,9 @@
- #include <netconfig.h>
- #include <netdir.h>
- #endif
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- diff --git a/libtirpc/src/svc_generic.c b/libtirpc/src/svc_generic.c
- index 762123b..5a0e65e 100644
- --- a/libtirpc/src/svc_generic.c
- +++ b/libtirpc/src/svc_generic.c
- @@ -36,19 +36,25 @@
- *
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- -//#include <sys/socket.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include <rpc/nettype.h>
- #include <stdio.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- #include <rpc/svc.h>
- diff --git a/libtirpc/src/svc_raw.c b/libtirpc/src/svc_raw.c
- index 55e29ac..d3e2e97 100644
- --- a/libtirpc/src/svc_raw.c
- +++ b/libtirpc/src/svc_raw.c
- @@ -38,7 +38,9 @@
- *
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <rpc/rpc.h>
- #include <sys/types.h>
- diff --git a/libtirpc/src/svc_run.c b/libtirpc/src/svc_run.c
- index a525a35..bfab92e 100644
- --- a/libtirpc/src/svc_run.c
- +++ b/libtirpc/src/svc_run.c
- @@ -31,18 +31,26 @@
- * Wait for input, call server program.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <rpc/rpc.h>
- #include <stdio.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #include "rpc_com.h"
- -//#include <sys/select.h>
- +#ifndef _WIN32
- +#include <sys/select.h>
- +#endif /* !_WIN32 */
- void
- svc_run()
- diff --git a/libtirpc/src/svc_simple.c b/libtirpc/src/svc_simple.c
- index 925089c..f4bc47a 100644
- --- a/libtirpc/src/svc_simple.c
- +++ b/libtirpc/src/svc_simple.c
- @@ -29,7 +29,9 @@
- * Copyright (c) 1986-1991 by Sun Microsystems Inc.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * svc_simple.c
- @@ -43,7 +45,9 @@
- * for the given prognum and procnum.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- #include <sys/types.h>
- #include <rpc/rpc.h>
- @@ -51,7 +55,10 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <err.h>
- +#include <wintirpc.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include "rpc_com.h"
- diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
- index 05640e7..e6e8355 100644
- --- a/libtirpc/src/svc_vc.c
- +++ b/libtirpc/src/svc_vc.c
- @@ -27,7 +27,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * svc_vc.c, Server side for Connection Oriented based RPC.
- @@ -37,17 +39,23 @@
- * and a record/tcp stream.
- */
- #include <wintirpc.h>
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <reentrant.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <sys/types.h>
- -//#include <sys/param.h>
- -//#include <sys/poll.h>
- -//#include <sys/un.h>
- -//#include <sys/time.h>
- -//#include <sys/uio.h>
- -//#include <netinet/in.h>
- -//#include <netinet/tcp.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#include <sys/poll.h>
- +#include <sys/un.h>
- +#include <sys/time.h>
- +#include <sys/uio.h>
- +#include <netinet/in.h>
- +#include <netinet/tcp.h>
- +#endif /* !_WIN32 */
- #ifndef _WIN32
- #include <assert.h>
- @@ -58,7 +66,9 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
- index d9f4d4c..81acb3c 100644
- --- a/libtirpc/src/wintirpc.c
- +++ b/libtirpc/src/wintirpc.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- diff --git a/libtirpc/src/xdr.c b/libtirpc/src/xdr.c
- index 51e58ac..464ff71 100644
- --- a/libtirpc/src/xdr.c
- +++ b/libtirpc/src/xdr.c
- @@ -38,7 +38,9 @@
- */
- #include <wintirpc.h>
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/xdr_array.c b/libtirpc/src/xdr_array.c
- index 0f68b9d..b78be10 100644
- --- a/libtirpc/src/xdr_array.c
- +++ b/libtirpc/src/xdr_array.c
- @@ -27,7 +27,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_array.c, Generic XDR routines impelmentation.
- @@ -40,8 +42,10 @@
- #include <wintirpc.h>
- #include "namespace.h"
- -//#include <err.h>
- -//#include <limits.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#include <limits.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/xdr_float.c b/libtirpc/src/xdr_float.c
- index 095236e..6410b22 100644
- --- a/libtirpc/src/xdr_float.c
- +++ b/libtirpc/src/xdr_float.c
- @@ -27,7 +27,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_float.c, Generic XDR routines implementation.
- @@ -42,7 +44,9 @@
- #include <wintirpc.h>
- #include "namespace.h"
- #include <sys/types.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- diff --git a/libtirpc/src/xdr_mem.c b/libtirpc/src/xdr_mem.c
- index 59a2ac0..4553c41 100644
- --- a/libtirpc/src/xdr_mem.c
- +++ b/libtirpc/src/xdr_mem.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_mem.h, XDR implementation using memory buffers.
- @@ -43,7 +45,9 @@
- #include "namespace.h"
- #include <sys/types.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- #include <string.h>
- diff --git a/libtirpc/src/xdr_rec.c b/libtirpc/src/xdr_rec.c
- index 5fe0cfc..16ee72a 100644
- --- a/libtirpc/src/xdr_rec.c
- +++ b/libtirpc/src/xdr_rec.c
- @@ -26,8 +26,10 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
- @@ -47,10 +49,12 @@
- */
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -71,9 +75,13 @@
- #include <io.h>
- #include <sys/types.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- @@ -86,7 +94,9 @@
- #include <rpc/clnt.h>
- #include <stddef.h>
- #include "rpc_com.h"
- -//#include <unistd.h>
- +#ifndef _WIN32
- +#include <unistd.h>
- +#endif /* !_WIN32 */
- static bool_t xdrrec_getlong(XDR *, long *);
- static bool_t xdrrec_putlong(XDR *, const long *);
- static bool_t xdrrec_getbytes(XDR *, char *, u_int);
- diff --git a/libtirpc/src/xdr_reference.c b/libtirpc/src/xdr_reference.c
- index 601a27a..00dd283 100644
- --- a/libtirpc/src/xdr_reference.c
- +++ b/libtirpc/src/xdr_reference.c
- @@ -26,8 +26,10 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_reference.c, Generic XDR routines impelmentation.
- @@ -40,7 +42,9 @@
- #include <wintirpc.h>
- #include "namespace.h"
- -//#include <err.h>
- +#ifndef _WIN32
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- diff --git a/libtirpc/src/xdr_sizeof.c b/libtirpc/src/xdr_sizeof.c
- index 69243c1..1ad25fc 100644
- --- a/libtirpc/src/xdr_sizeof.c
- +++ b/libtirpc/src/xdr_sizeof.c
- @@ -34,7 +34,9 @@
- * when serialized using XDR.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <wintirpc.h>
- #include "namespace.h"
- diff --git a/libtirpc/src/xdr_stdio.c b/libtirpc/src/xdr_stdio.c
- index 4052860..1da79a8 100644
- --- a/libtirpc/src/xdr_stdio.c
- +++ b/libtirpc/src/xdr_stdio.c
- @@ -26,7 +26,9 @@
- * POSSIBILITY OF SUCH DAMAGE.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * xdr_stdio.c, XDR implementation on standard i/o file.
- @@ -42,7 +44,9 @@
- #include "namespace.h"
- #include <stdio.h>
- -//#include <arpa/inet.h>
- +#ifndef _WIN32
- +#include <arpa/inet.h>
- +#endif /* !_WIN32 */
- #include <rpc/types.h>
- #include <rpc/xdr.h>
- #include "un-namespace.h"
- diff --git a/libtirpc/tirpc/misc/event.h b/libtirpc/tirpc/misc/event.h
- index ca21c2f..7875ca8 100644
- --- a/libtirpc/tirpc/misc/event.h
- +++ b/libtirpc/tirpc/misc/event.h
- @@ -186,7 +186,9 @@ extern int kqueue_del_filteropts(int filt);
- #else /* !_KERNEL */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- struct timespec;
- __BEGIN_DECLS
- diff --git a/libtirpc/tirpc/netconfig.h b/libtirpc/tirpc/netconfig.h
- index 9182b5d..6ebb70d 100644
- --- a/libtirpc/tirpc/netconfig.h
- +++ b/libtirpc/tirpc/netconfig.h
- @@ -1,9 +1,11 @@
- #ifndef _NETCONFIG_H_
- #define _NETCONFIG_H_
- -//#include <features.h>
- +#ifndef _WIN32
- +#include <features.h>
- +#endif /* !_WIN32 */
- -// XXX Should be in, or come from, the registry!!!
- +/* XXX Should be in, or come from, the registry!!! */
- #define NETCONFIG "c:\\etc\\netconfig"
- #define NETPATH "NETPATH"
- diff --git a/libtirpc/tirpc/reentrant.h b/libtirpc/tirpc/reentrant.h
- index 08024db..a157b2e 100644
- --- a/libtirpc/tirpc/reentrant.h
- +++ b/libtirpc/tirpc/reentrant.h
- @@ -88,7 +88,8 @@
- */
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -111,7 +112,9 @@
- #ifndef _REENTRANT_H
- #define _REENTRANT_H
- -//#include <pthread.h>
- +#ifndef _WIN32
- +#include <pthread.h>
- +#endif /* !_WIN32 */
- #include <libc_private.h>
- #include <stdlib.h>
- diff --git a/libtirpc/tirpc/rpc/auth.h b/libtirpc/tirpc/rpc/auth.h
- index bfea084..2dbafe6 100644
- --- a/libtirpc/tirpc/rpc/auth.h
- +++ b/libtirpc/tirpc/rpc/auth.h
- @@ -44,10 +44,12 @@
- */
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -69,8 +71,10 @@
- #include <rpc/xdr.h>
- #include <rpc/clnt_stat.h>
- -//#include <sys/cdefs.h>
- -//#include <sys/socket.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#include <sys/socket.h>
- +#endif /* !_WIN32 */
- #include <sys/types.h>
- diff --git a/libtirpc/tirpc/rpc/auth_unix.h b/libtirpc/tirpc/rpc/auth_unix.h
- index 2adf21a..9d9f059 100644
- --- a/libtirpc/tirpc/rpc/auth_unix.h
- +++ b/libtirpc/tirpc/rpc/auth_unix.h
- @@ -45,7 +45,9 @@
- #ifndef _TIRPC_AUTH_UNIX_H
- #define _TIRPC_AUTH_UNIX_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /* The machine name is part of a credential; it may not exceed 255 bytes */
- #define MAX_MACHINE_NAME 255
- diff --git a/libtirpc/tirpc/rpc/clnt.h b/libtirpc/tirpc/rpc/clnt.h
- index f511f8b..6d5e353 100644
- --- a/libtirpc/tirpc/rpc/clnt.h
- +++ b/libtirpc/tirpc/rpc/clnt.h
- @@ -40,10 +40,12 @@
- */
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-25 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -63,13 +65,17 @@
- #ifndef _TIRPC_CLNT_H_
- #define _TIRPC_CLNT_H_
- -//#include <rpc/clnt_stat.h>
- +#ifndef _WIN32
- +#include <rpc/clnt_stat.h>
- +#endif /* !_WIN32 */
- #include "clnt_stat.h"
- #include <rpc/auth.h>
- -//#include <sys/cdefs.h>
- -//#include <netconfig.h>
- -//#include <sys/un.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#include <netconfig.h>
- +#include <sys/un.h>
- +#endif /* !_WIN32 */
- /*
- * Well-known IPV6 RPC broadcast address.
- diff --git a/libtirpc/tirpc/rpc/clnt_soc.h b/libtirpc/tirpc/rpc/clnt_soc.h
- index 4cf4d78..172ef61 100644
- --- a/libtirpc/tirpc/rpc/clnt_soc.h
- +++ b/libtirpc/tirpc/rpc/clnt_soc.h
- @@ -46,7 +46,9 @@
- * with TS-RPC.
- */
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
- diff --git a/libtirpc/tirpc/rpc/des_crypt.h b/libtirpc/tirpc/rpc/des_crypt.h
- index d4bd825..d7be062 100644
- --- a/libtirpc/tirpc/rpc/des_crypt.h
- +++ b/libtirpc/tirpc/rpc/des_crypt.h
- @@ -43,7 +43,9 @@
- #ifndef _DES_DES_CRYPT_H
- #define _DES_DES_CRYPT_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <rpc/rpc.h>
- #define DES_MAXDATA 8192 /* max bytes encrypted in one call */
- diff --git a/libtirpc/tirpc/rpc/pmap_clnt.h b/libtirpc/tirpc/rpc/pmap_clnt.h
- index 98ac4fd..9df2e44 100644
- --- a/libtirpc/tirpc/rpc/pmap_clnt.h
- +++ b/libtirpc/tirpc/rpc/pmap_clnt.h
- @@ -63,7 +63,9 @@
- #ifndef _RPC_PMAP_CLNT_H_
- #define _RPC_PMAP_CLNT_H_
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- __BEGIN_DECLS
- extern bool_t pmap_set(u_long, u_long, int, int);
- diff --git a/libtirpc/tirpc/rpc/pmap_prot.h b/libtirpc/tirpc/rpc/pmap_prot.h
- index 27fae0c..3389b51 100644
- --- a/libtirpc/tirpc/rpc/pmap_prot.h
- +++ b/libtirpc/tirpc/rpc/pmap_prot.h
- @@ -71,7 +71,10 @@
- #ifndef _RPC_PMAP_PROT_H
- #define _RPC_PMAP_PROT_H
- -//#include <sys/cdefs.h>
- +
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #define PMAPPORT ((u_short)111)
- #define PMAPPROG ((u_long)100000)
- diff --git a/libtirpc/tirpc/rpc/pmap_rmt.h b/libtirpc/tirpc/rpc/pmap_rmt.h
- index bb9591d..02b4ba3 100644
- --- a/libtirpc/tirpc/rpc/pmap_rmt.h
- +++ b/libtirpc/tirpc/rpc/pmap_rmt.h
- @@ -41,7 +41,9 @@
- #ifndef _RPC_PMAP_RMT_H
- #define _RPC_PMAP_RMT_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- struct rmtcallargs {
- u_long prog, vers, proc, arglen;
- diff --git a/libtirpc/tirpc/rpc/rpc.h b/libtirpc/tirpc/rpc/rpc.h
- index e136149..6759fc5 100644
- --- a/libtirpc/tirpc/rpc/rpc.h
- +++ b/libtirpc/tirpc/rpc/rpc.h
- @@ -37,8 +37,10 @@
- #include <rpc/types.h> /* some typedefs */
- #include "winsock2.h"
- -//#include <sys/socket.h>
- -//#include <netinet/in.h>
- +#ifndef _WIN32
- +#include <sys/socket.h>
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- /* external data representation interfaces */
- #include <rpc/xdr.h> /* generic (de)serializer */
- diff --git a/libtirpc/tirpc/rpc/rpc_com.h b/libtirpc/tirpc/rpc/rpc_com.h
- index 096cf23..37f36a5 100644
- --- a/libtirpc/tirpc/rpc/rpc_com.h
- +++ b/libtirpc/tirpc/rpc/rpc_com.h
- @@ -41,7 +41,9 @@
- #ifndef _RPC_RPCCOM_H
- #define _RPC_RPCCOM_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */
- diff --git a/libtirpc/tirpc/rpc/svc.h b/libtirpc/tirpc/rpc/svc.h
- index 6f83fd5..b523d3b 100644
- --- a/libtirpc/tirpc/rpc/svc.h
- +++ b/libtirpc/tirpc/rpc/svc.h
- @@ -40,7 +40,9 @@
- #ifndef _TIRPC_SVC_H
- #define _TIRPC_SVC_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /*
- * This interface must manage two items concerning remote procedure calling:
- diff --git a/libtirpc/tirpc/rpc/svc_soc.h b/libtirpc/tirpc/rpc/svc_soc.h
- index d21f1ab..2bbfddb 100644
- --- a/libtirpc/tirpc/rpc/svc_soc.h
- +++ b/libtirpc/tirpc/rpc/svc_soc.h
- @@ -38,7 +38,9 @@
- #ifndef _RPC_SVC_SOC_H
- #define _RPC_SVC_SOC_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- /* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */
- /* svc_soc.h 1.8 89/05/01 SMI */
- diff --git a/libtirpc/tirpc/rpc/types.h b/libtirpc/tirpc/rpc/types.h
- index 2f595f7..4abeceb 100644
- --- a/libtirpc/tirpc/rpc/types.h
- +++ b/libtirpc/tirpc/rpc/types.h
- @@ -67,8 +67,10 @@
- #endif /* !_WIN32 */
- #ifdef _WIN32
- -// Windows mappings of data types
- -// Fixed size things
- +/*
- + * Windows mappings of data types
- + * Fixed size things
- + */
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef INT32 int32_t;
- @@ -82,7 +84,7 @@ typedef UINT32 uint32_t;
- typedef UINT64 u_int64_t;
- typedef UINT64 uint64_t;
- typedef PCHAR caddr_t;
- -// Scalable things
- +/* Scalable things */
- typedef UCHAR u_char;
- typedef unsigned short u_short;
- typedef UINT32 u_int;
- @@ -95,7 +97,9 @@ typedef UINT uid_t;
- typedef UINT gid_t;
- typedef DWORD pid_t;
- -//typedef SIZE_T size_t; //This is causing a "benign redefinition error"
- +#if 0
- +typedef SIZE_T size_t; /* This is causing a "benign redefinition error" */
- +#endif
- typedef SSIZE_T ssize_t;
- #endif /* _WIN32 */
- @@ -124,8 +128,10 @@ typedef int32_t rpc_inline_t;
- #define mem_alloc(bsize) calloc(1, bsize)
- #define mem_free(ptr, bsize) free(ptr)
- -//#include <sys/time.h>
- -//#include <sys/param.h>
- +#ifndef _WIN32
- +#include <sys/time.h>
- +#include <sys/param.h>
- +#endif /* !_WIN32 */
- #include <stdlib.h>
- #include <netconfig.h>
- diff --git a/libtirpc/tirpc/rpc/xdr.h b/libtirpc/tirpc/rpc/xdr.h
- index 39782d7..be14dd6 100644
- --- a/libtirpc/tirpc/rpc/xdr.h
- +++ b/libtirpc/tirpc/rpc/xdr.h
- @@ -40,10 +40,14 @@
- #ifndef _TIRPC_XDR_H
- #define _TIRPC_XDR_H
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- -//#include <netinet/in.h>
- -// Rajout pour la definition des types
- +#ifndef _WIN32
- +#include <netinet/in.h>
- +#endif /* !_WIN32 */
- +/* Rajout pour la definition des types */
- #include <rpc/types.h>
- /*
- diff --git a/libtirpc/tirpc/spinlock.h b/libtirpc/tirpc/spinlock.h
- index 8c65ab5..31a9103 100644
- --- a/libtirpc/tirpc/spinlock.h
- +++ b/libtirpc/tirpc/spinlock.h
- @@ -37,7 +37,9 @@
- #ifndef _SPINLOCK_H_
- #define _SPINLOCK_H_
- -//#include <sys/cdefs.h>
- +#ifndef _WIN32
- +#include <sys/cdefs.h>
- +#endif /* !_WIN32 */
- #include <sys/types.h>
- /*
- --
- 2.45.4
- From 04914f111700daddeeb7d5a4c14b743850b7d6e4 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 2 Sep 2025 19:23:34 +0200
- Subject: [PATCH 2/2] libtirpc: Remove non-CVE code which is no longer in
- upstream libtirpc
- Remove non-CVE code which is no longer in upstream libtirpc.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- libtirpc/src/rpc_generic.c | 6 ------
- libtirpc/src/rpcb_prot.c | 38 --------------------------------------
- libtirpc/src/rpcb_st_xdr.c | 18 ------------------
- libtirpc/src/svc_vc.c | 16 ----------------
- 4 files changed, 78 deletions(-)
- diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
- index 23ac77f..b9a6726 100644
- --- a/libtirpc/src/rpc_generic.c
- +++ b/libtirpc/src/rpc_generic.c
- @@ -665,11 +665,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
- switch (af) {
- case AF_INET:
- -#ifdef _WIN32 // CVE-2017-8779
- if (nbuf->len < sizeof(*sin)) {
- return NULL;
- }
- -#endif
- sin = nbuf->buf;
- if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf)
- == NULL)
- @@ -681,11 +679,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
- break;
- #ifdef INET6
- case AF_INET6:
- -#ifdef _WIN32 // CVE-2017-8779
- if (nbuf->len < sizeof(*sin6)) {
- return NULL;
- }
- -#endif
- sin6 = nbuf->buf;
- if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6)
- == NULL)
- @@ -732,10 +728,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
- port = 0;
- sin = NULL;
- -#ifdef _WIN32 // CVE-2017-8779
- if (uaddr == NULL)
- return NULL;
- -#endif
- addrstr = strdup(uaddr);
- if (addrstr == NULL)
- return NULL;
- diff --git a/libtirpc/src/rpcb_prot.c b/libtirpc/src/rpcb_prot.c
- index 6b8d38b..7f6c323 100644
- --- a/libtirpc/src/rpcb_prot.c
- +++ b/libtirpc/src/rpcb_prot.c
- @@ -42,9 +42,7 @@
- #include <rpc/types.h>
- #include <rpc/xdr.h>
- #include <rpc/rpcb_prot.h>
- -#ifdef _WIN32 // CVE-2017-8779
- #include "rpc_com.h"
- -#endif /* _WIN32 */
- bool_t
- xdr_rpcb(
- @@ -57,17 +55,6 @@ xdr_rpcb(
- if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
- return (FALSE);
- }
- -#ifndef _WIN32 // CVE-2017-8779
- - if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
- - return (FALSE);
- - }
- - if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) {
- - return (FALSE);
- - }
- - if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) {
- - return (FALSE);
- - }
- -#else
- if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- @@ -77,7 +64,6 @@ xdr_rpcb(
- if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- -#endif
- return (TRUE);
- }
- @@ -175,39 +161,21 @@ xdr_rpcb_entry(
- XDR *xdrs,
- rpcb_entry *objp)
- {
- -#ifndef _WIN32 // CVE-2017-8779
- - if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
- - return (FALSE);
- - }
- - if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) {
- - return (FALSE);
- - }
- -#else
- if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- -#endif
- if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) {
- return (FALSE);
- }
- -#ifndef _WIN32 // CVE-2017-8779
- - if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) {
- - return (FALSE);
- - }
- - if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) {
- - return (FALSE);
- - }
- -#else
- if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) {
- return (FALSE);
- }
- -#endif
- return (TRUE);
- }
- @@ -326,11 +294,7 @@ xdr_rpcb_rmtcallres(
- bool_t dummy;
- struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
- -#ifdef _WIN32 // CVE-2017-8779
- if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) {
- -#else
- - if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) {
- -#endif
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->results.results_len)) {
- @@ -350,13 +314,11 @@ xdr_netbuf(
- if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) {
- return (FALSE);
- }
- -#ifdef _WIN32 // CVE-2017-8779
- if (objp->maxlen > RPC_MAXDATASIZE) {
- return (FALSE);
- }
- -#endif
- dummy = xdr_bytes(xdrs, (char **)&(objp->buf),
- (u_int *)&(objp->len), objp->maxlen);
- return (dummy);
- diff --git a/libtirpc/src/rpcb_st_xdr.c b/libtirpc/src/rpcb_st_xdr.c
- index adca935..cf15bac 100644
- --- a/libtirpc/src/rpcb_st_xdr.c
- +++ b/libtirpc/src/rpcb_st_xdr.c
- @@ -41,9 +41,7 @@
- #include <wintirpc.h>
- #include <rpc/rpc.h>
- -#ifdef _WIN32 // CVE-2017-8779
- #include "rpc_com.h"
- -#endif /* _WIN32 */
- /* Link list of all the stats about getport and getaddr */
- @@ -65,11 +63,7 @@ xdr_rpcbs_addrlist(
- if (!xdr_int(xdrs, &objp->failure)) {
- return (FALSE);
- }
- -#ifdef _WIN32 // CVE-2017-8779
- if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
- -#else
- - if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
- -#endif
- return (FALSE);
- }
- @@ -120,11 +114,7 @@ xdr_rpcbs_rmtcalllist(
- IXDR_PUT_INT32(buf, objp->failure);
- IXDR_PUT_INT32(buf, objp->indirect);
- }
- -#ifdef _WIN32 // CVE-2017-8779
- if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
- -#else
- - if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
- -#endif
- return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->next,
- @@ -162,11 +152,7 @@ xdr_rpcbs_rmtcalllist(
- objp->failure = (int)IXDR_GET_INT32(buf);
- objp->indirect = (int)IXDR_GET_INT32(buf);
- }
- -#ifdef _WIN32 // CVE-2017-8779
- if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
- -#else
- - if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
- -#endif
- return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->next,
- @@ -194,11 +180,7 @@ xdr_rpcbs_rmtcalllist(
- if (!xdr_int(xdrs, &objp->indirect)) {
- return (FALSE);
- }
- -#ifdef _WIN32 // CVE-2017-8779
- if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
- -#else
- - if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
- -#endif
- return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->next,
- diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
- index e6e8355..df06002 100644
- --- a/libtirpc/src/svc_vc.c
- +++ b/libtirpc/src/svc_vc.c
- @@ -324,9 +324,6 @@ rendezvous_request(
- socklen_t len;
- struct __rpc_sockinfo si;
- SVCXPRT *newxprt;
- -#ifndef _WIN32 // CVE-2018-14621
- - fd_set cleanfds;
- -#endif
- assert(xprt != NULL);
- assert(msg != NULL);
- @@ -338,17 +335,6 @@ again:
- &len)) == SOCKET_ERROR) {
- if (errno == EINTR)
- goto again;
- -#ifndef _WIN32 // CVE-2018-14621
- - /*
- - * Clean out the most idle file descriptor when we're
- - * running out.
- - */
- - if (errno == EMFILE || errno == ENFILE) {
- - cleanfds = svc_fdset;
- - __svc_clean_idle(&cleanfds, 0, FALSE);
- - goto again;
- - }
- -#endif
- return (FALSE);
- }
- /*
- @@ -356,10 +342,8 @@ again:
- */
- newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
- -#ifdef _WIN32 // CVE-2018-14622
- if (!newxprt)
- return (FALSE);
- -#endif
- if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
- return (FALSE);
- --
- 2.45.4
msnfs41client: Patches for libtirpc cleanup, 2025-09-02
Posted by Anonymous on Tue 2nd Sep 2025 19:07
raw | new post
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.