Commit Graph

199 Commits

Author SHA1 Message Date
Todd C. Miller
2566e6b7d8 Move declatation of struct timespec to its own include files for
systems without it since it needs time_t defined.
2005-06-23 03:04:35 +00:00
Todd C. Miller
304dc46d7f Add efree() for consistency with emalloc() et al. Allows us to rely
on C89 behavior (free(NULL) is valid) even on K&R.
2005-03-29 14:29:47 +00:00
Todd C. Miller
d4b7457596 make print_unused static like proto says 2005-03-10 14:57:17 +00:00
Todd C. Miller
778d587063 Update copyright years. 2005-02-12 22:56:07 +00:00
Todd C. Miller
3b8b88407f Add __unused to rcsids 2005-01-27 15:42:30 +00:00
Todd C. Miller
0ab0ad2441 Remove sudo_*{pw,gr}* stubs and add sudo_setspent/sudo_endspent stubs instead.
We can now just use the caching sudo_*{pw,gr}* functions in pwutil.c
Add comment about wanting to call sudo_endpwent/sudo_endgrent in cleanup()
2005-01-05 19:46:39 +00:00
Todd C. Miller
a5d9296d25 Adapt to pwutil.c 2005-01-05 01:10:16 +00:00
Todd C. Miller
a58012cfff Only check group vector in usergr_matches() if we are matching the
invoking or list user.  Always check the group members, even if
there was a group vector.
2005-01-01 17:41:21 +00:00
Todd C. Miller
7d488657f0 Use TIME_WITH_SYS_TIME 2004-12-03 18:52:28 +00:00
Todd C. Miller
33db4b2edb Add check for 2-argument form of timespecsub (FreeBSD and BSD/OS) and
fix a typo in the gettimeofday check.
2004-11-25 17:09:31 +00:00
Todd C. Miller
fe869025c4 Add support for command-specific Defaults entries. E.g.
Defaults!/usr/bin/vi noexec
2004-11-19 21:35:12 +00:00
Todd C. Miller
2c2daa8eca Use: #include <config.h>
Not: #include "config.h"
That way we get the correct config.h when build dir != src dir
2004-11-19 18:39:14 +00:00
Todd C. Miller
6a78b91949 Make arg splitting in visudo and sudoedit consistent. 2004-11-19 17:55:14 +00:00
Todd C. Miller
3f9ee04fbb quit() should not be __noreturn__ as it is non-void on some platforms. 2004-11-19 17:30:22 +00:00
Todd C. Miller
75ad6b81a2 Add support for VISUAL and EDITOR containing command line args.
If env_editor is not set any args in VISUAL and EDITOR are ignored.
Arguments are also now supported in def_editor.
2004-11-18 20:28:53 +00:00
Todd C. Miller
9846e562ad Implement group caching and use the passwd and group caches throughout. 2004-11-16 04:24:11 +00:00
Todd C. Miller
51375f969f 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.
2004-11-15 15:53:53 +00:00
Todd C. Miller
e26e40df8a Store aliases in a red-black tree. 2004-11-15 03:55:22 +00:00
Todd C. Miller
f3839f1bf0 Edit all sudoers file if there were unused or undefined aliases and we
are in strict mode.
2004-11-15 03:37:53 +00:00
Todd C. Miller
a768dbc34f Bring back the "secure_path" Defaults option now that Defaults take
effect before the path is searched.
2004-11-12 16:19:19 +00:00
Todd C. Miller
2c1da58a82 Rework for the new parser.
Now checks for unused aliases in sudoers.
2004-10-26 22:26:28 +00:00
Todd C. Miller
8a33025986 Use __attribute__((__noreturn__)) 2004-09-30 17:55:21 +00:00
Todd C. Miller
1e65afba3d Exit() takes a negative value to indicate it was not called via signal. 2004-09-30 17:44:24 +00:00
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
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
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
ec0ef3fcf7 Add open_sudoers() stubs. 2004-09-27 16:02:10 +00:00
Todd C. Miller
0f056c0d5f Use timespec throughout. 2004-09-08 15:48:23 +00:00
Todd C. Miller
7f772c822f Add an extra param to touch() for nsec 2004-09-07 19:55:37 +00:00
Todd C. Miller
1c20ff1a6d Use utimes() and futimes() instead of utime() in touch(), emulating as needed.
Not all systems are able to support setting the times of an fd so touch()
takes both an fd and a file name as arguments.
2004-09-07 17:14:52 +00:00
Todd C. Miller
f30ab72c44 Add cmnd_base to struct sudo_user and set it in init_vars().
Add cmnd_stat to struct sudo_user and set it in sudo_goodpath().
No longer use gross statics in command_matches().
Also rename some variables for improved clarity.
2004-08-24 18:01:14 +00:00
Todd C. Miller
1a46dd74f6 Don't pass user_cmnd and user_args to command_matches(), just use
the globals there.  Since we keep state with statics anyway it is
misleading to pretend that passing in different cmnd and cmnd_args
will work.
2004-08-02 18:44:58 +00:00
Todd C. Miller
ce1b21d42c Add a check in visudo for runas_default being set after it has already
been used.
2004-06-08 19:55:53 +00:00
Todd C. Miller
c01dbab988 update (c) year 2004-06-07 00:02:56 +00:00
Todd C. Miller
77791e7ab3 Remove trailing spaces, no actual code changes. 2004-06-06 23:58:15 +00:00
Todd C. Miller
3e1e279d21 Error out if argc < 1. 2004-06-03 20:21:07 +00:00
Todd C. Miller
d33ad95208 Use PATH_MAX, not MAXPATHLEN since the former is standardized. 2004-06-01 01:22:27 +00:00
Todd C. Miller
e6f074282f filesystem -> file system 2004-05-17 22:21:15 +00:00
Todd C. Miller
a6849607c9 Preliminary changes to support nsr-tandem-nsk. Based on patches from
Tom Bates.
2004-05-17 20:08:46 +00:00
Todd C. Miller
2e121633d4 In Exit() when used as a signal handler, emsg is a pointer so
sizeof() is wrong so make it a #define instead.  Also avoid using
a negative exit value.  Found by Aaron Campbell
2004-04-05 00:27:05 +00:00
Todd C. Miller
6190f376c1 If the user specified a uid with the -u flag and the uid exists in
the passwd file, set runas_user to the name, not the uid.

