From 1bcddb9602eeac0ff5543c5e85da5401cd94e24d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 21 Feb 2023 14:46:27 -0700 Subject: [PATCH] Stub out pivot_root() and unpivot_root() for all but the sudoers module. --- plugins/sudoers/Makefile.in | 17 +++++++++-------- plugins/sudoers/regress/fuzz/fuzz_stubs.c | 12 ++++++++++++ plugins/sudoers/stubs.c | 14 ++++++++++++++ plugins/sudoers/testsudoers.c | 12 ++++++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index ca65b2618..17a90ea5f 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -176,19 +176,20 @@ AUTH_OBJS = sudo_auth.lo @AUTH_OBJS@ LIBPARSESUDOERS_OBJS = alias.lo b64_decode.lo canon_path.lo defaults.lo \ digestname.lo exptilde.lo filedigest.lo gentime.lo \ gram.lo match.lo match_addr.lo match_command.lo \ - match_digest.lo pivot.lo pwutil.lo pwutil_impl.lo \ + match_digest.lo pwutil.lo pwutil_impl.lo \ redblack.lo strlist.lo sudoers_debug.lo timeout.lo \ timestr.lo toke.lo toke_util.lo LIBPARSESUDOERS_IOBJS = $(LIBPARSESUDOERS_OBJS:.lo=.i) passwd.i -SUDOERS_OBJS = $(AUTH_OBJS) audit.lo boottime.lo check.lo editor.lo env.lo \ - sudoers_hooks.lo env_pattern.lo file.lo find_path.lo \ - fmtsudoers.lo gc.lo goodpath.lo group_plugin.lo interfaces.lo \ - iolog.lo iolog_path_escapes.lo locale.lo log_client.lo \ - logging.lo parse.lo policy.lo prompt.lo serialize_list.lo \ - set_perms.lo starttime.lo strlcpy_unesc.lo strvec_join.lo \ - sudo_nss.lo sudoers.lo timestamp.lo unesc_str.lo @SUDOERS_OBJS@ +SUDOERS_OBJS = $(AUTH_OBJS) audit.lo boottime.lo check.lo editor.lo \ + env.lo sudoers_hooks.lo env_pattern.lo file.lo \ + find_path.lo fmtsudoers.lo gc.lo goodpath.lo group_plugin.lo \ + interfaces.lo iolog.lo iolog_path_escapes.lo locale.lo \ + log_client.lo logging.lo parse.lo pivot.lo policy.lo \ + prompt.lo serialize_list.lo set_perms.lo starttime.lo \ + strlcpy_unesc.lo strvec_join.lo sudo_nss.lo sudoers.lo \ + timestamp.lo unesc_str.lo @SUDOERS_OBJS@ SUDOERS_IOBJS = $(SUDOERS_OBJS:.lo=.i) diff --git a/plugins/sudoers/regress/fuzz/fuzz_stubs.c b/plugins/sudoers/regress/fuzz/fuzz_stubs.c index 27b26c095..04f8b712a 100644 --- a/plugins/sudoers/regress/fuzz/fuzz_stubs.c +++ b/plugins/sudoers/regress/fuzz/fuzz_stubs.c @@ -56,6 +56,18 @@ init_eventlog_config(void) return; } +bool +pivot_root(const char *new_root, int fds[2]) +{ + return true; +} + +bool +unpivot_root(int fds[2]) +{ + return true; +} + int group_plugin_query(const char *user, const char *group, const struct passwd *pw) { diff --git a/plugins/sudoers/stubs.c b/plugins/sudoers/stubs.c index 9aae59d41..dff32c038 100644 --- a/plugins/sudoers/stubs.c +++ b/plugins/sudoers/stubs.c @@ -96,6 +96,20 @@ init_eventlog_config(void) return; } +/* STUB */ +bool +pivot_root(const char *new_root, int fds[2]) +{ + return true; +} + +/* STUB */ +bool +unpivot_root(int fds[2]) +{ + return true; +} + /* * Look up the hostname and set user_host and user_shost. */ diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index ecc80820f..b74745500 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -506,6 +506,18 @@ init_eventlog_config(void) return; } +bool +pivot_root(const char *new_root, int fds[2]) +{ + return true; +} + +bool +unpivot_root(int fds[2]) +{ + return true; +} + int set_cmnd_path(const char *runchroot) {