Todd C. Miller [Mon, 15 Nov 2004 17:33:52 +0000 (17:33 +0000)]
Use ALIAS for the member type when storing an alias instead of
HOSTALIAS/RUNASALIAS/CMNDALIAS/USERALIAS since match.c relies on
the more generic type. Expand runas_matches instead of calling
user_matches() inside of it since user_matches() looks up USERALIASes,
not RUNASALIASes.
Todd C. Miller [Mon, 15 Nov 2004 15:53:53 +0000 (15:53 +0000)]
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.
Todd C. Miller [Mon, 15 Nov 2004 14:53:05 +0000 (14:53 +0000)]
Cache passwd db entries in 2 reb-black trees; one indexed by uid,
the other by user name. The data returned from the cache should
be considered read-only and is destroyed by sudo_endpwent().
Todd C. Miller [Wed, 27 Oct 2004 16:16:23 +0000 (16:16 +0000)]
Only reset sudo_user.pw based on SUDO_USER environment variables for
real commands and sudoedit. This avoids a confusing message when a
user tries "sudo -l" or "sudo -v" and is denied.
Todd C. Miller [Tue, 26 Oct 2004 22:22:46 +0000 (22:22 +0000)]
Update for new parse. We now call find_path() *after* we have updated
the global defaults based on sudoers. Also adds support for listing
other user's privs if you are root.
Todd C. Miller [Tue, 26 Oct 2004 22:19:58 +0000 (22:19 +0000)]
Split sudo_ldap_check() into three pieces: sudo_ldap_open(),
udo_ldap_update_defaults() and sudo_ldap_check(). This allows
us to connecto to LDAP, apply the default options, find the command
in the user's path, and then check whether the user is allowed to
run it. The important thing here is that the default runas user
may be specified as a default option and that needs to be set
before we search for the command.
Todd C. Miller [Tue, 26 Oct 2004 22:14:01 +0000 (22:14 +0000)]
foo_matches() routines now live in match.c
Added user_matches(), runas_matches(), host_matches(), cmnd_matches()
and alias_matches() that operate on the parsed sudoers file.
Todd C. Miller [Tue, 26 Oct 2004 22:10:55 +0000 (22:10 +0000)]
Rewritten parser that converts sudoers into a set of data structures.
This eliminates ordering issues and makes it possible to apply
sudoers Defaults entries before searching for the command.
Todd C. Miller [Thu, 7 Oct 2004 18:52:51 +0000 (18:52 +0000)]
Use glob(3) instead of fnmatch(3) for matching pathnames and stat each
result that matches the basename of the user's command. This makes
"cd /usr/bin ; sudo ./blah" work when sudoers allows /usr/bin/blah.
Fixes bug #143.
Todd C. Miller [Fri, 1 Oct 2004 18:30:20 +0000 (18:30 +0000)]
No need to include syscall.h, use 1024 as the max # of entries (the
max that systrace(4) allows).
Only need to use SYSTR_POLICY_ASSIGN once
Change check_syscall() -> find_handler() and have it return the
handler instead of just running it. We need this since handler now
have two parts: one part that generates and answer and another that
gets called after the answer is accepted (to do logging).
Todd C. Miller [Thu, 30 Sep 2004 22:14:34 +0000 (22:14 +0000)]
Add support for tracing emulations. At the moment, all emulations are
compiled in. It might make sense to #ifdef them in the future, though
this impeeds readability.
Todd C. Miller [Thu, 30 Sep 2004 17:22:37 +0000 (17:22 +0000)]
Define Err() and Errx() that are like err() and errx() but call Exit()
instead of exit(). Build private copy of alloc.o for visudo that calls
Err() and Errx().
Todd C. Miller [Wed, 29 Sep 2004 18:41:38 +0000 (18:41 +0000)]
Overhaul visudo for editing multiple files:
o visudo has been broken out into functions (more work needed here)
o each file is now edited before sudoers is re-parsed
o if a #include line is added that file will be edited too
TODO:
o cleanup temp files when exiting via err() or errx()
o continue breaking things out into separate functions
Todd C. Miller [Wed, 29 Sep 2004 18:36:33 +0000 (18:36 +0000)]
Add keepopen arg to open_sudoers that open_sudoers can use to
indicate to the caller that the fd should not be closed when it
is done with it. To be used by visudo to keep locked fds from
being closed prematurely (and thus losing the lock).