When comparing usernames in sudoers, if a name is really a uid (starts
with '#') compare it numerically to pw_uid.
2004-03-24 23:06:34 +00:00
Todd C. Miller
5befe6ddfe More to a less restrictive, ISC-style license. 2004-02-13 21:36:44 +00:00
Todd C. Miller
24155a405a Use WIFEXITED and WEXITSTATUS macros. If there are systems out there
that want to run sudo that still don't support these we can try to
deal with that later.
2004-01-22 02:44:13 +00:00
Todd C. Miller
f068ee01c4 Prefer VISUAL over EDITOR like old vipw did. 2004-01-20 19:18:44 +00:00
Todd C. Miller
327729a7e6 Add stub set_runaspw() function 2004-01-16 23:09:34 +00:00
Todd C. Miller
6ad252765b Create def_* macros for each defaults value so we no longer need
the def_{flag,ival,str,list,mode} macros (which have been removed).
This is a step toward more flexible data types in def_data.in.
2003-12-30 22:20:21 +00:00
Todd C. Miller
4e74e8c530 add DARPA credit on affected files 2003-04-16 00:42:10 +00:00
Todd C. Miller
dcf1a5acce Use warn/err and getprogname() throughout. The main exception is
openlog().  Since the admin may be filtering logs based on the
program name in the log files, hard code this to "sudo".
2003-04-02 18:25:30 +00:00