Compare commits

..

6 commits

Author SHA1 Message Date
Fedora Release Engineering
818e70d129 dist-git conversion 2010-07-29 14:50:08 +00:00
Bill Nottingham
40c1aba58f Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:16:35 +00:00
kzak
8cd1dac567 - fix #489672 - flock segfaults when file name is not given
- fix #503266 - mountpoint named tmpfs confuses the mount command
- fix #474628 - setterm -blank no longer works as documented
2009-06-01 11:04:05 +00:00
kzak
2bbeddcb71 - fix #480413 - util-linux-ng doesn't include scriptreplay 2009-01-22 11:27:06 +00:00
kzak
2b9130c36b - fix #472502 - problem with fdisk and use +sectors for the end of
partition
2008-11-21 14:51:48 +00:00
Jesse Keating
1bfc5f0443 Initialize branch F-10 for util-linux-ng 2008-11-07 05:00:11 +00:00
26 changed files with 2885 additions and 6 deletions

5
.gitignore vendored
View file

@ -1,5 +1,2 @@
util-linux-ng-2.14.1.tar.bz2
floppy-0.16.tar.bz2
util-linux-ng-2.18.tar.bz2
*~
*.rpm
*.log

View file

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

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 @@
9aab772ee9b1f4e67dff98169f3cb380 util-linux-ng-2.14.1.tar.bz2
7eeb9a6f7a258174bf0fa80f1370788d floppy-0.16.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,13 @@
Index: util-linux-ng-2.14.1-rc1/fdisk/fdisk.c
===================================================================
--- util-linux-ng-2.14.1-rc1.orig/fdisk/fdisk.c
+++ util-linux-ng-2.14.1-rc1/fdisk/fdisk.c
@@ -2589,7 +2589,7 @@ main(int argc, char **argv) {
*/
sector_size = atoi(optarg);
if (sector_size != 512 && sector_size != 1024 &&
- sector_size != 2048)
+ sector_size != 2048 && sector_size != 4096)
fatal(usage);
sector_offset = 2;
user_set_sector_size = 1;

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,56 @@
--- util-linux-ng-2.13-rc3/sys-utils/ipcs.c.kzak 2007-04-25 14:43:38.000000000 +0200
+++ util-linux-ng-2.13-rc3/sys-utils/ipcs.c 2007-08-13 12:21:15.000000000 +0200
@@ -253,6 +253,26 @@
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)
{
@@ -268,7 +288,7 @@
printf (_("kernel not configured for shared memory\n"));
return;
}
-
+
switch (format) {
case LIMITS:
printf (_("------ Shared Memory Limits --------\n"));
@@ -276,12 +296,12 @@
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"),
- sysconf(_SC_PAGESIZE) / 1024 * (unsigned long long) shminfo.shmall);
+ sysconf(_SC_PAGESIZE) / 1024 * shminfo_from_proc("shmall", shminfo.shmall));
printf (_("min seg size (bytes) = %lu\n"),
(unsigned long) shminfo.shmmin);
return;

View file

