uuidgen: fix --random

Addresses: https://github.com/karelzak/util-linux/issues/20
Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: make --autologin useful with --skip-login (prompt)

The --autologin prints

	hostname login: username (automatic login)

message. This commit allows to suppress the message at all if
--skip-login (aka skip prompt) is specified.

It means that

	agetty --skip-login --noissue --autologin foouser

does completely silent autologin.

Addresses: https://github.com/karelzak/util-linux/issues/21
Signed-off-by: Karel Zak <kzak@redhat.com>
wipefs: Add --force option to force it to erase.

Commit c550f728f724360f99aae0fdb45b0589d9a347e0 added O_EXCL when
opening the thing to erase.  This broke the wipefs utility when used
on anything which isn't an unmounted filesystem.  eg. If you use it on
a block device containing partitions, then it won't work because the
kernel recognizes the partitions and so thinks the device is in use.

This change adds the --force option which, when used, undoes the above
flag change.  However you still have to use --force most of the time
when erasing something that isn't a plain unmounted filesystem.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
libblkid: (gpt) don't modify in memory buffers

LIBBLKID_DEBUG=0xffff blkid -p ....

gpt: ---> call probefunc()
	reuse buffer: off=0 len=1024 pr=0xb0b690
	reuse buffer: off=0 len=1024 pr=0xb0b690
	reuse buffer: off=1024 len=16384 pr=0xb0b690
GPT entries corrupted
	reuse buffer: off=10737417728 len=512 pr=0xb0b690
	reuse buffer: off=10737401344 len=16384 pr=0xb0b690
GPT entries corrupted
gpt: <--- (rc = 1)

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: add --{erase,kill}-chars options

We need way to disable the default kill and erase agetty chars to make
the getty usable for Active Directory users with '@' in username.

It seems that the most extendible solution is to add options that
allow to complete control additional erase/kill chars. If you specify
empty strings then the chars are disabled at all.

Note that this patch is backwardly compatible.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=870854
Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: remove @ and # as default kill and erase chars

Signed-off-by: Karel Zak <kzak@redhat.com>
su: rename log_su to log_syslog

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: use libcommon.a for lslocks

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/ttyutils: create .c file

Well, now all tty stuff are incline functions in include/ttyutils.h.
It's seems more elegant to create regular lib/ttyutils.c for libcommon
and write test program.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/ttyutils: add test program

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/ttyutils: add get_terminal_name()

Signed-off-by: Karel Zak <kzak@redhat.com>
login: use get_terminal_name() from ttyutils.c

Signed-off-by: Karel Zak <kzak@redhat.com>
su: use get_terminal_name() for compatibility with login(1)

login(1) uses tty name (!= path) in the syslog messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
su: log failed logins to btmp

Signed-off-by: Karel Zak <kzak@redhat.com>
ipcs: add /proc and /sys path definitions

The necessary proc and sysfs files are tested to be present.  When
information files are missing the ipcs will use obsolted system calls,
and data structures, as fallback.

[kzak@redhat.com: - fix #define _PATH_PROC_IPC_MSG "/proc/sys/kernel/sem" typo]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path: rename functions to be more explicit

 ... and to have names compatible with lib/sysfs.c

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path: add path_read_u64()

Signed-off-by: Karel Zak <kzak@redhat.com>
ipcs: determine ipc limits from /proc

Some of the limit values are not dynamic.  Like in kernel these values
are #defined.

[kzak@redhat.com: - use better names for functions,
                  - add ipcutils.{c,h}
                  - read also shmmax from /proc]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
ipcs: read shared memory values from /proc

[kzak@redhat.com: - move to ipcutils.{c,h},
                  - fix datatypes to be arch independent]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
ipcs: clean up do_shm()

 - don't expect maxid as argument in ipc_shm_get_info()
 - if there is @id argument then use it everywhere in ipc_shm_get_info()
 - don't call shmctl() if not necessary in do_shm()

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