libmount: tags does not start with '/'

References: https://bugzilla.redhat.com/show_bug.cgi?id=909866
Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: Add flag for enabling/disabling libuser support.

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
chsh-chfn: Move pam auth to its own function, factoring out common code

This makes it easier to add support for libuser, which needs the same PAM
authentication. Also removes duplicate code between chsh and chfn.

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
chsh: Add libuser support

This is based directly on lchsh which is a part of libuser. libuser.{c,h}
exist because exactly the same code is needed for both chsh and chfn.

[kzak@redhat.com: cleanup err() usage]

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
chfn: Add libuser support

Signed-off-by: Cody Maloney <cmaloney@theoreticalchaos.com>
libmount: correctly propagate ambivalent blkid probing results

libmount ignores "ambivalent probing result" from libblkid and tries
filesystems /etc/filesystems. This is incorrect behavior.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
chsh-chfn: fix bugs, improve compilation

 * rename --disable-require-password to --disable-chsh-chfn-password

 * is_local() is really unnecessary when linked with libuser

 * fix set_value_libuser() returns codes

 * fix chfn.c, there is no 'pw', but oldf.pw

 * don't link with PAM when--disable-chsh-chfn-password

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: add config-gen.d stuff for chsh-chfn

Signed-off-by: Karel Zak <kzak@redhat.com>
switch_root: Add a sanity check

As switch_root basically does rm -Rf / we should make sure
that / is really an initramfs.

Signed-off-by: Richard Weinberger <richard@nod.at>
libmount: add missing MNT_ERR_AMBIFS

Sorry, the last commit into libmount has been incomplete.

Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: use AC_COMPILE_IFELSE

The AC_TRY_COMPILE is obsolete.

Addresses: http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html#index-AC_005fTRY_005fCOMPILE-2203
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
build-sys: use AC_USE_SYSTEM_EXTENSIONS

The AC_GNU_SOURCE is obsolete.

Addresses: http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html#index-AC_005fGNU_005fSOURCE-2058
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
build-sys: add package url to AC_INIT

See last line from './configure --help'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libblkid: Don't keep reading same sector of ISO

We were reading the same sector over and over again when parsing ISO9660.
This patches fixes it.
libblkid: Expose more ISO9660 headers

In order to kill libosinfo's infamous udev rule[1], we need to make blkid
report the following information as udev properties on IS09660 media so
that libosinfo can make use of that for detection:

1. Volume ID (already exposed as label).
2. System ID.
3. Publisher ID.
4. Application ID.
5. Boot record's boot system ID, (almost always 'EL TORITO
   SPECIFICATION' if boot record is present).

Example use:

$ blkid -p -o udev Fedora-17-x86_64-DVD.iso
ID_FS_SYSTEM_ID=LINUX
ID_FS_APPLICATION_ID=GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C)
1993 E.YOUNGDALE
ID_FS_UUID=2012-05-22-20-55-32-00
ID_FS_UUID_ENC=2012-05-22-20-55-32-00
ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION
ID_FS_LABEL=Fedora_17_x86_64
ID_FS_LABEL_ENC=Fedora\x2017\x20x86_64
ID_FS_TYPE=iso9660
ID_PART_TABLE_TYPE=dos

[1] https://fedorahosted.org/libosinfo/ticket/1

[kzak@redhat.com: - add blkid_ltrim_whitespace() and use it together
                    with blkid_rtrim_whitespace() to trim white spaces
                  - enlarge blkid values to 128 bytes
                  - add generic blkid_probe_set_id_label() function
                  - always terminate all _ID with \0
                  - don't export the _IDs to blkid cache]

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: Probe UDF volumes for ISO9660 info as well

I have seen blkid failing to report any meaningful data on some of UDF
volumes I have (Windows installer media):

$ ./blkid -p -o udev en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso
ID_FS_LABEL=UDF_Volume
ID_FS_LABEL_ENC=UDF\x20Volume
ID_FS_TYPE=udf

Also, once my patches to expose more of ISO9660 info get merged, we'd
also need the same info to be exposed for UDF volumes.

This patch adds ISO9660 probing to UDF volumes and here is the result I
see on my example UDF volume (together with my pending patch to expose
more ISO9660 information):

$ ./blkid -p -o udev en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso
ID_FS_PUBLISHER_ID=MICROSOFT CORPORATION
ID_FS_APPLICATION_ID=CDIMAGE 2.54 (01/01/2005 TM)
ID_FS_UUID=2011-04-12-02-38-58-00
ID_FS_UUID_ENC=2011-04-12-02-38-58-00
ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION
ID_FS_LABEL=GSP1RMCPRXFRER_EN_DVD
ID_FS_LABEL_ENC=GSP1RMCPRXFRER_EN_DVD
ID_FS_TYPE=iso9660

$ ./blkid -p -o udev en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso
ID_FS_PUBLISHER_ID=MICROSOFT CORPORATION
ID_FS_APPLICATION_ID=CDIMAGE 2.52 (03/09/2004 TM)
ID_FS_UUID=2008-04-14-12-00-00-00
ID_FS_UUID_ENC=2008-04-14-12-00-00-00
ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION
ID_FS_LABEL=GRTMPFPP_EN
ID_FS_LABEL_ENC=GRTMPFPP_EN
ID_FS_TYPE=iso9660

Before anyone asks, Yes! The UDF media I have is all legal and downloaded
directly from MSDN. :)

[kzak@redhat.com: - read LABEL from UDF only if not found anything
                    useful in ISO9660]

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: read whole buffer for iso_volume_descriptor

Signed-off-by: Karel Zak <kzak@redhat.com>
unshare,nsenter: spawn shell by default

The behaviour mimics chroot.

Possibly it would have been nicer to to query the password database in
the new namepace and run the shell of the user there, but it's hard to
do correctly. getpwuid() might need to load nss plugins, and the arch
in the new namespace might be different (in case of NEWNS mounts), or
the hostname might be different, etc. So in general it's not possible
to do it reliably.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
nsenter: fix errors in manpage

- spell abbreviations with capital letters
- fix the names of a few options and files

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
lscpu: don't read cpuid on non-live systems

Reported-by: Luis Aranguren <pizzaman@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>