Commit Graph

15578 Commits

Author SHA1 Message Date
Karel Zak 939a997de0 tests: enable mtablock test when uid=0 only
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-04-03 22:19:28 +02:00
Karel Zak 72a7145496 docs: add the DEPRECATED file
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-04-03 22:02:20 +02:00
Karel Zak 72ab6bb4b9 losetup: add to man page info about deprecated cryptoloop
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-04-03 21:56:55 +02:00
Karel Zak dc8fdc57cd 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>
2007-03-30 13:10:59 +02:00
Karel Zak 2cd72ac0e0 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>
2007-03-28 18:43:03 +02:00
Karel Zak 61b2affd6e tests: make clean need to remove diffs and outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-28 17:01:19 +02:00
Jim Meyering ce5f2f2677 Help translators include translation team's web or email address.
* src/system.h (emit_bug_reporting_address): New function.
* src/base64.c: Use it rather than a literal printf.
* src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c:
* src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c:
* src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c:
* src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c:
* src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c:
* src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c:
* src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c:
* src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c:
* src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c:
* src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c:
* src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c:
* src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c:
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c:
* src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c:
* src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c:
* src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c:
* src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c:
* src/who.c, src/whoami.c, src/yes.c: Likewise.
2007-03-28 08:50:29 +02:00
Karel Zak faf142b65a 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>
2007-03-22 20:54:07 +01:00
Karel Zak 8b125fae1c losetup: add -a option to list all used loop devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-22 14:22:10 +01:00
Karel Zak 460e061dd9 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>
2007-03-22 12:51:47 +01:00
Karel Zak 2ac07cbb66 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>
2007-03-22 01:56:54 +01:00
Karel Zak ce11301210 tests: add test for /sbin/mount.<type> call
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-22 01:28:44 +01:00
Karel Zak 66a9411eb0 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>
2007-03-21 23:07:25 +01:00
Karel Zak ac70067ae6 newgrp: check result from getgrnam() more carefully
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 17:29:20 +01:00
Karel Zak 72bcf1898b hwclock: make ggc happy and check return values from fgets, read and write
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 16:21:34 +01:00
Karel Zak 9abb26854c hwclock: remove tailing white-spaces and clean up clock.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 15:05:58 +01:00
Karel Zak 88058a71e2 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>
2007-03-21 14:12:05 +01:00
Karel Zak 99c392d8ba 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>
2007-03-20 00:32:37 +01:00
Karel Zak 51bc94930b 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>
2007-03-20 00:08:49 +01:00
Karel Zak 05de812634 tests: add ts_ok and ts_failed
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-19 23:27:40 +01:00
Karel Zak 88681c5f1a 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>
2007-03-19 10:14:13 +01:00
Karel Zak de55796274 docs: fix URL and typos in README.devel
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-14 14:16:45 +01:00
Karel Zak 82640b11ba 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>
2007-03-14 14:10:18 +01:00
Karel Zak 0e9f3267a7 build-sys: remove aclocal.m4 from SCM
The aclocal.m4 is also generated by autogen.sh

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-14 12:51:49 +01:00
Karel Zak e09947b58b login: remove triiling white-spaces
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-12 14:31:11 +01:00
Karel Zak f8bdba2fd2 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>
2007-03-12 14:26:34 +01:00
Karel Zak bbae9cb03e build-sys: add support for audit
You can compile --with-audit now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-12 12:20:54 +01:00
Karel Zak ea6c190a66 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>
2007-03-10 01:28:10 +01:00
Karel Zak 71562c1fdd 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>
2007-03-09 14:56:18 +01:00
Karel Zak 75d4dbb0d7 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>
2007-03-08 23:22:06 +01:00
Karel Zak 987195ce41 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>
2007-03-08 22:42:50 +01:00
Karel Zak 62eabbf4a9 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>
2007-03-08 22:35:38 +01:00
Karel Zak 1727423368 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>
2007-03-08 22:27:17 +01:00
Karel Zak 649efbb369 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>
2007-03-08 22:21:15 +01:00
Karel Zak b245235886 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>
2007-03-08 21:57:48 +01:00
Karel Zak 1c51a3683a todo: add item about ipcs
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-07 10:14:23 +01:00
Karel Zak f2c7ae1ddd 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>
2007-03-07 10:14:13 +01:00
Karel Zak 7ab59baf58 chsh: remove tailing wihit-spaces and use PATH_BSHELL
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-07 10:14:03 +01:00
Karel Zak 429ee99745 look: remove tailing white-spaces
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-07 09:53:56 +01:00
Karel Zak dab737cc42 look: fix problem with !isalnum() words
for example "$ look apple-pie"

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-06 13:14:52 +01:00
Karel Zak a17bead499 tests: add look test for words with separator
$ look apple-pie

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-06 13:04:25 +01:00
Karel Zak 8b0f4ae981 po: vipw doesn't use rpmatch, all translations have to use y/n
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-06 12:03:19 +01:00
Karel Zak 1bf100f33b cfdisk: build-sys defines HAVE_RPMATCH, not HAVE_rpmatch
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-06 11:54:39 +01:00
Karel Zak 2bfcd20b8d mkfs.cramfs: fix a way how mkfs works with empty files
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-27 16:49:25 +01:00
Karel Zak 40b115acc5 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>
2007-02-27 16:38:27 +01:00
Karel Zak 3e52b13e91 mkfs.cramfs: remove hardcoded limit for directories
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-27 16:31:21 +01:00
Karel Zak 86ec1b63f9 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>
2007-02-27 15:59:04 +01:00
Karel Zak 31ffd207d2 vipw: fix permissions (600->400) for edited /etc/[g]shodow files
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-15 11:46:23 +01:00
Karel Zak 2f2d6528e3 partx: add man pages for addpart, delpart and partx
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-09 19:15:23 +01:00
Karel Zak 4717ea4a97 clean up realpath.[ch] includes and macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-09 17:35:15 +01:00