]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
17 years agobuild-sys: call automake after autoconf
Stepan Kasal [Mon, 7 May 2007 18:06:06 +0000 (20:06 +0200)] 
build-sys: call automake after autoconf

"automake" calls "autoconf" internally, to trace the expansion of
configure.ac.  So it is more natural to call "autoconf" before
"automake".

Signed-off-by: Stepan Kasal <skasal@redhat.com>
17 years agobuild-sys: remove config.h.in from VCS
Stepan Kasal [Mon, 7 May 2007 17:30:57 +0000 (19:30 +0200)] 
build-sys: remove config.h.in from VCS

config.h.in is generated, no need to keep it.

Signed-off-by: Stepan Kasal <skasal@redhat.com>
17 years agomount: add support for context, fscontext and defcontext selinux mount options
Karel Zak [Fri, 4 May 2007 09:05:51 +0000 (11:05 +0200)] 
mount: add support for context, fscontext and defcontext selinux mount options

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: use realloc for xstrconcat functions
Karel Zak [Fri, 4 May 2007 07:14:04 +0000 (09:14 +0200)] 
mount: use realloc for xstrconcat functions

Everywhere in code is

s = xstrconcat3(s, t, u);

that's nonsense use malloc(new_s); free(s); return new_s;

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: use growable string for options
Karel Zak [Thu, 3 May 2007 12:16:24 +0000 (14:16 +0200)] 
mount: use growable string for options

The parse_opt() routine uses fixed size of string for mount options.
This is useless for future selinux options where is not well defined
size of selinux context name.

The patch also makes code more readable and all option-string
operations share same code.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: avoid duplicate entries in mtab when mount -f
Karel Zak [Mon, 30 Apr 2007 22:28:08 +0000 (00:28 +0200)] 
mount: avoid duplicate entries in mtab when mount -f

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add mount -o remount test
Karel Zak [Thu, 26 Apr 2007 20:25:13 +0000 (22:25 +0200)] 
tests: add mount -o remount test

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add mount --move test
Karel Zak [Thu, 26 Apr 2007 13:10:00 +0000 (15:10 +0200)] 
tests: add mount --move test

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: doesn't rpc_pipefs and nfsd on umount -a
Karel Zak [Thu, 26 Apr 2007 09:06:44 +0000 (11:06 +0200)] 
mount: doesn't rpc_pipefs and nfsd on umount -a

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: fix list logic in update_mtab
Karel Zak [Wed, 25 Apr 2007 23:49:28 +0000 (01:49 +0200)] 
mount: fix list logic in update_mtab

If mtab does not contain the new entry, then only mc0->prev is updated
to point to absent, but not the old mc0->prev's nxt pointer.  Because
we then use the nxt pointers to write the new mtab, absent is not
added to the new mtab.

(Note: fortunately, the mount doesn't use the update_mtab() for new
mounts, but for remount, move and umount only -- kzak)

If mtab is empty, absent->prev should be set to mc0, and not
mc0->prev, as it will be NULL.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: fix memory usage in update_mtab
Mike Frysinger [Fri, 13 Apr 2007 11:54:38 +0000 (07:54 -0400)] 
mount: fix memory usage in update_mtab

The update_mtab deallocates memory which was allocated by caller. It's nice
opportunity for double-free errors.

The patch fix a memory leak if we have to abort before mc0 are freed.  The
patch also fix a memory leak when we deallocate old (umounted) entry.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: do not treat arm/sparc specially.
Mike Frysinger [Fri, 13 Apr 2007 11:19:39 +0000 (07:19 -0400)] 
mount: do not treat arm/sparc specially.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
17 years agomount: don't umount sysfs when running umount -a
Mike Frysinger [Fri, 13 Apr 2007 11:15:44 +0000 (07:15 -0400)] 
mount: don't umount sysfs when running umount -a

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
17 years agopo: typo in french translation of mount error.
Mike Frysinger [Fri, 13 Apr 2007 11:11:44 +0000 (07:11 -0400)] 
po: typo in french translation of mount error.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
17 years agomount: fix -fv so that it doesn't incorrectly spit out an error that nothing was...
Mike Frysinger [Fri, 13 Apr 2007 10:58:18 +0000 (06:58 -0400)] 
mount: fix -fv so that it doesn't incorrectly spit out an error that nothing was done.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
17 years agosys-utils: move some man pages from category 8 to 1
Karel Zak [Wed, 25 Apr 2007 21:50:52 +0000 (23:50 +0200)] 
sys-utils: move some man pages from category 8 to 1

