Remove /sbin from paths if split-bin is false (#8324)
Follow-up for 157baa87e4
.
This commit is contained in:
parent
7df4b832d0
commit
671f0f8de0
|
@ -59,13 +59,16 @@ if get_option('split-usr') == 'auto'
|
||||||
else
|
else
|
||||||
split_usr = get_option('split-usr') == 'true'
|
split_usr = get_option('split-usr') == 'true'
|
||||||
endif
|
endif
|
||||||
conf.set10('HAVE_SPLIT_USR', split_usr)
|
conf.set10('HAVE_SPLIT_USR', split_usr,
|
||||||
|
description : '/usr/bin and /bin directories are separate')
|
||||||
|
|
||||||
if get_option('split-bin') == 'auto'
|
if get_option('split-bin') == 'auto'
|
||||||
split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
|
split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
|
||||||
else
|
else
|
||||||
split_bin = get_option('split-bin') == 'true'
|
split_bin = get_option('split-bin') == 'true'
|
||||||
endif
|
endif
|
||||||
|
conf.set10('HAVE_SPLIT_BIN', split_bin,
|
||||||
|
description : 'bin and sbin directories are separate')
|
||||||
|
|
||||||
rootprefixdir = get_option('rootprefix')
|
rootprefixdir = get_option('rootprefix')
|
||||||
# Unusual rootprefixdir values are used by some distros
|
# Unusual rootprefixdir values are used by some distros
|
||||||
|
|
|
@ -28,8 +28,14 @@
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "time-util.h"
|
#include "time-util.h"
|
||||||
|
|
||||||
#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
|
#if HAVE_SPLIT_BIN
|
||||||
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
|
# define PATH_SBIN_BIN(x) x "sbin:" x "bin"
|
||||||
|
#else
|
||||||
|
# define PATH_SBIN_BIN(x) x "bin"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
|
||||||
|
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
|
||||||
|
|
||||||
#if HAVE_SPLIT_USR
|
#if HAVE_SPLIT_USR
|
||||||
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
|
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
|
||||||
|
|
|
@ -152,7 +152,9 @@ static const MountEntry protect_system_yes_table[] = {
|
||||||
{ "/lib", READONLY, true },
|
{ "/lib", READONLY, true },
|
||||||
{ "/lib64", READONLY, true },
|
{ "/lib64", READONLY, true },
|
||||||
{ "/bin", READONLY, true },
|
{ "/bin", READONLY, true },
|
||||||
|
# if HAVE_SPLIT_BIN
|
||||||
{ "/sbin", READONLY, true },
|
{ "/sbin", READONLY, true },
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,7 +168,9 @@ static const MountEntry protect_system_full_table[] = {
|
||||||
{ "/lib", READONLY, true },
|
{ "/lib", READONLY, true },
|
||||||
{ "/lib64", READONLY, true },
|
{ "/lib64", READONLY, true },
|
||||||
{ "/bin", READONLY, true },
|
{ "/bin", READONLY, true },
|
||||||
|
# if HAVE_SPLIT_BIN
|
||||||
{ "/sbin", READONLY, true },
|
{ "/sbin", READONLY, true },
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -478,6 +478,12 @@ static int search_from_environment(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_SPLIT_BIN
|
||||||
|
# define ARRAY_SBIN_BIN(x) x "sbin", x "bin"
|
||||||
|
#else
|
||||||
|
# define ARRAY_SBIN_BIN(x) x "bin"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int get_search(uint64_t type, char ***list) {
|
static int get_search(uint64_t type, char ***list) {
|
||||||
|
|
||||||
assert(list);
|
assert(list);
|
||||||
|
@ -490,13 +496,10 @@ static int get_search(uint64_t type, char ***list) {
|
||||||
".local/bin",
|
".local/bin",
|
||||||
"PATH",
|
"PATH",
|
||||||
true,
|
true,
|
||||||
"/usr/local/sbin",
|
ARRAY_SBIN_BIN("/usr/local/"),
|
||||||
"/usr/local/bin",
|
ARRAY_SBIN_BIN("/usr/"),
|
||||||
"/usr/sbin",
|
|
||||||
"/usr/bin",
|
|
||||||
#if HAVE_SPLIT_USR
|
#if HAVE_SPLIT_USR
|
||||||
"/sbin",
|
ARRAY_SBIN_BIN("/"),
|
||||||
"/bin",
|
|
||||||
#endif
|
#endif
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue