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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
diff -ur e2fsprogs-1.37/ChangeLog e2fsprogs-1.37-patched/ChangeLog
--- e2fsprogs-1.37/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,8 @@
+2005-03-31 Theodore Ts'o <tytso@mit.edu>
+
+ * configure.in: Add tests for __secure_getenv(), prctl(),
+ and sys/prctl.h
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/configure e2fsprogs-1.37-patched/configure
--- e2fsprogs-1.37/configure 2005-02-05 14:53:55.000000000 -0600
+++ e2fsprogs-1.37-patched/configure 2005-06-11 21:25:24.000000000 -0500
@@ -10713,7 +10713,8 @@
-for ac_header in stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if_dl.h netinet/in.h
+
+for ac_header in stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/prctl.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if_dl.h netinet/in.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -13816,7 +13817,9 @@
-for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc
+
+
+for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
diff -ur e2fsprogs-1.37/configure.in e2fsprogs-1.37-patched/configure.in
--- e2fsprogs-1.37/configure.in 2005-02-05 14:53:55.000000000 -0600
+++ e2fsprogs-1.37-patched/configure.in 2005-06-11 21:25:24.000000000 -0500
@@ -525,7 +525,7 @@
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
-AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if_dl.h netinet/in.h)
+AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/prctl.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if_dl.h netinet/in.h)
AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
[[
#if HAVE_SYS_QUEUE_H
@@ -628,7 +628,7 @@
[#include <sys/types.h>
#include <sys/socket.h>])
dnl
-AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc)
+AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl)
dnl
dnl Check to see if -lsocket is required (solaris) to make something
dnl that uses socket() to compile; this is needed for the UUID library
diff -ur e2fsprogs-1.37/debian/changelog e2fsprogs-1.37-patched/debian/changelog
--- e2fsprogs-1.37/debian/changelog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/debian/changelog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,20 @@
+e2fsprogs (1.37-2) unstable; urgency=low
+
+ * Fix filefrag so that it works non ext2/3 filesystems again.
+ (Closes: #303509)
+ * Make sure we include stdlib.h to fix a core dump bug in mke2fs on the
+ IA64 architecture (or other platforms where sizeof(ptr) > sizeof(int))
+ (Closes: #302200)
+ * Add missing return values so that we don't return garbage in certain
+ error cases in ext2fs_write_new_inode() and ext2fs_read_int_block().
+ * Fix minor spelling typo in the mke2fs man page
+ * Avoid doing the LOW_DTIME checks if the superblock last mount time
+ indicates that the system clock may not be set correctly.
+ * Add further paranoia checks to the blkid, ext2fs, and ss libraries to
+ make them safe to call from setuid or setgid applications.
+
+ -- Theodore Y. Ts'o <tytso@mit.edu> Sat, 9 Apr 2005 11:08:04 -0400
+
e2fsprogs (1.37-1) unstable; urgency=low
* New upstream release.
diff -ur e2fsprogs-1.37/e2fsck/ChangeLog e2fsprogs-1.37-patched/e2fsck/ChangeLog
--- e2fsprogs-1.37/e2fsck/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/e2fsck/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,9 @@
+2005-04-06 Theodore Ts'o <tytso@mit.edu>
+
+ * pass1.c (e2fsck_pass1): If the superblock last mount time (not
+ just the last write time) looks insane, then assume that
+ we can't do the LOW_DTIME checks.
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/e2fsck/pass1.c e2fsprogs-1.37-patched/e2fsck/pass1.c
--- e2fsprogs-1.37/e2fsck/pass1.c 2005-03-21 16:31:21.000000000 -0600
+++ e2fsprogs-1.37-patched/e2fsck/pass1.c 2005-06-11 21:25:24.000000000 -0500
@@ -518,7 +518,8 @@
if (ctx->progress)
if ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count))
return;
- if (fs->super->s_wtime < fs->super->s_inodes_count)
+ if ((fs->super->s_wtime < fs->super->s_inodes_count) ||
+ (fs->super->s_mtime < fs->super->s_inodes_count))
busted_fs_time = 1;
while (1) {
diff -ur e2fsprogs-1.37/e2fsprogs.lsm e2fsprogs-1.37-patched/e2fsprogs.lsm
--- e2fsprogs-1.37/e2fsprogs.lsm 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/e2fsprogs.lsm 2005-06-11 21:25:24.000000000 -0500
@@ -8,7 +8,7 @@
Author: tytso@mit.edu (Theodore Tso)
Maintained-by: tytso@mit.edu (Theodore Tso)
Primary-site: download.sourceforge.net /pub/sourceforge/e2fsprogs
- 3192kB e2fsprogs-1.37.tar.gz
+ 3432kB e2fsprogs-1.37.tar.gz
452kB e2fsprogs-libs-1.37.tar.gz
1kB e2fsprogs-1.37.lsm
Alternate-site:
diff -ur e2fsprogs-1.37/lib/blkid/ChangeLog e2fsprogs-1.37-patched/lib/blkid/ChangeLog
--- e2fsprogs-1.37/lib/blkid/ChangeLog 2005-03-21 21:32:51.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/blkid/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,12 @@
+2005-03-31 Theodore Ts'o <tytso@mit.edu>
+
+ * cache.c (blkid_get_cache): Use a much more paranoid
+ safe_getenv() function which will ignore the BLKID_FILE
+ environment varaible if the application program is setgid
+ or on a Linux system, if kernel doesn't think the process
+ is eligible to create a core dump. Also if glibc has
+ __secure_getenv(), then use it.
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/lib/blkid/cache.c e2fsprogs-1.37-patched/lib/blkid/cache.c
--- e2fsprogs-1.37/lib/blkid/cache.c 2005-03-21 21:11:36.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/blkid/cache.c 2005-06-11 21:25:24.000000000 -0500
@@ -10,12 +10,48 @@
* %End-Header%
*/
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#else
+#define PR_GET_DUMPABLE 3
+#endif
+#if (!defined(HAVE_PRCTL) && defined(linux))
+#include <sys/syscall.h>
+#endif
#include "blkidP.h"
int blkid_debug_mask = 0;
+
+static char *safe_getenv(const char *arg)
+{
+ if ((getuid() != geteuid()) || (getgid() != getgid()))
+ return NULL;
+#if HAVE_PRCTL
+ if (prctl(PR_GET_DUMPABLE) == 0)
+ return NULL;
+#else
+#if (defined(linux) && defined(SYS_prctl))
+ if (syscall(SYS_prctl, PR_GET_DUMPABLE) == 0)
+ return NULL;
+#endif
+#endif
+
+#ifdef HAVE___SECURE_GETENV
+ return __secure_getenv("BLKID_FILE");
+#else
+ return getenv("BLKID_FILE");
+#endif
+}
+
int blkid_get_cache(blkid_cache *ret_cache, const char *filename)
{
blkid_cache cache;
@@ -41,8 +77,8 @@
if (filename && !strlen(filename))
filename = 0;
- if (!filename && (getuid() == geteuid()))
- filename = getenv("BLKID_FILE");
+ if (!filename)
+ filename = safe_getenv("BLKID_FILE");
if (!filename)
filename = BLKID_CACHE_FILE;
cache->bic_filename = blkid_strdup(filename);
diff -ur e2fsprogs-1.37/lib/e2p/ChangeLog e2fsprogs-1.37-patched/lib/e2p/ChangeLog
--- e2fsprogs-1.37/lib/e2p/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/e2p/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,15 @@
+2005-04-09 Theodore Ts'o <tytso@mit.edu>
+
+ * ls.c: Add stdlib.h header file since list_super2() uses the
+ free() function.
+
+2005-03-30 Theodore Ts'o <tytso@mit.edu>
+
+ * ostype.c (e2p_os2string): Check to make sure malloc() is
+ successful before attempting to copy into it. Add
+ #include of stdlib.h to fix a core dump bug on the IA64
+ architecture. (Addresses Debian Bug #302200)
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/lib/e2p/ls.c e2fsprogs-1.37-patched/lib/e2p/ls.c
--- e2fsprogs-1.37/lib/e2p/ls.c 2005-03-19 14:59:40.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/e2p/ls.c 2005-06-11 21:25:24.000000000 -0500
@@ -12,6 +12,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <grp.h>
diff -ur e2fsprogs-1.37/lib/e2p/ostype.c e2fsprogs-1.37-patched/lib/e2p/ostype.c
--- e2fsprogs-1.37/lib/e2p/ostype.c 2005-03-19 00:17:09.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/e2p/ostype.c 2005-06-11 21:25:24.000000000 -0500
@@ -9,6 +9,7 @@
#include "e2p.h"
#include <string.h>
+#include <stdlib.h>
const char *os_tab[] =
{ "Linux",
@@ -32,7 +33,8 @@
os = "(unknown os)";
ret = malloc(strlen(os)+1);
- strcpy(ret, os);
+ if (ret)
+ strcpy(ret, os);
return ret;
}
diff -ur e2fsprogs-1.37/lib/ext2fs/ChangeLog e2fsprogs-1.37-patched/lib/ext2fs/ChangeLog
--- e2fsprogs-1.37/lib/ext2fs/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ext2fs/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,16 @@
+2005-04-09 Theodore Ts'o <tytso@mit.edu>
+
+ * inode.c (ext2fs_write_new_inode),
+ ind_block.c (ext2fs_read_ind_block): Add missing return
+ value in error return case. (Otherwise we return garbage
+ instead of the error code.)
+
+2005-03-31 Theodore Ts'o <tytso@mit.edu>
+
+ * test_io.c (test_open): If called by a setuid/setgid or an
+ otherwise privileged program, be paranoid and ignore the
+ TEST_IO_* environment variables.
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/lib/ext2fs/ext2fs.h e2fsprogs-1.37-patched/lib/ext2fs/ext2fs.h
--- e2fsprogs-1.37/lib/ext2fs/ext2fs.h 2005-03-20 21:31:41.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ext2fs/ext2fs.h 2005-06-11 21:28:17.000000000 -0500
@@ -61,6 +61,7 @@
#include <stdio.h>
#include <stdlib.h>
+#define EXT2_FLAT_INCLUDES
#if EXT2_FLAT_INCLUDES
#include "e2_types.h"
#include "ext2_fs.h"
diff -ur e2fsprogs-1.37/lib/ext2fs/ind_block.c e2fsprogs-1.37-patched/lib/ext2fs/ind_block.c
--- e2fsprogs-1.37/lib/ext2fs/ind_block.c 2005-01-05 22:15:49.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ext2fs/ind_block.c 2005-06-11 21:25:24.000000000 -0500
@@ -32,7 +32,7 @@
else {
retval = io_channel_read_blk(fs->io, blk, 1, buf);
if (retval)
- retval;
+ return retval;
}
#ifdef EXT2FS_ENABLE_SWAPFS
if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_READ)) {
diff -ur e2fsprogs-1.37/lib/ext2fs/inode.c e2fsprogs-1.37-patched/lib/ext2fs/inode.c
--- e2fsprogs-1.37/lib/ext2fs/inode.c 2005-03-21 00:10:13.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ext2fs/inode.c 2005-06-11 21:25:24.000000000 -0500
@@ -724,7 +724,6 @@
struct ext2_inode *inode)
{
struct ext2_inode *buf;
- errcode_t retval;
int size = EXT2_INODE_SIZE(fs->super);
struct ext2_inode_large *large_inode;
@@ -743,7 +742,7 @@
large_inode->i_extra_isize = sizeof(struct ext2_inode_large) -
EXT2_GOOD_OLD_INODE_SIZE;
- retval = ext2fs_write_inode_full(fs, ino, buf, size);
+ return ext2fs_write_inode_full(fs, ino, buf, size);
}
diff -ur e2fsprogs-1.37/lib/ext2fs/test_io.c e2fsprogs-1.37-patched/lib/ext2fs/test_io.c
--- e2fsprogs-1.37/lib/ext2fs/test_io.c 2004-12-06 16:45:50.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ext2fs/test_io.c 2005-06-11 21:25:24.000000000 -0500
@@ -22,6 +22,14 @@
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#else
+#define PR_GET_DUMPABLE 3
+#endif
+#if (!defined(HAVE_PRCTL) && defined(linux))
+#include <sys/syscall.h>
+#endif
#include "ext2_fs.h"
#include "ext2fs.h"
@@ -132,6 +140,27 @@
abort();
}
+static char *safe_getenv(const char *arg)
+{
+ if ((getuid() != geteuid()) || (getgid() != getgid()))
+ return NULL;
+#if HAVE_PRCTL
+ if (prctl(PR_GET_DUMPABLE) == 0)
+ return NULL;
+#else
+#if (defined(linux) && defined(SYS_prctl))
+ if (syscall(SYS_prctl, PR_GET_DUMPABLE) == 0)
+ return NULL;
+#endif
+#endif
+
+#ifdef HAVE___SECURE_GETENV
+ return __secure_getenv("BLKID_FILE");
+#else
+ return getenv("BLKID_FILE");
+#endif
+}
+
static errcode_t test_open(const char *name, int flags, io_channel *channel)
{
io_channel io = NULL;
@@ -178,25 +207,25 @@
data->write_byte = test_io_cb_write_byte;
data->outfile = NULL;
- if ((value = getenv("TEST_IO_LOGFILE")) != NULL)
+ if ((value = safe_getenv("TEST_IO_LOGFILE")) != NULL)
data->outfile = fopen(value, "w");
if (!data->outfile)
data->outfile = stderr;
data->flags = 0;
- if ((value = getenv("TEST_IO_FLAGS")) != NULL)
+ if ((value = safe_getenv("TEST_IO_FLAGS")) != NULL)
data->flags = strtoul(value, NULL, 0);
data->block = 0;
- if ((value = getenv("TEST_IO_BLOCK")) != NULL)
+ if ((value = safe_getenv("TEST_IO_BLOCK")) != NULL)
data->block = strtoul(value, NULL, 0);
data->read_abort_count = 0;
- if ((value = getenv("TEST_IO_READ_ABORT")) != NULL)
+ if ((value = safe_getenv("TEST_IO_READ_ABORT")) != NULL)
data->read_abort_count = strtoul(value, NULL, 0);
data->write_abort_count = 0;
- if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL)
+ if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
data->write_abort_count = strtoul(value, NULL, 0);
*channel = io;
diff -ur e2fsprogs-1.37/lib/ss/ChangeLog e2fsprogs-1.37-patched/lib/ss/ChangeLog
--- e2fsprogs-1.37/lib/ss/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ss/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,10 @@
+2005-03-31 Theodore Ts'o <tytso@mit.edu>
+
+ * get_readline.c (ss_get_readline), pager.c (ss_page_stdin): If
+ called by a setuid/setgid or an otherwise privileged
+ program, be paranoid and ignore the PAGER and
+ SS_READLINE_PATH environment variables.
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/lib/ss/get_readline.c e2fsprogs-1.37-patched/lib/ss/get_readline.c
--- e2fsprogs-1.37/lib/ss/get_readline.c 2003-12-07 11:11:38.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ss/get_readline.c 2005-06-11 21:25:24.000000000 -0500
@@ -50,7 +50,7 @@
if (info->readline_handle)
return;
- libpath = getenv("SS_READLINE_PATH");
+ libpath = ss_safe_getenv("SS_READLINE_PATH");
if (!libpath)
libpath = DEFAULT_LIBPATH;
if (*libpath == 0 || !strcmp(libpath, "none"))
diff -ur e2fsprogs-1.37/lib/ss/pager.c e2fsprogs-1.37-patched/lib/ss/pager.c
--- e2fsprogs-1.37/lib/ss/pager.c 2003-12-07 11:11:38.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ss/pager.c 2005-06-11 21:25:24.000000000 -0500
@@ -28,11 +28,40 @@
#include <sys/types.h>
#include <sys/file.h>
#include <signal.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#else
+#define PR_GET_DUMPABLE 3
+#endif
+#if (!defined(HAVE_PRCTL) && defined(linux))
+#include <sys/syscall.h>
+#endif
static char MORE[] = "more";
extern char *_ss_pager_name;
extern char *getenv PROTOTYPE((const char *));
+char *ss_safe_getenv(const char *arg)
+{
+ if ((getuid() != geteuid()) || (getgid() != getgid()))
+ return NULL;
+#if HAVE_PRCTL
+ if (prctl(PR_GET_DUMPABLE) == 0)
+ return NULL;
+#else
+#if (defined(linux) && defined(SYS_prctl))
+ if (syscall(SYS_prctl, PR_GET_DUMPABLE) == 0)
+ return NULL;
+#endif
+#endif
+
+#ifdef HAVE___SECURE_GETENV
+ return __secure_getenv("BLKID_FILE");
+#else
+ return getenv("BLKID_FILE");
+#endif
+}
+
/*
* this needs a *lot* of work....
*
@@ -89,7 +118,7 @@
sigdelset(&mask, SIGINT);
sigprocmask(SIG_SETMASK, &mask, 0);
if (_ss_pager_name == (char *)NULL) {
- if ((_ss_pager_name = getenv("PAGER")) == (char *)NULL)
+ if ((_ss_pager_name = ss_safe_getenv("PAGER")) == (char *)NULL)
_ss_pager_name = MORE;
}
(void) execlp(_ss_pager_name, _ss_pager_name, (char *) NULL);
diff -ur e2fsprogs-1.37/lib/ss/ss_internal.h e2fsprogs-1.37-patched/lib/ss/ss_internal.h
--- e2fsprogs-1.37/lib/ss/ss_internal.h 2003-12-07 11:11:38.000000000 -0600
+++ e2fsprogs-1.37-patched/lib/ss/ss_internal.h 2005-06-11 21:25:24.000000000 -0500
@@ -89,6 +89,7 @@
void ss_list_requests(int, char const * const *, int, pointer);
int ss_execute_command(int sci_idx, char *argv[]);
int ss_pager_create(void);
+char *ss_safe_getenv(const char *arg);
char **ss_rl_completion(const char *text, int start, int end);
extern ss_data **_ss_table;
diff -ur e2fsprogs-1.37/misc/ChangeLog e2fsprogs-1.37-patched/misc/ChangeLog
--- e2fsprogs-1.37/misc/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/misc/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,13 @@
+2005-04-09 Theodore Ts'o <tytso@mit.edu>
+
+ * filefrag.c (frag_report): Don't abort filefrag if
+ EXT3_IOC_GETFLAGS ioctl is not supported, so that filefrag
+ can work on non-ext2/3 filesystems, as advertised.
+ (Addresses Debian Bug: #303509)
+
+ * mke2fs.8.in: Fix minor spelling typo. (Addresses SourceForge
+ Bug #1177804)
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/misc/filefrag.c e2fsprogs-1.37-patched/misc/filefrag.c
--- e2fsprogs-1.37/misc/filefrag.c 2005-03-18 19:25:28.000000000 -0600
+++ e2fsprogs-1.37-patched/misc/filefrag.c 2005-06-11 21:25:24.000000000 -0500
@@ -110,11 +110,8 @@
close(fd);
return;
}
- if (ioctl(fd, EXT3_IOC_GETFLAGS, &flags) < 0) {
- perror("EXT3_IOC_GETFLAGS");
- close(fd);
- return;
- }
+ if (ioctl(fd, EXT3_IOC_GETFLAGS, &flags) < 0)
+ flags = 0;
if (flags & EXT3_EXTENTS_FL) {
printf("File is stored in extents format\n");
is_ext2 = 0;
diff -ur e2fsprogs-1.37/misc/mke2fs.8.in e2fsprogs-1.37-patched/misc/mke2fs.8.in
--- e2fsprogs-1.37/misc/mke2fs.8.in 2005-01-05 10:12:19.000000000 -0600
+++ e2fsprogs-1.37-patched/misc/mke2fs.8.in 2005-06-11 21:25:24.000000000 -0500
@@ -305,7 +305,7 @@
.B \-M
Set the last mounted directory for the filesystem. This might be useful
for the sake of utilities that key off of the last mounted directory to
-determine where the filesytem should be mounted.
+determine where the filesystem should be mounted.
.TP
.B \-n
causes mke2fs to not actually create a filesystem, but display what it
diff -ur e2fsprogs-1.37/tests/ChangeLog e2fsprogs-1.37-patched/tests/ChangeLog
--- e2fsprogs-1.37/tests/ChangeLog 2005-03-21 21:37:01.000000000 -0600
+++ e2fsprogs-1.37-patched/tests/ChangeLog 2005-06-11 21:25:24.000000000 -0500
@@ -1,3 +1,8 @@
+2005-04-09 Theodore Ts'o <tytso@mit.edu>
+
+ * test_script.in: Make the test script driver exit with a non-zero
+ status if there are any failed tests.
+
2005-03-21 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.37
diff -ur e2fsprogs-1.37/tests/test_script.in e2fsprogs-1.37-patched/tests/test_script.in
--- e2fsprogs-1.37/tests/test_script.in 2005-01-17 18:13:38.000000000 -0600
+++ e2fsprogs-1.37-patched/tests/test_script.in 2005-06-11 21:25:24.000000000 -0500
@@ -59,3 +59,4 @@
echo "$num_ok tests succeeded $num_failed tests failed"
+test "$num_failed" -eq 0 || exit 1
|