The dmesg, ipcrm, ipcs, renice and setsid are user-accessible commands
and belong in man1 more than to man8.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agodocs: fix info about devel/master branchs
Karel Zak [Wed, 25 Apr 2007 13:23:21 +0000 (15:23 +0200)] 
docs: fix info about devel/master branchs

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agodocs: remove deprecated section from README
Karel Zak [Tue, 24 Apr 2007 22:40:28 +0000 (00:40 +0200)] 
docs: remove deprecated section from README

The deprecated stuff is already described in the DEPRECATED file.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: add SUID_CFLAGS
Karel Zak [Tue, 24 Apr 2007 09:44:19 +0000 (11:44 +0200)] 
build-sys: add SUID_CFLAGS

The patch allows to define special CFLAGS for typical suid programs
(like mount, umount, chfn, ...). Some distributions use for example
"-fpic" for suid binaries.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: add support for mtab "uhelper" option
Karel Zak [Thu, 12 Apr 2007 12:35:46 +0000 (14:35 +0200)] 
mount: add support for mtab "uhelper" option

The helper is an external /sbin/umount.<suffix> program where the
suffix is a value from the uhelper= option from /etc/mtab.

The uhelper (unprivileged umount helper) is possible to used when
non-root user wants to umount a mountpoint which is not defined in the
/etc/fstab file (e.g devices mounted by HAL).

This option is already supported by HAL upstream.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: update mtab correctly when mount --move
Karel Zak [Thu, 12 Apr 2007 11:27:41 +0000 (13:27 +0200)] 
mount: update mtab correctly when mount --move

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoschedutils: define SCHED_BATCH when compile with old glibc
Karel Zak [Wed, 11 Apr 2007 21:18:08 +0000 (23:18 +0200)] 
schedutils: define SCHED_BATCH when compile with old glibc

This is temporary workaround and it will be removed in 2.14 when
minimal number of people will use old systems where is not defined
SCHED_BATCH in (bits/)sched.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agocheck exit status of autotools
Mike Frysinger [Tue, 10 Apr 2007 14:54:22 +0000 (10:54 -0400)] 
check exit status of autotools

Make sure each autotool run in autogen.sh worked and if not, abort.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
17 years agotodo: add request for cal highlight control option
Karel Zak [Fri, 6 Apr 2007 10:31:40 +0000 (12:31 +0200)] 
todo: add request for cal highlight control option

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotodo: add entry about replay
Karel Zak [Fri, 6 Apr 2007 10:17:43 +0000 (12:17 +0200)] 
todo: add entry about replay

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: refresh mtablock output in expected/ directory
Karel Zak [Wed, 4 Apr 2007 11:09:34 +0000 (13:09 +0200)] 
tests: refresh mtablock output in expected/ directory

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: relative atime support
Valerie Henson [Sat, 9 Dec 2006 03:15:14 +0000 (19:15 -0800)] 
mount: relative atime support

Add the "relatime" (relative atime) option support to mount.  Relative
atime only updates the atime if the previous atime is older than the
mtime or ctime.  Like noatime, but useful for applications like mutt
that need to know when a file has been read since it was last
modified.

Cc: Adrian Bunk <bunk@stusta.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Karel Zak <kzak@redhat.com>
Signed-off-by: Valerie Henson <val_henson@linux.intel.com>
17 years agotests: add missing header
Matthias Koenig [Tue, 3 Apr 2007 14:06:55 +0000 (16:06 +0200)] 
tests: add missing header

