Commit Graph

11767 Commits

Author SHA1 Message Date
Todd C. Miller
a14bef6a41 Do not check files generated by protbuf-c with PVS-Studio 2022-06-29 10:17:35 -06:00
Todd C. Miller
b6151781ce Quiet some harmless PVS Studio warnings. 2022-06-29 10:08:55 -06:00
Todd C. Miller
54ed54d94e Use "unable to allocate memory" warning on malloc failure.
This is consistent with the rest of the sudo source code.
2022-06-29 10:00:03 -06:00
Todd C. Miller
3e21c8da5c Add missing PVS Studio Open Source comments.
Also avoid checking protobuf-c source and protobuf-c generated files.
2022-06-29 09:45:04 -06:00
Todd C. Miller
e5834bd405 Use #include <config.h> not #include "config.h" for consistency.
Otherwise, some compilers may do the wrong thing in a build
dir if there is a config.h file in the source dir too.
2022-06-29 08:47:16 -06:00
Todd C. Miller
38278640ca Update group_plugin_load() stub to match its prototype. 2022-06-28 16:42:25 -06:00
Todd C. Miller
13672f28df Make sudo pass -Wwrite-strings 2022-06-28 16:33:15 -06:00
Todd C. Miller
b3a8cad346 A typo prevented -Wno-deprecated-declarations from being used on macOS. 2022-06-28 15:43:27 -06:00
Todd C. Miller
0efd616202 Fix missing prototype warning. 2022-06-27 14:01:29 -06:00
Todd C. Miller
89666e7c37 Define _LFS64_LARGEFILE, _LARGEFILE64_SOURCE if 64-bit or _LARGE_FILES set.
autoconf does not define _LARGEFILE64_SOURCE by default but zlib
expects it (its own configure script will define it).
Fixes a missing prototype for crc32_combine_gen64() on AIX and HP-UX.
2022-06-27 13:02:13 -06:00
Todd C. Miller
f5ac1317c4 Make sudo pass -Wmissing-prototypes 2022-06-27 12:48:03 -06:00
Todd C. Miller
f432209304 Include inttypes.h if stdint.h is not present.
Bug #1035
2022-06-27 07:20:37 -06:00
Todd C. Miller
e9c2695268 intercept_write: remove unused CD_USE_PTRACE code.
It is not possible to end up in intercept_write when CD_USE_PTRACE
is set.
2022-06-21 09:54:41 -06:00
Todd C. Miller
33547702f3 readlink(2) does NUL-terminate the buffer, do it manually.
Fixes a bug where the current working directory could include garbage
in intercept mode using ptrace(2).
2022-06-21 20:12:58 -06:00
Todd C. Miller
01a9e5a157 Sudo 1.9.11p3 2022-06-20 16:58:03 -06:00
Todd C. Miller
332a6afe77 Set TCP_NODELAY on the socket used for intercept IPC to reduce latency.
On some systems, Nagle's algorithm was delaying receipt of the data,
causing commands with intercept or log_subcmds to run slowly.
Related to Bug #1034.
2022-06-20 16:22:29 -06:00
Todd C. Miller
b10201bdc4 Use blocking I/O when talking to the sudo process.
Also check for EAGAIN/EINTR when reading the message size.
Fixes a problem seen on AIX where recv_intercept_response() could
fail unexpectedly.  Bug #1034.
2022-06-20 15:02:11 -06:00
Todd C. Miller
8829c028d3 Add debug printfs when send/recv return EAGAIN or EINTR.
These are not actually errors but can help gain insight into what
is going on and, in the case of EAGAIN, whether or not there may
be a kernel resource starvation problem.
2022-06-20 14:58:06 -06:00
Todd C. Miller
49c27f5278 log_exit_status: make local variables match struct evlog members. 2022-06-14 13:10:13 -06:00
Todd C. Miller
5787da7b21 Quiet a compiler warning on macOS.
The getgrouplist() groups array on macOS is int * instead of gid_t *.
2022-06-13 14:59:00 -06:00
Todd C. Miller
04746d0e65 Sudo 1.9.11p2 2022-06-12 08:05:00 -06:00
Todd C. Miller
dfee181d15 Fix compilation on Linux/x32; GitHub issue #158 2022-06-11 16:59:18 -06:00
Todd C. Miller
1c00c7c238 Fix pasto in comment after HAVE_PRIV_SET #endif 2022-06-10 09:42:22 -06:00
Todd C. Miller
169e049821 Fix typo, we should define SSIZE_MAX if it is not defined. 2022-06-10 09:34:33 -06:00
Todd C. Miller
6525436db7 Change black list -> blocklist
This was missed in the previous conversion.
2022-06-09 14:49:49 -06:00
Todd C. Miller
d04810c4f2 Save a pointer to the event_alloc parameter in the plugin open function.
That way we don't need to pass event_alloc around to the log client
functions.
2022-06-09 13:05:21 -06:00
Todd C. Miller
b6a6451482 Fix regression with zero-length messages introduced in protobuf-c PR 500. 2022-06-09 07:34:55 -06:00
Todd C. Miller
d2bf3aad06 Sudo 1.9.11p1 2022-06-08 08:31:27 -06:00
Todd C. Miller
964bcfa2dd Make read and write events persistent and disable as needed.
For the read callback, disable reader when the buffer is full.
For the write callback, disable writer when the buffer is consumed.
2022-06-07 12:40:00 -06:00
Todd C. Miller
7689b8718c Check for SECCOMP_MODE_FILTER not SECCOMP_SET_MODE_FILTER.
This matches the actual prctl() call we use.
2022-06-07 10:50:59 -06:00
Todd C. Miller
fedcb99ee8 Merge pull request #157 from 0x2b3bfa0/improve-tag-spec-ebnf-docs
Improve Tag_Spec EBNF documentation
2022-06-07 09:27:31 -06:00
Todd C. Miller
161b01fccd Treat EINTR in a callback like we do EAGAIN.
We shouldn't get EINTR in practice since we set SA_RESTART when
registering signal handlers but it doesn't hurt to be consistent.
2022-06-07 09:25:07 -06:00
Helio Machado
d60b6c618f Improve Tag_Spec EBNF documentation 2022-06-07 17:24:45 +02:00
Todd C. Miller
7f98ae7d23 Merge pull request #156 from delroth/aarch64-build
exec_ptrace: fix missing sudo_pt_regs on aarch64
2022-06-07 09:20:35 -06:00
Pierre Bourdon
d549adf04b exec_ptrace: fix missing sudo_pt_regs on aarch64
AArch64 already had an existing "user_pt_regs" struct and didn't need a
struct alias before the renaming to "sudo_pt_regs". Make the code build
again by adding the now missing alias.

