Commit Graph

230 Commits

Author SHA1 Message Date
Todd C. Miller
3b8b88407f Add __unused to rcsids 2005-01-27 15:42:30 +00:00
Todd C. Miller
2c2daa8eca Use: #include <config.h>
Not: #include "config.h"
That way we get the correct config.h when build dir != src dir
2004-11-19 18:39:14 +00:00
Todd C. Miller
9846e562ad Implement group caching and use the passwd and group caches throughout. 2004-11-16 04:24:11 +00:00
Todd C. Miller
51375f969f Add local error/warning functions like err/warn but that call an additional
cleanup routine in the error case.  This means we no longer need to compile
a special version of alloc.o for visudo.
2004-11-15 15:53:53 +00:00
Todd C. Miller
0f056c0d5f Use timespec throughout. 2004-09-08 15:48:23 +00:00
Todd C. Miller
7f772c822f Add an extra param to touch() for nsec 2004-09-07 19:55:37 +00:00
Todd C. Miller
1c20ff1a6d Use utimes() and futimes() instead of utime() in touch(), emulating as needed.
Not all systems are able to support setting the times of an fd so touch()
takes both an fd and a file name as arguments.
2004-09-07 17:14:52 +00:00
Todd C. Miller
31f98d84df Don't ask for a password if invoking user == target user. 2004-06-10 20:19:38 +00:00
Todd C. Miller
ba803b6e1b Remove trailing spaces, no actual code changes. 2004-06-06 23:58:09 +00:00
Todd C. Miller
d33ad95208 Use PATH_MAX, not MAXPATHLEN since the former is standardized. 2004-06-01 01:22:27 +00:00
Todd C. Miller
51c9ed3198 Preliminary changes to support nsr-tandem-nsk. Based on patches from
Tom Bates.
2004-05-17 20:08:46 +00:00
Todd C. Miller
5b217d36a3 More to a less restrictive, ISC-style license. 2004-02-13 21:36:43 +00:00
Todd C. Miller
e404f54c23 Add Stan Lee / Uncle Ben quote to the lecture from RedHat 2004-01-16 23:16:24 +00:00
Todd C. Miller
9eba370a09 Update copyright year 2004-01-05 01:13:50 +00:00
Todd C. Miller
b289f73870 Add a new option, lecture_file, that can be used to point to a custom
sudo lecture.
2004-01-05 01:12:22 +00:00
Todd C. Miller
02f37dc2da Add support for tuples in def_data.in; these are implemented as an
enum type.  Currently there is only a single tuple enum but in the
future we may have one tuple enum per T_TUPLE entry in def_data.in.
Currently listpw, verifypw and lecture are tuples.  This avoids the
need to have two entries (one ival, one str) for pwflags and syslog
values.

lecture is now a tuple with the following values: never, once, always