minor patch, which adds a missing string.h header to
mnt_test_sysinfo.c

Signed-Off-By: Matthias Koenig <mkoenig@suse.de>
17 years agomisc-utils: add scriptreplay manpage
Matthias Koenig [Tue, 3 Apr 2007 14:04:15 +0000 (16:04 +0200)] 
misc-utils: add scriptreplay manpage

a really minor patch which adds the manpage for scriptreplay.

Signed-Off-By: Matthias Koenig <mkoenig@suse.de>
17 years agomount: shared-subtree support
Karel Zak [Tue, 3 Apr 2007 20:54:47 +0000 (22:54 +0200)] 
mount: shared-subtree support

This patch builds shared-subtree semantics awareness into the mount
command.  Updates the man page for mount too.

The patch also fix a conflict between MS_COMMENT and MS_UNBINDABLE
(-- kzak).

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
17 years agotests: enable mtablock test when uid=0 only
Karel Zak [Tue, 3 Apr 2007 20:19:28 +0000 (22:19 +0200)] 
tests: enable mtablock test when uid=0 only

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agodocs: add the DEPRECATED file
Karel Zak [Tue, 3 Apr 2007 20:02:20 +0000 (22:02 +0200)] 
docs: add the DEPRECATED file

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agolosetup: add to man page info about deprecated cryptoloop
Karel Zak [Tue, 3 Apr 2007 19:56:55 +0000 (21:56 +0200)] 
losetup: add to man page info about deprecated cryptoloop

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: fix mtab_lock
Karel Zak [Fri, 30 Mar 2007 11:10:59 +0000 (13:10 +0200)] 
mount: fix mtab_lock

* the lock function uses F_SETLK / F_SETLKW as a conditional wait.
  It's more reliable and better for performance to close the
  MOUNTED_LOCK file in unlock_mtab(), otherwise concurrent process will
  be wait by while () { link() } loop instead on fcntl(F_SETLKW).

  Thanks to Jeff Moyer <moyer@redhat.com> who found the problem two
  year ago.

* when open(MOUNTED_LOCK) failed, we need to try everything again, but
  the original code didn't zeroize "we_created_lockfile" and the old
  version in particular case left lock_mtab() without locked /etc/mtab.
  This is nasty bug.

* the original locking code had bad performance due too long sleep
  (1s),  between attempts. Now we're more aggressive and we use
  5000ms. The result is that more processes is able to lock mtab in
  short time slice.

  Thanks to Peter Rockai <prockai@redhat.com> who found the problem
  and suggest a first version of the code with usleep.

* now we don't count number of attempts anymore, but we count sum of
  time which we spend in the mtab_lock(). The number of attempts is
  not important (and it also depends on CPU performance, load,
  scheduler, ...), the important thing is how long we spend with
  locking. Now time  limit is 30s.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add lock_mtab() performance and reliability test
Karel Zak [Wed, 28 Mar 2007 16:43:03 +0000 (18:43 +0200)] 
tests: add lock_mtab() performance and reliability test

The test starts concurrently many processes that use lock_mtab() as
lock for access to same file.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: make clean need to remove diffs and outputs
Karel Zak [Wed, 28 Mar 2007 15:01:19 +0000 (17:01 +0200)] 
tests: make clean need to remove diffs and outputs

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agolosetup: add support read-only loops
Karel Zak [Thu, 22 Mar 2007 19:54:07 +0000 (20:54 +0100)] 
losetup: add support read-only loops

This feature has been already supported by mount, but it wasn't accessible by
losetup command. Now you can use "losetup -r".

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agolosetup: add -a option to list all used loop devices
Karel Zak [Thu, 22 Mar 2007 13:22:10 +0000 (14:22 +0100)] 
losetup: add -a option to list all used loop devices

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: add -s and -f and note to man page for external mount helpers
Karel Zak [Thu, 22 Mar 2007 11:51:47 +0000 (12:51 +0100)] 
mount: add -s and -f and note to man page for external mount helpers

