Commit Graph

12802 Commits

Author SHA1 Message Date
Todd C. Miller
66c9a636d1 Build tsdump by default so it does not suffer bit rot. 2023-11-26 08:45:43 -07:00
Todd C. Miller
67ed8fbe58 Add sudo_debug_exit_dev_t stub for fuzzing. 2023-11-26 08:30:41 -07:00
Todd C. Miller
be911b77dd Avoid using the u_int type, which is not portable. 2023-11-26 08:24:26 -07:00
Todd C. Miller
5ff6f49653 tsdump: update to use a uid-based path by default
This matches the changes in sudo 1.9.15 to the sudoers policy module.
2023-11-26 08:21:05 -07:00
Todd C. Miller
ce74f50b44 Update for plugin version 1.22. 2023-11-25 18:51:28 -07:00
Todd C. Miller
61dbfe0924 Document ttydev and bump plugin version to 1.22 2023-11-25 18:38:36 -07:00
Todd C. Miller
a85494b5c4 Add ttydev to sudoers_user_context and use for timestamp file.
GitHub issue #329
2023-11-25 16:26:45 -07:00
Todd C. Miller
3dfbf9316c Pass tty device number from front-end to policy module.
GitHub issue #329
2023-11-25 16:26:44 -07:00
Todd C. Miller
b9275b7eab Rename submit_time -> event_time in struct eventlog. 2023-11-23 09:08:04 -05:00
Todd C. Miller
0e53d5fddf We can use evlog.submit_time in the call to eventlog_alert().
This is set to the current wallclock time by sudoers_to_eventlog().
2023-11-23 09:08:04 -05:00
Todd C. Miller
39ea3176c1 Replace submit_time in struct sudoers_context with start_time.
We need to track the (monotonic) command start time to be able to
generate an accurate run time.  Instead of setting submit time when
the policy initializes (and using that time for logging purposes),
set evlog->submit_time to the current wallclock time when we need
to perform logging.  This is more consistent with how sudo logging
was performed in the past.  Fixes GitHub issues #327.
2023-11-23 09:08:04 -05:00
Todd C. Miller
432b085558 log_server_open: always pass in awake time, not wallclock time.
The timespec passed to log_server_open() should be from
sudo_gettime_awake() since it is used to build the command run time.
2023-11-23 09:08:04 -05:00
Todd C. Miller
6965e1b0aa log_server_alert: use fmt_alert_message not fmt_reject_message
Only affects intercepted commands.
2023-11-23 09:08:04 -05:00
Todd C. Miller
13dec64f3d log_server_alert: struct timespec argument was not actually used
The struct timespec argument is used to initialize the command
start time, which is not used for an alert message.
2023-11-23 09:08:04 -05:00
Todd C. Miller
47a43c5404 cvtsudoers_csv.c: remove most sudo_fatal() calls.
Errors are now propagated up the call stack.
2023-11-11 10:22:14 -07:00
Todd C. Miller
dd5f7a4505 No need for sudo_fatalx() here, just pass back an error. 2023-11-11 08:31:23 -07:00
Todd C. Miller
2c06aa321b cvtsudoers_ldif: display warning on write error 2023-11-11 08:19:19 -07:00
Todd C. Miller
7e4632691b cvtsudoers_merge.c: remove sudo_fatal() calls.
Errors are now propagated up the call stack.
2023-11-11 08:15:06 -07:00
Todd C. Miller
8cfd4467f4 Make new_member() return NULL on failure and adjust callers. 2023-11-10 16:53:57 -07:00
Todd C. Miller
564d8ac01d Pass return values back instead of using sudo_fatal(). 2023-11-10 14:05:35 -07:00
Todd C. Miller
d28884b1c7 Add printf_attribute_ldif() to printf-format an LDIF attribute.
This replaces multiple sequences of asprintf() and print_attribute_ldif().
2023-11-10 13:34:13 -07:00
Todd C. Miller
12e55dcd78 cvtsudoers_json.c: check sudo_json_* return values.
Previously, we set memfatal to true in sudo_json_init() instead.
This also gets rid of a number of sudo_fatalx() calls.
2023-11-09 17:12:56 -07:00
Todd C. Miller
1a68935ae3 add_timestamp: check sudo_json_* return values. 2023-11-09 17:12:55 -07:00
Todd C. Miller
a2998a6701 alias_apply: change return type to bool
We can use the rbapply() return value to detect failure.
2023-11-09 15:31:26 -07:00
Todd C. Miller
ab49adb92d Always disable core dumps when sudo sends itself a fatal signal.
When a command exits due to a fatal signal, sudo will re-send that
signal to itself so the shell does not ignore keyboard-generated
signals.  However, now that sudo disables core dumps by default for
the command, we cannot rely on WCOREDUMP() telling us whether or
not the signal will lead to a core dump.  It is safest to always
disable core dumps before sending the signal to ourself.
2023-11-09 14:08:50 -07:00
Todd C. Miller
62895ea442 Sudo 1.9.15p2 2023-11-08 20:10:02 -07:00
Todd C. Miller
0f40753d46 Update PolyPkg from upstream. 2023-11-08 18:46:03 -07:00
Todd C. Miller
a6ac589cc1 sudo_term_restore: don't check c_cflag on systems with TCSASOFT.
If TCSASOFT is present, tcsetattr() will ignore c_cflag.
Fixes a bug where sudo_term_restore() would refuse to change
the terminal settings back if the PARENB control flag was set.
GitHub issue #326.
2023-11-08 16:58:02 -07:00
Todd C. Miller
0497bde983 Quote $osversion since it may include whitespace. 2023-11-08 08:16:57 -07:00
Todd C. Miller
e0d912d1db Use C99 designated struct initializers.
This is less error-prone and would have avoided GitHub issue #325.
2023-11-07 14:47:48 -07:00
Todd C. Miller
45aeeddcbe Sudo 1.9.15p1 2023-11-07 13:46:01 -07:00
Todd C. Miller
87c193f3f9 Correct the order of the strings in SUDOERS_CONTEXT_INITIALIZER.
Fixes GitHub issue #325, a bug introduced in sudo 1.9.15.
2023-11-07 13:38:30 -07:00
Todd C. Miller
d45071af4f In the sudo 1.9.14p3 section, "Python python" should be "Python plugin". 2023-11-06 12:14:40 -07:00
Todd C. Miller
747c340591 Sudo now logs the submitenv in the JSON logs. 2023-11-06 10:14:03 -07:00
Todd C. Miller
3686c9fdd1 Document special cases for AIX-style shared libraries.
The shared object is a member of an archive file that is specified
in parentheses.
2023-11-06 09:39:36 -07:00
Todd C. Miller
e772479272 Add sudoers plugin Debug example and x-ref sudoers man page for details. 2023-11-04 19:36:35 -06:00
Todd C. Miller
ec6906f63b The HP-UX getgrouplist() code has been disabled due to bugs. 2023-11-04 18:51:36 -06:00
Todd C. Miller
097bec06bd sudo_conf_debug_files: special handling of DSO members for AIX
When matching debug files for AIX-style DSOs like sudoers.a(sudoers.so)
we want to match on the full name, the name without the member and
on the member itself.  This makes it possible to use the existing
examples in the sudo.conf fiile on AIX.
2023-11-03 11:29:20 -06:00
Todd C. Miller
24351bdadc sudo_set_grlist and sudo_set_gidlist: set auth registry based on username
Previously we used the global registry but since we have the user's
passwd info we should use that when storing the group and gid lists.
2023-11-03 10:30:56 -06:00
Todd C. Miller
2ffcda8e15 role_to_sudoers: only try to reuse a privilege if one is present 2023-11-02 14:42:42 -06:00
Todd C. Miller
1a11be4d9f store_plugin: avoid potential NULL deref in boolean context
Coverity CID 330466
2023-11-02 14:26:44 -06:00
Todd C. Miller
4833ac0f01 Avoid passing sudo_term_is_raw() -1 for the fd.
Coverity CID 330472
Coverity CID 330468
2023-11-02 14:17:51 -06:00
Todd C. Miller
3b891c136e fmt_info_messages: bump info_msgs_size for submitenv 2023-11-02 13:57:18 -06:00
Todd C. Miller
77c2582907 Better log message when rejecting a setid command in intercept mode. 2023-11-02 13:44:19 -06:00
Todd C. Miller
886f1414eb Move the check for running setid commands in intercept mode to later.
Checking for setid commands in intercept mode after command matching
allows us to log a proper error message.  Previously, we simply
ignored setid commands when matching and the only indication of why
was in the debug logs.
2023-11-02 13:44:17 -06:00
Todd C. Miller
45e3c0dd17 timestamp_open: add some debugging 2023-11-02 09:10:49 -06:00
Todd C. Miller
3297ffa267 sudo_sia_begin_session: add missing struct sudoers_context * arg. 2023-10-31 10:26:57 -06:00
Todd C. Miller
747114f331 verify_krb_v5_tgt: auth name must be const to match struct sudo_auth. 2023-10-31 10:13:19 -06:00
Todd C. Miller
9ef52151ef Disable PAM before enabling Kerberos V. 2023-10-31 10:00:24 -06:00
Todd C. Miller
7ed7b4536f Add Kerberos V build and test to CI. 2023-10-31 09:54:57 -06:00