summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/systemd-pam-fix-msformat.patch
blob: cdf8d61dcf64f701ecacf3040562741dbab69427 (plain)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

--- systemd-pam-185/src/fsck/fsck.c.orig	2012-06-22 23:22:22.000000000 -0400
+++ systemd-pam-185/src/fsck/fsck.c	2012-06-22 21:15:56.000000000 -0400
@@ -36,6 +36,8 @@
 #include "bus-errors.h"
 #include "virt.h"
 
+#include "config.h"
+
 static bool arg_skip = false;
 static bool arg_force = false;
 static bool arg_show_progress = false;
@@ -193,9 +195,16 @@
                 char *device;
                 double p;
                 usec_t t;
-
+#ifdef HAVE_MSFORMAT
                 if (fscanf(f, "%i %lu %lu %ms", &pass, &cur, &max, &device) != 4)
-                        break;
+#else
+		device = malloc(257);
+		if (fscanf(f, "%i %lu %lu %256s", &pass, &cur, &max, device) != 4) {
+			free(device);
+		}
+
+#endif /* HAVE_MSFORMAT */
+			break;
 
                 /* Only show one progress counter at max */
                 if (!locked) {
--- systemd-pam-185/src/core/swap.c.orig	2012-06-22 23:22:55.000000000 -0400
+++ systemd-pam-185/src/core/swap.c	2012-06-22 21:17:10.000000000 -0400
@@ -40,6 +40,8 @@
 #include "def.h"
 #include "path-util.h"
 
+#include "config.h"
+
 static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
         [SWAP_DEAD] = UNIT_INACTIVE,
         [SWAP_ACTIVATING] = UNIT_ACTIVATING,
@@ -1038,7 +1040,7 @@
         for (i = 1;; i++) {
                 char *dev = NULL, *d;
                 int prio = 0, k;
-
+#ifdef HAVE_MSFORMAT
                 if ((k = fscanf(m->proc_swaps,
                                 "%ms "  /* device/file */
                                 "%*s "  /* type of swap */
@@ -1046,10 +1048,18 @@
                                 "%*s "  /* used */
                                 "%i\n", /* priority */
                                 &dev, &prio)) != 2) {
-
+#else
+		dev = malloc(257);
+                if ((k = fscanf(m->proc_swaps,
+                                "%256s "   /* device/file */
+                                "%*s "  /* type of swap */
+                                "%*s "  /* swap size */
+                                "%*s "  /* used */
+                                "%i\n", /* priority */
+                                dev, &prio)) != 2) {
+#endif /* HAVE_MSFORMAT */
                         if (k == EOF)
                                 break;
-
                         log_warning("Failed to parse /proc/swaps:%u.", i);
                         free(dev);
                         continue;
--- systemd-pam-185/src/core/mount-setup.c.orig	2012-06-22 23:23:41.000000000 -0400
+++ systemd-pam-185/src/core/mount-setup.c	2012-06-22 21:19:44.000000000 -0400
@@ -28,6 +28,7 @@
 #include <assert.h>
 #include <unistd.h>
 #include <ftw.h>
+#include <linux/fs.h>

 #include "mount-setup.h"
 #include "dev-setup.h"
@@ -41,6 +41,8 @@
 #include "path-util.h"
 #include "missing.h"
 
+#include "config.h"
+
 #ifndef TTY_GID
 #define TTY_GID 5
 #endif
@@ -200,9 +202,12 @@
         for (;;) {
                 char *controller;
                 int enabled = 0;
-
+#ifdef HAVE_MSFORMAT
                 if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) {
-
+#else
+		controller = malloc(257);
+                if (fscanf(f, "%256s %*i %*i %i", controller, &enabled) != 2) {
+#endif /* HAVE_MSFORMAT */
                         if (feof(f))
                                 break;
 
--- systemd-pam-185/src/core/mount.c.orig	2012-06-22 23:24:17.000000000 -0400
+++ systemd-pam-185/src/core/mount.c	2012-06-22 22:51:21.000000000 -0400
@@ -41,6 +41,8 @@
 #include "exit-status.h"
 #include "def.h"
 
+#include "config.h"
+
 static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
         [MOUNT_DEAD] = UNIT_INACTIVE,
         [MOUNT_MOUNTING] = UNIT_ACTIVATING,
@@ -1514,7 +1516,7 @@
                 int k;
 
                 device = path = options = options2 = fstype = d = p = o = NULL;
-
+#ifdef HAVE_MSFORMAT
                 if ((k = fscanf(m->proc_self_mountinfo,
                                 "%*s "       /* (1) mount id */
                                 "%*s "       /* (2) parent id */
@@ -1533,7 +1535,31 @@
                                 &fstype,
                                 &device,
                                 &options2)) != 5) {
-
+#else
+		path = malloc(257);
+		options = malloc(257);
+		fstype = malloc(257);
+		device = malloc(257);
+		options2 = malloc(257);
+                if ((k = fscanf(m->proc_self_mountinfo,
+                                "%*s "       /* (1) mount id */
+                                "%*s "       /* (2) parent id */
+                                "%*s "       /* (3) major:minor */
+                                "%*s "       /* (4) root */
+                                "%256s "     /* (5) mount point */
+                                "%256s"      /* (6) mount options */
+                                "%*[^-]"     /* (7) optional fields */
+                                "- "         /* (8) separator */
+                                "%256s "     /* (9) file system type */
+                                "%256s"      /* (10) mount source */
+                                "%256s"      /* (11) mount options 2 */
+                                "%*[^\n]",   /* some rubbish at the end */
+                                path,
+                                options,
+                                fstype,
+                                device,
+                                options2)) != 5) {
+#endif /* HAVE_MSFORMAT */
                         if (k == EOF)
                                 break;
 
--- systemd-pam-185/src/core/umount.c.orig	2012-06-22 23:24:37.000000000 -0400
+++ systemd-pam-185/src/core/umount.c	2012-06-22 22:56:15.000000000 -0400
@@ -35,6 +35,8 @@
 #include "path-util.h"
 #include "util.h"
 
+#include "config.h"
+
 typedef struct MountPoint {
         char *path;
         dev_t devnum;
@@ -74,7 +76,7 @@
                 MountPoint *m;
 
                 path = p = NULL;
-
+#ifdef HAVE_MSFORMAT
                 if ((k = fscanf(proc_self_mountinfo,
                                 "%*s "       /* (1) mount id */
                                 "%*s "       /* (2) parent id */
@@ -89,6 +91,23 @@
                                 "%*s"        /* (11) mount options 2 */
                                 "%*[^\n]",   /* some rubbish at the end */
                                 &path)) != 1) {
+#else
+		path = malloc(257);
+                if ((k = fscanf(proc_self_mountinfo,
+                                "%*s "       /* (1) mount id */
+                                "%*s "       /* (2) parent id */
+                                "%*s "       /* (3) major:minor */
+                                "%*s "       /* (4) root */
+                                "%256s "     /* (5) mount point */
+                                "%*s"        /* (6) mount options */
+                                "%*[^-]"     /* (7) optional fields */
+                                "- "         /* (8) separator */
+                                "%*s "       /* (9) file system type */
+                                "%*s"        /* (10) mount source */
+                                "%*s"        /* (11) mount options 2 */
+                                "%*[^\n]",   /* some rubbish at the end */
+                                path)) != 1) {
+#endif /* HAVE_MSFORMAT */
                         if (k == EOF)
                                 break;
 
@@ -150,7 +169,7 @@
                 MountPoint *swap;
                 char *dev = NULL, *d;
                 int k;
-
+#ifdef HAVE_MSFORMAT
                 if ((k = fscanf(proc_swaps,
                                 "%ms " /* device/file */
                                 "%*s " /* type of swap */
@@ -158,7 +177,16 @@
                                 "%*s " /* used */
                                 "%*s\n", /* priority */
                                 &dev)) != 1) {
-
+#else
+		dev = malloc(257);
+                if ((k = fscanf(proc_swaps,
+                                "%256s " /* device/file */
+                                "%*s " /* type of swap */
+                                "%*s " /* swap size */
+                                "%*s " /* used */
+                                "%*s\n", /* priority */
+                                dev)) != 1) {
+#endif /* HAVE_MSFORMAT */
                         if (k == EOF)
                                 break;
 
--- systemd-pam-185/src/shared/socket-util.c.orig	2012-06-22 23:25:00.000000000 -0400
+++ systemd-pam-185/src/shared/socket-util.c	2012-06-22 22:59:27.000000000 -0400
@@ -39,6 +39,8 @@
 #include "socket-util.h"
 #include "missing.h"
 
+#include "config.h"
+
 int socket_address_parse(SocketAddress *a, const char *s) {
         int r;
         char *e, *n;
@@ -201,8 +203,16 @@
         a->type = SOCK_RAW;
 
         errno = 0;
-        if (sscanf(s, "%ms %u", &sfamily, &group) < 1)
+#ifdef HAVE_MSFORMAT
+	if (sscanf(s, "%ms %u", &sfamily, &group) < 1)
+                return errno ? -errno : -EINVAL;
+#else
+	sfamily = malloc(257);
+	if (sscanf(s, "%256s %u", sfamily, &group) < 1) {
+		free(sfamily);
                 return errno ? -errno : -EINVAL;
+	}
+#endif /* HAVE_MSFORMAT */
 
         if ((family = netlink_family_from_string(sfamily)) < 0)
                 if (safe_atoi(sfamily, &family) < 0) {
--- systemd-pam-185/src/tmpfiles/tmpfiles.c.orig	2012-06-22 23:25:21.000000000 -0400
+++ systemd-pam-185/src/tmpfiles/tmpfiles.c	2012-06-22 23:13:49.000000000 -0400
@@ -48,6 +48,8 @@
 #include "set.h"
 #include "conf-files.h"
 
+#include "config.h"
+
 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
  * them in the file system. This is intended to be used to create
  * properly owned directories beneath /tmp, /var/tmp, /run, which are
@@ -970,7 +972,7 @@
         i = new0(Item, 1);
         if (!i)
                 return log_oom();
-
+#ifdef HAVE_MSFORMAT
         if (sscanf(buffer,
                    "%c "
                    "%ms "
@@ -986,6 +988,28 @@
                    &group,
                    &age,
                    &n) < 2) {
+#else
+	i->path = malloc(257);
+	mode = malloc(257);
+	user = malloc(257);
+	group = malloc(257);
+	age = malloc(257);
+        if (sscanf(buffer,
+                   "%c "
+                   "%256s "
+                   "%256s "
+                   "%256s "
+                   "%256s "
+                   "%256s "
+                   "%n",
+                   &type,
+                   i->path,
+                   mode,
+                   user,
+                   group,
+                   age,
+                   &n) < 2) {
+#endif /* HAVE_MSFORMAT */
                 log_error("[%s:%u] Syntax error.", fname, line);
                 r = -EIO;
                 goto finish;
--- systemd-pam-185/src/cryptsetup/cryptsetup-generator.c.orig	2012-06-22 23:25:47.000000000 -0400
+++ systemd-pam-185/src/cryptsetup/cryptsetup-generator.c	2012-06-22 23:16:35.000000000 -0400
@@ -30,6 +30,8 @@
 #include "virt.h"
 #include "strv.h"
 
+#include "config.h"
+
 static const char *arg_dest = "/tmp";
 static bool arg_enabled = true;
 static bool arg_read_crypttab = true;
@@ -421,8 +423,15 @@
                 l = strstrip(line);
                 if (*l == '#' || *l == 0)
                         continue;
-
+#ifdef HAVE_MSFORMAT
                 k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options);
+#else
+		name = malloc(257);
+		device = malloc(257);
+		password = malloc(257);
+		options = malloc(257);
+                k = sscanf(l, "%256s %256s %256s %256s", name, device, password, options);
+#endif /* HAVE_MSFORMAT */
                 if (k < 2 || k > 4) {
                         log_error("Failed to parse /etc/crypttab:%u, ignoring.", n);
                         r = EXIT_FAILURE;