2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-30 22:05:46 +00:00
Commit Graph

12517 Commits

Author SHA1 Message Date
Todd C. Miller
a06cbb8efa sudo 1.9.14p3
--HG--
branch : 1.9
SUDO_1_9_14p3 v1.9.14p3
2023-07-24 14:25:23 -06:00
Todd C. Miller
01702afcfd Document bug fixes in 1.9.14p3.
--HG--
branch : 1.9
2023-07-24 14:24:18 -06:00
Todd C. Miller
7facc380a3 The sudoers option is "use_pty", not "log_pty"
GitHub issue #291

--HG--
branch : 1.9
2023-07-18 07:26:53 -06:00
Todd C. Miller
aa7f77edd8 Merge sudo_module_register_loghandler and sudo_module_set_default_loghandler.
We now create the LogHandler class for each interpreter in
python_plugin_init() instead of just once in sudo_module_init().
This fixes the crash seen in Py_EndInterpreter() with Python 3.12
and significantly reduces the number of leaked objects tracked by
MemorySanitizer.

--HG--
branch : 1.9
2023-07-24 11:07:45 -06:00
Todd C. Miller
32ac7d4d63 sudo_module_register_loghandler: clear sudo_type_LogHandler on error
Also add comments about PyModule_AddObject stealing a ref on success.

--HG--
branch : 1.9
2023-07-22 08:33:04 -06:00
Todd C. Miller
2b0643f6a2 Work around a crash with Python 3.12.
In sudo_module_set_default_loghandler() if we don't leak the reference
to py_loghandler we get a crash in Py_EndInterpreter() with Python
3.12.  This probably indicates a reference counting bug elsewhere.

--HG--
branch : 1.9
2023-07-21 12:20:18 -06:00
Todd C. Miller
28b05ea8f9 Use PyObject_CallNoArgs() where possible.
--HG--
branch : 1.9
2023-07-21 10:47:28 -06:00
Todd C. Miller
1143431421 Make sudo_type_ConvMessage and sudo_type_LogHandler static.
They are not used outside their respective compilation units.

--HG--
branch : 1.9
2023-07-21 10:46:16 -06:00
Todd C. Miller
46159d2844 Adapt to changed formatting of a rejected result in Python 3.12
--HG--
branch : 1.9
2023-07-20 07:46:28 -06:00
Todd C. Miller
58cd8e2302 Remove trailing whitespace from test output.
--HG--
branch : 1.9
2023-07-20 06:57:19 -06:00
Todd C. Miller
8aeb76f7f2 Use Py_InitializeFromConfig() not Py_InitializeEx() for Python >= 3.8.
Avoids deprecation warnings on Python 3.12.

--HG--
branch : 1.9
2023-07-18 20:18:38 -06:00
Todd C. Miller
5a6f0d5b19 Added tag SUDO_1_9_14p2 for changeset 47c0bf9a7ebb
--HG--
branch : 1.9
2023-07-15 09:41:19 -06:00
Todd C. Miller
2a3b848e4f sudo 1.9.14p2
--HG--
branch : 1.9
SUDO_1_9_14p2 v1.9.14p2
2023-07-15 09:41:12 -06:00
Todd C. Miller
181b639fbe Document bug fixes in 1.9.14p2.
--HG--
branch : 1.9
2023-07-14 15:29:52 -06:00
Todd C. Miller
23fc7abfad runas_userlist_matches: fix matching a Runas_Spec with an empty runas user.
We should only match a rule with an empty runas user if a group was
specified on the command line (sudo -g) without a user (no -u option)
or the user specified their own name on the command line.
GitHub issue #290

--HG--
branch : 1.9
2023-07-15 08:44:57 -06:00
Todd C. Miller
d821e8da3b Pass SUDO_TERM_OFLAG to sudo_term_raw() when sudo output is piped.
This fixes a problem with "stair-stepped" output when the sudo-run
command's output is piped to another program and the command reads
input from the terminal.

