version 1.11, 2002/01/03 03:49:16 |
version 1.12, 2002/01/08 15:44:25 |
|
|
/* |
/* |
* Copyright (c) 1993-1996,1998-2001 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1993-1996,1998-2002 Todd C. Miller <Todd.Miller@courtesan.com> |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
#include "version.h" |
#include "version.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: sudo.c,v 1.311 2001/12/15 00:45:13 millert Exp $"; |
static const char rcsid[] = "$Sudo: sudo.c,v 1.313 2002/01/08 15:00:18 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
int cmnd_status; |
int cmnd_status; |
int sudo_mode; |
int sudo_mode; |
int pwflag; |
int pwflag; |
|
char **new_environ; |
sigaction_t sa; |
sigaction_t sa; |
extern int printmatches; |
extern int printmatches; |
extern char **environ; |
extern char **environ; |
|
|
log_error(NO_MAIL|MSG_ONLY, "no passwd entry for %s!", *user_runas); |
log_error(NO_MAIL|MSG_ONLY, "no passwd entry for %s!", *user_runas); |
} |
} |
|
|
/* Customize environment and get rid of any nasty bits. */ |
/* Build up custom environment that avoids any nasty bits. */ |
environ = rebuild_env(sudo_mode, envp); |
new_environ = rebuild_env(sudo_mode, envp); |
|
|
/* This goes after the sudoers parse since we honor sudoers options. */ |
/* This goes after the sudoers parse since we honor sudoers options. */ |
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) { |
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) { |
|
|
|
|
/* Become specified user or root. */ |
/* Become specified user or root. */ |
set_perms(PERM_RUNAS, sudo_mode); |
set_perms(PERM_RUNAS, sudo_mode); |
|
|
|
/* Install the new environment. */ |
|
environ = new_environ; |
|
|
#ifndef PROFILING |
#ifndef PROFILING |
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0) |
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0) |