Package: libtirpc / 0.2.5-1.2+deb9u1

03-kfreebsd.diff Patch series | download
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
Index: libtirpc-0.2.5/src/svc_dg.c
===================================================================
--- libtirpc-0.2.5.orig/src/svc_dg.c
+++ libtirpc-0.2.5/src/svc_dg.c
@@ -641,6 +641,7 @@ cache_get(xprt, msg, replyp, replylenp)
 void
 svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
 {
+#ifdef __linux__
 	int val = 1;
 
 	switch (si->si_af) {
@@ -653,6 +654,7 @@ svc_dg_enable_pktinfo(int fd, const stru
 		break;
 #endif
 	}
+#endif
 }
 
 /*
@@ -663,6 +665,7 @@ svc_dg_enable_pktinfo(int fd, const stru
 int
 svc_dg_valid_pktinfo(struct msghdr *msg)
 {
+#ifdef __linux__
 	struct cmsghdr *cmsg;
 
 	if (!msg->msg_name)
@@ -709,4 +712,7 @@ svc_dg_valid_pktinfo(struct msghdr *msg)
 	}
 
 	return 1;
+#else
+        return 0;
+#endif
 }
Index: libtirpc-0.2.5/src/clnt_vc.c
===================================================================
--- libtirpc-0.2.5.orig/src/clnt_vc.c
+++ libtirpc-0.2.5/src/clnt_vc.c
@@ -70,6 +70,7 @@
 #define MCALL_MSG_SIZE 24
 
 #define CMGROUP_MAX    16
+#ifndef SCM_CREDS
 #define SCM_CREDS      0x03            /* process creds (struct cmsgcred) */
 
 /*
@@ -87,6 +88,7 @@ struct cmsgcred {
         short   cmcred_ngroups;         /* number or groups */
         gid_t   cmcred_groups[CMGROUP_MAX];     /* groups */
 };
+#endif
 
 struct cmessage {
         struct cmsghdr cmsg;
Index: libtirpc-0.2.5/src/getpeereid.c
===================================================================
--- libtirpc-0.2.5.orig/src/getpeereid.c
+++ libtirpc-0.2.5/src/getpeereid.c
@@ -29,6 +29,7 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/user.h>
 
 #include <errno.h>
 #include <unistd.h>
@@ -36,12 +37,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)
Index: libtirpc-0.2.5/tirpc/reentrant.h
===================================================================
--- libtirpc-0.2.5.orig/tirpc/reentrant.h
+++ libtirpc-0.2.5/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>