500 Commits

Author SHA1 Message Date
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
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