1 |
commit: 69d51c8245bd290d210f71ac5412bed7e3a82161 |
2 |
Author: Luis Ressel <aranea <AT> aixah <DOT> de> |
3 |
AuthorDate: Mon Nov 13 06:33:01 2017 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 13 09:44:43 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=69d51c82 |
7 |
|
8 |
sys-process/audit: Add patch for musl |
9 |
|
10 |
sys-process/audit/audit-2.6.4.ebuild | 1 + |
11 |
sys-process/audit/audit-2.7.1.ebuild | 1 + |
12 |
sys-process/audit/files/audit-2.7.1-musl.patch | 173 +++++++++++++++++++++++++ |
13 |
3 files changed, 175 insertions(+) |
14 |
|
15 |
diff --git a/sys-process/audit/audit-2.6.4.ebuild b/sys-process/audit/audit-2.6.4.ebuild |
16 |
index e83cf86..d4ecbd3 100644 |
17 |
--- a/sys-process/audit/audit-2.6.4.ebuild |
18 |
+++ b/sys-process/audit/audit-2.6.4.ebuild |
19 |
@@ -35,6 +35,7 @@ pkg_setup() { |
20 |
} |
21 |
|
22 |
src_prepare() { |
23 |
+ eapply "${FILESDIR}/${PN}-2.7.1-musl.patch" |
24 |
eapply_user |
25 |
|
26 |
# Do not build GUI tools |
27 |
|
28 |
diff --git a/sys-process/audit/audit-2.7.1.ebuild b/sys-process/audit/audit-2.7.1.ebuild |
29 |
index 85a1f9a..3886ae6 100644 |
30 |
--- a/sys-process/audit/audit-2.7.1.ebuild |
31 |
+++ b/sys-process/audit/audit-2.7.1.ebuild |
32 |
@@ -35,6 +35,7 @@ pkg_setup() { |
33 |
} |
34 |
|
35 |
src_prepare() { |
36 |
+ eapply "${FILESDIR}/${P}-musl.patch" |
37 |
eapply_user |
38 |
|
39 |
# Do not build GUI tools |
40 |
|
41 |
diff --git a/sys-process/audit/files/audit-2.7.1-musl.patch b/sys-process/audit/files/audit-2.7.1-musl.patch |
42 |
new file mode 100644 |
43 |
index 0000000..099f985 |
44 |
--- /dev/null |
45 |
+++ b/sys-process/audit/files/audit-2.7.1-musl.patch |
46 |
@@ -0,0 +1,173 @@ |
47 |
+From db5c09f7995a27555a10418648d9dc7e1e8bb94b Mon Sep 17 00:00:00 2001 |
48 |
+From: Luis Ressel <aranea@×××××.de> |
49 |
+Date: Mon, 13 Nov 2017 07:33:35 +0100 |
50 |
+Subject: [PATCH] Musl compability |
51 |
+ |
52 |
+A couple of header fixes, one occurrence of rawmemchr() and three of |
53 |
+strndupa(). |
54 |
+--- |
55 |
+ audisp/audispd.c | 4 +++- |
56 |
+ auparse/auparse.c | 13 +++++++++++-- |
57 |
+ auparse/interpret.c | 2 +- |
58 |
+ lib/libaudit.c | 2 +- |
59 |
+ lib/netlink.c | 2 +- |
60 |
+ src/auditctl.c | 1 + |
61 |
+ src/auditd.c | 9 +++++++-- |
62 |
+ src/ausearch-lol.c | 13 +++++++++++-- |
63 |
+ 8 files changed, 36 insertions(+), 10 deletions(-) |
64 |
+ |
65 |
+diff --git a/audisp/audispd.c b/audisp/audispd.c |
66 |
+index 9831cf3..0720814 100644 |
67 |
+--- a/audisp/audispd.c |
68 |
++++ b/audisp/audispd.c |
69 |
+@@ -31,7 +31,9 @@ |
70 |
+ #include <pthread.h> |
71 |
+ #include <dirent.h> |
72 |
+ #include <fcntl.h> |
73 |
+-#include <sys/poll.h> |
74 |
++#include <limits.h> |
75 |
++#include <poll.h> |
76 |
++#include <sys/uio.h> |
77 |
+ #include <netdb.h> |
78 |
+ #include <arpa/inet.h> |
79 |
+ |
80 |
+diff --git a/auparse/auparse.c b/auparse/auparse.c |
81 |
+index 2812028..a5d8c9e 100644 |
82 |
+--- a/auparse/auparse.c |
83 |
++++ b/auparse/auparse.c |
84 |
+@@ -1090,10 +1090,19 @@ static int extract_timestamp(const char *b, au_event_t *e) |
85 |
+ int rc = 1; |
86 |
+ |
87 |
+ e->host = NULL; |
88 |
++ char _tmp[341]; |
89 |
+ if (*b == 'n') |
90 |
+- tmp = strndupa(b, 340); |
91 |
++ { |
92 |
++ strncpy(_tmp, b, 340); |
93 |
++ _tmp[340] = '\0'; |
94 |
++ tmp = _tmp; |
95 |
++ } |
96 |
+ else |
97 |
+- tmp = strndupa(b, 80); |
98 |
++ { |
99 |
++ strncpy(_tmp, b, 80); |
100 |
++ _tmp[80] = '\0'; |
101 |
++ tmp = _tmp; |
102 |
++ } |
103 |
+ ptr = audit_strsplit(tmp); |
104 |
+ if (ptr) { |
105 |
+ // Optionally grab the node - may or may not be included |
106 |
+diff --git a/auparse/interpret.c b/auparse/interpret.c |
107 |
+index 071c4ef..ba38199 100644 |
108 |
+--- a/auparse/interpret.c |
109 |
++++ b/auparse/interpret.c |
110 |
+@@ -803,7 +803,7 @@ static const char *print_proctitle(const char *val) |
111 |
+ size_t len = strlen(val) / 2; |
112 |
+ const char *end = out + len; |
113 |
+ char *ptr = out; |
114 |
+- while ((ptr = rawmemchr(ptr, '\0'))) { |
115 |
++ while ((ptr = memchr(ptr, '\0', SIZE_MAX))) { |
116 |
+ if (ptr >= end) |
117 |
+ break; |
118 |
+ *ptr = ' '; |
119 |
+diff --git a/lib/libaudit.c b/lib/libaudit.c |
120 |
+index f434d4a..bd679a5 100644 |
121 |
+--- a/lib/libaudit.c |
122 |
++++ b/lib/libaudit.c |
123 |
+@@ -32,7 +32,7 @@ |
124 |
+ #include <pwd.h> |
125 |
+ #include <grp.h> |
126 |
+ #include <errno.h> |
127 |
+-#include <sys/poll.h> |
128 |
++#include <poll.h> |
129 |
+ #include <sys/utsname.h> |
130 |
+ #include <sys/stat.h> |
131 |
+ #include <fcntl.h> /* O_NOFOLLOW needs gnu defined */ |
132 |
+diff --git a/lib/netlink.c b/lib/netlink.c |
133 |
+index 90c79b9..9486560 100644 |
134 |
+--- a/lib/netlink.c |
135 |
++++ b/lib/netlink.c |
136 |
+@@ -27,7 +27,7 @@ |
137 |
+ #include <errno.h> |
138 |
+ #include <fcntl.h> |
139 |
+ #include <time.h> |
140 |
+-#include <sys/poll.h> |
141 |
++#include <poll.h> |
142 |
+ #include "libaudit.h" |
143 |
+ #include "private.h" |
144 |
+ |
145 |
+diff --git a/src/auditctl.c b/src/auditctl.c |
146 |
+index 81000ee..6415264 100644 |
147 |
+--- a/src/auditctl.c |
148 |
++++ b/src/auditctl.c |
149 |
+@@ -34,6 +34,7 @@ |
150 |
+ #include <sys/utsname.h> |
151 |
+ #include <fcntl.h> |
152 |
+ #include <errno.h> |
153 |
++#include <sys/select.h> |
154 |
+ #include <libgen.h> /* For basename */ |
155 |
+ #include <limits.h> /* PATH_MAX */ |
156 |
+ #include "libaudit.h" |
157 |
+diff --git a/src/auditd.c b/src/auditd.c |
158 |
+index 3f0162d..535207d 100644 |
159 |
+--- a/src/auditd.c |
160 |
++++ b/src/auditd.c |
161 |
+@@ -30,6 +30,7 @@ |
162 |
+ #include <errno.h> |
163 |
+ #include <string.h> |
164 |
+ #include <time.h> |
165 |
++#include <alloca.h> |
166 |
+ #include <sys/resource.h> |
167 |
+ #include <sys/time.h> |
168 |
+ #include <sys/stat.h> |
169 |
+@@ -185,7 +186,9 @@ static void child_handler2( int sig ) |
170 |
+ |
171 |
+ static int extract_type(const char *str) |
172 |
+ { |
173 |
+- const char *tptr, *ptr2, *ptr = str; |
174 |
++ const char *ptr2, *ptr = str; |
175 |
++ char *tptr; |
176 |
++ |
177 |
+ if (*str == 'n') { |
178 |
+ ptr = strchr(str+1, ' '); |
179 |
+ if (ptr == NULL) |
180 |
+@@ -195,7 +198,9 @@ static int extract_type(const char *str) |
181 |
+ // ptr should be at 't' |
182 |
+ ptr2 = strchr(ptr, ' '); |
183 |
+ // get type=xxx in a buffer |
184 |
+- tptr = strndupa(ptr, ptr2 - ptr); |
185 |
++ tptr = (char *) alloca(ptr2 - ptr + 1); |
186 |
++ strncpy(tptr, ptr, ptr2 - ptr); |
187 |
++ tptr[ptr2 - ptr] = '\0'; |
188 |
+ // find = |
189 |
+ str = strchr(tptr, '='); |
190 |
+ if (str == NULL) |
191 |
+diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c |
192 |
+index b1aec06..bb9330d 100644 |
193 |
+--- a/src/ausearch-lol.c |
194 |
++++ b/src/ausearch-lol.c |
195 |
+@@ -135,10 +135,19 @@ static int extract_timestamp(const char *b, event *e) |
196 |
+ char *ptr, *tmp, *tnode, *ttype; |
197 |
+ |
198 |
+ e->node = NULL; |
199 |
++ char _tmp[341]; |
200 |
+ if (*b == 'n') |
201 |
+- tmp = strndupa(b, 340); |
202 |
++ { |
203 |
++ strncpy(_tmp, b, 340); |
204 |
++ _tmp[340] = '\0'; |
205 |
++ tmp = _tmp; |
206 |
++ } |
207 |
+ else |
208 |
+- tmp = strndupa(b, 80); |
209 |
++ { |
210 |
++ strncpy(_tmp, b, 80); |
211 |
++ _tmp[80] = '\0'; |
212 |
++ tmp = _tmp; |
213 |
++ } |
214 |
+ ptr = audit_strsplit(tmp); |
215 |
+ if (ptr) { |
216 |
+ // Check to see if this is the node info |
217 |
+-- |
218 |
+2.15.0 |
219 |
+ |