summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Check whether stderr is a tty before trying TIOCGWINSZ.Todd C. Miller2023-04-161-5/+6
|
* Use -no-undefined on macOS to avoid "-undefined dynamic_lookup" warnings.Todd C. Miller2023-04-142-39/+91
| | | | | | Starting with macOS 13, the linker warns when "-undefined dynamic_lookup" is used. This is added by libtool by default on macOS but we can suppress it by passing -no-undefined to libtool.
* Add make to Dockerfile and sort packages.Todd C. Miller2023-04-087-27/+22
|
* Enable the use_pty option by default for sudo 1.9.14.Todd C. Miller2023-04-064-9/+31
| | | | GitHub issue #258
* Split up the monolithic sudoers_policy_main() function.Todd C. Miller2023-04-053-135/+247
| | | | | | | | | | This splits the code to find the command, perform a sudoers lookup, ask for a password as needed, and perform post-lokup checks out into sudoers_check_common(). The old sudoers_policy_main() has been replaced by sudoers_check_cmnd() (called by sudoers_policy_check()), sudoers_validate_user() (called by sudoers_policy_validate()) and sudoers_list() (called by sudoers_policy_list()). The list_user lookup is now performed in sudoers_list().
* Move the root_sudo check until after we apply per-command Defaults.Todd C. Miller2023-04-051-8/+8
| | | | | It is possible, though unlikely, for "root_sudo" to be used in a per-command Defaults statement.
* sudoers_policy_main: restore locale if sudoers_lookup() fails.Todd C. Miller2023-04-011-4/+2
| | | | | Previously, if sudoers_lookup() set VALIDATE_ERROR, the sudoers locale would still be in effect instead of the original locale.
* sudoers_lookup_pseudo: remove validated function argumentTodd C. Miller2023-04-011-5/+3
| | | | | | This was always set to FLAG_NO_USER|FLAG_NO_HOST which are cleared at the top of the fuction. Make validated a local variables, initialized to 0, instead. No change in behavior.
* The I/O log file name is not just the basename of the full iolog_path.Todd C. Miller2023-03-312-2/+0
| | | | | | | The audit plugin already has the correct value for iolog_file, don't overwrite it with basename(iolog_path). In the future we may wish to pass in iolog_file and iolog_dir in addition to iolog_path. Fixes Bug #1046.
* Warn with "unknown user" not "unknown uid" if user cannot be resolved.Todd C. Miller2023-03-291-3/+2
| | | | | Prior to sudo 1.8 this was after a getpwuid() but now we use getpwnam().
* Set timestamp_uid and timestamp_gid via a callback.Todd C. Miller2023-03-291-29/+38
| | | | | This also makes it possible to include the location of the line in the sudoers file in the warning message (and mail).
* Fix display of escape sequencees in ldapsearch example.Todd C. Miller2023-03-282-2/+2
|
* White space is not allowed between Defaults and '@', ':', '!', '>'.Todd C. Miller2023-03-282-20/+68
| | | | The EBNF made it appear that this is allowed when it really is not.
* Make struct {command,user}_details pointers const where possible.Todd C. Miller2023-03-2713-65/+68
|
* Make user_details private to main.Todd C. Miller2023-03-274-31/+37
|
* Make user_details private to sudo.c.Todd C. Miller2023-03-279-79/+97
|
* Use sudo_get_ttysize() in help() and usage().Todd C. Miller2023-03-251-6/+10
| | | | This eliminates a dependency on the user_details global.
* Regenerate with the autoconf 2.72c snapshot.Todd C. Miller2023-03-272-7/+7
|
* Store submitcwd (from user_details) in struct command_details.Todd C. Miller2023-03-253-9/+11
| | | | This eliminates use of the user_details global from exec_setup().
* utmp_fill: user is now always non-NULL, no need for user_details.Todd C. Miller2023-03-241-6/+1
|
* Remove list_user global.Todd C. Miller2023-03-243-6/+8
|
* No need to declare tgetpass_flags, it is already in sudo.h.Todd C. Miller2023-03-241-3/+1
|
* No need for sudo_mode to be global anymore.Todd C. Miller2023-03-241-2/+1
|
* Make command_details private to main().Todd C. Miller2023-03-241-10/+10
|
* Make iobufs private to exec_iolog.c.Todd C. Miller2023-03-244-15/+13
|
* Remove ttymode and its associated values.Todd C. Miller2023-03-241-5/+0
|
* Move ptyname to struct exec_closureTodd C. Miller2023-03-245-38/+37
|
* Move pty_make_controlling() to exec_monitor.c where it is called.Todd C. Miller2023-03-243-25/+26
| | | | We can use details->tty to access the pty follower path.
* Eliminate utmp_user global, just use the value in struct command details.Todd C. Miller2023-03-242-8/+6
|
* Replace tty_mode global with term_raw flag in struct exec_closure.Todd C. Miller2023-03-244-57/+93
| | | | | | The pty_cleanup hook needs access to the closure so add pty_cleanup_init() to store a pointer to the closure for use by pty_cleanup_hook().
* Register pty cleanup function in exec_pty(), not exec_cmnd_pty().Todd C. Miller2023-03-243-6/+9
| | | | We want it to execute in the main sudo process, not the monitor.
* Make ttyblock private to exec_iolog.cTodd C. Miller2023-03-241-2/+3
|
* exec_pty.c: move foreground flag to struct exec_closure.Todd C. Miller2023-03-232-15/+16
| | | | | Also make pipeline flag private to exec_pty() and remove the unneeded check_foreground() prototype.
* On resume, always sync the pty terminal settings with /dev/tty.Todd C. Miller2023-03-231-25/+27
| | | | | | | | | | Changes made to the terminal settings while the command is suspended are now reflected in the pty when the command is resumed. This is more consistent with the non-pty behavior and allows for the removal of the "tty_initialized" global. One downside to this change is that if a terminal-based program using the pty is stopped with SIGSTOP it may have the wrong terminal settings on resume. However, this is no different from the non-pty case.
* Correct a comment.Todd C. Miller2023-03-232-2/+2
|
* GitHub sponsor settings.Todd C. Miller2023-03-221-0/+2
|
* Use built-in tests for bit types instead of using AC_CHECK_TYPES.Todd C. Miller2023-03-223-134/+424
| | | | | This should be more portable as it handles the quirks of some older systems.
* Quiet compiler warnings on systems where pid_t is not an int.Todd C. Miller2023-03-222-7/+7
| | | | Historically, pid_t was a long on some 32-bit systems like Solaris.
* Silence "used uninitialized" false positives with older gcc versions.Todd C. Miller2023-03-221-2/+2
|
* exec_pty: always copy the terminal settings from /dev/tty the pty.Todd C. Miller2023-03-221-13/+19
| | | | | | | | | Previously, we only did this when running in the foreground but this can cause problems when running a program that reads the terminal settings or window size in the background. If sudo is running in the background, the terminal settings will be updated if it transitions to the foreground process. Based on a suggestion from From Duncan Overbruck.
* check_foreground: use SFD_LEADER not SFD_FOLLOWER (which was closed).Todd C. Miller2023-03-221-3/+4
| | | | | Also use SFD_LEADER for sudo_term_copy() in exec_pty() for consistency. From Duncan Overbruck.
* suspend_sudo_pty: fix cut & pasto in last commit to catch SIGCONT.Todd C. Miller2023-03-221-4/+3
| | | | | Also set sa.sa_handler to SIG_DFL instead of SIG_IGN. There is no difference for SIGCONT but it means we can re-use sa as-is later.
* Catch SIGCONT and restore terminal settings on resume from SIGSTOP.Todd C. Miller2023-03-211-35/+75
| | | | | | While we cannot catch SIGSTOP, we _can_ catch SIGCONT and set /dev/tty to raw mode when running in the foreground. Ignore SIGCONT in suspend_sudo_pty() so we don't call resume_terminal() twice.
* Only convert a signal number to a name if we are going to use it.Todd C. Miller2023-03-212-41/+56
| | | | It is mostly used for debug logging.
* Move updating of the window size back to the main sudo process.Todd C. Miller2023-03-213-66/+18
| | | | | We can use the leader file descriptor with TIOCGWINSZ to set the window size of the pty. Thanks to Duncan Overbruck for the hint.
* visudo: restore controlling terminal after running the editor.Todd C. Miller2023-03-211-20/+85
| | | | | | | Otherwise, visudo will get SIGTTOU if it tries to write to the terminal after the editor finishes. Also avoid races by setting the process group ID in both the parent and child, and grant the controlling terminal in the parent, not the child.
* Warn about ignored files in sudoers.d in visudo.Todd C. Miller2023-03-208-41/+120
|
* Replace sudoers_warnings with sudoers_verbose.Todd C. Miller2023-03-2011-28/+41
| | | | This is now an int, with values > 1 reserved for visudo.
* Split push_include() into push_include() and push_includedir().Todd C. Miller2023-03-205-9/+34
| | | | This moves the "isdir" function argument to the internal version.
* Pass around const struct sudo_nss pointers where possible.Todd C. Miller2023-03-178-25/+25
|