| Age | Commit message (Collapse) | Author | Files | Lines |
|
This change simplifies future test work.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The functions are originally from systemd/udev, so it's possible that
during static linking, they may collide with other systemd-based
components.
Fixes: https://github.com/util-linux/util-linux/issues/3626
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Let's enhance portability and readability slightly.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Comparing effective and real uid/gid is not a proper way to check for
SUID execution:
1. this does not consider file capabilities
2. this check breaks when NO_NEW_PRIVS is used as the Linux kernel
resets effective ids during execve(); this means the check is
false, but the process still has raised capabilities
For more details about the NO_NEW_PRIVS problem, check this post and
the surrounding thread:
https://lore.kernel.org/lkml/20250509184105.840928-1-max.kellermann@ionos.com/
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
|
|
There is no error when the /proc/#/environ file does not contain any
NAME=value items.
Fixes: https://github.com/util-linux/util-linux/issues/3270
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* Add env_list_add_getenv() to import a single variable from the
environ[] array. The function may accept a default value if getenv()
does not return anything.
* Add env_list_add_getenvs() to import multiple variables from the
environ[] array.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
* rename env_from_fd() to env_list_from_fd()
* rename remove_entry() to ul_remove_entry()
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
The struct ul_env_list is currently only used to store the value of
env when sanitizing environ[]. It would be beneficial to also use the
functions related to ul_env_list for other purposes. In order to do
this, it is important to keep the NAME and VALUE components separate.
* Accept non-terminated name and value for env_list_add().
* Add env_list_add_from_string() to add item to the list from a
"name=value" string.
* Add env_list_add_variable() to add item to the list using separate
"name" and "value" strings.
* Update __sanitize_env() to use env_list_add_from_string().
* Modify the test to use "abc" as the value instead of copying the
variable name (with '=') to the value.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
|
read_all_alloc() returns a negative error on failure.
When casting this to an unsigned type the failure check "< 1"
will not work.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
This commit adds support for the -e or --env option in nsenter, allowing a new process to inherit the environment va
If the option is not given, the environment variables will stay the same as in the current namespace.
Example:
Setup the namespace:
$ docker run -d -e PROJECT='util linux' --rm alpine sleep 10000
cb0b69aa7aec
$ docker inspect --format '{{ .State.Pid }}' cb0b69aa7aec
470012
Enter the namespace:
$ nsenter --all -t 470012 --env env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=cb0b69aa7aec
PROJECT=util linux
HOME=/root
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: u2386 <hugo.cavan2386@gmail.com>
|
|
This allows users to override settings like BLKID_FILE, as is done in
the e2fsprogs test suite.
Bug: https://bugs.gentoo.org/839825
Fixes: 035507c84b53bceb143d0923e65916cbf90979c7
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
|
|
Fixes: https://github.com/karelzak/util-linux/issues/1434
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
A function to remove an command-line option argument, or environment
variable.
Requested-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/1003#discussion_r403988092
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
The RLD environment variables are related to runtime linker vulnerability in
TELNET on systems running Silicon Graphics IRIX. It is extremely unlikely
current util-linux would be compiled on such system.
Reference: http://www.cert.org/historical/advisories/CA-1995-14.cfm
Reference: http://signatures.juniper.net/documentation/signatures/TELNET%3AEXPLOIT%3ASGI-RLD.html
Refefence: http://www.polarhome.com/service/man/?qf=rld&tf=2&of=IRIX&sf=1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
In current glibc versions, internal __secure_getenv
no longer exists and was replaced by secure_getenv()
Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
|
|
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
|
|
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]
kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]
kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
Fix to `warning: undefined preprocessor identifier' messages.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|