Fixes: 2eb8ff17
2022-06-07 17:14:39 +02:00
Todd C. Miller
a4b2012c17 Merge pull request #154 from 0x2b3bfa0/fix-tag-spec-docs
Add missing colon in Tag_Spec documentation
2022-06-07 08:31:51 -06:00
Todd C. Miller
ab00d29ecf Merge pull request #152 from particleflux/fix-sudoers-typo
Fix typo in sudoers comment
2022-06-07 08:30:44 -06:00
Helio Machado
3405fac05e Add missing colon in Tag_Spec documentation 2022-06-07 16:28:14 +02:00
Stefan Linke
a074d058ef Fix typo in sudoers comment
Fix a typo in the sudoers comment about `maxseq` param.

Introduced by 906eb19ece in 1.9.11.
2022-06-07 13:03:03 +02:00
Todd C. Miller
e4ea5ad8af Only shift unsigned values to avoid implementation-specific behavior.
This converts the arithmetic shifts to logical shifts.
2022-06-06 20:15:37 -06:00
Todd C. Miller
263fdc6b06 Fix issue protobuf-c#499: unsigned integer overflow
Signed-off-by: 10054172 <hui.zhang@thalesgroup.com>
2022-06-06 20:15:03 -06:00
Todd C. Miller
b77cbb2e67 Fix building with select (not poll) when fd_set is not defined in sys/types.h.
We can use a void * for the fd_set arrays and just add a cast when
using the FD_SET macros.
2022-06-06 19:42:29 -06:00
Todd C. Miller
c2a131714a Reinstall the event handler if we get EAGAIN from read/write callback.
The read and write events do not set SUDO_EV_PERSIST so we need to
explicitly re-enable the event if there is still data to be read.
Bug #963.
2022-06-06 19:42:07 -06:00
Todd C. Miller
db6fc237c4 If write(2) returns EAGAIN just re-enter the event loop.
This is consistent with how we handle EAGAIN for read(2).
2022-06-06 19:42:06 -06:00
Todd C. Miller
fcb5867f1d Document how setting ModulePath affects the Python search path.
Also advise the user to use a unique prefix to avoid name space
collisions with installed Python modules.  Bug #1031.
2022-06-06 08:39:22 -06:00
Todd C. Miller
96c3c28194 Add EXAMPLES variables for use in the man pages for the examples directory. 2022-06-06 08:36:44 -06:00
Todd C. Miller
24522fb4e4 Updated translations from translationproject.org 2022-06-04 11:44:13 -06:00
Todd C. Miller
258b504be8 Rebuild Croatian message catalog. 2022-06-04 10:25:30 -06:00
Todd C. Miller
4386be3d68 Add new test binaries to the ignore files. 2022-06-03 15:26:06 -06:00
Todd C. Miller
5cb94eb258 Updated translations from translationproject.org 2022-06-03 13:09:57 -06:00