Todd C. Miller [Wed, 8 Sep 1999 08:06:28 +0000 (08:06 +0000)]
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.
Todd C. Miller [Fri, 27 Aug 1999 21:02:24 +0000 (21:02 +0000)]
Only block SIGINT, SIGQUIT, SIGTSTP (which can be generated from
the keyboard). Since we run with ruid/euid == 0 the user can't
really signal us in nasty ways.
Todd C. Miller [Fri, 27 Aug 1999 21:01:06 +0000 (21:01 +0000)]
Don't need to worry about catching too many signals since we do locking
on the tmp file. If a lockfile is really stale, it will be detected
and overwritten.
Todd C. Miller [Thu, 26 Aug 1999 13:16:06 +0000 (13:16 +0000)]
Kill VISUDO_LIBS and VISUDO_LDFLAGS. Add LIBS, NET_LIBS, and LDFLAGS.
Common libs go in LIBS, commong ld flags go in LDFLAGS and network libs
like -lsocket, -lnsl go in NET_LIBS. This allows testsudoers to build
on Solaris and is a bit cleaner in general.
Todd C. Miller [Tue, 24 Aug 1999 15:58:39 +0000 (15:58 +0000)]
In "sudo -l" mode, the type of the stored (expanded) alias was not
stored with the contents. This could lead to incorrect output
if the sudoers file had different alias types with the same name.
Normal parsing (ie: not in '-l' mode) is unaffected.
Todd C. Miller [Sun, 22 Aug 1999 09:59:28 +0000 (09:59 +0000)]
Add check for LONG_IS_QUAD
#undef MAXINT before including hpsecurity.h to silence an HP-UX warning
Check for U?LONG_LONG_MAX in snprintf.c and use LONG_IS_QUAD
Todd C. Miller [Fri, 20 Aug 1999 20:37:16 +0000 (20:37 +0000)]
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.
Todd C. Miller [Thu, 19 Aug 1999 17:45:36 +0000 (17:45 +0000)]
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.
Todd C. Miller [Thu, 19 Aug 1999 16:30:09 +0000 (16:30 +0000)]
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.
Todd C. Miller [Tue, 17 Aug 1999 15:29:47 +0000 (15:29 +0000)]
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.
Todd C. Miller [Sat, 14 Aug 1999 15:36:47 +0000 (15:36 +0000)]
In struct sudo_auth, turn need_root and configured into flags and
add a flag to specify an auth method is running alone (the only
one). Pass auth methods their sudo_auth pointer, not the data
pointer. This allows us to get at the flags and tell if we are the
only auth method. That, in turn, allows the method to be able to
decide what should/should not be a fatal error. Currently only
rfc1938 uses it this way, which allows us to kill the OTP_ONLY
define and te hackery that went with it. With access to the
sudo_auth struct, methods can also get at a string holding their
cannonical name (useful in error messages).
Todd C. Miller [Sat, 14 Aug 1999 15:34:55 +0000 (15:34 +0000)]
o --with-otp deprecated, use --without-passwd instead
o real dependencies in the Makefile
o --with-devel option to enable yacc, lex, and -Wall
o style -- "foo -> bar" becomes "foo->bar"
o ALL goes back to being a token, not a string but don't leak memory
o rename hsotspec -> host in parse.yacc
Todd C. Miller [Thu, 12 Aug 1999 16:24:10 +0000 (16:24 +0000)]
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
Todd C. Miller [Thu, 12 Aug 1999 14:37:27 +0000 (14:37 +0000)]
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.
Todd C. Miller [Thu, 12 Aug 1999 14:29:12 +0000 (14:29 +0000)]
Break 'WORD' regexp def into HOSTNAME and USERNAME. These days a
username can contain just about anything so be very permissive.
Also drop the unused \. punctuation.
Todd C. Miller [Mon, 9 Aug 1999 22:25:17 +0000 (22:25 +0000)]
o add a 'val' element to aliasinfo struct and move -> parse.h
o find_alias() now returns an aliasinfo * instead of boolean
o add_alias() now takes a value parameter to store in the aliasinfo.val
o The cmnd, hostspec, runasuser, and user rules now return:
1) positive match
0) negative match (due to '!')
-1) no match
This means setting $$ explicitly in all cases, which I should have done in
the first place. It also means that we always store a value that is != -1
and when we see a '!' we can set *_matches to !rv if rv != -1.
The upshot of all of this is that '!' now works the way it should in
lists and some of the rules are more uniform and sensible.
Todd C. Miller [Mon, 9 Aug 1999 14:35:53 +0000 (14:35 +0000)]
Allow a list of users as the first thing in a user spec, not just a
single entry. This makes things more uniform, though it does allow
you to write user specs that are hard to read.
Todd C. Miller [Sat, 7 Aug 1999 09:59:43 +0000 (09:59 +0000)]
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.
Todd C. Miller [Fri, 6 Aug 1999 09:37:03 +0000 (09:37 +0000)]
o /etc/stmp -> /etc/sudoers.tmp since solaris uses stmp as shadow temp file
o _PATH_SUDO_SUDOERS -> _PATH_SUDOERS and _PATH_SUDO_STMP -> _PATH_SUDOERS_TMP