We no longer use both an int and string entry for syslog facilities
and priorities.  Instead, there are logfac2str() and logpri2str()
functions that get used when we need to print the string values.
2003-12-30 22:31:30 +00:00
Todd C. Miller
6ad252765b Create def_* macros for each defaults value so we no longer need
the def_{flag,ival,str,list,mode} macros (which have been removed).
This is a step toward more flexible data types in def_data.in.
2003-12-30 22:20:21 +00:00
Todd C. Miller
6c51ebd37a add DARPA credit on affected files 2003-04-16 00:42:09 +00:00
Todd C. Miller
dcf1a5acce Use warn/err and getprogname() throughout. The main exception is
openlog().  Since the admin may be filtering logs based on the
program name in the log files, hard code this to "sudo".
2003-04-02 18:25:30 +00:00
Todd C. Miller
f761cef5c8 oflow detection in expand_prompt() was faulty (false positives).
The count was based on strlcat() return value which includes the
length of the entire string.
2003-04-01 14:58:55 +00:00
Todd C. Miller
48229cbac6 update copyright year 2003-03-15 20:31:02 +00:00
Todd C. Miller
b18a141ae9 Cast [ug]ids to unsigned long and printf with %lu 2003-03-15 20:19:58 +00:00
Todd C. Miller
eebc763bd3 Use strlc{at,py} for paranoia's sake and exit on overflow. In all
cases the strings were either pre-allocated to the correct size of
length checks were done before the copy but a little paranoia can
go a long way.
2003-03-13 20:00:45 +00:00
Todd C. Miller
0b0f8d6d32 Add %U and %H escapes and redo prompt rewriting. "%%" now gets collapsed
to "%" as was originally intended.  This also gets rid of lastchar (does
lookahead instead of lookback) which should simplify the logic slightly.
2002-12-14 19:15:30 +00:00
Todd C. Miller
982218c343 Don't call set_perms() when doing timestamp stuff unless timestamp_uid != 0. 2002-05-05 00:45:51 +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
db63aefb21 The the loop used to expand %h and %u, the lastchar variable was not being
initialized.  This means that if the last char in the prompt is '%' and the
first char is 'h' or 'u' a extra copy of the host or user name would be
copied, for which space had not been allocated.
2002-04-25 15:30:12 +00:00
Todd C. Miller
46dd419cd9 o Reorder some headers and use STDC_HEADERS define properly
o Update copyright year
2001-12-14 19:52:47 +00:00
Todd C. Miller
dea43637e8 fix I_TS_TIMEOUT vs. I_TIMESTAMP_TIMEOUT pasto in previous commit 2001-11-02 20:59:22 +00:00
Todd C. Miller
3550d52a90 Add new T_UINT type that most things use instead of T_INT
If timestamp_timeout is < 0 then treat the ticket as never expiring
(to be expired manually by the user).
2001-11-02 20:56:20 +00:00
Todd C. Miller
4f69069533 Use stashed user_gid when checking against exempt gid since sudo
sets its gid to a a value that makes sudoers readable.  Previously
if you used gid 0 as the exempt group everyone would be exempt.
From Paul Kranenburg <pk@cs.few.eur.nl>
2001-03-30 13:54:27 +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
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
192b2ae6c3 If the targetpw flag is set, use target username as part of the timestamp path.
If tty tickets are in effect cat the tty and the target username with a
':' as the separator.
2000-05-10 04:56:28 +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
fc08d7004c Move user_is_exempt prototype into sudo.h 2000-02-15 23:36:04 +00:00
Todd C. Miller
12f5216097 Don't kill the user's tickets until after sudoers has been parsed
since tty_tickets and ticket_dir could be set in sudoers.
1999-12-05 02:54:20 +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
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
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
2386dc1b45 o Add a "pedentic" flag to the parser. This makes sudo warn in cases
where an alias may be used before it is defined.  Only turned on for visudo
and testsudoers.
o Add --disable-authentication option that makes sudo not require
authentication by default.  The PASSWD tag can be used to require
authentication for an entry.  We no longer overload --without-passwd.
1999-08-12 14:37:27 +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
7c53b74961 o Kill *_MESSAGE and replace with NO_LECTURE
o Add more things to root sudo -V config reporting
1999-08-05 21:38:19 +00:00
Todd C. Miller
9283524123 Don't need version.c 1999-08-05 10:49:24 +00:00
Todd C. Miller
ca8eb6f2aa add 4th term to license similar to term 5 in the apache license 1999-07-31 16:19:45 +00:00
Todd C. Miller
794f537eef there was a 1995 release too 1999-07-31 16:02:13 +00:00
Todd C. Miller
0804f1786b Use dirs instead of files for timestamp. This allows tty and non-tty
schemes to coexist reasonably.  Note, however, that when you update
a tty ticket, the mtime on the user dir gets updated as well.
1999-07-28 09:21:00 +00:00
Todd C. Miller
ccc7369371 Rewrote all the old sudo 1.1/1.2 code. Timestamp handling is now
done more reasonably--better sanity checks and tty-based stamps are
now done as files in a directory with the same name as the invoking
user, eg. /var/run/sudo/millert/ttyp1.  It is not currently possible
to mix tty and non-tty based ticket schemes but this may change in
the future (it requires sudo to use a directory instead of a file
in the non-tty case).  Also, ``sudo -k'' now sets the ticket back
to the epoch and ``sudo -K'' really deletes the file.  That way you
don't get the lecture again just because you killed your ticket in
.logout.  BSD-style copyright now.
1999-07-22 12:19:11 +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