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
Todd C. Miller [Fri, 24 Sep 2004 17:30:23 +0000 (17:30 +0000)]
systrace(4) support for sudo. On systems with the systrace(4) kernel
facility (OpenBSD, NetBSD, Linux w/ patches) sudo can intercept exec
calls and check the exec args against the sudoers file.
In other words, sudo can now control subcommands and shell escapes.