Compare commits

..

12 commits

Author SHA1 Message Date
Karel Zak
bac1509084 2.18-4.8: CVE-2010-3879
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-27 20:41:10 +01:00
Karel Zak
610a3d4de5 2.18-4.7: improve RAIDs detection
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-12 14:35:04 +01:00
Karel Zak
a39df2aac5 2.18-4.6: libblkid upstream fixes
- backport upstream patch to fix wipefs(8) for LUKS
 - backport upstream patch to fix blkid cache usage

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-25 13:09:35 +01:00
Karel Zak
1a6ca1d9ab 2.18-4.5: fix #563267
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-19 13:46:39 +01:00
Karel Zak
2dd9a9de20 2.18-4.4: fix #645640
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-27 00:36:28 +02:00
Karel Zak
ba161998dc 2.18-4.3: #641169 - cfdisk does not accept partition type
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-11 09:06:22 +02:00
Karel Zak
cb5474ca02 2.18-4.2: fix #538551, #625064
- fix #538551 - Dual-filesystem (ISO9660/HFS) CD-ROMs not mounted automatically
- fix #625064 - fuse-sshfs mounts are not displayed in Nautilus

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 13:30:55 +02:00
Karel Zak
285494e8eb 2.18-4.1: fix cfdisk(8) and findmnt(1)
- fix 630340 - cfdisk cannot read default installer partitioning
- don't truncate findmnt(1) output (usptream v2.18-6-ga93e569)

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 12:09:41 +02:00
Karel Zak
e05fd6b280 2.18-4: fix #623685
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-18 10:17:41 +02:00
Karel Zak
79fe500e3a Merge branch 'master' into f14
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-05 11:59:36 +02:00
Karel Zak
49e94c6245 - fix #618957 - ISO images listed in fstab are mounted twice at boot
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-02 11:42:32 +02:00
kzak
83a7109b70 - fix #615719 - tmpfs mount fails with 'user' option.
- fix #598631 - shutdown, reboot, halt and C-A-D don't work
2010-08-02 11:29:54 +02:00
31 changed files with 3875 additions and 2 deletions

View file

@ -1,2 +0,0 @@
util-linux-ng has been renamed to util-linux

51
mount.tmpfs Normal file
View file

@ -0,0 +1,51 @@
#! /bin/bash
#
# Copyright (C) 2009 Eric Paris <eparis@redhat.com>
# Daniel Walsh <dwalsh@redhat.com>
# Karel Zak <kzak@redhat.com>
#
# http://bugzilla.redhat.com/show_bug.cgi?id=476964
#
# Usage:
# /sbin/mount.tmpfs spec dir [-sfnv] [-o options]
#
case $1 in
-h|--help|-?)
echo "mount.tmpfs is a private mount(8) wrapper for tmpfs."
echo "Don't use it directly!"
exit 1
;;
esac
restricted=1
if [ $UID -eq 0 ] && [ $UID -eq $EUID ]; then
restricted=0
fi
# mount(8) in restricted mode (for non-root users) does not allow to use any
# mount options, types or so on command line. We have to call mount(8) with
# mountpoint only. All necessary options have to be defined in /etc/fstab.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=615719
#
if [ $restricted -eq 1 ]; then
exec /bin/mount -i "$2"
fi
# Remount with context mount options is unsupported
# http://bugzilla.redhat.com/show_bug.cgi?id=563267
#
if ! echo "$@" | grep -q -E '\-o.*remount'; then
if ! echo "$@" | grep -q -E '(fs|def|root)?context='; then
con=$(ls --scontext -d "$2" | cut -f 1 -d ' ')
if [ -n "$con" ] && [ "$con" != "?" ] && [ "$con" != "unlabeled" ]; then
exec /bin/mount "$@" -o "rootcontext=\"$con\"" -i -t tmpfs
fi
fi
fi
exec /bin/mount "$@" -i -t tmpfs

63
nologin.8 Normal file
View file

@ -0,0 +1,63 @@
.\" $OpenBSD: nologin.8,v 1.8 1999/06/04 02:45:19 aaron Exp $
.\" $NetBSD: nologin.8,v 1.3 1995/03/18 14:59:09 cgd Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)nologin.8 8.1 (Berkeley) 6/19/93
.\"
.Dd February 15, 1997
.Dt NOLOGIN 8
.Os
.Sh NAME
.Nm nologin
.Nd politely refuse a login
.Sh SYNOPSIS
.Nm nologin
.Sh DESCRIPTION
.Nm
displays a message that an account is not available and
exits non-zero.
It is intended as a replacement shell field for accounts that
have been disabled.
.Pp
If the file
.Pa /etc/nologin.txt
exists,
.Nm
displays its contents to the user instead of the default message.
.Sh SEE ALSO
.Xr login 1
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.4 .

58
nologin.c Normal file
View file

@ -0,0 +1,58 @@
/* $OpenBSD: nologin.c,v 1.2 1997/04/04 16:51:37 millert Exp $ */
/*
* Copyright (c) 1997, Jason Downs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
/* Distinctly different from _PATH_NOLOGIN. */
#define _PATH_NOLOGIN_TXT "/etc/nologin.txt"
#define DEFAULT_MESG "This account is currently not available.\n"
/*ARGSUSED*/
int main(argc, argv)
int argc;
char *argv[];
{
int nfd, nrd;
char nbuf[128];
nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
if (nfd < 0) {
write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
exit (1);
}
while ((nrd = read(nfd, nbuf, sizeof(nbuf))) > 0)
write(STDOUT_FILENO, nbuf, nrd);
close (nfd);
exit (1);
}

2
sources Normal file
View file

@ -0,0 +1,2 @@
7eeb9a6f7a258174bf0fa80f1370788d floppy-0.16.tar.bz2
2f5f71e6af969d041d73ab778c141a77 util-linux-ng-2.18.tar.bz2

View file

@ -0,0 +1,10 @@
--- util-linux-2.13-pre6/sys-utils/ctrlaltdel.8.kzak 2006-08-10 12:23:53.000000000 +0200
+++ util-linux-2.13-pre6/sys-utils/ctrlaltdel.8 2006-08-10 12:24:08.000000000 +0200
@@ -32,7 +32,6 @@
.SH FILES
.I /etc/rc.local
.SH "SEE ALSO"
-.BR simpleinit (8),
.BR init (8)
.SH AUTHOR
Peter Orbaek (poe@daimi.aau.dk)

