1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
Description: Fix build on non Linux architectures
Author: Andreas Beckmann <anbe@debian.org>
Last-Update: 2019-09-01
Forwarded: not-needed
--- a/src/svc_dg.c
+++ b/src/svc_dg.c
@@ -650,6 +650,7 @@
void
svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
{
+#ifdef __linux__
int val = 1;
switch (si->si_af) {
@@ -662,6 +663,7 @@
break;
#endif
}
+#endif
}
/*
@@ -672,6 +674,7 @@
int
svc_dg_valid_pktinfo(struct msghdr *msg)
{
+#ifdef __linux__
struct cmsghdr *cmsg;
if (!msg->msg_name)
@@ -718,4 +721,7 @@
}
return 1;
+#else
+ return 0;
+#endif
}
--- a/src/clnt_vc.c
+++ b/src/clnt_vc.c
@@ -76,10 +76,12 @@
#define MCALL_MSG_SIZE 24
#define CMGROUP_MAX 16
-#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
#undef rpc_createerr /* make it clear it is a thread safe variable */
+#ifndef SCM_CREDS
+#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
+
/*
* Credentials structure, used to verify the identity of a peer
* process that has sent us a message. This is allocated by the
@@ -95,6 +97,7 @@
short cmcred_ngroups; /* number or groups */
gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
};
+#endif
struct cmessage {
struct cmsghdr cmsg;
--- a/src/getpeereid.c
+++ b/src/getpeereid.c
@@ -28,6 +28,7 @@
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <sys/user.h>
#include <errno.h>
#include <unistd.h>
@@ -35,12 +36,22 @@
int
getpeereid(int s, uid_t *euid, gid_t *egid)
{
+#ifdef XUCRED_VERSION
+ struct xucred uc;
+#define uid cr_uid
+#define gid cr_gid
+#else
struct ucred uc;
+#endif
socklen_t uclen;
int error;
uclen = sizeof(uc);
+#ifdef XUCRED_VERSION
+ error = getsockopt(s, 0, LOCAL_PEERCRED, &uc, &uclen);
+#else
error = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &uc, &uclen); /* SCM_CREDENTIALS */
+#endif
if (error != 0)
return (error);
// if (uc.cr_version != XUCRED_VERSION)
--- a/tirpc/reentrant.h
+++ b/tirpc/reentrant.h
@@ -36,7 +36,7 @@
* These definitions are only guaranteed to be valid on Linux.
*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
#include <pthread.h>
|