2.19-0.1: initial import of util-linux

Note that the upstream package has been renamed from util-linux-ng
back to util-linux. The util-linux-ng is obsolete now.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2011-01-19 09:56:35 +01:00
parent 73db4af8d9
commit fd7089e44b
19 changed files with 2922 additions and 1 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/floppy-0.16.tar.bz2
/util-linux-2.19-rc1.tar.bz2
/util-linux-2.19-rc1-32-gbded43d.tar.bz2

View File

@ -1 +0,0 @@
Obsolete in favor of util-linux-ng.

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
96714c97fda4a18b7480eac71ab421fa util-linux-2.19-rc1-32-gbded43d.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,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

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

2297
util-linux.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 $?