Todd C. Miller
879c46e4dd
Add support for setting environment variables on the command line.
...
This is only allowed if the setenv sudoers options is enabled or if
the command is prefixed with the SETENV tag.
2007-06-23 23:58:54 +00:00
Todd C. Miller
98931e0f8f
don't call sudo_ldap_display_cmnd if ldap not setup
2005-06-23 03:19:00 +00:00
Todd C. Miller
7ce5994d6c
include grp.h to silence a warning on Solaris
2005-04-24 23:22:19 +00:00
Todd C. Miller
f1a0953085
Fix printing of += and -= defaults.
2005-04-23 19:10:16 +00:00
Todd C. Miller
f261a99f22
In -l mode, only check local sudoers file if def_ignore_sudoers is not set
...
and call LDAP versions from display_privs() and display_cmnd() instead
of directly from main(). Because of this we need to defer closing
the ldap connection until after -l processing has ocurred and we
must pass in the ldap pointer to display_privs() and display_cmnd().
2005-04-12 01:37:08 +00:00
Todd C. Miller
d0df82a93a
Add macro to test if the tag changed to improve readability.
2005-04-10 21:44:27 +00:00
Todd C. Miller
ce7708e09a
Avoid printing defaults header if there are no defaults to print...
2005-04-10 21:40:41 +00:00
Todd C. Miller
9efe91fa1e
Move initgroups() for -U option into display_privs() so group matching
...
in sudoers works correctly.
2005-03-29 03:33:05 +00:00
Todd C. Miller
61413ca509
Add missing space in Defaults printing
2005-03-27 01:01:02 +00:00
Todd C. Miller
f35ff3e327
make this build in K&R land
2005-03-10 14:51:48 +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
ed4df3a948
Print Defaults info in "sudo -l" output and wrap lines based on the
...
terminal width.
2005-01-02 00:31:08 +00:00
Todd C. Miller
5f06b19a6e
Add -U option to use in conjunction with -l instead of -u.
...
Add support for "sudo -l command" to test a specific command.
2004-11-24 21:31:51 +00:00
Todd C. Miller
9c526bdc30
Correctly handle multiple privileges per userspec and runas inheritence.
2004-11-23 23:18:15 +00:00
Todd C. Miller
e605070143
Remove the FLAG_NOPASS, FLAG_NOEXEC and FLAG_MONITOR flags. Instead,
...
we just set the approriate defaults variable.
2004-11-19 23:00:28 +00:00
Todd C. Miller
0cddfc3684
Change an occurence of user_matches() -> runas_matches() missed previously
...
runas_matches(), host_matches() and cmnd_matches() only really need to pass in
a list of members. user_matches() still needs to pass in a passwd struct
because of "sudo -l"
2004-11-19 20:03:33 +00:00
Todd C. Miller
2c3cff1704
Check def_authenticate, def_noexec and def_monitor when setting return flags.
...
XXX May be better to just set the defaults directly and get rid of those flags.
2004-11-19 19:46:55 +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
74169a83e0
Expand aliases in "sudo -l" mode
2004-11-15 18:00:29 +00:00
Todd C. Miller
541908f1bd
A user can always list their own entries, even with -u.
...
Better error message when failing to list another user's entries.
2004-11-11 17:22:30 +00:00
Todd C. Miller
a239e60a6a
The syntax to list another user's entries is now "-u otheruser -l".
...
Only root or users with sudo "ALL" may list other user's entries.
2004-11-11 17:12:20 +00:00
Todd C. Miller
5becc03851
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.
2004-10-26 22:10:55 +00:00
Todd C. Miller
1b06f3e81d
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 .
2004-10-07 18:52:51 +00:00
Todd C. Miller
3c8145a923
No longer call it tracing, it is now "monitoring" which should be more
...
a obvious name to non-hackers.
2004-10-04 16:07:19 +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
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
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
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
98fb553875
Fix a bug introduced in rev. 1.149. When checking for pseudo-commands
...
check for a '/' anywhere in cmnd, not just the first character.
2004-08-02 18:40:39 +00:00
Todd C. Miller
8ce996770c
Parse sudoers file as PERM_RUNAS not PERM_ROOT and remove a useless
...
PERM_SUDOERS. Restore to PERM_ROOT upon exit of the parse.
2004-07-23 20:43:09 +00:00
Todd C. Miller
a6fe34784a
When matching for "sudoedit" in sudoers check both the command the user
...
typed *and* the command that is listed in the sudoers entry.
2004-07-08 00:15:37 +00:00
Todd C. Miller
713e419fe9
Remove trailing spaces, no actual code changes.
2004-06-06 23:58:11 +00:00
Todd C. Miller
b954f0bc94
When checking for a command in the directory, only copy the base dir once.
2004-06-01 16:51:06 +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
5150db1db3
In sudoers_lookup() return VALIDATE_NOT_OK if the runas user was
...
explicitly denied and the command matched. This fixes a long-standing
bug and makes:
foo machine = (ALL) /usr/bin/blah
foo machine = (!bar) /usr/bin/blah
equivalent to:
foo machine = (ALL, !bar) /usr/bin/blah
2004-05-27 19:55:06 +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
3a2282c927
More to a less restrictive, ISC-style license.
2004-02-13 21:36:43 +00:00
Todd C. Miller
c4a8ab8b99
Use the SET, CLR and ISSET macros.
2004-01-29 22:33:58 +00:00
Todd C. Miller
4dc5700a6d
Add a new flag, -e, that makes it possible to give users the ability
...
to edit files with the editor of their choice as the invoking user,
not the runas user. Temporary files are used for the actual edit
and the temp file is copied over the original after the editor is done.
2004-01-21 22:25:10 +00:00
Todd C. Miller
69d47fe756
If we can't stat the command as root, try as the runas user instead.
2004-01-16 23:10:13 +00:00
Todd C. Miller
8e421c95b8
update copyright year
2004-01-05 17:15:32 +00:00
Todd C. Miller
7536a781f0
Add support for preloading a shared object containing a dummy execve()
...
function that just sets error and returns -1. This adds a
"noexec_file" option to load the filename as well as a "noexec" flag
to enable it unconditionally. There is also a NOEXEC tag that can
be attached to specific commands and an EXEC tag to disable it.
2004-01-05 02:48:09 +00:00
Todd C. Miller
02f37dc2da
Add support for tuples in def_data.in; these are implemented as an
...
enum type. Currently there is only a single tuple enum but in the
future we may have one tuple enum per T_TUPLE entry in def_data.in.
Currently listpw, verifypw and lecture are tuples. This avoids the
need to have two entries (one ival, one str) for pwflags and syslog
values.
lecture is now a tuple with the following values: never, once, always
We no longer use both an int and string entry for syslog facilities
and priorities. Instead, there are logfac2str() and logpri2str()
functions that get used when we need to print the string values.
2003-12-30 22:31:30 +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
40b63be2fc
Don't assume that getgrnam() calls don't modify contents of
...
struct passwd returned by getpwnam(). On FreeBSD w/ NIS this
can happen. Based on a patch from Kirk Webb.
2003-05-22 01:53:01 +00:00
Todd C. Miller
a76a79f6d7
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