@ -0,0 +1,11 @@
--- util-linux-ng-2.13-rc3/login-utils/login.c.xxx 2007-08-13 12:11:14.000000000 +0200
+++ util-linux-ng-2.13-rc3/login-utils/login.c 2007-08-13 12:12:24.000000000 +0200
@@ -1402,7 +1402,7 @@
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,13 @@
Index: util-linux-ng-2.14.1-rc1/login-utils/login.c
===================================================================
--- util-linux-ng-2.14.1-rc1.orig/login-utils/login.c
+++ util-linux-ng-2.14.1-rc1/login-utils/login.c
@@ -542,7 +542,7 @@ main(int argc, char **argv)
* Therefore, we are safe not setting it to anything
*/
- retcode = pam_start("login",username, &conv, &pamh);
+ retcode = pam_start(hflag?"remote":"login",username, &conv, &pamh);
if(retcode != PAM_SUCCESS) {
fprintf(stderr, _("%s: PAM failure, aborting: %s\n"),
"login", pam_strerror(pamh, retcode));

View file

@ -0,0 +1,93 @@
diff -up util-linux-ng-2.14-rc3/disk-utils/blockdev.c.rm util-linux-ng-2.14-rc3/disk-utils/blockdev.c
--- util-linux-ng-2.14-rc3/disk-utils/blockdev.c.rm 2008-04-22 10:59:53.000000000 +0200
+++ util-linux-ng-2.14-rc3/disk-utils/blockdev.c 2008-05-19 12:31:52.000000000 +0200
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <errno.h>
+#include <linux/blkpg.h>
#include "nls.h"
#include "blkdev.h"
@@ -47,8 +48,11 @@ struct bdc {
{ "--setfra", "BLKFRASET", BLKFRASET, ARGINTA, 0, "FSREADAHEAD", N_("set filesystem readahead") },
{ "--getfra", "BLKFRAGET", BLKFRAGET, ARGLINTG, -1, NULL, N_("get filesystem readahead") },
{ "--flushbufs", "BLKFLSBUF", BLKFLSBUF, ARGNONE, 0, NULL, N_("flush buffers") },
- { "--rereadpt", "BLKRRPART", BLKRRPART, ARGNONE, 0, NULL,
- N_("reread partition table") },
+ { "--rereadpt", "BLKRRPART", BLKRRPART, ARGNONE, 0, NULL, N_("reread partition table") },
+#ifdef BLKPG
+ { "--rmpart", "BLKPG", BLKPG, ARGINTAP, 0, "PARTNO", N_("disable partition") },
+ { "--rmparts", "BLKPG", BLKPG, ARGNONE, 0, NULL, N_("disable all partitions") },
+#endif
};
#define SIZE(a) (sizeof(a)/sizeof((a)[0]))
@@ -89,6 +93,40 @@ find_cmd(char *s) {
return -1;
}
+#ifdef BLKPG
+static int
+disable_partition(int fd, int partno) {
+ struct blkpg_partition part = {
+ .pno = partno,
+ .start = 0,
+ .length = 0,
+ .devname[0] = 0,
+ .volname[0] = 0,
+ };
+ struct blkpg_ioctl_arg io = {
+ .op = BLKPG_DEL_PARTITION,
+ .datalen = sizeof(part),
+ .data = &part,
+ .flags = 0,
+ };
+ int res;
+
+ res = ioctl(fd, BLKPG, &io);
+ if (res < 0)
+ return 0;
+ return 1;
+}
+
+static int
+disable_partitions(int fd) {
+ int p, res = 0;
+
+ for (p = 1; p <= 256; p++)
+ res += disable_partition(fd, p);
+ return res ? 0 : -1;
+}
+#endif
+
void do_commands(int fd, char **argv, int d);
void report_header(void);
void report_device(char *device, int quiet);
@@ -206,6 +244,12 @@ do_commands(int fd, char **argv, int d)
switch(bdcms[j].argtype) {
default:
case ARGNONE:
+#ifdef BLKPG
+ if (bdcms[j].ioc == BLKPG) {
+ res = disable_partitions(fd);
+ break;
+ }
+#endif
res = ioctl(fd, bdcms[j].ioc, 0);
break;
case ARGINTA:
@@ -223,6 +267,13 @@ do_commands(int fd, char **argv, int d)
bdcms[j].name);
usage();
}
+#ifdef BLKPG
+ if (bdcms[j].ioc == BLKPG) {
+ iarg = atoi(argv[++i]);
+ res = disable_partition(fd, iarg) ? 0 : -1;
+ break;
+ }
+#endif
iarg = atoi(argv[++i]);
res = ioctl(fd, bdcms[j].ioc, &iarg);
break;

View file

