Commit | Line | Data |
---|---|---|
3dbfab47 RW |
1 | This is a combination of two patches: |
2 | ||
3 | 1) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/03-kfreebsd.diff | |
4 | ||
5 | Description: Fix build on non Linux architectures | |
6 | Author: Andreas Beckmann <anbe@debian.org> | |
7 | Last-Update: 2019-09-01 | |
8 | ||
9 | 2) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/05-hurd-port.diff | |
10 | ||
11 | Description: Get source building on Hurd | |
12 | - Look for <sys/user.h> before using it. | |
13 | - Define MAXHOSTNAMELEN to 64 if missing. | |
14 | - Bind sockets on Hurd like on Linux. | |
15 | Author: Petter Reinholdtsen <pere@hungry.com> | |
16 | ||
17 | --- a/src/svc_dg.c | |
18 | +++ b/src/svc_dg.c | |
19 | @@ -648,6 +648,7 @@ | |
20 | void | |
21 | svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si) | |
22 | { | |
23 | +#ifdef __linux__ | |
24 | int val = 1; | |
25 | ||
26 | switch (si->si_af) { | |
27 | @@ -660,6 +661,7 @@ | |
28 | break; | |
29 | #endif | |
30 | } | |
31 | +#endif | |
32 | } | |
33 | ||
34 | /* | |
35 | @@ -670,6 +672,7 @@ | |
36 | int | |
37 | svc_dg_valid_pktinfo(struct msghdr *msg) | |
38 | { | |
39 | +#ifdef __linux__ | |
40 | struct cmsghdr *cmsg; | |
41 | ||
42 | if (!msg->msg_name) | |
43 | @@ -716,4 +719,7 @@ | |
44 | } | |
45 | ||
46 | return 1; | |
47 | +#else | |
48 | + return 0; | |
49 | +#endif | |
50 | } | |
51 | --- a/src/clnt_vc.c | |
52 | +++ b/src/clnt_vc.c | |
53 | @@ -71,10 +71,12 @@ | |
54 | #define MCALL_MSG_SIZE 24 | |
55 | ||
56 | #define CMGROUP_MAX 16 | |
57 | -#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ | |
58 | ||
59 | #undef rpc_createerr /* make it clear it is a thread safe variable */ | |
60 | ||
61 | +#ifndef SCM_CREDS | |
62 | +#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ | |
63 | + | |
64 | /* | |
65 | * Credentials structure, used to verify the identity of a peer | |
66 | * process that has sent us a message. This is allocated by the | |
67 | @@ -90,6 +92,7 @@ | |
68 | short cmcred_ngroups; /* number or groups */ | |
69 | gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ | |
70 | }; | |
71 | +#endif | |
72 | ||
73 | struct cmessage { | |
74 | struct cmsghdr cmsg; | |
75 | --- a/src/getpeereid.c | |
76 | +++ b/src/getpeereid.c | |
77 | @@ -25,9 +25,14 @@ | |
78 | */ | |
79 | ||
80 | ||
81 | +#include "config.h" | |
82 | + | |
83 | #include <sys/param.h> | |
84 | #include <sys/socket.h> | |
85 | #include <sys/un.h> | |
86 | +#ifdef HAVE_SYS_USER_H | |
87 | +# include <sys/user.h> | |
88 | +#endif /* HAVE_SYS_USER_H */ | |
89 | ||
90 | #include <errno.h> | |
91 | #include <unistd.h> | |
92 | --- a/src/getpeereid.c | |
93 | +++ b/src/getpeereid.c | |
94 | @@ -35,12 +36,25 @@ | |
95 | int | |
96 | getpeereid(int s, uid_t *euid, gid_t *egid) | |
97 | { | |
98 | +#ifndef HAVE_SYS_USER_H | |
99 | + return(-1); | |
100 | +#else | |
101 | +#ifdef XUCRED_VERSION | |
102 | + struct xucred uc; | |
103 | +#define uid cr_uid | |
104 | +#define gid cr_gid | |
105 | +#else | |
106 | struct ucred uc; | |
107 | +#endif | |
108 | socklen_t uclen; | |
109 | int error; | |
110 | ||
111 | uclen = sizeof(uc); | |
112 | +#ifdef XUCRED_VERSION | |
113 | + error = getsockopt(s, 0, LOCAL_PEERCRED, &uc, &uclen); | |
114 | +#else | |
115 | error = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &uc, &uclen); /* SCM_CREDENTIALS */ | |
116 | +#endif | |
117 | if (error != 0) | |
118 | return (error); | |
119 | // if (uc.cr_version != XUCRED_VERSION) | |
120 | @@ -59,4 +66,5 @@ | |
121 | *euid = uc.uid; | |
122 | *egid = uc.gid; | |
123 | return (0); | |
124 | +#endif /* HAVE_SYS_USER_H */ | |
125 | } | |
126 | --- a/tirpc/reentrant.h | |
127 | +++ b/tirpc/reentrant.h | |
128 | @@ -36,7 +36,7 @@ | |
129 | * These definitions are only guaranteed to be valid on Linux. | |
130 | */ | |
131 | ||
132 | -#if defined(__linux__) | |
133 | +#if defined(__linux__) || defined(__GLIBC__) | |
134 | ||
135 | #include <pthread.h> | |
136 | ||
137 | --- a/configure.ac | |
138 | +++ b/configure.ac | |
139 | @@ -93,7 +93,7 @@ | |
140 | AC_PROG_LIBTOOL | |
141 | AC_HEADER_DIRENT | |
142 | AC_PREFIX_DEFAULT(/usr) | |
143 | -AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h]) | |
144 | +AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h sys/user.h]) | |
145 | AC_CHECK_LIB([pthread], [pthread_create]) | |
146 | AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent]) | |
147 | ||
148 | --- a/src/auth_unix.c | |
149 | +++ b/src/auth_unix.c | |
150 | @@ -56,6 +56,11 @@ | |
151 | #include <rpc/auth.h> | |
152 | #include <rpc/auth_unix.h> | |
153 | ||
154 | +/* Workaround for Hurd */ | |
155 | +#ifndef MAXHOSTNAMELEN | |
156 | +# define MAXHOSTNAMELEN 64 | |
157 | +#endif | |
158 | + | |
159 | /* auth_unix.c */ | |
160 | static void authunix_nextverf (AUTH *); | |
161 | static bool_t authunix_marshal (AUTH *, XDR *); | |
162 | --- a/src/bindresvport.c | |
163 | +++ b/src/bindresvport.c | |
164 | @@ -64,7 +64,7 @@ | |
165 | return bindresvport_sa(sd, (struct sockaddr *)sin); | |
166 | } | |
167 | ||
168 | -#ifdef __linux__ | |
169 | +#if defined(__linux__) || defined(__GNU__) | |
170 | ||
171 | #define STARTPORT 600 | |
172 | #define LOWPORT 512 |