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).
Todd C. Miller [Tue, 28 Sep 2004 18:31:24 +0000 (18:31 +0000)]
More scaffolding for dealing with multiple sudoers files:
o init_parser() now takes a path used to populate the sudoers global
o the sudoers global is used to print the correct file in yyerror()
o when switching to a new sudoers file, perserve old file name and line number
Todd C. Miller [Sat, 25 Sep 2004 21:08:48 +0000 (21:08 +0000)]
o Made children global so check_exec() can lookup a child.
o Replaced uid in struct childinfo with struct passwd * (for runas)
o new_child() now takes a parent pid so the runas info can be inherited
o Added find_child() to lookup a child by its pid
o update_child() now fills in a struct passwd
o Converted the big if/else mess in set_policy to a switch
o Syscalls that change uid are now "ask" so we get SYSTR_MSG_UGID events
Todd C. Miller [Sat, 25 Sep 2004 21:01:46 +0000 (21:01 +0000)]
Add flag to sudo_pwdup that indicates whether or not to lookup the
shadow password. Will be used to a struct passwd that has the
shadow password already filled in.
Todd C. Miller [Sat, 25 Sep 2004 20:11:39 +0000 (20:11 +0000)]
Don't leak /dev/systrace fd to tracee
Make initialized global for simplicity
If STRIOCATTACH returns EBUSY we are already being traced
Check for user_args == NULL in setproctitle() call
Add missing calls to STRIOCANSWER