The mount -s (for nfs only) and -f options must be exported to
external /sbin/mount.<type> helpers.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomount: call /sbin/mount.<type> also when mounting without "-t"
Karel Zak [Thu, 22 Mar 2007 00:56:54 +0000 (01:56 +0100)] 
mount: call /sbin/mount.<type> also when mounting without "-t"

The mount uses /sbin/mount.<type> when the type is *defined* on
command line or in fstab only. It's not a consistent solution, because
we also support fylesystem type autodetection. The patch allows to
mount OCFS2 by label for example.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add test for /sbin/mount.<type> call
Karel Zak [Thu, 22 Mar 2007 00:28:44 +0000 (01:28 +0100)] 
tests: add test for /sbin/mount.<type> call

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agonewgrp: add support for /etc/gshadow
Karel Zak [Wed, 21 Mar 2007 22:07:25 +0000 (23:07 +0100)] 
newgrp: add support for /etc/gshadow

The original newgrp command doesn't expect group pasword in /etc/gshadow
although almost all distributions use this file (and the gpasswd command).

The newgrp from util-linux is deprecated and better is use shadow-utils only.
Unfortunately, shadow-utils are broken too (see RH version where is bugfix).
In this case it's better fix util-linux version at least...

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agonewgrp: check result from getgrnam() more carefully
Karel Zak [Wed, 21 Mar 2007 16:29:20 +0000 (17:29 +0100)] 
newgrp: check result from getgrnam() more carefully

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohwclock: make ggc happy and check return values from fgets, read and write
Karel Zak [Wed, 21 Mar 2007 15:21:34 +0000 (16:21 +0100)] 
hwclock: make ggc happy and check return values from fgets, read and write

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohwclock: remove tailing white-spaces and clean up clock.h
Karel Zak [Wed, 21 Mar 2007 14:05:58 +0000 (15:05 +0100)] 
hwclock: remove tailing white-spaces and clean up clock.h

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohwclock: add support for audit system
Karel Zak [Wed, 21 Mar 2007 13:12:05 +0000 (14:12 +0100)] 
hwclock: add support for audit system

If you compile --with-audit the hwclock tool reports changes in sys/hw clock to
audit system. The real long-term and final solution is probably add hooks for
/dev/rtc to kernel, but it's not implemented yet.

Signed-off-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohwclock: fix --systohc sets clock 0.5 seconds slow
Karel Zak [Mon, 19 Mar 2007 23:32:37 +0000 (00:32 +0100)] 
hwclock: fix --systohc sets clock 0.5 seconds slow

quote from rh150493:

The kernel code, when setting the BIOS clock notes that the clock time
ticks to the next second 0.5 seconds after adjusting it  (see
linux/arch/i386/kernel/time.c).

hwclock --systohc sets the CMOS clock at the 1 second boundry and thus
causes the clock to be wrong by 500ms each time it is reset.  If the
clock is set every shutdown then the clock will have a reboot-count
related drift as well as the natural drift problems of the clock. Note
that this also mucks up the drift calculations, of course.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add hwclock systohc test
Karel Zak [Mon, 19 Mar 2007 23:08:49 +0000 (00:08 +0100)] 
tests: add hwclock systohc test

The test detects how "hwclock --systohc" untune the clock. Now the hwclock
command causes the hw clock to be wrong by 500ms each time it is reset.

The test resets the clock 10 times and result is 5 sec difference between NTP
and the clock. That's a bug... and it has to bee fixed in a next commit.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add ts_ok and ts_failed
Karel Zak [Mon, 19 Mar 2007 22:27:40 +0000 (23:27 +0100)] 
tests: add ts_ok and ts_failed

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohwclock: add --rtc=<path> option and support for /dev/rtc0
Karel Zak [Mon, 19 Mar 2007 09:14:13 +0000 (10:14 +0100)] 
hwclock: add --rtc=<path> option and support for /dev/rtc0

