1
0
forked from pool/util-linux
OBS User unknown 2007-10-02 23:18:16 +00:00 committed by Git OBS Bridge
parent cbfe7fd1d3
commit aa6a912f2c
12 changed files with 158 additions and 181 deletions

View File

@ -1,39 +0,0 @@
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkswap.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
@@ -660,7 +660,7 @@ main(int argc, char ** argv) {
usage();
}
- DEV = open(device_name,O_RDWR);
+ DEV = open(device_name, O_RDWR | O_EXCL);
if (DEV < 0 || fstat(DEV, &statbuf) < 0) {
perror(device_name);
exit(1);
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkfs.minix.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkfs.minix.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkfs.minix.c
@@ -699,7 +699,7 @@ main(int argc, char ** argv) {
tmp += dirsize;
*(short *)tmp = 2;
strcpy(tmp+2,".badblocks");
- DEV = open(device_name,O_RDWR );
+ DEV = open(device_name,O_RDWR | O_EXCL);
if (DEV<0)
die(_("unable to open %s"));
if (fstat(DEV,&statbuf)<0)
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkfs.bfs.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkfs.bfs.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkfs.bfs.c
@@ -170,7 +170,7 @@ main(int argc, char *argv[]) {
if (!S_ISBLK(statbuf.st_mode))
fatal(_("%s is not a block special device"), device);
- fd = open(device, O_RDWR);
+ fd = open(device, O_RDWR | O_EXCL);
if (fd == -1) {
perror(device);
fatal(_("cannot open %s"), device);

View File

@ -0,0 +1,70 @@
commit 5d1f6bae3b298809ecd63b3e55f6ab30caaa4dbf
Author: Matthias Koenig <mkoenig@suse.de>
Date: Thu Sep 20 11:11:18 2007 +0200
hwclock: fix --rtc option
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.
Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
diff --git a/hwclock/rtc.c b/hwclock/rtc.c
index f8e626e..724daf9 100644
--- a/hwclock/rtc.c
+++ b/hwclock/rtc.c
@@ -104,24 +104,21 @@ open_rtc(void) {
"/dev/misc/rtc",
NULL
};
- char **p = fls;
- char *fname = rtc_dev_name ? : *p;
-
- do {
- int fd = open(fname, O_RDONLY);
-
- if (fd < 0 && errno == ENOENT) {
- if (fname == rtc_dev_name)
- break;
- fname = *++p;
- } else {
- rtc_dev_name = *p;
- return fd;
- }
- } while(fname);
-
- if (!rtc_dev_name)
- rtc_dev_name = *fls;
+ char **p;
+
+ /* --rtc option has been given */
+ if (rtc_dev_name)
+ return open(rtc_dev_name, O_RDONLY);
+
+ for (p=fls; *p; ++p) {
+ int fd = open(*p, O_RDONLY);
+
+ if (fd < 0 && errno == ENOENT)
+ continue;
+ rtc_dev_name = *p;
+ return fd;
+ }
+ rtc_dev_name = *fls; /* default */
return -1;
}

View File

@ -1,32 +0,0 @@
--- util-linux-ng-2.13rc2+git20070725/mount/lomount.c.org 2007-08-16 17:09:33.258902000 +0200
+++ util-linux-ng-2.13rc2+git20070725/mount/lomount.c 2007-08-16 17:09:43.016135000 +0200
@@ -398,6 +398,7 @@
}
if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
perror ("ioctl: LOOP_CLR_FD");
+ close(fd);
return 1;
}
close (fd);
--- util-linux-ng-2.13rc2+git20070725/mount/fsprobe_volumeid.c.org 2007-08-16 18:16:03.120065000 +0200
+++ util-linux-ng-2.13rc2+git20070725/mount/fsprobe_volumeid.c 2007-08-16 18:27:43.967526000 +0200
@@ -34,8 +34,10 @@
return NULL;
id = volume_id_open_fd(fd);
- if (!id)
+ if (!id) {
+ close(fd);
return NULL;
+ }
/* TODO: use blkdev_get_size() */
if (ioctl(fd, BLKGETSIZE64, &size) != 0)
@@ -61,6 +63,7 @@
}
volume_id_close(id);
+ close(fd);
return value;
}

View File