--HG--
branch : 1.9
2023-07-14 14:12:18 -06:00
Todd C. Miller
9cdebcf907 Simplify the exec_monitor() foreground flag.
Add cmnd_foreground flag that is only true if sudo is the foreground
process and the CD_EXEC_BG flag is not set and pass it to exec_monitor().
This means exec_monitor() no longer needs to check for CD_EXEC_BG.

--HG--
branch : 1.9
2023-07-14 14:08:59 -06:00
Todd C. Miller
77f209e145 sudo_term_raw: change the isig argument into a flags field
There are current two flags: SUDO_TERM_ISIG (enable terminal signals)
and SUDO_TERM_OFLAG (preserve output flags).

--HG--
branch : 1.9
2023-07-14 13:12:51 -06:00
Todd C. Miller
24cc3f4c91 Fix a crash in intercept mode running a command with NULL argv[0].
Newer Linux kernels replace a NULL argv[0] with the empty string,
we should as well.

--HG--
branch : 1.9
2023-07-12 09:29:00 -06:00
Todd C. Miller
8f3b92ee89 Added tag SUDO_1_9_14p1 for changeset fc033946b1a9
--HG--
branch : 1.9
2023-07-11 14:27:13 -06:00
Todd C. Miller
e1b4d21a23 sudo 1.9.14p1
--HG--
branch : 1.9
SUDO_1_9_14p1 v1.9.14p1
2023-07-11 14:26:52 -06:00
Todd C. Miller
696094c0e1 Docume bug fixes in 1.9.14p1.
--HG--
branch : 1.9
2023-07-11 14:24:42 -06:00
Todd C. Miller
ff5f68f2e2 fmt_info_messages: don't include ttyname if it is NULL
The NULL check was commented out for testing but should have been
restored.  Fixes a potential protocol error message from sudo_logsrvd.

--HG--
branch : 1.9
2023-07-11 14:15:46 -06:00
Todd C. Miller
ac830c558d evlog_new: store a new copy of peeraddr, not a pointer to a buffer.
Starting in sudo 1.9.14, eventlog_free() will free the peeraddr
member too so it needs to be dynamically allocated.

--HG--
branch : 1.9
2023-07-11 13:51:16 -06:00
Todd C. Miller
8fe76f4414 Added tag SUDO_1_9_14 for changeset 8010d7515347
--HG--
branch : 1.9
2023-06-27 11:34:51 -06:00
Todd C. Miller
26f1789b3f Merge sudo 1.9.14 from tip.
--HG--
branch : 1.9
SUDO_1_9_14 v1.9.14
2023-06-27 11:34:37 -06:00
Todd C. Miller
a2a87323eb Merge pull request #275 from AtariDreams/emergency
Set command_info to NULL once it is freed
2023-06-26 13:52:48 -06:00
Rose
0bb41ed82a Set command_info to NULL once it is freed
The lack of setting to NULL is a holdover from when command_info was a local variable and not a global one. However, we given how other global variables are set to NULL, it is best that we do the same here to avoid potential issues should sudoers_policy_store_result be called again after the first time failed, otherwise we could get a double-free.
2023-06-26 15:08:51 -04:00
Todd C. Miller
676066e2aa Merge pull request #274 from bin-ly/main
Modify the is_script function for match_command.c
2023-06-25 07:55:54 -06:00
binlingyu
f8a45e8a54 Modify the is_script function for match_command.c 2023-06-25 11:15:17 +08:00
Todd C. Miller
7fb98a9a33 Mention C99 requirement. 2023-06-21 07:56:17 -06:00
Todd C. Miller
e0ee845dfc Reference SETENV-related settings in the command environment section.
Based on GitHub PR #273 from Ilya Kulakov.
2023-06-20 15:12:43 -06:00
Todd C. Miller
733d5291b4 Sudo requires a C99 compiler due to the use of flexible array members. 2023-06-20 13:39:10 -06:00
Todd C. Miller
3bdd2214ad Merge pull request #266 from AtariDreams/c99
Do variable length arrays the C99 way
2023-06-20 13:29:30 -06:00
Todd C. Miller
69b486d462 Merge pull request #269 from trackers-lover/main
correct the return value type of function alias_find_used
2023-06-19 10:39:59 -06:00
Todd C. Miller
5d2b1761f6 Clarify that use_pty is on by default starting with 1.9.14. 2023-06-18 12:44:57 -06:00
Todd C. Miller
afb09e0044 Sudo runs the command in a pty by default in 1.9.14 and above. 2023-06-18 08:08:32 -06:00
Todd C. Miller
4da1f373de Add commented out example for disabling use_pty. 2023-06-18 08:03:46 -06:00
Rose
7fd680c983 Do variable length arrays the C99 way
Variable length arrays are supported by C99, but having it denoted as "1" confused the compiler and is not defined.