The patch to allow "hwclock --rtc /dev/rtc1" and so on,
since "/dev/rtc" may not be there and "/dev/rtc0" may not be
the right answer either.

The "--rtc" is compatible with next Bryan Henderson's hwclock
versions.

Signed-off-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agodocs: fix URL and typos in README.devel
Karel Zak [Wed, 14 Mar 2007 13:16:45 +0000 (14:16 +0100)] 
docs: fix URL and typos in README.devel

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add library for LD_PRELOAD to manipulate with time() in tests
Karel Zak [Wed, 14 Mar 2007 13:10:18 +0000 (14:10 +0100)] 
tests: add library for LD_PRELOAD to manipulate with time() in tests

The cal command generates output that depends on time(). For reliable
regression tests we need to use still same time. It seems that LD_PRELOAD is
pretty simple way.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: remove aclocal.m4 from SCM
Karel Zak [Wed, 14 Mar 2007 11:51:49 +0000 (12:51 +0100)] 
build-sys: remove aclocal.m4 from SCM

The aclocal.m4 is also generated by autogen.sh

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: remove triiling white-spaces
Karel Zak [Mon, 12 Mar 2007 13:31:11 +0000 (14:31 +0100)] 
login: remove triiling white-spaces

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: add audit support
Karel Zak [Mon, 12 Mar 2007 13:26:34 +0000 (14:26 +0100)] 
login: add audit support

The login command reports AUDIT_USER_LOGIN message to audit system
(depends on --with-audit).

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: add support for audit
Karel Zak [Mon, 12 Mar 2007 11:20:54 +0000 (12:20 +0100)] 
build-sys: add support for audit

You can compile --with-audit now.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: add IPv6 support
Karel Zak [Sat, 10 Mar 2007 00:28:10 +0000 (01:28 +0100)] 
login: add IPv6 support

This support includes:

   * non-PAM version supports IPv6 ranges in /etc/usertty
   * utmp records with IPv6 addresses

Based on patch by: Milan Zazrivec <mzazrivec@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: add regression test for IP address checking code
Karel Zak [Fri, 9 Mar 2007 13:56:18 +0000 (14:56 +0100)] 
login: add regression test for IP address checking code

The hnmatch() in checktty.c is checking IP addresses if the login util
is compiled without PAM support.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: update 32bit utmp correctly on 64bit system
Karel Zak [Thu, 8 Mar 2007 22:22:06 +0000 (23:22 +0100)] 
login: update 32bit utmp correctly on 64bit system

On 64-bit platforms such as x86_64, glibc is usually built with 32-bit
compatibility for various structures. One of them is utmp.

What this means is that gettimeofday(&ut.ut_tv, NULL) on x86_64 will
end up overwriting the first parts of ut_addr_v6, leading to garbage
in the utmp file.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: omits PAM account validation when auth is skipped (CVE-2006-7108)
Karel Zak [Thu, 8 Mar 2007 21:42:50 +0000 (22:42 +0100)] 
login: omits PAM account validation when auth is skipped (CVE-2006-7108)

The login omits pam_acct_mgmt & chauth_tok when authentication is skipped.
Authentication may be skipped, for example, during krlogin because Kerberos
already took care of it. The problem with skipping pam_acct_mgmt is that it
allows users to use the system when maybe they should not be allowed, such that
if they have a Kerberos ticket, the other checks do not apply.

If a user had to use password authentication, pam_acct_mgmt may reject the user
for several reasons: not allowed to use the system at this time, not allowed to
use this system, user's account has been disabled, etc. Why should these tests
be skipped just because the user has a ticket?

Same with pam_chauthtok: the user may have a valid ticket, but if their
password has expired, they need to enter a new one right now.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: attempt to run if it has no read/write access to its terminal
Karel Zak [Thu, 8 Mar 2007 21:35:38 +0000 (22:35 +0100)] 
login: attempt to run if it has no read/write access to its terminal

