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
25917e435c
We need to unlimit RLIMIT_NPROC in sudoers as well as the sudo front
...
end since set_perms() and restore_perms change the read uid and may
fail with EAGAIN on Linux kernels prior to 3.1.
2015-06-12 15:30:06 -06:00
Todd C. Miller
8eff57f070
Bring back VALIDATE_ERROR which will be used in the case of memory
...
allocation errors.
2015-06-04 20:42:42 -06:00
Todd C. Miller
9d1c408b73
Non-exiting allocators for log functions. If log_allowed() fails
...
the user may not run the command. We don't try to return early for
log_failure(), log_auth_failure() or log_denial() as we would not
run the command in that case.
2015-05-27 10:55:27 -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
8d1708434f
Add sudo_strsplit(), similar to strtok_r() but non-destructive and
...
operates on non-C strings (requires a length parameter).
2015-05-26 15:46:41 -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
8bc70a635c
Instead of trying to make weak functions work on all platforms,
...
just use a registration function for a plugin-specific setlocale
function. The sudoers version just wraps sudoers_setlocale().
2015-05-11 14:51:32 -06:00
Todd C. Miller
caf5d45e0f
Previously, debug_return_bool was the same as debug_return_int
...
except that it logged true/false for 1/0. However, this appears
to trigger a bug in some compilers. To avoid this, debug_return_bool
now uses bool, not int. Callers that were passing it an int have
been converted to use debug_return_int instead.
2015-05-07 10:33:23 -06:00
Todd C. Miller
e98778b2a2
When creating a passwd struct from a uid that is not in the passwd
...
database, set pw_gid to the user's gid instead of whatever the user
specified via the -g flag (or 0 if no -g).
2015-04-16 13:19:04 -06:00
Todd C. Miller
be4872f691
For sudoedit, run the editor with the user's original environment
...
as per the documentation (and as in sudo 1.7.x). Bug #688
2015-03-16 20:19:24 -06: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
57553fffdd
Rename VALIDATE_OK -> VALIDATE_SUCCESS
...
Rename VALIDATE_NOT_OK -> VALIDATE_FAILURE
2015-01-21 11:03:48 -07:00
Todd C. Miller
832a4dee6b
In set_fqdn() we neeed to set user_runhost/user_srunhost at the
...
same time we set user_host/user_shost since that is what
hostlist_matches() uses. Bug #678
2014-11-12 20:33:41 -07: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
79f4471e41
Move sudo_printf to policy.c to match sudo_conv.
2014-10-06 10:13:42 -06:00
Todd C. Miller
bd99dcc028
Add sudo_warn_set_conversation() to specify a conversation function
...
to use for warn/fatal. If no conversation function is specified,
the standard error will be used. We now only need sudo_printf()
for things that use the parser.
2014-10-05 16:41:52 -06:00
Todd C. Miller
ecaecdc1f4
Merge secure_path.h -> sudo_util.h
2014-07-22 11:37:39 -06:00
Todd C. Miller
cedc34561d
For sudoedit, audit the actual editor being run, not just the
...
sudoedit command.
2014-07-12 10:35:00 -06:00
Todd C. Miller
36a5767e3e
efree -> sudo_efree for consistency
2014-07-10 15:35:04 -06:00
Todd C. Miller
a8fa112a53
atobool -> sudo_strtobool
...
atoid-> sudo_strtoid
atomode -> sudo_strtomode
2014-06-27 14:53:54 -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
2166a6afe1
Remove use of setjmp/longjmp in the sudoers plugin. We no longer
...
call fatal() except in the malloc wrappers and due to libsudo_util
there is now a single copy of fatal/fatalx.
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
337a712745
Pass argc to audit functions too. Will be needed for Solaris audit
...
support.
2014-05-13 09:41:53 -06:00
Todd C. Miller
b0f1fa7d05
Rename log_warning flags and only send mail if SLOG_SEND_MAIL is
...
set instead of mailing by default like we used to.
2014-05-02 20:54:01 -06:00
Todd C. Miller
954a3e77b1
Add log_warningx
2014-05-02 16:40:30 -06:00
Todd C. Miller
cbee9cc8cb
Remove now-unused log_fatal()
2014-04-30 17:00:20 -06:00
Todd C. Miller
5086194c67
Eliminate calls to fatal()/fatalx()/log_fatal() in env.c and just
...
pass back a return value.
2014-04-30 16:57:12 -06:00
Todd C. Miller
62a278183b
Format string safety in error path.
2014-04-22 16:03:57 -06:00
Todd C. Miller
134b2a4228
Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray().
2014-04-22 16:02:28 -06:00
Todd C. Miller
a78da37487
Make set_perms() and restore_perms() return an error instead of
...
calling exit() on failure.
2014-04-10 16:11:47 -06:00
Todd C. Miller
40375a6268
Eliminate calls to fatal() in sudoers.c and just pass back a return
...
value.
2014-04-10 16:03:26 -06:00
Todd C. Miller
2a290f812e
Return MODE_ERROR from sudoers_policy_deserialize_info() instead
...
of calling fatalx().
2014-04-07 05:34:56 -06:00
Todd C. Miller
9b7dfa7522
Remove calls to log_fatal() in I/O log functions and just pass an
...
error back to the caller.
2014-04-04 15:30:12 -06:00
Todd C. Miller
6a295400b7
Make "internal error, %s overflow" arguments consistent, using
...
__func__ where possible (when debugging is allowed).
2014-04-01 16:42:13 -06:00
Todd C. Miller
639ac92e6d
In find_path(), return NOT_FOUND_ERROR instead of calling fatal()
...
if the path is too long. Remove an extraneous check against PATH_MAX
in set_cmnd() since find_path() already contains such a check.
2014-03-26 14:15:15 -06:00
Todd C. Miller
2220f55aef
Propagate errors in audit code to caller instead of using fatal().
...
If we fail to audit an otherwise successful command, return an error
from the policy. For Linux audit, sudo may be compiled with audit
support but auditing may not be setup, so we don't consider that
an error.
2014-03-26 13:00:56 -06:00
Todd C. Miller
1017ad4e2c
Audit path too long errror. Add comments about non-audit events
...
and placeholders for future audit hooks.
2014-03-25 16:46:00 -06:00
Todd C. Miller
c6e310b948
We also need to open the sudoers file as root if there is a GID
...
mismatch.
2014-02-17 10:20:14 -07:00
Todd C. Miller
b2c456341a
Move symbol extern defs into sudoers.h
2013-12-16 14:18:42 -07:00
Todd C. Miller
8bdf3d9a27
When checking whether a user may change the login class, just check
...
pw_uid of the runas user, which was passed in to set_loginclass().
2013-12-07 09:17:54 -07:00
Todd C. Miller
e1ac1a2ff3
Use atoid() not atoi() when parsing uids/gids.
2013-12-05 15:51:56 -07:00
Todd C. Miller
96eb2c4f8f
Add warning_gettext() wrapper function that changes to the user locale,
...
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
0817429583
More sign compare fixes. On Solaris id_t is signed so use uid_t
...
in the set_perms.c ID macro instead.
2013-10-23 15:19:41 -06:00
Todd C. Miller
923edabe6c
Convert sudo to use BSD TAILQ macros instead of home ground tail
...
queue functions. This includes a private queue.h header derived
from FreeBSD. It is simpler to just use our own header rather than
try to deal with macros that may or may not be present in various
queue.h incarnations.
2013-10-22 09:00:37 -06:00