Commit Graph

147 Commits

Author SHA1 Message Date
Todd C. Miller
b31b73f071 In log_error() free message, not logline unconditionally, then
free logline if it is not the same as message.  No function change
but this mirrors how they are allocated.
2001-08-23 21:42:31 +00:00
Todd C. Miller
11127e3468 Use setpwent()/endpwent() + all the shadow variants to make sure
we don't inadvertantly leak an fd to the child.  Apparently Linux's
shadow routines leave the fd open even if you don't call setspent().
Reported by mike@gistnet.com; different patch used.
2001-05-10 18:55:12 +00:00
Todd C. Miller
9dd02e2fb9 Fix a non-exploitable buffer overflow in the word splitting code. This
should really be rewritten.
2001-04-13 01:41:57 +00:00
Todd C. Miller
d956d77528 Move defaults info into its own files from which we generate
.h and .c files.  This makes adding or rearranging variables
much simpler.
2000-12-31 01:38:37 +00:00
Todd C. Miller
2ad0d64a1a Fix errant ';' (typo) that broken MSG_ONLY 2000-10-27 22:35:42 +00:00
Todd C. Miller
2ff3a2315e Don't use vsyslog(3) since HP-UX (and others?) lack it. This means
that "%m" won't be expanded but we don't use that anyway since the
logging routines may splat to stderr as well.
2000-09-07 14:43:26 +00:00
Todd C. Miller
455f27816f Bracket calls to syslog with an openlog() and closelog() since some
authentication methods (like PAM) may do their own logging via
syslog.  Since we don't use syslog much (usually just once per
session) this doesn't really incur a performance penalty.
It also Fixes a SEGV with pam_kafs.
2000-04-17 18:01:14 +00:00
Todd C. Miller
a6ad7f071c Get rid of grandchild hack, it was causing problems and there is really
no need for it.  This fixes a bug where we spin eating up CPU when the
user runs a long-running process like a shell.
2000-03-13 16:05:05 +00:00
Todd C. Miller
deab20a57f mail_if_foo -> mail_foo 1999-10-09 05:01:48 +00:00
Todd C. Miller
1296f28845 The exit() in log_error() was mistakenly removed in a previous version.
Put it back...
1999-10-08 01:12:02 +00:00
Todd C. Miller
7769bf6a32 o Change defaults stuff to put the value right in the struct.
o Implement mailer_flags
o Store syslog stuff both in int and string form.  Setting the string
  form magically updates the int version.
o Add boolean attribute to strings where it makes sense to say !foo
1999-10-07 21:21:08 +00:00
Todd C. Miller
f7e23611be Use strftime() instead of ctime() if it is available. 1999-09-15 09:15:33 +00:00
Todd C. Miller
80ac47fb07 add log_year option 1999-09-14 16:56:32 +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
a2b3e36e73 add FLAG_NO_CHECK 1999-08-26 09:06:41 +00:00
Todd C. Miller
275c2fc980 Run most of the code as root, not the invoking user. It doesn't really
gain us anything to run as the user since an attacker can just have
an setuid(0) in their egg.  Running as root solves potential problems
wrt signalling.
1999-08-20 20:37:16 +00:00
Todd C. Miller
b9746389ce Don't wait for child to finish in log_error(), let the signal handler
get it if we are still running, else let init reap it for us.  The extra
time it takes to wait lets the user know that mail is being sent.

Install SIGCHLD handler in main() and for POSIX signals, block everything
*except* SIGCHLD.
1999-08-19 17:45:36 +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
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
68a2b16781 add fcntl locking 1999-08-06 13:49:26 +00:00
Todd C. Miller
925f4eabc2 Lock the log file. 1999-08-06 13:33:03 +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
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
8d72a57eb9 use easprintf() and evasprintf() 1999-07-22 16:23:13 +00:00
Todd C. Miller
7e369e5195 o rewritten logging routines. log_error() now takes printf-style varargs
and log_auth() for the return value of validate().
o BSD-style copyright
1999-07-22 12:13:50 +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
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
850a52aa6f o Replace _PASSWD_LEN braindeath with our own SUDO_MAX_PASS.
It turns out the old DES crypt does the right thing with passwords
   longert than 8 characters.
 o Fix common typo (necesary -> necessary)
 o Update TODO list
1999-05-14 16:30:14 +00:00
Todd C. Miller
06e586ee7b Function names should be flush with the start of the line so they can be found trivially in an editor and with grep 1999-04-10 04:49:03 +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
d53f3818ad Kill GLOBAL_NO_SPW_ENT (not used) and crank GLOBAL_PROBLEM 1999-04-06 05:38:59 +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
Todd C. Miller
79c46d1c81 ++version 1999-03-29 04:05:15 +00:00
Todd C. Miller
382ef75493 Use emalloc/erealloc/estrdup 1999-03-29 02:59:34 +00:00
Todd C. Miller
52916f16ac add explicate copyright 1999-02-03 04:32:19 +00:00
Todd C. Miller
826fe213f2 add sudo tags 1999-01-17 23:16:20 +00:00
Todd C. Miller
d3aaf52283 crank version and regen files 1999-01-17 22:40:55 +00:00
Todd C. Miller
3983a7a651 kerb5 support from fcusack@iconnet.net 1999-01-17 22:08:55 +00:00
Todd C. Miller
62dba8f4d1 more -Wall 1998-11-18 04:16:13 +00:00
Todd C. Miller
c253188f55 -Wall 1998-11-18 03:51:10 +00:00
Todd C. Miller
5731e248b5 kill perror("malloc") since we already have a good error messages 1998-11-04 01:39:25 +00:00
Todd C. Miller
1dffdd17c3 add SIA support 1998-10-19 00:22:38 +00:00
Todd C. Miller
5bfb481ca7 no more options.h 1998-10-15 05:41:26 +00:00
Todd C. Miller
d680945141 sys/errno -> errno 1998-10-15 03:15:19 +00:00
Todd C. Miller
4c0e6f8828 time.h, not sys/time.h 1998-09-24 15:36:24 +00:00
Todd C. Miller
8450ad0802 MAILER -> _PATH_SENDMAIL 1998-09-21 23:52:41 +00:00
Todd C. Miller
0ef9f25d7e updated version 1998-09-17 16:27:15 +00:00