Commit Graph

15578 Commits

Author SHA1 Message Date
Karel Zak f59c8fd38d build-sys: release++ (v2.37.2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 15:23:50 +02:00
Karel Zak 9ffaa85be1 docs: update v2.37.2-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 15:22:37 +02:00
Karel Zak a2ec89ca4b docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 15:16:38 +02:00
Karel Zak c10d72868e po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 15:15:36 +02:00
Jose Riha 1a59c9fa15 po: add sk.po (from translationproject.org) 2021-08-16 15:06:14 +02:00
Jakub Bogusz ede5254afa po: update pl.po (from translationproject.org) 2021-08-16 15:06:14 +02:00
Karel Zak d0aeb4d2c0 mount.8: don't consider additional mounts as experimental
This is bug, we have "EXPERIMENTAL" flag in the man page since v2.23.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 13:00:18 +02:00
panchenbo 75882dea1a lscpu:Add Phytium FT-2000+ & S2500 support 2021-08-16 12:59:52 +02:00
panchenbo 6dde514b2a lscpu:Add Phytium aarch64 cpupart 2021-08-16 12:59:42 +02:00
Karel Zak 19238be16d docs: fix info about LIBSMARTCOLS_DEBUG_PADDING
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-16 12:59:31 +02:00
Karel Zak a5c6ab54e6 lscpu: fix compilation against librtas
Fixes: https://github.com/karelzak/util-linux/issues/1406
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-09 11:54:38 +02:00
Karel Zak f6dd7b20cd prlimit: fix compiler warning [-Wmaybe-uninitialized]
sys-utils/prlimit.c:467:16: warning: 'hard' may be used uninitialized in this function [-Wmaybe-uninitialized]
  lim->rlim_max = hard;
  ~~~~~~~~~~~~~~^~~~~~
sys-utils/prlimit.c:456:15: note: 'hard' was declared here
  rlim_t soft, hard;
               ^~~~
sys-utils/prlimit.c:466:16: warning: 'soft' may be used uninitialized in this function [-Wmaybe-uninitialized]
  lim->rlim_cur = soft;
  ~~~~~~~~~~~~~~^~~~~~
sys-utils/prlimit.c:456:9: note: 'soft' was declared here
  rlim_t soft, hard;
         ^~~~

References: https://github.com/karelzak/util-linux/issues/1406
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-09 11:54:07 +02:00
Karel Zak ebd4749115 lscpu: fix NULL dereference
Fixes: https://github.com/karelzak/util-linux/issues/1401
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-30 14:44:32 +02:00
Érico Nogueira 692167ff5e lib/pwdutils: use assert to check correct usage.
Since these functions are only used internally, we can make sure they
are being used correctly, and assert() helps in catching remaining
issues. Usage of each changed function has been reviewed:

For xgetpwnam:

- chsh(1) only calls it if a username has been set
- login(1) only calls it if username has been set and is not empty
- su(1) always initializes new_user to "root"
- unshare(1) calls get_user with optarg, so always set as well

For xgetgrnam:

- unshare(1) calls get_group with optarg

For xgetpwuid:

- chsh(1) passes a stack allocated struct for struct passwd

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2021-07-29 21:40:33 +02:00
Érico Nogueira 8ab700b933 logger: use xgetlogin from pwdutils.
It defined its own xgetlogin, which queried geteuid() instead of getuid(),
with a fallback to "<someone>" when lookup fails. This has been the case
since the function was introduced in
019b97024f, so geteuid() has always been
used. Since using geteuid for identification isn't consistent with the
rest of util-linux, switching to xgetlogin(), which uses getuid(),
should be correct.

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2021-07-29 21:40:33 +02:00
Érico Nogueira 5cc21d91fc wall: use xgetlogin.
getlogin(3) shouldn't be used for identification here. This also removes
the bug where a missing entry for getuid() in passwd database wouldn't
print a warning, because whom would be set to "???".

For consistency, switch to "<someone>" when pw look up fails.

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2021-07-29 21:40:33 +02:00
Érico Nogueira bca77acb03 lib/pwdutils: don't use getlogin(3).
Per the man page, it shouldn't be used for security purposes. This is an
issue especially on musl, where getlogin is implemented as
getenv("LOGNAME"). Since xgetlogin is being used as user identity in su(1), to
set PAM_RUSER, we simply switch to always using getpwuid(getuid()).

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2021-07-29 21:40:05 +02:00
Karel Zak 3c466f7c35 sulogin: fix getpasswd()
Fixes: https://github.com/karelzak/util-linux/issues/1400
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 21:28:00 +02:00
Karel Zak 54cb0dd60c libmount: don't use setgroups at all()
It's probably good idea to call setgroups() to cleanup groups,
but it introduces a regression as some mount helpers depend on
supplementary groups like "network" etc.

Fixes: https://github.com/karelzak/util-linux/issues/1398
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 20:42:24 +02:00
Karel Zak 4763080701 libmount: fix setgroups() use
* keep process in single supplementary group, which is the real group ID for the process

* make sure we have rights to call setgroups(), requires group permissions

Fixes: https://github.com/karelzak/util-linux/issues/1398
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:57:37 +02:00
Karel Zak 4f2406545c losetup: use LOOP_CONFIGURE in a more robust way
32-bit userspace returns ENOTTY:
 ioctl(4, LOOP_CONFIGURE, {fd=3, block_size=0, info={lo_offset=0, lo_number=0, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name="/usr/install/iso/systemrescue-8.04-amd64.iso", ...}}) = -1 ENOTTY (Inappropriate ioctl for device)

64-bit userspace returns EINVAL:
 ioctl(4, LOOP_CONFIGURE, {fd=3, block_size=0, info={lo_offset=0, lo_number=0, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name="/usr/src/PACKAGES/systemrescue-8.04-amd64.iso", ...}}) = -1 EINVAL (Invalid argument)

The correct return value for an unknown ioctl is ENOTTY, but we need
to support already released kernels, so let's support both errnos.

Reported-by: Krzysztof Olędzki <ole@ans.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:57:17 +02:00
Karel Zak 31bb588663 blockdev: use snprintf() rather than sprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:57:17 +02:00
Karel Zak 86d5de52d4 sys-utils/ipcutils: be careful when call calloc() for uint64 nmembs
Fix: https://github.com/karelzak/util-linux/issues/1395
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:57:17 +02:00
Karel Zak 9d761e8325 libfdisk: (dos) support partition and MBR overlap
Let's support this crazy use-case in expert menu, because it's normal
for removable FAT disks, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:57:17 +02:00
Karel Zak 6e8af4695e libfdisk: (dos) don't ignore MBR+FAT use-case
Since libblkid commit 751eca28fc it does
not ignore FAT on whole-disks, so now libfdisk sees collision between
FAT and MBR. It's fine to report the collision to users, but we should
not ignore the MBR.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-29 11:55:45 +02:00
Thomas Abraham b5a4d57a5c blockdev: allow for larger values for start sector
commit 9147d2ad8a ("blockdev: Don't fail on missing start sector") limits
the size of the start sector to 10 digits.

Multi-terrabyte devices can have partitions with a start sector larger than
10 digits, which will cause an sprintf() to abort due to overflowing the buffer.

It causes:
  # blockdev --report /dev/sda4
  RO    RA   SSZ   BSZ   StartSec            Size   Device
  *** buffer overflow detected ***: terminated
  Aborted (core dumped)
2021-07-29 11:55:45 +02:00
Christian Finnberg bb894a4493 Fix typo 2021-07-29 11:55:45 +02:00
Karel Zak bb954f7658 build-sys: release++ (v2.37.1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:59:15 +02:00
Karel Zak 7169c01223 docs: update v2.37.1-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:56:53 +02:00
Karel Zak 6bf2c99b2e docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:55:04 +02:00
Karel Zak debce7468d po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:52:06 +02:00
Мирослав Николић 2349d4c090 po: update sr.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Rafael Fontenelle e5694e94b5 po: update pt_BR.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Antonio Ceballos Roa 5ba2c4317c po: update es.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Karel Zak 4fcd20534f lslogins: fix memory leak [asan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:38 +02:00
Karel Zak d1a5e99e8a lslogins: ask for supplementary groups only once [asan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:38 +02:00
Karel Zak f626170062 lslogins: use sd_journal_get_data() in proper way
man sd_journal_get_data:
    The returned data is in a read-only memory map and is only valid until the next invocation
    of sd_journal_get_data().

It means that use data after 3x sd_journal_get_data() is really bad
idea. It also seems better to not assume the fields are zero
terminated as journal API works with void* and size_t to address the
data.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1984704
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:22 +02:00
Karel Zak a3d73c246f login: add callback for close_range()
Let's make it more robust for old kernels where is no close_range() or
in cases when it's unsuccessful.

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 650fca1a06 lslogins: consolidate and optimize utmp files use
* the original read_utmp() code is from GPLv3+, but lslogins is GPLv2+
  (see a6bf40ee77 (commitcomment-53407151))

* remove redundant parse_btmp() and parse_wtmp() as it does not
  provide anything

* reduce realloc() calls, allocate all in one step

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 22a2bce042 hardlink: remove pcre2posix.h support
It's deprecated for years. Let's rely on old good libc regex.h for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 937fe5d9c5 login: fix close_range() use
This new syscall comes with three arguments (see kernel commit
278a5fbaed89dacd04e9d052f4594ffd0e0585de). Not sure why util-linux
assume only two.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1981729
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 1bb08cfc01 tests: update sfdisk reorder test
References: commit f05a5bb2c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:05 +02:00
Karel Zak 4bea4821ab tests: skip if scsi_debug model file is not accessible
* do not print grep(1) info message

* use ts_skip rather than ts_die when scsi_debug is useless

Fixes: https://github.com/karelzak/util-linux/issues/1376
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:58:48 +02:00
Pali Rohár 18492b47b7 fdisk: move reorder diag messages to fdisk_reorder_partitions()
The function fdisk_reorder_partitions() is also used in sfdisk and cfdisk
and these commands assume info/warn messages from the library. So move all
messages from fdisk to fdisk_reorder_partitions().

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:58:13 +02:00
Luca Boccassi db4d80fcef verity: fix verity.roothashsig only working as last parameter
Parsing of verity.roothashsig did not take into consideration that other options
might follow, and used the whole string as a file path. But mnt_optstr_get_option
just returns a pointer in the mount option string, it doesn't extract it, so it
would have other subsequent options too. The length parameter has to be used.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-07-20 11:57:58 +02:00
Pali Rohár d501259161 fdisk: do not print error message when partition reordering is not needed
Option 'f' currently prints following RED error message:

    Nothing to do. Ordering is correct already.
    Failed to fix partitions order.

This change removes RED error message when ordering is already correct.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:57:13 +02:00
Pali Rohár ee3d6b0d4a libblkid: vfat: Fix reading FAT32 boot label
FAT32 can be formatted with boot sign 0x28 to indicate that only serial id
is present or with boot sign 0x29 which indicates that both boot label and
serial id is present.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:56:34 +02:00
Pali Rohár 9c3b9269d9 libblkid: vfat: Fix reading FAT16 boot label and serial id
Older FAT16 variants do not have to contain boot label or serial id. Boot
sign 0x28 indicates that only serial id is present and boot sign 0x29
indicates that both boot label and serial id is present. Other boot sign
values (e.g. zero) indicates older FAT16 variant without boot label and
boot sign.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:56:34 +02:00
Luca Boccassi 6a7194ea23 mount: fix roothash signature extension in manpage
The PKCS7 RFC recommends to use .p7s for detached signatures file extensions,
so use that in the example.

https://datatracker.ietf.org/doc/html/rfc5751#section-3.2.1
2021-07-20 11:55:32 +02:00
Luca Boccassi 71b98c36d4 meson: fix dlopen support for cryptsetup
dlopen is treated as a dependency, but that's not quite right, it
should be an alternative way to link to libcryptsetup.
Search for it only if cryptsetup is not disabled, and if the cryptsetup-dlopen
is explicitly set to enabled. If it is, do not link to libcryptsetup.

Add cryptsetup support status to the meson summary.
2021-07-20 11:55:21 +02:00