diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch | 335 |
1 files changed, 335 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch new file mode 100644 index 0000000000..ee63329830 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch | |||
@@ -0,0 +1,335 @@ | |||
1 | --- systemd-pam-185/src/fsck/fsck.c.orig 2012-06-22 23:22:22.000000000 -0400 | ||
2 | +++ systemd-pam-185/src/fsck/fsck.c 2012-06-22 21:15:56.000000000 -0400 | ||
3 | @@ -36,6 +36,8 @@ | ||
4 | #include "bus-errors.h" | ||
5 | #include "virt.h" | ||
6 | |||
7 | +#include "config.h" | ||
8 | + | ||
9 | static bool arg_skip = false; | ||
10 | static bool arg_force = false; | ||
11 | static bool arg_show_progress = false; | ||
12 | @@ -193,9 +195,16 @@ | ||
13 | char *device; | ||
14 | double p; | ||
15 | usec_t t; | ||
16 | - | ||
17 | +#ifdef HAVE_MSFORMAT | ||
18 | if (fscanf(f, "%i %lu %lu %ms", &pass, &cur, &max, &device) != 4) | ||
19 | - break; | ||
20 | +#else | ||
21 | + device = malloc(257); | ||
22 | + if (fscanf(f, "%i %lu %lu %256s", &pass, &cur, &max, device) != 4) { | ||
23 | + free(device); | ||
24 | + } | ||
25 | + | ||
26 | +#endif /* HAVE_MSFORMAT */ | ||
27 | + break; | ||
28 | |||
29 | /* Only show one progress counter at max */ | ||
30 | if (!locked) { | ||
31 | --- systemd-pam-185/src/core/swap.c.orig 2012-06-22 23:22:55.000000000 -0400 | ||
32 | +++ systemd-pam-185/src/core/swap.c 2012-06-22 21:17:10.000000000 -0400 | ||
33 | @@ -40,6 +40,8 @@ | ||
34 | #include "def.h" | ||
35 | #include "path-util.h" | ||
36 | |||
37 | +#include "config.h" | ||
38 | + | ||
39 | static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = { | ||
40 | [SWAP_DEAD] = UNIT_INACTIVE, | ||
41 | [SWAP_ACTIVATING] = UNIT_ACTIVATING, | ||
42 | @@ -1038,7 +1040,7 @@ | ||
43 | for (i = 1;; i++) { | ||
44 | char *dev = NULL, *d; | ||
45 | int prio = 0, k; | ||
46 | - | ||
47 | +#ifdef HAVE_MSFORMAT | ||
48 | if ((k = fscanf(m->proc_swaps, | ||
49 | "%ms " /* device/file */ | ||
50 | "%*s " /* type of swap */ | ||
51 | @@ -1046,10 +1048,18 @@ | ||
52 | "%*s " /* used */ | ||
53 | "%i\n", /* priority */ | ||
54 | &dev, &prio)) != 2) { | ||
55 | - | ||
56 | +#else | ||
57 | + dev = malloc(257); | ||
58 | + if ((k = fscanf(m->proc_swaps, | ||
59 | + "%256s " /* device/file */ | ||
60 | + "%*s " /* type of swap */ | ||
61 | + "%*s " /* swap size */ | ||
62 | + "%*s " /* used */ | ||
63 | + "%i\n", /* priority */ | ||
64 | + dev, &prio)) != 2) { | ||
65 | +#endif /* HAVE_MSFORMAT */ | ||
66 | if (k == EOF) | ||
67 | break; | ||
68 | - | ||
69 | log_warning("Failed to parse /proc/swaps:%u.", i); | ||
70 | free(dev); | ||
71 | continue; | ||
72 | --- systemd-pam-185/src/core/mount-setup.c.orig 2012-06-22 23:23:41.000000000 -0400 | ||
73 | +++ systemd-pam-185/src/core/mount-setup.c 2012-06-22 21:19:44.000000000 -0400 | ||
74 | @@ -28,6 +28,7 @@ | ||
75 | #include <assert.h> | ||
76 | #include <unistd.h> | ||
77 | #include <ftw.h> | ||
78 | +#include <linux/fs.h> | ||
79 | |||
80 | #include "mount-setup.h" | ||
81 | #include "dev-setup.h" | ||
82 | @@ -41,6 +41,8 @@ | ||
83 | #include "path-util.h" | ||
84 | #include "missing.h" | ||
85 | |||
86 | +#include "config.h" | ||
87 | + | ||
88 | #ifndef TTY_GID | ||
89 | #define TTY_GID 5 | ||
90 | #endif | ||
91 | @@ -200,9 +202,12 @@ | ||
92 | for (;;) { | ||
93 | char *controller; | ||
94 | int enabled = 0; | ||
95 | - | ||
96 | +#ifdef HAVE_MSFORMAT | ||
97 | if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) { | ||
98 | - | ||
99 | +#else | ||
100 | + controller = malloc(257); | ||
101 | + if (fscanf(f, "%256s %*i %*i %i", controller, &enabled) != 2) { | ||
102 | +#endif /* HAVE_MSFORMAT */ | ||
103 | if (feof(f)) | ||
104 | break; | ||
105 | |||
106 | --- systemd-pam-185/src/core/mount.c.orig 2012-06-22 23:24:17.000000000 -0400 | ||
107 | +++ systemd-pam-185/src/core/mount.c 2012-06-22 22:51:21.000000000 -0400 | ||
108 | @@ -41,6 +41,8 @@ | ||
109 | #include "exit-status.h" | ||
110 | #include "def.h" | ||
111 | |||
112 | +#include "config.h" | ||
113 | + | ||
114 | static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = { | ||
115 | [MOUNT_DEAD] = UNIT_INACTIVE, | ||
116 | [MOUNT_MOUNTING] = UNIT_ACTIVATING, | ||
117 | @@ -1514,7 +1516,7 @@ | ||
118 | int k; | ||
119 | |||
120 | device = path = options = options2 = fstype = d = p = o = NULL; | ||
121 | - | ||
122 | +#ifdef HAVE_MSFORMAT | ||
123 | if ((k = fscanf(m->proc_self_mountinfo, | ||
124 | "%*s " /* (1) mount id */ | ||
125 | "%*s " /* (2) parent id */ | ||
126 | @@ -1533,7 +1535,31 @@ | ||
127 | &fstype, | ||
128 | &device, | ||
129 | &options2)) != 5) { | ||
130 | - | ||
131 | +#else | ||
132 | + path = malloc(257); | ||
133 | + options = malloc(257); | ||
134 | + fstype = malloc(257); | ||
135 | + device = malloc(257); | ||
136 | + options2 = malloc(257); | ||
137 | + if ((k = fscanf(m->proc_self_mountinfo, | ||
138 | + "%*s " /* (1) mount id */ | ||
139 | + "%*s " /* (2) parent id */ | ||
140 | + "%*s " /* (3) major:minor */ | ||
141 | + "%*s " /* (4) root */ | ||
142 | + "%256s " /* (5) mount point */ | ||
143 | + "%256s" /* (6) mount options */ | ||
144 | + "%*[^-]" /* (7) optional fields */ | ||
145 | + "- " /* (8) separator */ | ||
146 | + "%256s " /* (9) file system type */ | ||
147 | + "%256s" /* (10) mount source */ | ||
148 | + "%256s" /* (11) mount options 2 */ | ||
149 | + "%*[^\n]", /* some rubbish at the end */ | ||
150 | + path, | ||
151 | + options, | ||
152 | + fstype, | ||
153 | + device, | ||
154 | + options2)) != 5) { | ||
155 | +#endif /* HAVE_MSFORMAT */ | ||
156 | if (k == EOF) | ||
157 | break; | ||
158 | |||
159 | --- systemd-pam-185/src/core/umount.c.orig 2012-06-22 23:24:37.000000000 -0400 | ||
160 | +++ systemd-pam-185/src/core/umount.c 2012-06-22 22:56:15.000000000 -0400 | ||
161 | @@ -35,6 +35,8 @@ | ||
162 | #include "path-util.h" | ||
163 | #include "util.h" | ||
164 | |||
165 | +#include "config.h" | ||
166 | + | ||
167 | typedef struct MountPoint { | ||
168 | char *path; | ||
169 | dev_t devnum; | ||
170 | @@ -74,7 +76,7 @@ | ||
171 | MountPoint *m; | ||
172 | |||
173 | path = p = NULL; | ||
174 | - | ||
175 | +#ifdef HAVE_MSFORMAT | ||
176 | if ((k = fscanf(proc_self_mountinfo, | ||
177 | "%*s " /* (1) mount id */ | ||
178 | "%*s " /* (2) parent id */ | ||
179 | @@ -89,6 +91,23 @@ | ||
180 | "%*s" /* (11) mount options 2 */ | ||
181 | "%*[^\n]", /* some rubbish at the end */ | ||
182 | &path)) != 1) { | ||
183 | +#else | ||
184 | + path = malloc(257); | ||
185 | + if ((k = fscanf(proc_self_mountinfo, | ||
186 | + "%*s " /* (1) mount id */ | ||
187 | + "%*s " /* (2) parent id */ | ||
188 | + "%*s " /* (3) major:minor */ | ||
189 | + "%*s " /* (4) root */ | ||
190 | + "%256s " /* (5) mount point */ | ||
191 | + "%*s" /* (6) mount options */ | ||
192 | + "%*[^-]" /* (7) optional fields */ | ||
193 | + "- " /* (8) separator */ | ||
194 | + "%*s " /* (9) file system type */ | ||
195 | + "%*s" /* (10) mount source */ | ||
196 | + "%*s" /* (11) mount options 2 */ | ||
197 | + "%*[^\n]", /* some rubbish at the end */ | ||
198 | + path)) != 1) { | ||
199 | +#endif /* HAVE_MSFORMAT */ | ||
200 | if (k == EOF) | ||
201 | break; | ||
202 | |||
203 | @@ -150,7 +169,7 @@ | ||
204 | MountPoint *swap; | ||
205 | char *dev = NULL, *d; | ||
206 | int k; | ||
207 | - | ||
208 | +#ifdef HAVE_MSFORMAT | ||
209 | if ((k = fscanf(proc_swaps, | ||
210 | "%ms " /* device/file */ | ||
211 | "%*s " /* type of swap */ | ||
212 | @@ -158,7 +177,16 @@ | ||
213 | "%*s " /* used */ | ||
214 | "%*s\n", /* priority */ | ||
215 | &dev)) != 1) { | ||
216 | - | ||
217 | +#else | ||
218 | + dev = malloc(257); | ||
219 | + if ((k = fscanf(proc_swaps, | ||
220 | + "%256s " /* device/file */ | ||
221 | + "%*s " /* type of swap */ | ||
222 | + "%*s " /* swap size */ | ||
223 | + "%*s " /* used */ | ||
224 | + "%*s\n", /* priority */ | ||
225 | + dev)) != 1) { | ||
226 | +#endif /* HAVE_MSFORMAT */ | ||
227 | if (k == EOF) | ||
228 | break; | ||
229 | |||
230 | --- systemd-pam-185/src/shared/socket-util.c.orig 2012-06-22 23:25:00.000000000 -0400 | ||
231 | +++ systemd-pam-185/src/shared/socket-util.c 2012-06-22 22:59:27.000000000 -0400 | ||
232 | @@ -39,6 +39,8 @@ | ||
233 | #include "socket-util.h" | ||
234 | #include "missing.h" | ||
235 | |||
236 | +#include "config.h" | ||
237 | + | ||
238 | int socket_address_parse(SocketAddress *a, const char *s) { | ||
239 | int r; | ||
240 | char *e, *n; | ||
241 | @@ -201,8 +203,16 @@ | ||
242 | a->type = SOCK_RAW; | ||
243 | |||
244 | errno = 0; | ||
245 | - if (sscanf(s, "%ms %u", &sfamily, &group) < 1) | ||
246 | +#ifdef HAVE_MSFORMAT | ||
247 | + if (sscanf(s, "%ms %u", &sfamily, &group) < 1) | ||
248 | + return errno ? -errno : -EINVAL; | ||
249 | +#else | ||
250 | + sfamily = malloc(257); | ||
251 | + if (sscanf(s, "%256s %u", sfamily, &group) < 1) { | ||
252 | + free(sfamily); | ||
253 | return errno ? -errno : -EINVAL; | ||
254 | + } | ||
255 | +#endif /* HAVE_MSFORMAT */ | ||
256 | |||
257 | if ((family = netlink_family_from_string(sfamily)) < 0) | ||
258 | if (safe_atoi(sfamily, &family) < 0) { | ||
259 | --- systemd-pam-185/src/tmpfiles/tmpfiles.c.orig 2012-06-22 23:25:21.000000000 -0400 | ||
260 | +++ systemd-pam-185/src/tmpfiles/tmpfiles.c 2012-06-22 23:13:49.000000000 -0400 | ||
261 | @@ -48,6 +48,8 @@ | ||
262 | #include "set.h" | ||
263 | #include "conf-files.h" | ||
264 | |||
265 | +#include "config.h" | ||
266 | + | ||
267 | /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates | ||
268 | * them in the file system. This is intended to be used to create | ||
269 | * properly owned directories beneath /tmp, /var/tmp, /run, which are | ||
270 | @@ -970,7 +972,7 @@ | ||
271 | i = new0(Item, 1); | ||
272 | if (!i) | ||
273 | return log_oom(); | ||
274 | - | ||
275 | +#ifdef HAVE_MSFORMAT | ||
276 | if (sscanf(buffer, | ||
277 | "%c " | ||
278 | "%ms " | ||
279 | @@ -986,6 +988,28 @@ | ||
280 | &group, | ||
281 | &age, | ||
282 | &n) < 2) { | ||
283 | +#else | ||
284 | + i->path = malloc(257); | ||
285 | + mode = malloc(257); | ||
286 | + user = malloc(257); | ||
287 | + group = malloc(257); | ||
288 | + age = malloc(257); | ||
289 | + if (sscanf(buffer, | ||
290 | + "%c " | ||
291 | + "%256s " | ||
292 | + "%256s " | ||
293 | + "%256s " | ||
294 | + "%256s " | ||
295 | + "%256s " | ||
296 | + "%n", | ||
297 | + &type, | ||
298 | + i->path, | ||
299 | + mode, | ||
300 | + user, | ||
301 | + group, | ||
302 | + age, | ||
303 | + &n) < 2) { | ||
304 | +#endif /* HAVE_MSFORMAT */ | ||
305 | log_error("[%s:%u] Syntax error.", fname, line); | ||
306 | r = -EIO; | ||
307 | goto finish; | ||
308 | --- systemd-pam-185/src/cryptsetup/cryptsetup-generator.c.orig 2012-06-22 23:25:47.000000000 -0400 | ||
309 | +++ systemd-pam-185/src/cryptsetup/cryptsetup-generator.c 2012-06-22 23:16:35.000000000 -0400 | ||
310 | @@ -30,6 +30,8 @@ | ||
311 | #include "virt.h" | ||
312 | #include "strv.h" | ||
313 | |||
314 | +#include "config.h" | ||
315 | + | ||
316 | static const char *arg_dest = "/tmp"; | ||
317 | static bool arg_enabled = true; | ||
318 | static bool arg_read_crypttab = true; | ||
319 | @@ -421,8 +423,15 @@ | ||
320 | l = strstrip(line); | ||
321 | if (*l == '#' || *l == 0) | ||
322 | continue; | ||
323 | - | ||
324 | +#ifdef HAVE_MSFORMAT | ||
325 | k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options); | ||
326 | +#else | ||
327 | + name = malloc(257); | ||
328 | + device = malloc(257); | ||
329 | + password = malloc(257); | ||
330 | + options = malloc(257); | ||
331 | + k = sscanf(l, "%256s %256s %256s %256s", name, device, password, options); | ||
332 | +#endif /* HAVE_MSFORMAT */ | ||
333 | if (k < 2 || k > 4) { | ||
334 | log_error("Failed to parse /etc/crypttab:%u, ignoring.", n); | ||
335 | r = EXIT_FAILURE; | ||