Commit Graph

289 Commits

Author SHA1 Message Date
Todd C. Miller
838ec0a2ca Add erealloc3(), a realloc() version of emalloc2(). 2003-03-12 21:51:39 +00:00
Todd C. Miller
8b4248529e Add emalloc2() -- like calloc() but w/o the bzero and with error/oflow
checking.
2003-03-12 21:41:22 +00:00
Todd C. Miller
b152da4cdb Revamp set_perms. We now use a version based on setresuid() or setreuid()
when possible since that allows us to support the stay_setuid option and
we always know exactly what the semantics will be (various Linux kernels
have broken POSIX saved uid support).
2002-11-22 19:09:49 +00:00
Todd C. Miller
0f60107a1c No need for dump_badenv() now that dump_defaults() knows how to dump lists. 2002-05-05 19:58:29 +00:00
Todd C. Miller
c289159953 g/c second arg to set_perms--it is no longer used 2002-05-05 00:43:38 +00:00
Todd C. Miller
a30951d34c Add support for non-root timestamp dirs. This allows the timestamp
dir to be shared via NFS (though this is not recommended).
2002-05-03 22:48:17 +00:00
Todd C. Miller
fec1b63caa Bring back PERM_FULL_USER 2002-01-16 21:27:09 +00:00
Todd C. Miller
26f2a96558 Remove PERM_FULL_USER (which is no longer used) and add PERM_FULL_ROOT
(used when exec'ing the mailer).
2002-01-13 18:28:09 +00:00
Todd C. Miller
a55e6898e1 o Add pam_prep_user function to call pam_setcred() for the target user;
on Linux this often sets resource limits.
2001-12-31 17:18:05 +00:00
Todd C. Miller
761b119e2e Add new sudoers option "preserve_groups". Previously sudo would not
call initgroups() if the target user was root.  Now it always calls
initgroups() unless the -P command line option or the "preserve_groups"
sudoers option is set.  Idea from TJ Saunders.
2001-12-15 00:24:27 +00:00
Todd C. Miller
47dff37185 o Update copyright year 2001-12-14 19:54:56 +00:00
Todd C. Miller
e63182a25b Prototype init_envtables() 2001-12-11 23:03:24 +00:00
Todd C. Miller
63ae9ec2ad Dump default bad env table when 'sudo -V' is run by root. 2001-11-12 18:08:30 +00:00
Todd C. Miller
572b4cf39a Don't try and build saved uid version of set_perms on systems w/o them.
Rename set_perms_saved_uid() -> set_perms_posix()
Make set_perms_setreuid simply be set_perms_fallback() and simply include
  the appropriate function at compile time (setreuid() vs. setuid()).
2000-12-30 03:59:40 +00:00
Todd C. Miller
998631b73a New Defaults options:
o stay_setuid - sudo will remain setuid if system has saved uids or setreuid(2)
 o env_reset - reset the environment to a sane default
 o env_keep - preserve environment variables that would otherwise be cleared

No longer use getenv/putenv/setenv functions--do environment munging by hand.
Potentially dangerous environment variables can be cleared only if they
contain '/' pr '%' characters to protect buggy programs.
Moved environment routines into env.c (new file)
2000-12-30 03:29:47 +00:00
Todd C. Miller
9745a31948 sudo_setenv() now exits on memory alloc failure instead of returning -1. 2000-09-14 20:48:58 +00:00
Todd C. Miller
fc15c3dbd1 Update proto for evasprintf and easprintf 2000-05-10 05:11:36 +00:00
Todd C. Miller
165bd7fafb Fix root, runas, and target authentication for non-passwd file auth
methods.
2000-05-09 15:42:38 +00:00
Todd C. Miller
935a51e76a FreeBSD login class (login.conf) support. 2000-03-07 04:29:46 +00:00
Todd C. Miller
54fbe08545 Added -S flag (read passwd from stdin) and tgetpass_flags global
that holds flags to be passed in to tgetpass().  Change echo_off
param to tgetpass() into a flags field.  There are currently 2
possible flags for tgetpass(): TGP_ECHO and TGP_STDIN.  In tgetpass(),
abstract the echo set/clear via macros and if (flags & TGP_ECHO)
but echo is not set on the terminal, but sure to set it.
2000-02-27 03:49:07 +00:00
Todd C. Miller
09b23e7b41 Add rootpw, runaspw, and targetpw options. 2000-02-18 17:56:28 +00:00
Todd C. Miller
fc08d7004c Move user_is_exempt prototype into sudo.h 2000-02-15 23:36:04 +00:00
Todd C. Miller
9e0bae9fc6 update copyright year on changed files 2000-01-17 23:46:26 +00:00
Todd C. Miller
ccb808da31 Add 'shell_noargs' runtime option back in. We have to defer checking
until after the sudoers file has been parsed but since there are now
other options that operate that way this one can too.  Based on a patch
from bguillory@email.com.
2000-01-17 17:25:10 +00:00
Todd C. Miller
f68cc2f628 Add "listpw" and "verifypw" options. 2000-01-17 04:05:18 +00:00
Todd C. Miller
625e3e46d0 Make treatment of -l and -v sane wrt NOPASSWD flags. Now allow -l w/o a passwd
if there is *any* entry for the user on the host with a NOPASSWD flag.
For -v, only allow w/o a passwd if *all* entries for the user on the host
w/ the specified runas user have the NOPASSWD flag set.
2000-01-03 04:43:33 +00:00
Todd C. Miller
449f67f776 o Kill shell_noargs option, it cannot work since the command needs to
be set before sudoers is parsed.
o Fix the "set_home" sudoers option (only worked at compile time).
o Fix "fqdn" sudoers option.  We now set host/shost via set_fqdn which
  gets called when the "fqdn" option is set in sudoers.
o Move the openlog() to store_syslogfac() so this gets overridden
  correctly from the sudoers file.
1999-12-02 20:31:25 +00:00
Todd C. Miller
13bf42675d Add support for "Defaults" line in sudoers to make configuration variables
changable at runtime (and on a global, per-host and per-user basis).
Both the names and the internal representation are still subject to change.
It was necessary to make sudo_user.runas but a char ** instead of a
char * since this value can be changed by a Defaults line.  There is a
similar (but more complicated) issue with sudo_user.prompt but it
is handled differently at the moment.

Add a "-L" flag to list the name of options with their descriptions.  This
may only be temporary.

Move some prototypes to parse.h

Be much less restrictive on what is allowed for a username.
1999-09-08 08:06:28 +00:00
Todd C. Miller
607e54b5e6 add strcasecmp proto 1999-08-28 09:59:18 +00:00
Todd C. Miller
a2b3e36e73 add FLAG_NO_CHECK 1999-08-26 09:06:41 +00:00
Todd C. Miller
0598093e2c sudoers_lookup() now returns a bitmap instead of an int. This makes it
possible to express things like "failed to validate because user not listed
for this host".  Some thigns that were previously VALIDATE_FOO are now
FLAG_FOO.  This may change later on.

Reorganized code in log_auth() and sudo.c to deal with above changes.

Safer versions of push/pushcp with in the do { ... } while (0) style

parse.yacc now saves info on the stack to allow parse.c to determine
if a user was listed, but not for the host he/she tried to run on.

Added --with-mail-if-no-host option
1999-08-19 16:30:09 +00:00
Todd C. Miller
804e168d90 o NewArgv and NewArgc don't need to be externally visible.
o If pedantic > 1, it is a parse error.
o Add -s (strict) option to visudo which sets pedantic to 2.
1999-08-17 15:29:47 +00:00
Todd C. Miller
d7ebfe06d1 o Digital UNIX needs to check for *snprintf() before -ldb is added to LIBS
since -ldb includes a bogus snprintf().
o Add forward refs for struct mbuf and struct rtentry for Digital UNIX.
o Reorder some functions in snprintf.c to fix -Wall
o Add missing includes to fix more -Wall
1999-08-12 16:24:10 +00:00
Todd C. Miller
76148d5316 o Move lock_file() and touch() into fileops.c so visudo can use them
o Visudo now locks the sudoers temp file instead of bailing when
the temp file already exists.  This fixes the problem of stale
temp files but it does *require* that you not try to put the
temp file in a world-writable directory.  This shoud not be
an issue as the temp file should live in the same dir as sudoers.
o Visudo now only installs the temp file as sudoers if it changed.
1999-08-07 09:59:43 +00:00
Todd C. Miller
27d6f353e2 o new defines for syslog facility and priority
o use new print_version() functino for -V mode
1999-08-05 10:51:02 +00:00
Todd C. Miller
6b3909c780 rename validate() to the more descriptive sudoers_lookup() 1999-08-01 15:42:12 +00:00
Todd C. Miller
0d732401f4 add 4th term to license similar to term 5 in the apache license 1999-07-31 16:19:50 +00:00
Todd C. Miller
794f537eef there was a 1995 release too 1999-07-31 16:02:13 +00:00
Todd C. Miller
fd410d4bcb add easprintf() and evasprintf(), error checking versions of asprintf() and vasprintf() 1999-07-22 16:22:47 +00:00
Todd C. Miller
95179ddffe o BSD copyright
o logging and parser bits moved to their own .h files
o new "struct sudo_user" to encapsulate many of the old globals.
1999-07-22 12:56:28 +00:00
Todd C. Miller
69a00325ec New (correct) PAM code
Tgetpass now takes an echo flag for use with PAM_PROMPT_ECHO_ON
Block SIGINT and SIGTSTP during auth
remove a useless umask setting
Change error from BAD_ALLOCATION -> BAD_AUTH_INIT (for use with sia/PAM)
Some cosmetic changes to auth.c for consistency
1999-07-05 20:14:21 +00:00
Todd C. Miller
406056d7e5 move authentication code to auth.c 1999-06-03 15:51:07 +00:00
Todd C. Miller
80287c981c Move interface-related defines to interfaces.h so we don't have to include
<netinet/in.h> everywhere.
1999-05-17 01:36:30 +00:00
Todd C. Miller
8e8fbc251e catch case where cmnd_safe is not set (this should not be possible) 1999-04-10 04:37:35 +00:00
Todd C. Miller
59b0cff8cf Stash the "safe" path (ie: the one listed in sudoers) to the command instead
of stashing the struct stat.  Should be safer.
1999-04-10 04:10:01 +00:00
Todd C. Miller
0d67007d1b In estrdup(), do the malloc ourselves so we don't need to rely on the
system strdup(3) which may or may not exist.  There is now no need to
provide strdup() for those w/o it.  Also, the prototype for estrdup()
was wrong, it returns char * and its param is const.
1999-04-06 17:55:01 +00:00
Todd C. Miller
d53f3818ad Kill GLOBAL_NO_SPW_ENT (not used) and crank GLOBAL_PROBLEM 1999-04-06 05:38:59 +00:00
Todd C. Miller
1818ace053 Definitions of *_matched were wrong--user top, not top-2 as subscript. 1999-04-06 05:08:40 +00:00
Todd C. Miller
499e869237 Add VALIDATE_NOT_OK_NOPASS for when user is not allowed to run a command
but the NOPASSWD flag was set.
Make runasspec, runaslist, runasuser, and nopasswd typeless in parse.yacc
Add support for '!' in the runas list
Fix double printing of '%' and '+' for groups and netgroups respectively
Add *_matched macros (no need for local stack variable).  Should only be
used directly after a pop (since top must be >= 2).
1999-04-06 05:00:29 +00:00
Todd C. Miller
e6deacb6c4 Crank version to 1.6 and combine copyright statements 1999-04-05 20:57:25 +00:00