@ -1,13 +0,0 @@
Index: util-linux-ng-2.13rc2+git20070725/mount/mount.c
===================================================================
--- util-linux-ng-2.13rc2+git20070725.orig/mount/mount.c
+++ util-linux-ng-2.13rc2+git20070725/mount/mount.c
@@ -546,7 +546,7 @@ create_mtab (void) {
char *extra_opts;
parse_opts (fstab->m.mnt_opts, &flags, &extra_opts);
mnt.mnt_dir = "/";
- mnt.mnt_fsname = canonicalize (fstab->m.mnt_fsname);
+ mnt.mnt_fsname = fsprobe_get_devname(fstab->m.mnt_fsname);
mnt.mnt_type = fstab->m.mnt_type;
mnt.mnt_opts = fix_opts_string (flags, extra_opts, NULL);
mnt.mnt_freq = mnt.mnt_passno = 0;

View File

@ -0,0 +1,50 @@
commit ebbeb2c7ac1b00b6083905957837a271e80b187e
Author: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Thu Sep 20 14:57:20 2007 +0200
mount: doesn't drop privileges properly when calling helpers
{,u}mount calls setuid() and setgid() in the wrong order and doesn't checking
the return value of set{u,g}id(() when running helpers like mount.nfs.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
diff --git a/mount/mount.c b/mount/mount.c
index 40699f3..5bc2b30 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -634,8 +634,12 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
char *oo, *mountargs[10];
int i = 0;
- setuid(getuid());
- setgid(getgid());
+ if(setgid(getgid()) < 0)
+ die(EX_FAIL, _("mount: cannot set group id: %s"), strerror(errno));
+
+ if(setuid(getuid()) < 0)
+ die(EX_FAIL, _("mount: cannot set user id: %s"), strerror(errno));
+
oo = fix_opts_string (flags, extra_opts, NULL);
mountargs[i++] = mountprog; /* 1 */
mountargs[i++] = (char *) spec; /* 2 */
diff --git a/mount/umount.c b/mount/umount.c
index b3100c9..3221619 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -102,8 +102,12 @@ check_special_umountprog(const char *spec, const char *node,
char *umountargs[8];
int i = 0;
- setuid(getuid());
- setgid(getgid());
+ if(setgid(getgid()) < 0)
+ die(EX_FAIL, _("umount: cannot set group id: %s"), strerror(errno));
+
+ if(setuid(getuid()) < 0)
+ die(EX_FAIL, _("umount: cannot set user id: %s"), strerror(errno));
+
umountargs[i++] = umountprog;
umountargs[i++] = xstrdup(node);
if (nomtab)

View File

@ -1,55 +0,0 @@
Original patch from Bernhard Voelker.
Index: util-linux-ng-2.13rc2+git20070725/schedutils/ionice.c
===================================================================
--- util-linux-ng-2.13rc2+git20070725.orig/schedutils/ionice.c
+++ util-linux-ng-2.13rc2+git20070725/schedutils/ionice.c
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
case 'h':
default:
usage();
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
break;
default:
printf("bad prio class %d\n", ioprio_class);
- return 1;
+ exit(EXIT_FAILURE);
}
if (!set) {
@@ -134,9 +134,10 @@ int main(int argc, char *argv[])
ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid);
- if (ioprio == -1)
+ if (ioprio == -1) {
perror("ioprio_get");
- else {
+ exit(EXIT_FAILURE);
+ } else {
ioprio_class = ioprio >> IOPRIO_CLASS_SHIFT;
if (ioprio_class != IOPRIO_CLASS_IDLE) {
ioprio = ioprio & 0xff;
@@ -147,11 +148,15 @@ int main(int argc, char *argv[])
} else {
if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1) {
perror("ioprio_set");
- return 1;
+ exit(EXIT_FAILURE);
}
- if (argv[optind])
+ if (argv[optind]) {
execvp(argv[optind], &argv[optind]);
+ /* execvp should never return */
+ perror("execvp");
+ exit(EXIT_FAILURE);
+ }
}
return 0;

View File

@ -1,16 +0,0 @@
Index: util-linux-ng-2.13-rc1/sys-utils/Makefile.am
===================================================================
--- util-linux-ng-2.13-rc1.orig/sys-utils/Makefile.am
+++ util-linux-ng-2.13-rc1/sys-utils/Makefile.am
@@ -26,6 +26,11 @@ usrsbinexec_PROGRAMS += rdev
man_MANS += rdev.8 ramsize.8 rootflags.8 vidmode.8
RDEV_LINKS = ramsize vidmode rootflags
endif
+if ARCH_86_64
+usrsbinexec_PROGRAMS += rdev
+man_MANS += rdev.8 ramsize.8 rootflags.8 vidmode.8
+RDEV_LINKS = ramsize vidmode rootflags
+endif
endif
SETARCH_LINKS = linux32 linux64

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:002412e93d8e85b1796fdbe65bbb0a4d193d0317a7155fda4270667e08bdfbfc
size 2702618

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:74640e1af0289d3be9397c8a7c8b62f147a3dbfad232fd4a7ec15a41e9ac1cf8
size 1544622

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Oct 1 17:08:06 CEST 2007 - mkoenig@suse.de
- update to version 2.13
merged upstream:
util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
util-linux-2.13-loop.patch
util-linux-2.13-mount_create_mtab.patch
util-linux-2.13-schedutils_error_handling.patch
util-linux-2.13-sys_utils_build_rdev_x86_64.patch
- fix hwclock --rtc option [#326106]
- fix setuid/setgid mixup and error checking [#327022]
-------------------------------------------------------------------
Fri Sep 14 11:24:33 CEST 2007 - mkoenig@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package util-linux (Version 2.12r+2.13rc2+git20070725)
# spec file for package util-linux (Version 2.13)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -17,12 +17,12 @@ Provides: util rawio raw base schedutils
Supplements: filesystem(minix)
Obsoletes: util rawio raw base schedutils
PreReq: %install_info_prereq permissions
License: BSD 3-Clause, GPL v2 or later
License: BSD 3-Clause; GPL v2 or later
Group: System/Base
AutoReqProv: on
Version: 2.12r+2.13rc2+git20070725
Release: 21
%define upver 2.13rc2+git20070725
Version: 2.13
Release: 1
%define upver 2.13
Summary: A collection of basic system utilities
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%upver.tar.bz2
Source2: nologin.c
@ -58,23 +58,17 @@ Patch2: util-linux-mount_opt_nofail.patch
#Patch96: util-linux-2.12r-mount_external_prog_on_guess.patch
# 160822 - fix for 153657
Patch3: util-linux-2.12r-fdisk_cyl.patch
# 238687 - let mkfs tools open block devices with O_EXCL
Patch4: util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
# 241372 - remove legacy warnings from fdisk
Patch5: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
# 254437 - swapon should automatically reset the suspend signature
# TODO: Needs to be ported to new version
Patch38: util-linux-2.12r-mount_swapon_swsuspend_resume.patch
# suse48633 - util-linux on x86_64 does not contain "rdev" and "vidmode"
Patch6: util-linux-2.13-sys_utils_build_rdev_x86_64.patch
# 297172 - mount does not free loop devices if it fails
Patch7: util-linux-2.13-loop.patch
Patch8: util-linux-2.13-mount_create_mtab.patch
Patch9: util-linux-2.13-schedutils_error_handling.patch
# 304861 - support password hashing and key length
Patch10: cryptsetup-2.13-crypto.diff
Patch10: util-linux-2.13-mount_losetup_crypto.patch
Patch11: util-linux-2.13-mount_fd_leak.patch
Patch12: util-linux-2.13-fdisk_cfdisk_ncursesw.patch
Patch13: util-linux-2.13-mount_helper_fix.patch
Patch14: util-linux-2.13-hwclock_rtc_option.patch
##
##
## adjtimex
@ -112,16 +106,13 @@ Authors:
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
#%patch38 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
#
cd adjtimex-*
%patch50 -p1
@ -185,8 +176,8 @@ make setctsid CFLAGS="$RPM_OPT_FLAGS"
CFLAGS=-DCONFIG_SMP
%endif
# Use autogen, when building from git tree
#autoreconf -fi
./autogen.sh
autoreconf -fi
#./autogen.sh
./configure --mandir=%{_mandir} \
--datadir=%{_datadir} \
--with-fsprobe=volume_id \
@ -324,7 +315,6 @@ rm -rf $RPM_BUILD_ROOT
if [ -f etc/fstab ]; then
sed -i 's:code=:codepage=:' etc/fstab
fi
%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/freeramdisk.info.gz
@ -559,8 +549,17 @@ fi
#/usr/bin/i386
#/usr/bin/ia64
#%endif
%changelog
* Mon Oct 01 2007 - mkoenig@suse.de
- update to version 2.13
merged upstream:
util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
util-linux-2.13-loop.patch
util-linux-2.13-mount_create_mtab.patch
util-linux-2.13-schedutils_error_handling.patch
util-linux-2.13-sys_utils_build_rdev_x86_64.patch
- fix hwclock --rtc option [#326106]
- fix setuid/setgid mixup and error checking [#327022]
* Fri Sep 14 2007 - mkoenig@suse.de
- link cfdisk against libncursesw instead libncurses to fix
broken utf-8 characters [#307353]