version 1.19, 2003/04/03 19:15:34 |
version 1.20, 2003/04/19 21:57:17 |
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* |
|
* Sponsored in part by the Defense Advanced Research Projects |
|
* Agency (DARPA) and Air Force Research Laboratory, Air Force |
|
* Materiel Command, USAF, under agreement number F39502-99-1-0512. |
|
* |
* For a brief history of sudo, please see the HISTORY file included |
* For a brief history of sudo, please see the HISTORY file included |
* with this distribution. |
* with this distribution. |
*/ |
*/ |
|
|
#include "version.h" |
#include "version.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: sudo.c,v 1.335 2003/04/02 18:25:19 millert Exp $"; |
static const char rcsid[] = "$Sudo: sudo.c,v 1.337 2003/04/16 00:42:10 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
extern int errorlineno; |
extern int errorlineno; |
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) |
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) |
static struct rlimit corelimit; |
static struct rlimit corelimit; |
#endif /* RLIMIT_CORE */ |
#endif /* RLIMIT_CORE && !SUDO_DEVEL */ |
#ifdef HAVE_LOGIN_CAP_H |
#ifdef HAVE_LOGIN_CAP_H |
login_cap_t *lc; |
login_cap_t *lc; |
#endif /* HAVE_LOGIN_CAP_H */ |
#endif /* HAVE_LOGIN_CAP_H */ |
|
|
/* Restore coredumpsize resource limit. */ |
/* Restore coredumpsize resource limit. */ |
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) |
#if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) |
(void) setrlimit(RLIMIT_CORE, &corelimit); |
(void) setrlimit(RLIMIT_CORE, &corelimit); |
#endif /* RLIMIT_CORE */ |
#endif /* RLIMIT_CORE && !SUDO_DEVEL */ |
|
|
/* Become specified user or root. */ |
/* Become specified user or root. */ |
set_perms(PERM_RUNAS); |
set_perms(PERM_RUNAS); |
|
|
* Turn off core dumps. |
* Turn off core dumps. |
*/ |
*/ |
(void) getrlimit(RLIMIT_CORE, &corelimit); |
(void) getrlimit(RLIMIT_CORE, &corelimit); |
rl.rlim_cur = rl.rlim_max = 0; |
memcpy(&rl, &corelimit, sizeof(struct rlimit)); |
|
rl.rlim_cur = 0; |
(void) setrlimit(RLIMIT_CORE, &rl); |
(void) setrlimit(RLIMIT_CORE, &rl); |
#endif /* RLIMIT_CORE */ |
#endif /* RLIMIT_CORE && !SUDO_DEVEL */ |
|
|
/* |
/* |
* Close any open fd's other than stdin, stdout and stderr. |
* Close any open fd's other than stdin, stdout and stderr. |