If you manage to exec login with a userid other than root, and its
input / output directed to a terminal for which it does not have
read/write access, it will attempt to proceed (and can potentially
hang forever -- but this hang has been fixed in a previous commit).

It's better to check if we have permissions for terminal rather than
do any useless things.

From: Jason Vas Dias <jvdias@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: keep syslog useful for end of PAM session.
Karel Zak [Thu, 8 Mar 2007 21:27:17 +0000 (22:27 +0100)] 
login: keep syslog useful for end of PAM session.

The PAM session modules typically write to syslog when leaving the
session. The openlog() is way how define a "ident" for syslog messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: login's timeout can fail
Karel Zak [Thu, 8 Mar 2007 21:21:15 +0000 (22:21 +0100)] 
login: login's timeout can fail

Login tries to set a timeout in main() by SIGALARM. If any restartable system
call is entered, such system calls can block indefinitely and will NOT be
interrupted by the SIGALRM.

The bug appears when the login program is run for a terminal for which it
doens't have read or write permission.

In that case, login hung until manually killed by the administrator in its
tcsetattr(...) call at login.c, line 460:
   /* Kill processes left on this tty */
tcsetattr(0,TCSAFLUSH,&ttt);

This may possibly be a kernel bug - instead of returning EIO / EPERM, the
kernel continously sends an infinite number of SIGTTOU signals to the process .

