mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 14:55:12 +00:00
Stash coredumpsize resource limit and retsore it before the exec()
Otherwise the child ends up with a coredumpsize of 0.
This commit is contained in:
17
sudo.c
17
sudo.c
@@ -121,11 +121,14 @@ int NewArgc = 0;
|
|||||||
char **NewArgv = NULL;
|
char **NewArgv = NULL;
|
||||||
struct sudo_user sudo_user;
|
struct sudo_user sudo_user;
|
||||||
FILE *sudoers_fp = NULL;
|
FILE *sudoers_fp = NULL;
|
||||||
static char *runas_homedir = NULL; /* XXX */
|
|
||||||
struct interface *interfaces;
|
struct interface *interfaces;
|
||||||
int num_interfaces;
|
int num_interfaces;
|
||||||
int tgetpass_flags;
|
int tgetpass_flags;
|
||||||
extern int errorlineno;
|
extern int errorlineno;
|
||||||
|
static char *runas_homedir = NULL; /* XXX */
|
||||||
|
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL)
|
||||||
|
static struct rlimit corelimit;
|
||||||
|
#endif /* RLIMIT_CORE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Table of "bad" envariables to remove and len for strncmp()
|
* Table of "bad" envariables to remove and len for strncmp()
|
||||||
@@ -332,9 +335,6 @@ main(argc, argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Become specified user or root. */
|
|
||||||
set_perms(PERM_RUNAS, sudo_mode);
|
|
||||||
|
|
||||||
/* Set $HOME for `sudo -H' */
|
/* Set $HOME for `sudo -H' */
|
||||||
if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
|
if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
|
||||||
(void) sudo_setenv("HOME", runas_homedir);
|
(void) sudo_setenv("HOME", runas_homedir);
|
||||||
@@ -369,6 +369,14 @@ main(argc, argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Restore coredumpsize resource limit. */
|
||||||
|
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL)
|
||||||
|
(void) setrlimit(RLIMIT_CORE, &corelimit);
|
||||||
|
#endif /* RLIMIT_CORE */
|
||||||
|
|
||||||
|
/* Become specified user or root. */
|
||||||
|
set_perms(PERM_RUNAS, sudo_mode);
|
||||||
|
|
||||||
#ifndef PROFILING
|
#ifndef PROFILING
|
||||||
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0)
|
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0)
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -1009,6 +1017,7 @@ initial_setup()
|
|||||||
/*
|
/*
|
||||||
* Turn off core dumps.
|
* Turn off core dumps.
|
||||||
*/
|
*/
|
||||||
|
(void) getrlimit(RLIMIT_CORE, &corelimit);
|
||||||
rl.rlim_cur = rl.rlim_max = 0;
|
rl.rlim_cur = rl.rlim_max = 0;
|
||||||
(void) setrlimit(RLIMIT_CORE, &rl);
|
(void) setrlimit(RLIMIT_CORE, &rl);
|
||||||
#endif /* RLIMIT_CORE */
|
#endif /* RLIMIT_CORE */
|
||||||
|
Reference in New Issue
Block a user