View file

@ -0,0 +1,23 @@
--- util-linux-ng-2.13-rc3/disk-utils/fdformat.8.xxx 2007-07-03 01:56:04.000000000 +0200
+++ util-linux-ng-2.13-rc3/disk-utils/fdformat.8 2007-08-13 12:07:58.000000000 +0200
@@ -45,6 +45,10 @@
.BR setfdprm (8)
to load the disk parameters.
+For ATAPI IDE floppy driver (also known as LS-120 drives or "Superdisk"
+drives) you have to use the
+.BR floppy (8).
+
.SH OPTIONS
.TP
.B \-n
@@ -54,7 +58,8 @@
.BR fd (4),
.BR setfdprm (8),
.BR mkfs (8),
-.BR emkfs (8)
+.BR emkfs (8),
+.BR floppy (8)
.SH AUTHOR
Werner Almesberger (almesber@nessie.cs.id.ethz.ch)
.SH AVAILABILITY

View file

@ -0,0 +1,102 @@
--- util-linux-2.12p/floppy-0.16/floppyfloppy.c.generic 2001-02-13 01:15:38.000000000 +0100
+++ util-linux-2.12p/floppy-0.16/floppyfloppy.c 2005-09-30 15:38:08.000000000 +0200
@@ -264,6 +264,33 @@
#endif
}
+/* -1=error, 1=true, 0=false */
+static int check_generic(const char *dev, int n)
+{
+ struct floppy_struct param;
+ int fd;
+
+ if ((fd=open(dev, O_RDONLY)) < 0)
+ {
+ perror(dev);
+ return -1;
+ }
+ if (ioctl(fd,FDGETPRM,(long) &param) < 0)
+ {
+ perror(dev);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+
+ if (param.sect==floppy_type[n].sectors &&
+ param.head==floppy_type[n].heads &&
+ param.track==floppy_type[n].tracks)
+ /* generic device uses expected format */
+ return 1;
+
+ return 0;
+}
static int do_format(const char *dev, int fmtnum,
int (*fmt_func)(const char *, int), int flags)
@@ -275,6 +302,7 @@
struct format_descr curtrack;
int pct;
struct stat stat_buf;
+ int gen = 0;
int i, j;
char *devname;
@@ -297,23 +325,52 @@
strcat(strcpy(devname, dev), floppy_type[fmtnum].dev);
+ if (stat(devname, &stat_buf)==-1 && errno==ENOENT)
+ {
+ /* /dev/fd0xxxxx doesn't exist ...try to use generic device
+ *
+ * Note: we needn't size specific device if the generic device uses
+ * right floppy format (FDGETPRM). -- Karel Zak [30/09/2005]
+ */
+ if ((gen = check_generic(dev, fmtnum))==1) /* true */
+ {
+ fprintf(stderr, _("WARNING: size specific device %s doesn't exist, using generic device: %s\n"),
+ devname, dev);
+ strcpy(devname, dev);
+ }
+ else if (gen==0) /* false */
+ {
+ fprintf(stderr, _("ERROR: size specific device %1$s doesn't exist. Use \"MAKEDEV %1$s\" and try it again.\n"), devname);
+ return (1);
+ }
+ else /* error -- no floppy medium or device? */
+ return(1);
+ }
fd=open(devname, O_WRONLY);
if (fd < 0)
{
perror(devname);
return (1);
}
-
- if (fstat(fd, &stat_buf) ||
- !S_ISBLK(stat_buf.st_mode) ||
- MINOR_DEV(stat_buf.st_rdev) != fmtnum)
+ if (fstat(fd, &stat_buf) < 0)
+ {
+ perror(devname);
+ close(fd);
+ return (1);
+ }
+ if (!S_ISBLK(stat_buf.st_mode))
+ {
+ fprintf(stderr,_("%s: not a block device\n"), devname);
+ close(fd);
+ return (1);
+ }
+ if (gen==0 && MINOR_DEV(stat_buf.st_rdev) != fmtnum)
{
errno=EINVAL;
perror(devname);
close(fd);
return (1);
}
-
if (ioctl(fd, FDGETPRM, &geo) < 0)
{
perror(devname);

View file

@ -0,0 +1,10 @@
--- util-linux-ng-2.13-rc3/floppy-0.16/superfloppy.c.kzak 2001-07-14 05:26:16.000000000 +0200
+++ util-linux-ng-2.13-rc3/floppy-0.16/superfloppy.c 2007-08-13 13:14:53.000000000 +0200
@@ -12,6 +12,7 @@
#include <errno.h>
#include <popt.h>
#include <libintl.h>
+#include <locale.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

View file

@ -0,0 +1,13 @@
Index: util-linux-ng-2.14.2-rc1/login-utils/login.c
===================================================================
--- util-linux-ng-2.14.2-rc1.orig/login-utils/login.c
+++ util-linux-ng-2.14.2-rc1/login-utils/login.c
@@ -1415,7 +1415,7 @@ dolastlog(int quiet) {
struct lastlog ll;
int fd;
- if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
+ if ((fd = open(_PATH_LASTLOG, O_RDWR|O_CREAT, 0)) >= 0) {
lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET);
if (!quiet) {
if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) &&

View file

@ -0,0 +1,48 @@
diff -up util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c.kzak util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c
--- util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c.kzak 2009-03-25 13:19:08.000000000 +0100
+++ util-linux-ng-2.15.1-rc1/sys-utils/ipcs.c 2009-06-04 15:22:48.000000000 +0200
@@ -243,6 +243,26 @@ print_perms (int id, struct ipc_perm *ip
printf(" %-10d\n", ipcp->gid);
}
+static unsigned long long
+shminfo_from_proc(const char *name, unsigned long def)
+{
+ char path[256];
+ char buf[64];
+ FILE *f;
+ unsigned long long res = def;
+
+ if (!name)
+ return res;
+
+ snprintf(path, sizeof(path), "/proc/sys/kernel/%s", name);
+
+ if (!(f = fopen(path, "r")))
+ return res;
+ if (fgets(buf, sizeof(buf), f))
+ res = atoll(buf);
+ fclose(f);
+ return res;
+}
void do_shm (char format)
{
@@ -266,12 +286,12 @@ void do_shm (char format)
return;
/* glibc 2.1.3 and all earlier libc's have ints as fields
of struct shminfo; glibc 2.1.91 has unsigned long; ach */
- printf (_("max number of segments = %lu\n"),
- (unsigned long) shminfo.shmmni);
- printf (_("max seg size (kbytes) = %lu\n"),
- (unsigned long) (shminfo.shmmax >> 10));
+ printf (_("max number of segments = %llu\n"),
+ shminfo_from_proc("shmmni", shminfo.shmmni));
+ printf (_("max seg size (kbytes) = %llu\n"),
+ (shminfo_from_proc("shmmax", shminfo.shmmax) >> 10));
printf (_("max total shared memory (kbytes) = %llu\n"),
- getpagesize() / 1024 * (unsigned long long) shminfo.shmall);
+ getpagesize() / 1024 * shminfo_from_proc("shmall", shminfo.shmall));
printf (_("min seg size (bytes) = %lu\n"),
(unsigned long) shminfo.shmmin);
return;

View file

@ -0,0 +1,78 @@
---
misc-utils/blkid.8 | 4 ++--
misc-utils/blkid.c | 2 +-
shlibs/blkid/libblkid.3 | 6 +++---
shlibs/blkid/src/blkidP.h | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
--- util-linux-ng-2.18-rc1.orig/misc-utils/blkid.8
+++ util-linux-ng-2.18-rc1/misc-utils/blkid.8
@@ -81,7 +81,7 @@ same meaning as "KiB") or decimal (10^N)
Read from
.I cachefile
instead of reading from the default cache file
-.IR /etc/blkid.tab .
+.IR /etc/blkid/blkid.tab .
If you want to start with a clean cache (i.e. don't report devices previously
scanned but not necessarily available at this time), specify
.IR /dev/null .
@@ -228,7 +228,7 @@ Display version number and exit.
Write the device cache to
.I writecachefile
instead of writing it to the default cache file
-.IR /etc/blkid.tab .
+.IR /etc/blkid/blkid.tab .
If you don't want to save the cache to the default file, specify
.IR /dev/null.
If not specified it will be the same file as that given by the
--- util-linux-ng-2.18-rc1.orig/misc-utils/blkid.c
+++ util-linux-ng-2.18-rc1/misc-utils/blkid.c
@@ -65,7 +65,7 @@ static void usage(int error)
" [-o format] <dev> [dev ...]\n\n"
" %1$s -i [-s <tag>] [-o format] <dev> [dev ...]\n\n"
"Options:\n"
- " -c <file> cache file (default: /etc/blkid.tab, /dev/null = none)\n"
+ " -c <file> cache file (default: /etc/blkid/blkid.tab, /dev/null = none)\n"
" -h print this usage message and exit\n"
" -g garbage collect the blkid cache\n"
" -o <format> output format; can be one of:\n"
--- util-linux-ng-2.18-rc1.orig/shlibs/blkid/libblkid.3
+++ util-linux-ng-2.18-rc1/shlibs/blkid/libblkid.3
@@ -24,7 +24,7 @@ A common use is to allow use of LABEL= a
specific block device names into configuration files.
.P
Block device information is normally kept in a cache file
-.I /etc/blkid.tab
+.I /etc/blkid/blkid.tab
and is verified to still be valid before being returned to the user
(if the user has read permission on the raw block device, otherwise not).
The cache file also allows unprivileged users (normally anyone other
@@ -59,7 +59,7 @@ symlink does not match with LABEL or UUI
.I CACHE_FILE=<path>
Overrides the standard location of the cache file. This setting can be
overridden by the environment variable BLKID_FILE. Default is
-.I /etc/blkid.tab.
+.I /etc/blkid/blkid.tab.
.TP
.I EVALUATE=<methods>
Defines LABEL and UUID evaluation method(s). Currently, the libblkid library
@@ -77,7 +77,7 @@ from Ted Ts'o. The library was subseque
The low-level probing code was rewritten by Karel Zak.
.SH FILES
.TP 18
-.I /etc/blkid.tab
+.I /etc/blkid/blkid.tab
caches data extracted from each recognized block device
.TP
.I /etc/blkid.conf
--- util-linux-ng-2.18-rc1.orig/shlibs/blkid/src/blkidP.h
+++ util-linux-ng-2.18-rc1/shlibs/blkid/src/blkidP.h
@@ -279,7 +279,7 @@ extern int blkid_fstatat(DIR *dir, const
extern int blkid_openat(DIR *dir, const char *dirname, const char *filename,
int flags);
-#define BLKID_CACHE_FILE "/etc/blkid.tab"
+#define BLKID_CACHE_FILE "/etc/blkid/blkid.tab"
#define BLKID_CONFIG_FILE "/etc/blkid.conf"
#define BLKID_ERR_IO 5

View file

@ -0,0 +1,83 @@
diff -up util-linux-ng-2.17.2/mount/mount.c.kzak util-linux-ng-2.17.2/mount/mount.c
--- util-linux-ng-2.17.2/mount/mount.c.kzak 2010-03-22 09:10:56.000000000 +0100
+++ util-linux-ng-2.17.2/mount/mount.c 2010-07-29 16:15:28.000000000 +0200
@@ -1090,7 +1090,8 @@ loop_check(const char **spec, const char
if (verbose)
printf(_("mount: skipping the setup of a loop device\n"));
} else {
- int loop_opts = SETLOOP_AUTOCLEAR; /* always attempt autoclear */
+ /* use autoclear loopdev on system without regular mtab only */
+ int loop_opts = mtab_is_writable() ? 0 : SETLOOP_AUTOCLEAR;
int res;
if (*flags & MS_RDONLY)
@@ -1759,6 +1760,50 @@ mounted (const char *spec0, const char *
return ret;
}
+/* returns 0 if not mounted, 1 if mounted and -1 in case of error */
+static int
+is_fstab_entry_mounted(struct mntentchn *mc, int verbose)
+{
+ struct stat st;
+
+ if (mounted(mc->m.mnt_fsname, mc->m.mnt_dir))
+ goto yes;
+
+ /* extra care for loop devices */
+ if ((strstr(mc->m.mnt_opts, "loop=") ||
+ (stat(mc->m.mnt_fsname, &st) == 0 && S_ISREG(st.st_mode)))) {
+
+ char *p = strstr(mc->m.mnt_opts, "offset=");
+ uintmax_t offset = 0;
+
+ if (p && *(p + 7)) {
+ char *end = NULL;
+
+ p += 7;
+ errno = 0;
+ offset = strtoumax(p, &end, 0);
+
+ if (end == p || (errno != 0 &&
+ (offset == UINTMAX_MAX || offset == 0))) {
+ if (verbose)
+ printf(_("mount: ignore %s "
+ "(unparsable offset= option)\n"),
+ mc->m.mnt_fsname);
+ return -1;
+ }
+ }
+ if (is_mounted_same_loopfile(mc->m.mnt_dir, mc->m.mnt_fsname, offset))
+ goto yes;
+ }
+
+ return 0;
+yes:
+ if (verbose)
+ printf(_("mount: %s already mounted on %s\n"),
+ mc->m.mnt_fsname, mc->m.mnt_dir);
+ return 1;
+}
+
/* avoid using stat() on things we are not going to mount anyway.. */
static int
has_noauto (const char *opts) {
@@ -1804,16 +1849,8 @@ do_mount_all (char *types, char *options
if (matching_type (mc->m.mnt_type, types)
&& matching_opts (mc->m.mnt_opts, test_opts)
&& !streq (mc->m.mnt_dir, "/")
- && !streq (mc->m.mnt_dir, "root")) {
-
- if (mounted (mc->m.mnt_fsname, mc->m.mnt_dir)) {
- if (verbose)
- printf(_("mount: %s already mounted "
- "on %s\n"),
- mc->m.mnt_fsname,
- mc->m.mnt_dir);
- continue;
- }
+ && !streq (mc->m.mnt_dir, "root")
+ && !is_fstab_entry_mounted(mc, verbose)) {
mtmp = (struct mntentchn *) xmalloc(sizeof(*mtmp));
*mtmp = *mc;

View file

@ -0,0 +1,206 @@
based on upstream patch:
commit 848e5e6ce3978d921366b799d907a78a12299924
Author: Karel Zak <kzak@redhat.com>
Date: Wed Aug 18 09:02:03 2010 +0200
agetty: add -s to reuse existing baud rate
For example:
/sbin/agetty -s /dev/ttyS0 9600
will reuse the speed the kernel configured on the port. If the setting
from kernel is useless (tty returns BREAK character) then the baud
rate from command line (9600) is used.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685
Signed-off-by: Karel Zak <kzak@redhat.com>
and
commit e98f4af950a64db188e0a9f3eed20fefaa463a99
Author: Karel Zak <kzak@redhat.com>
Date: Fri Oct 22 21:24:50 2010 +0200
agetty: fix -s option (baud rate setup)
The problem is pretty visible in strace output:
broken version:
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
[...]
ioctl(0, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0
^^^
fixed version:
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
[...]
ioctl(0, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
Reported-by: Jon Masters <jcm@redhat.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=645640
Signed-off-by: Karel Zak <kzak@redhat.com>
diff -up util-linux-ng-2.18/login-utils/agetty.8.kzak util-linux-ng-2.18/login-utils/agetty.8
--- util-linux-ng-2.18/login-utils/agetty.8.kzak 2010-02-04 12:53:56.000000000 +0100
+++ util-linux-ng-2.18/login-utils/agetty.8 2010-10-22 22:07:43.000000000 +0200
@@ -3,7 +3,7 @@
agetty \- alternative Linux getty
.SH SYNOPSIS
-.BR "agetty " [\-8ihLmnUw]
+.BR "agetty " [\-8ihLmnsUw]
.RI "[-f " issue_file ]
.RI "[-l " login_program ]
.RI "[-I " init ]
@@ -12,16 +12,6 @@ agetty \- alternative Linux getty
.I port
.I baud_rate,...
.RI [ term ]
-.br
-.BR "agetty " [\-8ihLmnw]
-.RI "[-f " issue_file ]
-.RI "[-l " login_program ]
-.RI "[-I " init ]
-.RI "[-t " timeout ]
-.RI "[-H " login_host ]
-.I baud_rate,...
-.I port
-.RI [ term ]
.SH DESCRIPTION
.ad
@@ -163,6 +153,10 @@ Force the line to be a local line with n
be useful when you have a locally attached terminal where the serial line
does not set the carrier detect signal.
.TP
+\-s
+Try to keep the existing baud rate. The baud rates from
+the command line are used when agetty receives a BREAK character.
+.TP
\-U
Turn on support for detecting an uppercase only terminal. This setting will
detect a login name containing only capitals as indicating an uppercase
diff -up util-linux-ng-2.18/login-utils/agetty.c.kzak util-linux-ng-2.18/login-utils/agetty.c
--- util-linux-ng-2.18/login-utils/agetty.c.kzak 2010-04-01 16:11:56.000000000 +0200
+++ util-linux-ng-2.18/login-utils/agetty.c 2010-10-22 22:15:40.000000000 +0200
@@ -133,6 +133,7 @@ struct options {
#define F_CUSTISSUE (1<<6) /* give alternative issue file */
#define F_NOPROMPT (1<<7) /* don't ask for login name! */
#define F_LCUC (1<<8) /* Support for *LCUC stty modes */
+#define F_KEEPSPEED (1<<9) /* Follow baud rate from kernel */
/* Storage for things detected while the login name was read. */
@@ -203,7 +204,7 @@ void parse_args P_((int argc, char **arg
void parse_speeds P_((struct options *op, char *arg));
void update_utmp P_((char *line));
void open_tty P_((char *tty, struct termios *tp, int local));
-void termio_init P_((struct termios *tp, int speed, struct options *op));
+void termio_init P_((struct termios *tp, struct options *op));
void auto_baud P_((struct termios *tp));
void do_prompt P_((struct options *op, struct termios *tp));
void next_speed P_((struct termios *tp, struct options *op));
@@ -297,7 +298,7 @@ main(argc, argv)
tcsetpgrp(0, getpid());
/* Initialize the termios settings (raw mode, eight-bit, blocking i/o). */
debug("calling termio_init\n");
- termio_init(&termios, options.speeds[FIRST_SPEED], &options);
+ termio_init(&termios, &options);
/* write the modem init string and DON'T flush the buffers */
if (options.flags & F_INITSTRING) {
@@ -373,7 +374,7 @@ parse_args(argc, argv, op)
extern int optind; /* getopt */
int c;
- while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wUn"))) {
+ while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mst:wUn"))) {
switch (c) {
case '8':
op->eightbits = 1;
@@ -443,6 +444,9 @@ parse_args(argc, argv, op)
case 'n':
op->flags |= F_NOPROMPT;
break;
+ case 's':
+ op->flags |= F_KEEPSPEED; /* keep kernel defined speed */
+ break;
case 't': /* time out */
if ((op->timeout = atoi(optarg)) <= 0)
error(_("bad timeout value: %s"), optarg);
@@ -691,11 +695,17 @@ char gbuf[1024];
char area[1024];
void
-termio_init(tp, speed, op)
+termio_init(tp, op)
struct termios *tp;
- int speed;
struct options *op;
{
+ speed_t ispeed, ospeed;
+
+ if (op->flags & F_KEEPSPEED) {
+ ispeed = cfgetispeed(tp); /* save the original setting */
+ ospeed = cfgetospeed(tp);
+ } else
+ ospeed = ispeed = op->speeds[FIRST_SPEED];
/*
* Initial termios settings: 8-bit characters, raw-mode, blocking i/o.
@@ -706,14 +716,20 @@ termio_init(tp, speed, op)
/* flush input and output queues, important for modems! */
(void) tcflush(0, TCIOFLUSH);
+ tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
+
tp->c_cflag = CS8 | HUPCL | CREAD;
- cfsetispeed(tp, speed);
- cfsetospeed(tp, speed);
+
+ /* Note that the speed is stored in the c_cflag termios field, so we have
+ * set the speed always when the cflag se reseted.
+ */
+ cfsetispeed(tp, ispeed);
+ cfsetospeed(tp, ospeed);
+
if (op->flags & F_LOCAL) {
tp->c_cflag |= CLOCAL;
}
- tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
#ifdef HAVE_STRUCT_TERMIOS_C_LINE
tp->c_line = 0;
#endif
@@ -973,9 +989,18 @@ next_speed(tp, op)
struct termios *tp;
struct options *op;
{
- static int baud_index = FIRST_SPEED;/* current speed index */
+ static int baud_index = -1;
+
+ if (baud_index == -1)
+ /*
+ * if the F_KEEPSPEED flags is set then the FIRST_SPEED is not
+ * tested yet (see termio_init()).
+ */
+ baud_index = (op->flags & F_KEEPSPEED) ? FIRST_SPEED :
+ 1 % op->numspeed;
+ else
+ baud_index = (baud_index + 1) % op->numspeed;
- baud_index = (baud_index + 1) % op->numspeed;
cfsetispeed(tp, op->speeds[baud_index]);
cfsetospeed(tp, op->speeds[baud_index]);
(void) tcsetattr(0, TCSANOW, tp);
@@ -1203,7 +1228,7 @@ bcode(s)
void
usage()
{
- fprintf(stderr, _("Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
+ fprintf(stderr, _("Usage: %s [-8hiLmsUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
exit(1);
}

View file

@ -0,0 +1,26 @@
backport of upstream patch:
Commit: e143d1f00497f0178a1febec8fb4aa7c842fa35a
From: Karel Zak <kzak@redhat.com>
Date: Mon, 12 Jul 2010 11:57:55 +0200
Subject: [PATCH] aggety: don't wipe CLOCAL flag
gettey should not clear the flag. It seems that the flag is
automatically enabled for serial consoles tht don't use CD signal.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
Signed-off-by: Karel Zak <kzak@redhat.com>
diff -up util-linux-ng-2.18/login-utils/agetty.c.kzak util-linux-ng-2.18/login-utils/agetty.c
--- util-linux-ng-2.18/login-utils/agetty.c.kzak 2010-10-22 21:51:31.000000000 +0200
+++ util-linux-ng-2.18/login-utils/agetty.c 2010-10-22 21:51:31.000000000 +0200
@@ -715,7 +715,7 @@ termio_init(tp, speed, op)
tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
- tp->c_cflag = CS8 | HUPCL | CREAD;
+ tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
/* Note that the speed is stored in the c_cflag termios field, so we have
* set the speed always when the cflag se reseted.

View file

@ -0,0 +1,33 @@
From 23489c26252f1c40407804e0cd4964835db18e8c Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 7 Sep 2010 11:30:50 +0200
Subject: [PATCH] libblkid: don't ignore zero for SBMAGIC_OFFSET
The side effect of this bug is that wipefs(8) does not report LUKS...
Signed-off-by: Karel Zak <kzak@redhat.com>
---
shlibs/blkid/src/superblocks/superblocks.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c
index 3d66d98..95c10d6 100644
--- a/shlibs/blkid/src/superblocks/superblocks.c
+++ b/shlibs/blkid/src/superblocks/superblocks.c
@@ -487,10 +487,9 @@ int blkid_probe_set_magic(blkid_probe pr, blkid_loff_t offset,
int rc = 0;
struct blkid_chain *chn = blkid_probe_get_chain(pr);
- if (chn->flags & BLKID_SUBLKS_MAGIC) {
- if (magic && len)
- rc = blkid_probe_set_value(pr, "SBMAGIC", magic, len);
- if (!rc && offset)
+ if (magic && len && (chn->flags & BLKID_SUBLKS_MAGIC)) {
+ rc = blkid_probe_set_value(pr, "SBMAGIC", magic, len);
+ if (!rc)
rc = blkid_probe_sprintf_value(pr, "SBMAGIC_OFFSET",
"%llu", offset);
}
--
1.7.3.1

View file

@ -0,0 +1,12 @@
diff -up util-linux-ng-2.18/shlibs/blkid/src/partitions/partitions.c.kzak util-linux-ng-2.18/shlibs/blkid/src/partitions/partitions.c
--- util-linux-ng-2.18/shlibs/blkid/src/partitions/partitions.c.kzak 2011-01-12 14:21:10.000000000 +0100
+++ util-linux-ng-2.18/shlibs/blkid/src/partitions/partitions.c 2011-01-12 14:20:54.000000000 +0100
@@ -833,7 +833,7 @@ int blkid_probe_is_covered_by_pt(blkid_p
for (i = 0; i < nparts; i++) {
blkid_partition par = &ls->parts[i];
- if (par->start + par->size > pr->size) {
+ if (par->start + par->size > (pr->size >> 9)) {
DBG(DEBUG_LOWPROBE, printf("partition #%d overflows "
"device (off=%lu size=%lu)\n",
par->partno, par->start, par->size));

View file

@ -0,0 +1,63 @@
From e8fc977aba09ddbd89b25276fd777c3f0eef9299 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 23 Nov 2010 19:49:58 +0100
Subject: [PATCH] libblkid: cache is incorrectly revalidated
for example:
# echo "password" | cryptsetup luksFormat /dev/loop7
# blkid /dev/loop7
/dev/loop7: UUID="09240a80-1cf1-456d-9a6e-a35b39dc1f2b" TYPE="crypto_LUKS"
# pvcreate -ff /dev/loop7
# blkid /dev/loop7
#
the second blkid call has to return info about LVM.
Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
shlibs/blkid/src/blkidP.h | 2 +-
shlibs/blkid/src/probe.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/shlibs/blkid/src/blkidP.h b/shlibs/blkid/src/blkidP.h
index 6ac8910..956a84e 100644
--- a/shlibs/blkid/src/blkidP.h
+++ b/shlibs/blkid/src/blkidP.h
@@ -437,7 +437,7 @@ extern size_t blkid_rtrim_whitespace(unsigned char *str);
((bmp)[ blkid_bmp_idx_byte(item) ] |= blkid_bmp_idx_bit(item))
#define blkid_bmp_unset_item(bmp, item) \
- ((bmp)[ bmp_idx_byte(item) ] &= ~bmp_idx_bit(item))
+ ((bmp)[ blkid_bmp_idx_byte(item) ] &= ~blkid_bmp_idx_bit(item))
#define blkid_bmp_get_item(bmp, item) \
((bmp)[ blkid_bmp_idx_byte(item) ] & blkid_bmp_idx_bit(item))
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c
index 3698b99..33e2fe1 100644
--- a/shlibs/blkid/src/probe.c
+++ b/shlibs/blkid/src/probe.c
@@ -431,14 +431,13 @@ int __blkid_probe_invert_filter(blkid_probe pr, int chain)
struct blkid_chain *chn;
unsigned long *fltr;
- fltr = blkid_probe_get_filter(pr, chain, FALSE);
- if (!fltr)
- return -1;
-
chn = &pr->chains[chain];
+ if (!chn->driver->has_fltr || !chn->fltr)
+ return -1;
+
for (i = 0; i < blkid_bmp_nwords(chn->driver->nidinfos); i++)
- fltr[i] = ~fltr[i];
+ chn->fltr[i] = ~chn->fltr[i];
DBG(DEBUG_LOWPROBE, printf("probing filter inverted\n"));
/* blkid_probe_dump_filter(pr, chain); */
--
1.7.3.1

View file

@ -0,0 +1,88 @@
From 73356e0553bd9ac00f556891a4798064c0ee6849 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 6 Sep 2010 13:30:48 +0200
Subject: [PATCH] cfdisk: don't use size of device based on cylinders
This patch is enough to make cfdisk usable on non-DOS disks where
partitioning is not based on CHS. cfdisk should not print error
messages for such disks.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=630340
Signed-off-by: Karel Zak <kzak@redhat.com>
---
fdisk/cfdisk.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 8801a85..149a616 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -197,7 +197,6 @@ int heads = 0;
int sectors = 0;
long long cylinders = 0;
int cylinder_size = 0; /* heads * sectors */
-long long total_size = 0; /* actual_size rounded down */
long long actual_size = 0; /* (in 512-byte sectors) - set using ioctl */
/* explicitly given user values */
int user_heads = 0, user_sectors = 0;
@@ -779,7 +778,7 @@ del_part(int i) {
if (i < num_parts - 1)
p_info[i].last_sector = p_info[i+1].first_sector - 1;
else
- p_info[i].last_sector = total_size - 1;
+ p_info[i].last_sector = actual_size - 1;
p_info[i].offset = 0;
p_info[i].flags = 0;
@@ -828,7 +827,7 @@ add_part(int num, int id, int flags, long long first, long long last,
return -1;
}
- if (first >= total_size) {
+ if (first >= actual_size) {
*errmsg = _("Partition begins after end-of-disk");
return -1;
}
@@ -838,11 +837,6 @@ add_part(int num, int id, int flags, long long first, long long last,
return -1;
}
- if (last >= total_size) {
- *errmsg = _("Partition ends in the final partial cylinder");
- return -1;
- }
-
for (i = 0; i < num_parts; i++) {
if (p_info[i].id > 0 && IS_PRIMARY(p_info[i].num))
pri++;
@@ -1535,8 +1529,7 @@ decide_on_geometry(void) {
if (user_cylinders > 0)
cylinders = user_cylinders;
- total_size = cylinder_size*cylinders;
- if (total_size > actual_size)
+ if (cylinder_size * cylinders > actual_size)
print_warning(_("You specified more cylinders than fit on disk"));
}
@@ -1544,7 +1537,7 @@ static void
clear_p_info(void) {
num_parts = 1;
p_info[0].first_sector = 0;
- p_info[0].last_sector = total_size - 1;
+ p_info[0].last_sector = actual_size - 1;
p_info[0].offset = 0;
p_info[0].flags = 0;
p_info[0].id = FREE_SPACE;
@@ -2327,7 +2320,7 @@ change_geometry(void) {
if (ret_val) {
long long disk_end;
- disk_end = total_size-1;
+ disk_end = actual_size-1;
if (p_info[num_parts-1].last_sector > disk_end) {
while (p_info[num_parts-1].first_sector > disk_end) {
--
1.7.2.3

View file

@ -0,0 +1,57 @@
From 54a0fe298b4d6d948cffbd6fbbbe7dbabc9a6bb1 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 19 Jul 2010 22:52:58 +0200
Subject: [PATCH] cfdisk: get_string not calculating correct limits
Reported-by: James L. Hammons <jlhamm@acm.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
fdisk/cfdisk.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 7fa0b19..e7955fe 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -421,6 +421,11 @@ fdexit(int ret) {
exit(ret);
}
+/*
+ * Note that @len is size of @str buffer.
+ *
+ * Returns number of read bytes (without \0).
+ */
static int
get_string(char *str, int len, char *def) {
size_t cells = 0, i = 0;
@@ -472,7 +477,7 @@ get_string(char *str, int len, char *def) {
break;
default:
#if defined(HAVE_LIBNCURSESW) && defined(HAVE_WIDECHAR)
- if (i < len && iswprint(c)) {
+ if (i + 1 < len && iswprint(c)) {
wchar_t wc = (wchar_t) c;
char s[MB_CUR_MAX + 1];
int sz = wctomb(s, wc);
@@ -492,7 +497,7 @@ get_string(char *str, int len, char *def) {
putchar(BELL);
}
#else
- if (i < len && isprint(c)) {
+ if (i + 1 < len && isprint(c)) {
mvaddch(y, x + cells, c);
if (use_def) {
clrtoeol();
@@ -2405,7 +2410,7 @@ change_id(int i) {
sprintf(def, "%02X", new_id);
mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, _("Enter filesystem type: "));
- if ((len = get_string(id, 2, def)) <= 0 && len != GS_DEFAULT)
+ if ((len = get_string(id, 3, def)) <= 0 && len != GS_DEFAULT)
return;
if (len != GS_DEFAULT) {
--
1.7.3.1

View file

@ -0,0 +1,29 @@
From a93e5691369b0d0878f4434f980c79e94216775d Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@centrum.cz>
Date: Sun, 4 Jul 2010 20:02:57 +0200
Subject: [PATCH] libmount: fix merge_optstr (do not truncate 3 trailing characters)
I believe this is the correct fix.
Signed-off-by: Petr Uzel <petr.uzel@centrum.cz>
---
shlibs/mount/src/tab_parse.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index 5dbcfa6..680e1fc 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -254,7 +254,8 @@ static char *merge_optstr(const char *vfs, const char *fs)
if (!strcmp(vfs, fs))
return strdup(vfs); /* e.g. "aaa" and "aaa" */
- sz = strlen(vfs) + strlen(fs) + 2;
+ /* leave space for leading "r[ow],", "," and trailing zero */
+ sz = strlen(vfs) + strlen(fs) + 5;
res = malloc(sz);
if (!res)
return NULL;
--
1.7.2.3

View file

@ -0,0 +1,120 @@
From 81a12d11efc8d0db248f3bbdb21acd58a0651262 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 19 Nov 2010 13:37:25 +0100
Subject: [PATCH] mount: ignore *context= options on remount
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=563267
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/mount.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/mount/mount.c b/mount/mount.c
index 1c8a55f..c0023f3 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -378,6 +378,56 @@ append_context(const char *optname, char *optdata, char **extra_opts)
freecon(raw);
return 0;
}
+
+/* returns newly allocated string without *context= options */
+static char *remove_context_options(char *opts)
+{
+ char *begin = NULL, *end = NULL, *p;
+ int open_quote = 0, changed = 0;
+
+ if (!opts)
+ return NULL;
+
+ opts = xstrdup(opts);
+
+ for (p = opts; p && *p; p++) {
+ if (!begin)
+ begin = p; /* begin of the option item */
+ if (*p == '"')
+ open_quote ^= 1; /* reverse the status */
+ if (open_quote)
+ continue; /* still in quoted block */
+ if (*p == ',')
+ end = p; /* terminate the option item */
+ else if (*(p + 1) == '\0')
+ end = p + 1; /* end of optstr */
+ if (!begin || !end)
+ continue;
+
+ if (strncmp(begin, "context=", 8) == 0 ||
+ strncmp(begin, "fscontext=", 10) == 0 ||
+ strncmp(begin, "defcontext=", 11) == 0 ||
+ strncmp(begin, "rootcontext=", 12) == 0) {
+ size_t sz;
+
+ if ((begin == opts || *(begin - 1) == ',') && *end == ',')
+ end++;
+ sz = strlen(end);
+
+ memmove(begin, end, sz + 1);
+ if (!*begin && *(begin - 1) == ',')
+ *(begin - 1) = '\0';
+
+ p = begin;
+ changed = 1;
+ }
+ }
+
+ if (changed && verbose)
+ printf (_("mount: SELinux *context= options are ignore on remount.\n"));
+
+ return opts;
+}
#endif
/*
@@ -1382,6 +1432,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
parse_opts (opts, &flags, &extra_opts);
extra_opts1 = extra_opts;
+ mount_opts = extra_opts;
/* quietly succeed for fstab entries that don't get mounted automatically */
if (mount_all && (flags & MS_NOAUTO))
@@ -1397,8 +1448,6 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
"%s is already mounted on %s\n"),
spec, node);
- mount_opts = extra_opts;
-
if (opt_speed)
cdrom_setspeed(spec);
@@ -1419,12 +1468,17 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
if (flags & (MS_BIND | MS_MOVE | MS_PROPAGATION))
types = "none";
+#ifdef HAVE_LIBSELINUX
+ if ((flags & MS_REMOUNT) && mount_opts)
+ mount_opts = remove_context_options(mount_opts);
+#endif
+
/*
* Call mount.TYPE for types that require a separate mount program.
* For the moment these types are ncpfs and smbfs. Maybe also vxfs.
* All such special things must occur isolated in the types string.
*/
- if (check_special_mountprog(spec, node, types, flags, extra_opts, &status)) {
+ if (check_special_mountprog(spec, node, types, flags, mount_opts, &status)) {
res = status;
goto out;
}
@@ -1718,6 +1772,8 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
}
#endif
+ if (extra_opts1 != mount_opts)
+ my_free(mount_opts);
my_free(extra_opts1);
my_free(spec1);
my_free(node1);
--
1.7.3.1

View file

@ -0,0 +1,29 @@
From 1cf4c20b198c0c6566198fd00b983d9aaf8321bc Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <miklos@szeredi.hu>
Date: Thu, 7 Oct 2010 16:05:12 +0200
Subject: [PATCH] mount: don't canonicalize "spec" with --no-canonicalize option
"Spec" was still canonicalized despite --no-canonicalize. This
resulted in a hang during login with pam_encfs (Debian Bug#593336).
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
mount/devname.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mount/devname.c b/mount/devname.c
index 585d259..05da092 100644
--- a/mount/devname.c
+++ b/mount/devname.c
@@ -8,7 +8,7 @@ spec_to_devname(const char *spec)
{
if (!spec)
return NULL;
- if (is_pseudo_fs(spec))
+ if (nocanonicalize || is_pseudo_fs(spec))
return xstrdup(spec);
return fsprobe_get_devname_by_spec(spec);
}
--
1.7.3.4

View file

@ -0,0 +1,115 @@
From dc0a335554eafa643c7fd123d99e14df72c515c3 Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <miklos@szeredi.hu>
Date: Fri, 27 Aug 2010 16:58:44 +0200
Subject: [PATCH] mount: handle filesystems with subtype
Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format,
where the main type determines the actual filesystem driver while the
subtype can be interpreted by the filesystem itself.
When searching for mount helpers mount(8) and umount(8) should also
interpret such types, falling back to (u)mount.MAINTYPE if
(u)mount.MAINTYPE.SUBTYPE doesn't exist.
This patch implements this, passing the type with "-t TYPE"
to the mount program in this case.
Reported-by: Josef Bacik <josef@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
mount/mount.c | 19 ++++++++++++++++---
mount/umount.c | 17 +++++++++++++++--
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/mount/mount.c b/mount/mount.c
index f2b6ee2..84986e3 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -664,13 +664,22 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
path = strtok(search_path, ":");
while (path) {
+ int type_opt = 0;
+
res = snprintf(mountprog, sizeof(mountprog), "%s/mount.%s",
path, type);
path = strtok(NULL, ":");
if (res >= sizeof(mountprog) || res < 0)
continue;
- if (stat(mountprog, &statbuf))
+ res = stat(mountprog, &statbuf);
+ if (res == -1 && errno == ENOENT && strchr(type, '.')) {
+ /* If type ends with ".subtype" try without it */
+ *strrchr(mountprog, '.') = '\0';
+ type_opt = 1;
+ res = stat(mountprog, &statbuf);
+ }
+ if (res)
continue;
if (verbose)
@@ -678,7 +687,7 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
switch (fork()) {
case 0: { /* child */
- char *oo, *mountargs[10];
+ char *oo, *mountargs[12];
int i = 0;
if (setgid(getgid()) < 0)
@@ -703,7 +712,11 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
mountargs[i++] = "-o"; /* 8 */
mountargs[i++] = oo; /* 9 */
}
- mountargs[i] = NULL; /* 10 */
+ if (type_opt) {
+ mountargs[i++] = "-t"; /* 10 */
+ mountargs[i++] = (char *) type; /* 11 */
+ }
+ mountargs[i] = NULL; /* 12 */
if (verbose > 2) {
i = 0;
diff --git a/mount/umount.c b/mount/umount.c
index 5bd5360..0ad7c5f 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -103,11 +103,20 @@ check_special_umountprog(const char *spec, const char *node,
return 0;
if (strlen(type) < 100) {
+ int type_opt = 0;
+
sprintf(umountprog, "/sbin/umount.%s", type);
- if (stat(umountprog, &statbuf) == 0) {
+ res = stat(umountprog, &statbuf);
+ if (res == -1 && errno == ENOENT && strchr(type, '.')) {
+ /* If type ends with ".subtype" try without it */
+ *strrchr(umountprog, '.') = '\0';
+ type_opt = 1;
+ res = stat(umountprog, &statbuf);
+ }
+ if (res == 0) {
res = fork();
if (res == 0) {
- char *umountargs[8];
+ char *umountargs[10];
int i = 0;
if(setgid(getgid()) < 0)
@@ -128,6 +137,10 @@ check_special_umountprog(const char *spec, const char *node,
umountargs[i++] = "-v";
if (remount)
umountargs[i++] = "-r";
+ if (type_opt) {
+ umountargs[i++] = "-t";
+ umountargs[i++] = (char *) type;
+ }
umountargs[i] = NULL;
execv(umountprog, umountargs);
exit(1); /* exec failed */
--
1.7.2.3

View file

@ -0,0 +1,11 @@
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

View file

@ -0,0 +1,28 @@
From 791a2fd67c118c3f07141e4cc95532fe908015a9 Mon Sep 17 00:00:00 2001
From: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Date: Mon, 19 Jul 2010 18:04:33 -0500
Subject: [PATCH] libblkid: set tolerant flag for HFS
An CDROM can contain both HFS and ISO9660 views on the same filesystem.
This confuses mount/KDE/Gnome.
Signed-off-by: Karel Zak <kzak@redhat.com>
---
shlibs/blkid/src/superblocks/hfs.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/shlibs/blkid/src/superblocks/hfs.c b/shlibs/blkid/src/superblocks/hfs.c
index 8ebff68..033a65d 100644
--- a/shlibs/blkid/src/superblocks/hfs.c
+++ b/shlibs/blkid/src/superblocks/hfs.c
@@ -291,6 +291,7 @@ const struct blkid_idinfo hfs_idinfo =
.name = "hfs",
.usage = BLKID_USAGE_FILESYSTEM,
.probefunc = probe_hfs,
+ .flags = BLKID_IDINFO_TOLERANT,
.magics =
{
{ .magic = "BD", .len = 2, .kboff = 1 },
--
1.7.2.3

View file

@ -0,0 +1,6 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth include system-auth
account include system-auth
password include system-auth
session include system-auth

16
util-linux-ng-login.pamd Normal file
View file

@ -0,0 +1,16 @@
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
-session optional pam_ck_connector.so

14
util-linux-ng-remote.pamd Normal file
View file

@ -0,0 +1,14 @@
#%PAM-1.0
auth required pam_securetty.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth

2364
util-linux-ng.spec Normal file

File diff suppressed because it is too large Load diff

117
uuidd.init Executable file
View file

@ -0,0 +1,117 @@
#!/bin/bash
#
# uuidd uuidd daemon for unique time-based UUID generation
#
# Author: Eric Sandeen <sandeen@redhat.com>
#
# chkconfig: - 60 99
#
# description: uuidd is a helper daemon to guarantee uniqueness of \
# time-based UUIDs when using libuuid.
# processname: uuidd
# pidfile: /var/lib/libuuid/uuidd.pid
#
### BEGIN INIT INFO
# Provides: uuidd
# Required-Start: $time $local_fs
# Required-Stop: $time $local_fs
# Default-Stop: 0 1 6
# Short-Description: UUID daemon
# Description: Daemon which guarantees uniqueness of time-based UUIDS
# when using libuuid.
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
[ -e /etc/sysconfig/uuidd ] && . /etc/sysconfig/uuidd
DAEMON=uuidd
exec=/usr/sbin/uuidd
prog=uuidd
user=uuidd
lockfile=/var/lock/subsys/$DAEMON
pidfile=/var/run/uuidd/uuidd.pid
check() {
# Check that we're a privileged user
[ $(id -u) -eq 0 ] || exit 4
# Check if daemon binary is executable
[ -x $exec ] || exit 5
}
start () {
check
echo -n $"Starting $prog: "
daemon --user $user --pidfile $pidfile $DAEMON
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop () {
check
echo -n $"Stopping $prog: "
killproc $DAEMON
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $DAEMON
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?