@ -0,0 +1,30 @@
Upstream patch:
commit 5ea8931c95b2e0b1663f28591d2c721f07a88181
Author: Karel Zak <kzak@redhat.com>
Date: Thu Nov 13 23:08:34 2008 +0100
diff -up util-linux-ng-2.14.1/fdisk/fdisk.c.kzak util-linux-ng-2.14.1/fdisk/fdisk.c
--- util-linux-ng-2.14.1/fdisk/fdisk.c.kzak 2008-11-21 14:27:19.000000000 +0100
+++ util-linux-ng-2.14.1/fdisk/fdisk.c 2008-11-21 15:10:07.000000000 +0100
@@ -1193,7 +1193,8 @@ read_int(unsigned int low, unsigned int
*/
if (!display_in_cyl_units)
i *= heads * sectors;
- } else if (*(line_ptr + 1) == 'B' &&
+ } else if (*line_ptr &&
+ *(line_ptr + 1) == 'B' &&
*(line_ptr + 2) == '\0') {
/*
* 10^N
@@ -1206,7 +1207,8 @@ read_int(unsigned int low, unsigned int
absolute = 1000000000;
else
absolute = -1;
- } else if (*(line_ptr + 1) == '\0') {
+ } else if (*line_ptr &&
+ *(line_ptr + 1) == '\0') {
/*
* 2^N
*/

View file

@ -0,0 +1,34 @@
Based on upstream patch:
commit 841f86dbc2e35166fd43341c8eb144680b0c7ece
Author: Karel Zak <kzak@redhat.com>
Date: Wed Mar 11 12:49:50 2009 +0100
diff -up util-linux-ng-2.14.1/sys-utils/flock.c.kzak util-linux-ng-2.14.1/sys-utils/flock.c
--- util-linux-ng-2.14.1/sys-utils/flock.c.kzak 2008-09-10 11:02:43.000000000 +0200
+++ util-linux-ng-2.14.1/sys-utils/flock.c 2009-06-01 12:49:22.000000000 +0200
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
EX_NOINPUT);
}
- } else {
+ } else if (optind < argc) {
/* Use provided file descriptor */
fd = (int)strtol(argv[optind], &eon, 10);
@@ -222,8 +222,15 @@ int main(int argc, char *argv[])
exit(EX_USAGE);
}
+ } else {
+ /* Bad options */
+
+ fprintf(stderr, "%s: requires file descriptor, file or directory\n",
+ program);
+ exit(EX_USAGE);
}
+
if ( have_timeout ) {
if ( timeout.it_value.tv_sec == 0 &&
timeout.it_value.tv_usec == 0 ) {

View file

@ -0,0 +1,232 @@
Based on upstream patch:
From f1b3f066f7cbeee0864317fb85e8bb622da34917 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Sat, 13 Dec 2008 02:47:42 +0100
Subject: [PATCH] mount: clean up SPEC canonicalization
The SPEC (fsname) field in fstab/mtab could be:
- devname
- NAME=value (e.g LABEL, UUID)
- directory (MS_MOVE, MS_BIND, ..)
- pseudo-fs keyword (tmpfs, proc, sysfs, ...)
the pseudo-fs keywords shouldn't be canonicalized to absolute path. It
means we have to differ between SPEC and mountpoint (fs_dir).
Unfortunately, the keywords was checked on wrong place. This patch
move this check to the new function canonicalize_spec().
The fsname in mtab entry is canonicalized when the FS type is not
pseudo filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/fsprobe.c | 5 +++++
mount/fstab.c | 13 +++++++------
mount/mount.c | 18 ++++++++++++------
mount/realpath.c | 22 ++++++++++++++++------
mount/realpath.h | 3 ++-
5 files changed, 42 insertions(+), 19 deletions(-)
diff -up util-linux-ng-2.14.1/mount/fsprobe.c.kzak util-linux-ng-2.14.1/mount/fsprobe.c
--- util-linux-ng-2.14.1/mount/fsprobe.c.kzak 2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/fsprobe.c 2009-06-01 11:20:32.000000000 +0200
@@ -170,6 +170,9 @@ fsprobe_get_devname_for_mounting(const c
if (!spec)
return NULL;
+ if (is_pseudo_fs(spec))
+ return xstrdup(spec);
+
if (parse_spec(spec, &name, &value) != 0)
return NULL; /* parse error */
@@ -203,6 +206,8 @@ fsprobe_get_devname(const char *spec)
if (!spec)
return NULL;
+ if (is_pseudo_fs(spec))
+ return xstrdup(spec);
if (parse_spec(spec, &name, &value) != 0)
return NULL; /* parse error */
diff -up util-linux-ng-2.14.1/mount/fstab.c.kzak util-linux-ng-2.14.1/mount/fstab.c
--- util-linux-ng-2.14.1/mount/fstab.c.kzak 2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/fstab.c 2009-06-01 11:20:32.000000000 +0200
@@ -323,7 +323,7 @@ getfs_by_specdir (const char *spec, cons
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
/* dir */
if (!streq(mc->m.mnt_dir, dir)) {
- char *dr = canonicalize_mountpoint(mc->m.mnt_dir);
+ char *dr = canonicalize(mc->m.mnt_dir);
int ok = 0;
if (streq(dr, dir))
@@ -335,7 +335,7 @@ getfs_by_specdir (const char *spec, cons
/* spec */
if (!streq(mc->m.mnt_fsname, spec)) {
- char *fs = canonicalize(mc->m.mnt_fsname);
+ char *fs = canonicalize_spec(mc->m.mnt_fsname);
int ok = 0;
if (streq(fs, spec))
@@ -369,7 +369,7 @@ getfs_by_dir (const char *dir) {
if (streq(mc->m.mnt_dir, dir))
return mc;
- cdir = canonicalize_mountpoint(dir);
+ cdir = canonicalize(dir);
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
if (streq(mc->m.mnt_dir, cdir)) {
free(cdir);
@@ -402,7 +402,7 @@ getfs_by_spec (const char *spec) {
return mc;
}
- cspec = canonicalize(spec);
+ cspec = canonicalize_spec(spec);
mc = getfs_by_devname(cspec);
free(cspec);
@@ -433,7 +433,7 @@ getfs_by_devname (const char *devname) {
strncmp(mc->m.mnt_fsname, "UUID=", 5) == 0)
continue;
- fs = canonicalize(mc->m.mnt_fsname);
+ fs = canonicalize_spec(mc->m.mnt_fsname);
if (streq(fs, devname)) {
free(fs);
return mc;
@@ -919,7 +919,8 @@ void my_endmntent (mntFILE *mfp) { }
int my_addmntent (mntFILE *mfp, struct my_mntent *mnt) { return 0; }
char *canonicalize (const char *path) { return NULL; }
-char *canonicalize_mountpoint (const char *path) { return NULL; }
+char *canonicalize_spec (const char *path) { return NULL; }
+int is_pseudo_fs(const char *type) { return 0; };
int
main(int argc, char **argv)
diff -up util-linux-ng-2.14.1/mount/mount.c.kzak util-linux-ng-2.14.1/mount/mount.c
--- util-linux-ng-2.14.1/mount/mount.c.kzak 2009-06-01 10:22:19.000000000 +0200
+++ util-linux-ng-2.14.1/mount/mount.c 2009-06-01 11:20:32.000000000 +0200
@@ -240,7 +240,7 @@ print_one (const struct my_mntent *me) {
printf (" type %s", me->mnt_type);
if (me->mnt_opts != NULL)
printf (" (%s)", me->mnt_opts);
- if (list_with_volumelabel) {
+ if (list_with_volumelabel && is_pseudo_fs(me->mnt_type) == 0) {
const char *devname = fsprobe_get_devname(me->mnt_fsname);
if (devname) {
@@ -498,9 +498,11 @@ fix_opts_string (int flags, const char *
}
static int
-already (const char *spec, const char *node) {
+already (const char *spec0, const char *node0) {
struct mntentchn *mc;
int ret = 1;
+ char *spec = canonicalize_spec(spec0);
+ char *node = canonicalize(node0);
if ((mc = getmntfile(node)) != NULL)
error (_("mount: according to mtab, "
@@ -512,6 +514,10 @@ already (const char *spec, const char *n
spec, mc->m.mnt_dir);
else
ret = 0;
+
+ free(spec);
+ free(node);
+
return ret;
}
@@ -839,7 +845,7 @@ is_mounted_same_loopfile(const char *nod
char *node;
int res = 0;
- node = canonicalize_mountpoint(node0);
+ node = canonicalize(node0);
/* Search for mountpoint node in mtab,
* procceed if any of these has the loop option set or
@@ -979,8 +985,8 @@ update_mtab_entry(const char *spec, cons
const char *opts, int flags, int freq, int pass) {
struct my_mntent mnt;
- mnt.mnt_fsname = canonicalize (spec);
- mnt.mnt_dir = canonicalize_mountpoint (node);
+ mnt.mnt_fsname = is_pseudo_fs(type) ? xstrdup(spec) : canonicalize(spec);
+ mnt.mnt_dir = canonicalize (node);
mnt.mnt_type = type;
mnt.mnt_opts = opts;
mnt.mnt_freq = freq;
@@ -1496,7 +1502,7 @@ mounted (const char *spec0, const char *
if (!spec)
return ret;
- node = canonicalize_mountpoint(node0);
+ node = canonicalize(node0);
mc0 = mtab_head();
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
diff -up util-linux-ng-2.14.1/mount/realpath.c.kzak util-linux-ng-2.14.1/mount/realpath.c
--- util-linux-ng-2.14.1/mount/realpath.c.kzak 2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/realpath.c 2009-06-01 11:20:32.000000000 +0200
@@ -29,6 +29,19 @@
# define MAXSYMLINKS 256
#endif
+int
+is_pseudo_fs(const char *type)
+{
+ if (type == NULL || *type == '/')
+ return 0;
+ if (streq(type, "none") ||
+ streq(type, "proc") ||
+ streq(type, "tmpfs") ||
+ streq(type, "sysfs") ||
+ streq(type, "devpts"))
+ return 1;
+ return 0;
+}
/* Make a canonical pathname from PATH. Returns a freshly malloced string.
It is up the *caller* to ensure that the PATH is sensible. i.e.
@@ -36,15 +49,12 @@
is not a legal pathname for ``/dev/fd0''. Anything we cannot parse
we return unmodified. */
char *
-canonicalize_mountpoint (const char *path) {
+canonicalize_spec (const char *path)
+{
if (path == NULL)
return NULL;
-
- if (streq(path, "none") ||
- streq(path, "proc") ||
- streq(path, "devpts"))
+ if (is_pseudo_fs(path))
return xstrdup(path);
-
return canonicalize(path);
}
diff -up util-linux-ng-2.14.1/mount/realpath.h.kzak util-linux-ng-2.14.1/mount/realpath.h
--- util-linux-ng-2.14.1/mount/realpath.h.kzak 2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/realpath.h 2009-06-01 11:20:32.000000000 +0200
@@ -8,6 +8,7 @@
extern char *myrealpath(const char *path, char *resolved_path, int m);
extern char *canonicalize (const char *path);
-extern char *canonicalize_mountpoint (const char *path);
+extern char *canonicalize_spec (const char *path);
+extern int is_pseudo_fs(const char *type);
#endif /* REALPATH_H */

View file

@ -0,0 +1,52 @@
Index: util-linux-ng-2.14.1/mount/mount.c
===================================================================
--- util-linux-ng-2.14.1.orig/mount/mount.c
+++ util-linux-ng-2.14.1/mount/mount.c
@@ -329,7 +329,7 @@ append_context(const char *optname, char
security_context_t raw = NULL;
char *data = NULL;
- if (!is_selinux_enabled())
+ if (is_selinux_enabled() != 1)
/* ignore the option if we running without selinux */
return 0;
@@ -340,8 +340,8 @@ append_context(const char *optname, char
data = *optdata =='"' ? strip_quotes(optdata) : optdata;
if (selinux_trans_to_raw_context(
- (security_context_t) data, &raw)==-1 ||
- raw==NULL)
+ (security_context_t) data, &raw) == -1 ||
+ raw == NULL)
return -1;
if (verbose)
@@ -1372,6 +1372,27 @@ try_mount_one (const char *spec0, const
res = EX_FAIL;
out:
+
+#ifdef HAVE_LIBSELINUX
+ if (res != EX_FAIL && verbose && is_selinux_enabled() > 0) {
+ security_context_t raw = NULL, def = NULL;
+
+ if (getfilecon(node, &raw) > 0 &&
+ security_get_initial_context("file", &def) == 0) {
+
+ if (!selinux_file_context_cmp(raw, def))
+ printf(_("mount: %s does not contain SELinux labels.\n"
+ " You just mounted an file system that supports labels which does not\n"
+ " contain labels, onto an SELinux box. It is likely that confined\n"
+ " applications will generate AVC messages and not be allowed access to\n"
+ " this file system. For more details see restorecon(8) and mount(8).\n"),
+ node);
+ }
+ freecon(raw);
+ freecon(def);
+ }
+#endif
+
my_free(extra_opts1);
my_free(spec1);
my_free(node1);

View file

@ -0,0 +1,104 @@
From b9f2b3de43c820a4259ec8855359a2d8d18abe01 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 6 Oct 2008 12:56:37 +0200
Subject: [PATCH] mount: sync tmpfs info in mount.8 with Documentation/filesystems/tmpfs.txt
Addresses-Red-Hat-Bugzilla: #465761
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/mount.8 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 62 insertions(+), 9 deletions(-)
Index: util-linux-ng-2.14.1/mount/mount.8
===================================================================
--- util-linux-ng-2.14.1.orig/mount/mount.8
+++ util-linux-ng-2.14.1/mount/mount.8
@@ -1607,26 +1607,79 @@ and the current version of
None.
.SH "Mount options for tmpfs"
-The following parameters accept a suffix
-.BR k ,
-.B m
-or
-.B g
-for Ki, Mi, Gi (binary kilo, mega and giga) and can be changed on remount.
.TP
.BI size= nbytes
Override default maximum size of the filesystem.
The size is given in bytes, and rounded down to entire pages.
-The default is half of the memory.
+The default is half of the memory. The size parameter also accepts a suffix %
+to limit this tmpfs instance to that percentage of your physical RAM:
+the default, when neither size nor nr_blocks is specified, is size=50%
.TP
.B nr_blocks=
-Set number of blocks.
+The same as size, but in blocks of PAGE_CACHE_SIZE
.TP
.B nr_inodes=
-Set number of inodes.
+The maximum number of inodes for this instance. The default
+is half of the number of your physical RAM pages, or (on a
+machine with highmem) the number of lowmem RAM pages,
+whichever is the lower.
+.PP
+The tmpfs mount options for sizing (
+.BR size ,
+.BR nr_blocks ,
+and
+.BR nr_inodes )
+accept a suffix
+.BR k ,
+.B m
+or
+.B g
+for Ki, Mi, Gi (binary kilo, mega and giga) and can be changed on remount.
+
.TP
.B mode=
Set initial permissions of the root directory.
+.TP
+.B uid=
+The user id.
+.TP
+.B gid=
+The group id.
+.TP
+.B mpol=[default|prefer:Node|bind:NodeList|interleave|interleave:NodeList]
+Set the NUMA memory allocation policy for all files in that
+instance (if the kernel CONFIG_NUMA is enabled) - which can be adjusted on the
+fly via 'mount -o remount ...'
+.RS
+.TP
+.B default
+prefers to allocate memory from the local node
+.TP
+.B prefer:Node
+prefers to allocate memory from the given Node
+.TP
+.B bind:NodeList
+allocates memory only from nodes in NodeList
+.TP
+.B interleave
+prefers to allocate from each node in turn
+.TP
+.B interleave:NodeList
+allocates from each node of NodeList in turn.
+.PP
+The NodeList format is a comma-separated list of decimal numbers and ranges, a
+range being two hyphen-separated decimal numbers, the smallest and largest node
+numbers in the range. For example, mpol=bind:0-3,5,7,9-15
+
+Note that trying to mount a tmpfs with an mpol option will fail if the
+running kernel does not support NUMA; and will fail if its nodelist
+specifies a node which is not online. If your system relies on that
+tmpfs being mounted, but from time to time runs a kernel built without
+NUMA capability (perhaps a safe recovery kernel), or with fewer nodes
+online, then it is advisable to omit the mpol option from automatic
+mount options. It can be added later, when the tmpfs is already mounted
+on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'.
+.PE
.SH "Mount options for udf"
udf is the "Universal Disk Format" filesystem defined by the Optical

View file

@ -0,0 +1,12 @@
diff -up util-linux-ng-2.14-rc3/mount/mount.c.mng util-linux-ng-2.14-rc3/mount/mount.c
--- util-linux-ng-2.14-rc3/mount/mount.c.mng 2008-05-14 12:55:32.000000000 +0200
+++ util-linux-ng-2.14-rc3/mount/mount.c 2008-05-19 12:11:39.000000000 +0200
@@ -176,6 +176,8 @@ static const struct opt_map opt_map[] =
{ "norelatime", 0, 1, MS_RELATIME }, /* Update access time without regard
to mtime/ctime */
#endif
+ { "kudzu", 0, 0, MS_COMMENT }, /* Silently remove this option (backwards compat use only - deprecated) */
+ { "managed", 0, 0, MS_COMMENT }, /* Silently remove this option */
{ "nofail", 0, 0, MS_COMMENT}, /* Do not fail if ENOENT on dev */
{ NULL, 0, 0, 0 }
};

View file

@ -0,0 +1,37 @@
From e273df94bab7785df778de7eaeacfa729ee7d56e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 5 Dec 2008 11:41:28 +0100
Subject: [PATCH] setterm: fix -blank man page
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/setterm.1 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/misc-utils/setterm.1 b/misc-utils/setterm.1
index ec4b6a8..ed05dc1 100644
--- a/misc-utils/setterm.1
+++ b/misc-utils/setterm.1
@@ -135,8 +135,8 @@ every specified number of positions. Without an argument, defaults to 8.
.TP
.BR \-blank " [0-60|force|poke] (virtual consoles only)"
Sets the interval of inactivity, in minutes, after which the screen will be
-automatically blanked (using APM if available). Without an argument,
-defaults to 0 (disable console blanking).
+automatically blanked (using APM if available). Without an argument, gets the
+blank status (returns which vt was blanked or zero for unblanked vt).
The
.B force
@@ -144,7 +144,7 @@ option keeps screen blank even if a key is pressed.
The
.B poke
-option returns which vt was blanked.
+option unblank the screen.
.TP
.BR \-dump " [1-NR_CONS]"
Writes a snapshot of the given virtual console (with attributes) to the file
--
1.6.0.6

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,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

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

@ -0,0 +1,15 @@
#%PAM-1.0
auth required 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

1881
util-linux-ng.spec Normal file

File diff suppressed because it is too large Load diff