Commit Graph

3687 Commits

Author SHA1 Message Date
Todd C. Miller
2b020f9999 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().
2004-09-30 17:22:37 +00:00
Todd C. Miller
b5d2fbb77b regen 2004-09-29 19:22:38 +00:00
Todd C. Miller
bfaf674516 sync 2004-09-29 19:22:15 +00:00
Todd C. Miller
f2ae53323e 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
2004-09-29 18:41:38 +00:00
Todd C. Miller
cbcb60b184 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).
2004-09-29 18:36:33 +00:00
Todd C. Miller
e9b23cdee1 Add errorfile global that contains the name of the file that caused the
error.
2004-09-29 18:33:06 +00:00
Todd C. Miller
f8f41d69a7 return COMMENT to yacc grammar for a #include line 2004-09-29 18:30:49 +00:00
Todd C. Miller
72894e6937 Remove us of unput() in favor of yyless() which is cheaper. 2004-09-29 18:29:40 +00:00
Todd C. Miller
9e975fafe4 Allow an empty sudoers file. 2004-09-29 18:28:46 +00:00
Todd C. Miller
27e83bacb1 Rewind sudoers_fp now that sudoers_lookup() doesn't do it for us. 2004-09-28 20:50:33 +00:00
Todd C. Miller
f4b1891e02 regen 2004-09-28 18:37:08 +00:00
Todd C. Miller
34269049bd Do signal setup before calling edit_sudoers().
Don't shadow the "quiet" global.
2004-09-28 18:36:29 +00:00
Todd C. Miller
97d800c91f If a sudoers file includes other files, edit those too.
Does not yes deal with creating the new includes files itself.
2004-09-28 18:33:06 +00:00
Todd C. Miller
01212e4ebb init_parser now takes a path 2004-09-28 18:31:38 +00:00
Todd C. Miller
db2a97fd0a 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
2004-09-28 18:31:24 +00:00
Todd C. Miller
b99ad3ee2b Kill _PATH_SUDOERS_TMP; it is not meaningful now that we can have multiple
sudoers files.
2004-09-28 18:29:05 +00:00
Todd C. Miller
4b75a03343 Rewind sudoers_fp in open_sudoers() instead of sudoers_lookup() so
we start at the right file position when reading include files.
2004-09-28 17:52:59 +00:00
Todd C. Miller
fbb62c6805 document #include 2004-09-28 01:04:57 +00:00
Todd C. Miller
4aa29b5f2f regen 2004-09-28 00:47:47 +00:00
Todd C. Miller
8c039eac93 Add max depth of 128 for the include stack to avoid loops.
Since yyerror() doesn't stop parsing, pass return values back to
yylex and call yyterminate() on error.
2004-09-28 00:47:30 +00:00
Todd C. Miller
d1f1af2bce document tracing 2004-09-27 18:06:26 +00:00
Todd C. Miller
a79c3af487 Mention PREVENTING SHELL ESCAPES section of sudoers man page 2004-09-27 18:05:58 +00:00
Todd C. Miller
741177ad12 regen 2004-09-27 16:08:18 +00:00
Todd C. Miller
5691c513d3 Add support for #include in sudoers (visudo support TBD) 2004-09-27 16:03:15 +00:00
Todd C. Miller
7f73581592 make yyerror()'s argument const 2004-09-27 16:02:50 +00:00
Todd C. Miller
ec0ef3fcf7 Add open_sudoers() stubs. 2004-09-27 16:02:10 +00:00
Todd C. Miller
7cf26298a2 Rename check_sudoers() open_sudoers() and make it return a FILE * 2004-09-27 16:01:54 +00:00
Todd C. Miller
22ad3cbc96 Crank version 2004-09-26 16:35:58 +00:00
Todd C. Miller
8b8ff2e455 Better HP-UX depot construction 2004-09-26 16:33:31 +00:00
Todd C. Miller
e4d64ce1d0 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
2004-09-25 21:08:48 +00:00
Todd C. Miller
ea5307a433 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.
2004-09-25 21:01:46 +00:00
Todd C. Miller
28736eb556 add missing increment of addr in read_string() 2004-09-25 20:58:11 +00:00
Todd C. Miller
649e2dac12 Remove bogus call to update_child() and some cosmetic fixes 2004-09-25 20:15:44 +00:00
Todd C. Miller
4e5c53e139 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
2004-09-25 20:11:39 +00:00
Todd C. Miller
d4e3f175c8 g/c sudo_pwdup proto 2004-09-25 17:15:06 +00:00
Todd C. Miller
007aff2b63 Add target for building a depot file 2004-09-25 00:21:04 +00:00
Todd C. Miller
1131db0699 trim includes 2004-09-25 00:07:26 +00:00
Todd C. Miller
2bb8472982 regen 2004-09-24 18:11:19 +00:00
Todd C. Miller
78ac046db5 document --with-systrace 2004-09-24 18:10:32 +00:00
Todd C. Miller
35203ffe56 Add check for setproctitle 2004-09-24 18:10:27 +00:00
Todd C. Miller
11edf288bd pass struct str_msg_ask in to syscall checker so it can set the error code 2004-09-24 18:09:47 +00:00
Todd C. Miller
d492138ff0 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.
2004-09-24 17:30:23 +00:00
Todd C. Miller
aa8d212e3c Call systrace_attach() if FLAG_TRACE is set. 2004-09-24 17:17:29 +00:00
Todd C. Miller
e3391d597b Add trace Defaults option and TRACE/NOTRACE tags and set FLAG_TRACE 2004-09-24 17:15:51 +00:00
Todd C. Miller
0c2be08089 Don't close sudoers_fp, keep it open and set close on exec flag instead. 2004-09-24 17:13:24 +00:00
Todd C. Miller
ef874440a5 Add trace option 2004-09-24 17:11:14 +00:00
Todd C. Miller
84a3d101e8 Add systrace 2004-09-24 00:24:09 +00:00
Todd C. Miller
7db351d7ab SunOS /bin/sh blows up with configure 2004-09-24 00:23:51 +00:00
Todd C. Miller
ce559899e2 Include sys/param.h before systrace.h 2004-09-24 00:23:28 +00:00
Todd C. Miller
ec57f115f8 regen 2004-09-24 00:15:19 +00:00