Todd C. Miller
54efa54c0e
Only check SUDO_USER if euid is 0
2016-07-31 18:47:36 -06:00
Todd C. Miller
f85e95329f
Initialize sudo_user based on the SUDO_USER environment variable
...
if present. This allows things like :Defaults:username editor=foo"
to work when visudo is run via sudo.
2016-07-30 15:27:36 -06:00
Todd C. Miller
2c21663b22
Split set_default_entry() out of set_default() so we can call it
...
from check_defaults() to validate the defaults value. In visudo,
suppress warnings from update_defaults() and rely on check_defaults()
to provide warnings.
2016-07-23 09:10:48 -06:00
Todd C. Miller
e0ac766473
Pass quiet flag to init_parser() and update_defaults() when doing
...
first parse of sudoers.
2016-07-23 05:53:35 -06:00
Todd C. Miller
256ca993b9
Update defaults in visudo after sudoers has been edited so we pick
...
up locale changes. The init_defaults() function will now re-init
the sudoers locale.
2016-07-22 10:41:56 -06:00
Todd C. Miller
ef24bd5c3c
Set the locale to the sudoers locale when parsing and restore the
...
user's locale afterward. Also set the warn/fatal locale helper
function so warning messages during a sudoers parse are displayed
in the user's own locale.
2016-07-20 16:41:23 -06:00
Todd C. Miller
b5c2ca2fe5
Move sudoers locale callback function to locale.c and user it in
...
visudo and testsudoers.
2016-07-20 14:16:00 -06:00
Todd C. Miller
05db5aa3b8
Remove sudo_mkpwcache() and sudo_mkgrcache(). We now create the
...
caches as needed on demand. Also remove calls to sudo_freepwcache()
and sudo_freegrcache() that are immediately followed by execve(),
they are not needed.
2016-05-11 09:40:31 -06:00
Todd C. Miller
23d288563e
Eliminate use of setpwent()/endpwent() and setgrent()/endgrent().
...
Sudo never iterates over the passwd or group file.
Rename sudo_set{pw,gr}ent() -> sudo_mk{pw,gr}cache() and
use sudo_free{pw,gr}cache() instead of sudo_end{pw,gr}ent().
2016-05-11 07:06:45 -06:00
Todd C. Miller
bbda2e7b5b
Fix memory leak in get_editor() if resolve_editor() fails with
...
an error. Coverity CID 104107.
2016-05-07 04:59:56 -06:00
Todd C. Miller
96f5fe4cd0
Ignore the return value of the initial sudoersparse(), before
...
we have actually edited any files. Coverity CID 104078.
2016-05-07 04:52:21 -06:00
Todd C. Miller
3bebdfea79
Quiet address sanitizer leak detector.
2016-01-28 15:07:54 -07:00
Todd C. Miller
5ad68edd65
It is possible for WIFSTOPPED to be true even if waitpid() is not
...
given WUNTRACED if the child is ptraced. Don't exit the waitpid()
loop if WIFSTOPPED is true, just in case.
2015-10-02 11:24:01 -06:00
Todd C. Miller
b6cb1b65c9
We reserved two slots at the end of the editor argv for the line
...
number and the file name. However, resolve_editor() adds "--"
before the file names so the +line_number is interpreted as a file
name, not a line number so we need to overwrite the "--" as well.
2015-09-15 09:29:40 -06:00
Todd C. Miller
67183d74f4
Remove include/compat/timespec.h. Systems old enough to lack struct
...
timespec are too old to build a modern sudo.
2015-09-09 11:13:22 -06:00
Todd C. Miller
333faa20e2
When parsing def_editor, break out of the loop when we find the
...
first valid editor. Bug #714
2015-08-21 11:25:02 -06:00
Todd C. Miller
7df2487165
The condition for adding a missing newline at the end of sudoers
...
was never reached. Keep track of the last character and write a
newline character if when copying to the temp file. Found by Radovan
Sroka.
2015-08-18 08:57:53 -06:00
Todd C. Miller
7ef9b5827e
Remove extraneous while() from botched do {} while() loop
...
conversion to use sudo_strsplit. Noticed by Radovan Sroka.
2015-08-18 08:34:10 -06:00
Todd C. Miller
445e6f2e9a
Check sudo_conf_read() return value and exit on fatal error (a
...
warning was already printed by sudo_conf_read()).
2015-07-07 13:17:50 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
c36415417f
Add function name to "unable to allocate memory" warnings.
2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
ac13264b44
Use a common function for resolviong the user's editor in sudoedit
...
and visudo. The find_path() function now returns a dynamically
allocated path instead of using a static string.
2015-06-18 09:51:36 -06:00
Todd C. Miller
07f9814450
Remove remaining SUDO_MAIN remnants.
2015-06-17 10:20:14 -06:00
Todd C. Miller
d004b02fc6
Use non-exiting allocatings in the sudoers plugin.
2015-06-17 06:49:59 -06:00
Todd C. Miller
21f5753b7d
Restore old behavior where visudo prevents you from making the main
...
sudoers file zero length.
2015-05-27 13:34:28 -06:00
Todd C. Miller
2bf454b74d
Use non-exiting allocators in the redblack tree and fix the fallout.
...
Also switch to non-exiting allocators in affected code blocks.
2015-05-27 09:51:54 -06:00
Todd C. Miller
05a01d4c5d
Avoid using a leading underbar in defines as they are reserved in
...
ISO C.
2015-05-21 11:13:20 -06:00
Todd C. Miller
ee72cba937
Use futimens() and utimensat() instead of futimes() and utimes().
2015-03-02 13:58:50 -07:00
Todd C. Miller
ea514dc391
Fix compiler warning on systems where mode_t is not unsigned int,
...
such as 32-bit Solaris.
2015-03-02 13:58:45 -07:00
Todd C. Miller
973286c7ac
Check the return value of gettimeofday(), even though it should
...
never fail.
2015-02-25 07:10:25 -07:00
Todd C. Miller
be8dbeb22e
Avoid using HOST_NAME_MAX directly and use sysconf(_SC_HOST_NAME_MAX)
...
instead.
2015-02-19 20:28:02 -07:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
5c13889f26
Use sudoers.so args from sudo.conf to set sudoers_file, sudoers_uid,
...
sudoers_gid, and sudoers_mode in visudo.
2014-11-10 20:12:47 -07:00
Todd C. Miller
9d4589abd0
Use sudoers_file, sudoers_uid, sudoers_gid, and sudoers_mode
...
symbols from toke.l instead of the upper case defines.
2014-11-10 15:23:51 -07:00
Todd C. Miller
9d6e1a57d5
Add sudoers_debug_deregister() and use it instead of calling
...
sudo_debug_deregister() directly.
2014-10-27 16:06:20 -06:00
Todd C. Miller
6b1b734ffa
Add a flag argument to sudo_conf_read() so we can decide which
...
bits get parsed. This lets us parse Debug statements first and
init the debug subsystem early.
2014-10-26 08:33:08 -06:00
Todd C. Miller
fe9e035ccf
Set debug instance for standalone programs.
2014-10-23 09:40:36 -06:00
Todd C. Miller
8db5f29398
sudoers_debug_instance is now included in libparsesudoers so we don't
...
need to declare it here.
2014-10-23 06:19:30 -06:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
e64f1198b6
An unused alias is not really an error, even in strict mode.
...
RedHat bz #604297
2014-07-12 07:30:18 -06:00
Todd C. Miller
36a5767e3e
efree -> sudo_efree for consistency
2014-07-10 15:35:04 -06:00
Todd C. Miller
2d61d38c23
Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h
2014-06-27 10:48:31 -06:00
Todd C. Miller
aecef4aa1d
Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
...
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
f029e3e744
Remove touch() from fileops.c and just call utimes/futimes directly.
...
Rename lock_file -> sudo_lock_file to avoid namespace pollution
2014-06-26 15:51:15 -06:00
Todd C. Miller
088edcb6f5
Add exported libsudo_util functions to util.exp and mark in headers
...
using __dso_public.
2014-06-26 15:51:15 -06:00
Todd C. Miller
b0e6977c35
Try to be clearer about which are the input and output files in
...
export mode.
2014-05-13 15:00:43 -06:00
Todd C. Miller
45ff42eb9f
Don't try to install the temporary sudoers file if we didn't edit it.
...
By default, visudo does not edit files in a #includedir.
Fixes a NULL pointer defef on GNU hurd; Bug #647
2014-05-09 09:29:42 -06:00