An 80MB strace log file was generated, consisting of >1,000,000 repetitions
of :
4964  11:00:18 ioctl(0, SNDCTL_TMR_CONTINUE or TCSETSF, {c_iflags=0x106,
c_oflags=0x1805, c_cflags=0x800000be, c_lflags=0x3b, c_line=0,
c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"})
= ? ERESTARTSYS (To be restarted)
4964  11:00:18 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
4964  11:00:18 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---

Login's alarm signal handler DOES get the SIGALRM after the 60 second timeout,
and timedout() is called; but then timedout2 calls ioctl(0, TCSETA, &ti), which
also blocks, because the ioctl(0, TCSETSF...) of tcsetattr is in progress, and
the exit() call of timedout2 is never reached, and the tcsetattr call is
restarted.

From: Jason Vas Dias <jvdias@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: improve work with signals
Karel Zak [Thu, 8 Mar 2007 20:57:48 +0000 (21:57 +0100)] 
login: improve work with signals

The login cannot ignore signals, because:

 * SIGHUP is only way how inform session leader that controlling
   tty goes away. The leader has to inform others processes in same
   process group about the signal.

 * SIGHUP/SIGTERM cannot kill wait(2)-ing login, we have to wait as long
   as any child process exists. The PAM session has to be closed correctly.

 * The child process (before setsid()) has to call exit() if a controlling
   tty goes away.

This patch is inspired by patch from Red Hat that is very well tested for last
4 years in all Red Hat distros.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotodo: add item about ipcs
Karel Zak [Wed, 7 Mar 2007 00:03:28 +0000 (01:03 +0100)] 
todo: add item about ipcs

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agologin: close PAM session after failed pam_setcred
Karel Zak [Tue, 6 Mar 2007 14:08:58 +0000 (15:08 +0100)] 
login: close PAM session after failed pam_setcred

If for some reason the pam set credential call fails, it does not close the pam
session. pam open can mount drives, so calling pam close is important.

From: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agochsh: remove tailing wihit-spaces and use PATH_BSHELL
Karel Zak [Tue, 6 Mar 2007 12:45:59 +0000 (13:45 +0100)] 
chsh: remove tailing wihit-spaces and use PATH_BSHELL

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agolook: remove tailing white-spaces
Karel Zak [Wed, 7 Mar 2007 08:53:56 +0000 (09:53 +0100)] 
look: remove tailing white-spaces

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agolook: fix problem with !isalnum() words
Karel Zak [Tue, 6 Mar 2007 12:14:52 +0000 (13:14 +0100)] 
look: fix problem with !isalnum() words

for example "$ look apple-pie"

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add look test for words with separator
Karel Zak [Tue, 6 Mar 2007 12:04:25 +0000 (13:04 +0100)] 
tests: add look test for words with separator

$ look apple-pie

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agopo: vipw doesn't use rpmatch, all translations have to use y/n
Karel Zak [Tue, 6 Mar 2007 11:03:19 +0000 (12:03 +0100)] 
po: vipw doesn't use rpmatch, all translations have to use y/n

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agocfdisk: build-sys defines HAVE_RPMATCH, not HAVE_rpmatch
Karel Zak [Tue, 6 Mar 2007 10:54:39 +0000 (11:54 +0100)] 
cfdisk: build-sys defines HAVE_RPMATCH, not HAVE_rpmatch

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkfs.cramfs: fix a way how mkfs works with empty files
Karel Zak [Tue, 27 Feb 2007 15:49:25 +0000 (16:49 +0100)] 
mkfs.cramfs: fix a way how mkfs works with empty files

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add expected outputs for cramfs
Karel Zak [Tue, 27 Feb 2007 15:38:27 +0000 (16:38 +0100)] 
tests: add expected outputs for cramfs

The patch aslo reduce number of files and dirs in mkfs.cramfs tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkfs.cramfs: remove hardcoded limit for directories
Karel Zak [Tue, 27 Feb 2007 15:31:21 +0000 (16:31 +0100)] 
mkfs.cramfs: remove hardcoded limit for directories

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add mkfs.cramfs tests
Karel Zak [Tue, 27 Feb 2007 14:59:04 +0000 (15:59 +0100)] 
tests: add mkfs.cramfs tests

This test shows that actual mkfs.cramfs is ugly due MAXENTRIES (100) limit.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agovipw: fix permissions (600->400) for edited /etc/[g]shodow files
Karel Zak [Thu, 15 Feb 2007 10:46:23 +0000 (11:46 +0100)] 
vipw: fix permissions (600->400) for edited /etc/[g]shodow files

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agopartx: add man pages for addpart, delpart and partx
Karel Zak [Fri, 9 Feb 2007 18:15:23 +0000 (19:15 +0100)] 
partx: add man pages for addpart, delpart and partx

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoclean up realpath.[ch] includes and macros
Karel Zak [Fri, 9 Feb 2007 16:35:15 +0000 (17:35 +0100)] 
clean up realpath.[ch] includes and macros

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoswapon: does not correctly deal with symlinks
Karel Zak [Fri, 9 Feb 2007 16:15:39 +0000 (17:15 +0100)] 
swapon: does not correctly deal with symlinks

From: Marco d'Itri <md@Linux.IT>
Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkswap: automatically add selinux label to swapfile
Karel Zak [Thu, 8 Feb 2007 14:22:37 +0000 (15:22 +0100)] 
mkswap: automatically add selinux label to swapfile

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: configure.am selinux support cleanup
Karel Zak [Thu, 8 Feb 2007 14:19:36 +0000 (15:19 +0100)] 
build-sys: configure.am selinux support cleanup

Changes:
 - don't include SELinux as default (--with-selinux is required)
 - the SELinux is not useful for login-utils only
 - clean up PAM and login-utils tests in the configure.am

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: fix README filenames and add missing files to EXTRA_DISTs
Karel Zak [Thu, 8 Feb 2007 11:38:25 +0000 (12:38 +0100)] 
build-sys: fix README filenames and add missing files to EXTRA_DISTs

Also, the patch makes "make mrproper" more robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkswap: add regression test
Karel Zak [Wed, 7 Feb 2007 12:26:11 +0000 (13:26 +0100)] 
mkswap: add regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotodo: add item about exit() codes
Karel Zak [Wed, 7 Feb 2007 09:32:34 +0000 (10:32 +0100)] 
todo: add item about exit() codes

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkswap: avoid mkswap usage on already mounted device
Karel Zak [Wed, 7 Feb 2007 09:32:02 +0000 (10:32 +0100)] 
mkswap: avoid mkswap usage on already mounted device

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotodo: add this file
Karel Zak [Wed, 7 Feb 2007 09:11:07 +0000 (10:11 +0100)] 
todo: add this file

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agomkswap: gcc happy: unsigned long usage
Karel Zak [Wed, 7 Feb 2007 09:10:22 +0000 (10:10 +0100)] 
mkswap: gcc happy: unsigned long usage

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoClean up pagesize/PAGE_SIZE usage.
Karel Zak [Tue, 6 Feb 2007 10:35:15 +0000 (11:35 +0100)] 
Clean up pagesize/PAGE_SIZE usage.

Now all code in util-linux uses sysconf(_SC_PAGESIZE) that is standardized and
preferred way of querying page size. The asm/page.h file is not included to the
code anymore. (This patch doesn't change mount's FS detection code which will
be removed later).

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: fix argv[] usage in mnt_test_sysinfo.c
Karel Zak [Tue, 6 Feb 2007 10:33:35 +0000 (11:33 +0100)] 
tests: fix argv[] usage in mnt_test_sysinfo.c

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agonamei: new regression test
Karel Zak [Wed, 31 Jan 2007 15:45:01 +0000 (16:45 +0100)] 
namei: new regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agonamei: fix logic and infinite loop of symlinks
Karel Zak [Wed, 31 Jan 2007 15:43:18 +0000 (16:43 +0100)] 
namei: fix logic and infinite loop of symlinks

Don't follow the path if a component is not directory.  It doesn't make sense
to support something like:

$ touch a b
$ namei a/b  <-- where "a" is not directory

The support for infinite loop of symbolic links is a strange wish only. The
stack size is very limited. Try:

$ ln -s x
$ namei x/x

[Migration note: severity="low"]

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agocol: getwchar() errors shouldn't be hidden
Karel Zak [Tue, 30 Jan 2007 12:18:51 +0000 (13:18 +0100)] 
col: getwchar() errors shouldn't be hidden

The col truncates output when multibyte errors is detected, but the problem is
not reported to stderr and return code is still same like for successful exit.
This stupid behaviour is fixed by this patch.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agobuild-sys: fix ifdef ENABLE_WIDECHAR usage
Karel Zak [Tue, 30 Jan 2007 12:49:50 +0000 (13:49 +0100)] 
build-sys: fix ifdef ENABLE_WIDECHAR usage

There has been unexpected mix of HAVE_WIDECHAR and ENABLE_WIDECHAR macros. The
ENABLE_WIDECHAR is old version and has to be replaced everywhere otherwise we
will see bugs with multibyte stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agotests: add return code
Karel Zak [Sun, 28 Jan 2007 00:24:15 +0000 (01:24 +0100)] 
tests: add return code

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoraw: add file with udev rule example
Karel Zak [Fri, 26 Jan 2007 19:06:38 +0000 (20:06 +0100)] 
raw: add file with udev rule example

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoraw: move the raw command to /sbin
Karel Zak [Fri, 26 Jan 2007 19:01:39 +0000 (20:01 +0100)] 
raw: move the raw command to /sbin

The raw command could be used from udev scripts.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoraw: don't accept raw0 as a target name
Karel Zak [Fri, 26 Jan 2007 18:55:41 +0000 (19:55 +0100)] 
raw: don't accept raw0 as a target name

The raw0 is rawctl and cannot be used as a normal raw device. The patch
also enlarge range of <N> for raw<N> and improve the query mode.

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agoraw: update man page (about dd and O_DIRECT)
Karel Zak [Thu, 25 Jan 2007 10:22:42 +0000 (11:22 +0100)] 
raw: update man page (about dd and O_DIRECT)

Signed-off-by: Karel Zak <kzak@redhat.com>
17 years agohexdump: don't use memset with zero lenght
Karel Zak [Wed, 17 Jan 2007 13:27:15 +0000 (14:27 +0100)] 
hexdump: don't use memset with zero lenght

gcc 4.1.0: "warning: memset used with constant zero length parameter...."

Signed-off-by: Karel Zak <kzak@redhat.com>