Note that because we don't get the inferred NULL terminator, we have to increase the malloc size by one.
2023-06-15 15:25:17 -04:00
Todd C. Miller
64b666471a Update Xcode version from 13.2.1 to 13.4.1. 2023-06-15 11:24:44 -06:00
Todd C. Miller
dc49e11fa5 Add plugins/sudoers/regress/testsudoers/passwd to MANIFEST. 2023-06-14 12:48:05 -06:00
Todd C. Miller
c5c589da04 Updated translations from translationproject.org 2023-06-14 11:08:57 -06:00
Todd C. Miller
4f9185f4c5 Document recent bug fixes. 2023-06-14 11:08:24 -06:00
Todd C. Miller
baf482763c Add tests to exercise recent runas user and group bug fixes. 2023-06-14 10:29:07 -06:00
Todd C. Miller
0d17325039 Add test to exercise the bug that prevented the group specified via
"sudo -g" from matching when a Runas_Alias was used in the user or
group portion of a Runas_Spec.
2023-06-14 10:15:38 -06:00
Todd C. Miller
78e65e14ea runaslist_matches: split out user_list and group_list matching.
This makes it possible to call the appropriate runas user or group
list match function when resolving aliases instead of calling
runaslist_matches() itself.  Fixes a bug that prevented the group
specified via "sudo -g" from matching when a Runas_Alias was used
in the user or group portion of a Runas_Spec.
2023-06-13 20:13:24 -06:00
Todd C. Miller
4710283516 runaslist_matches: fix bug when no runas list is specified in sudoers.
If a sudoers rule has no runas list, a user-specified runas group
should only be allowed if it matches a group that the default runas
user belongs to.  Instead, a missing group check allowed the user
run commands as the default runas user with an arbitrary group.

This means that a rule like "somebody host = ALL", which should be
equivalent to "somebody host = (root) ALL", had the same effect as
"somebody host = (root:ALL) ALL".
2023-06-13 10:29:00 -06:00
Todd C. Miller
8c1559e0e3 runaslist_matches: remove special case to handle "sudo -g group"
Now that we are guaranteed to have a runas user list for all sudoers
rules that contain a runas list, we can remove support for the
special case where user_matched is set in the runas group matching
conditional.  This fixes a bug where "sudo -u myuser -g mygroup"
was permitted by a rule like "myuser ALL = (root) ALL".
2023-06-13 16:03:25 -06:00
Todd C. Miller
64ab8cd236 Populate runasusers even when only a grouplist is specified.
When a sudoers rule permits the user to run commands as a group,
not a user, we should set the runasusers to single member with the
special MYSELF token.  This guarantees that the only time runasusers
will be NULL is when no runaslist is present.
2023-06-13 15:46:46 -06:00
Todd C. Miller
a28d2d4128 Python may be built with 32-bit time_t support on 32-bit platforms.
We need to undef the SIZEOF_TIME_T from pyconfig.h so it does not
conflict with our own.
2023-06-11 14:05:02 -06:00