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
Todd C. Miller
c376c71618
Move the -C (user_closefrom) check until after set_cmnd() so that
...
closefrom_override can be used in a command-specific Defaults line.
Fixes bug #610 from Mengtao Sun.
2013-08-15 09:56:17 -06:00
Todd C. Miller
972ee9a0fb
Avoid "perm stack underflow" error when logging the unknown uid error.
2013-08-07 10:13:04 -06:00
Todd C. Miller
1f3ea50afd
Implement memset_s() and use it instead of zero_bytes().
...
A new constant, SUDO_CONV_REPL_MAX, is defined by the plugin
API as the max conversation reply length. This constant can be
used as a max value for memset_s() when clearing passwords
filled in by the conversation function.
2013-08-03 08:30:06 -06:00
Todd C. Miller
368a6558ca
Change some error/errorx -> fatal/fatalx in comments and xgettext
...
flags.
2013-04-26 16:06:05 -04:00
Todd C. Miller
5337da144b
Replace sudo_fakepwnamid() with sudo_mkpwent() and don't return an
...
error if the entry already exists in the cache.
2013-04-19 14:48:23 -04:00
Todd C. Miller
1162b55040
Rename log_error() -> log_warning() for consistency with warning()/fatal()
2013-04-18 14:14:03 -04:00
Todd C. Miller
39acd2fcba
Rename error/errorx -> fatal/fatalx and remove the exit value as
...
it was always 1.
2013-04-18 14:07:59 -04:00
Todd C. Miller
41ab8da22c
Fall back to opening /dev/tty to determine whether there is a tty
...
if the system doesn't have kernel support for determing the tty.
2013-04-01 10:40:17 -04:00
Todd C. Miller
37b4b5d15e
Now that we can determine the terminal even when file descriptors
...
are redirected we can check user_ttypath rather than opening
/dev/tty when enforcing requiretty.
2013-03-28 15:46:52 -04:00
Todd C. Miller
38dac1e0a4
Stash umask in struct sudo_user so we don't need to look it up later.
2013-03-28 15:40:32 -04:00
Todd C. Miller
5bac16f5cc
Minor cosmetic change
2013-03-28 14:25:24 -04:00
Todd C. Miller
213f7ff113
Don't need to include sudoers_version.h here.
2013-03-28 10:49:18 -04:00
Todd C. Miller
13dbba174e
Move sudo_conv into policy.c
2013-03-27 13:42:40 -04:00
Todd C. Miller
29becec0e7
Make "sudo -l non_existent_command" warn that non_existent_command
...
doesn't exist, not the "list" pseudo-command.
2013-02-20 15:35:26 -05:00
Todd C. Miller
b9159ecb26
Add maxseq sudoers option to limit the max number of I/O log files.
2013-02-18 15:06:23 -05:00
Todd C. Miller
af0bb55283
Move tzset() call from sudoers plugin to sudo front end.
2013-02-07 14:31:48 -05:00
Todd C. Miller
99704cc101
Catch SIGINT, SIGQUIT and SIGTSTP in the front end before we execute
...
the command. If we get SIGINT or SIGQUIT, call the plugin close()
functions as if the command was interrupted. If we get SIGTSTP,
uninstall the handler and deliver SIGTSTP to ourselves.
2013-01-17 09:20:45 -05:00
Todd C. Miller
9479bb623b
Add exec_background option in plugin command info and a sudoers
...
option to match. When set, commands are started in the background
and automatically foregrounded as needed. There are issues with
some ill-mannered programs (like Linux su) so this is not the
default.
2013-01-11 14:34:09 -05:00
Todd C. Miller
1d7072fe09
Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
...
MAXHOSTNAMELEN and the MIN/MAX macros. We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
b7ae7977a6
Cannot wrap sigsetjmp() or we end up returning to the wrong place.
...
Use a macro instead.
2012-11-29 06:37:13 -05:00
Todd C. Miller
2632ec7e69
Move warn/error into common and make static builds work.
2012-11-25 09:34:40 -05:00
Todd C. Miller
c2c6616a0c
Move _sudo_printf from src/conversation.c to common/sudo_printf.c.
...
Add sudo_printf function pointer that is initialized to _sudo_printf()
instead of requiring a sudo_conv function pointer everywhere. The
plugin will reset sudo_printf to point to the version passed in via
the plugin open function. Now plugin_error.c can just call sudo_printf
in all cases. The sudoers binaries no longer need their own version
of sudo_printf.
2012-11-25 09:34:33 -05:00
Todd C. Miller
5496ffe1e8
Add plugin_setjmp() wrapper for siglongjmp(error_jmp, 1) so we don't
...
need error_jmp to be extern. Also add plugin_clearjmp() that clears
a flag so error()/errorx() knows when to call exit() vs. longjmp().
2012-11-25 09:34:26 -05:00
Todd C. Miller
7b3d268687
Call gettext() on parameters for warning()/warningx() instead of
...
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
90147bb605
Allow sudoers programs (visudo, sudoreplay, visudo) to use
...
plugin_error.c instead of the error.c from the front-end. This
means sudoers_setlocale() needs to be independent of the sudo_user
struct and the defaults table. The sudoers locale is now updated
via a callback.
2012-11-25 09:33:52 -05:00