Todd C. Miller
eaa95acb31
Post-process protoc-c files to avoid depending on anonymous unions.
...
Based on a patch from Michael Osipov.
GitHub issue #60
2020-09-04 13:17:51 -06:00
Todd C. Miller
965ad74482
Update to protobuf-c 1.3.3
2020-09-02 09:06:29 -06:00
Todd C. Miller
bd254e1042
Read/write runchroot and runcwd entries in the JSON event log.
2020-09-01 06:26:05 -06:00
Todd C. Miller
86513c78b6
Unit test for exptilde
2020-09-01 06:26:05 -06:00
Todd C. Miller
84e6e6ccf9
Update copyright year on some files where it was out of date.
2020-08-31 14:09:36 -06:00
Todd C. Miller
019f1f6b93
Use sigabbrev_np(3) to access signal abbreviations if supported.
...
glibc-2.32 has removed sys_sigabbrev[], we can use sigabbrev_np(3) instead.
2020-08-25 16:48:13 -06:00
Todd C. Miller
cb2eb8ea94
Add missing ZFALLTHROUGH and use spaces not tabs.
2020-08-13 21:10:08 -06:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
cbad17a994
Move inclusion of compat headers up with the system headers.
...
Now that sudo_dso_public is defined in config.h we don't need sudo_compat.h
before including the compat headers.
2020-08-12 10:07:07 -06:00
Todd C. Miller
985af422d2
Rename __dso_public -> sudo_dso_public and move to config.h.
2020-08-12 09:57:42 -06:00
Todd C. Miller
076d0376db
We no longer need to include sudo_gettext.h before sudo_compat.h
2020-08-12 09:50:35 -06:00
Todd C. Miller
ce97ca28db
Use OpenBSD-compatible freezero() in place of explicit_bzero() + free()
2020-08-10 19:24:33 -06:00
Todd C. Miller
cef6e3687e
Switch from memset_s() -> explicit_bzero().
...
memset_s() (and all of Annex K) is likely to be removed from the
a future version of the standard.
2020-08-10 19:24:32 -06:00
Todd C. Miller
fa5d44b8b5
Quiet some clang 10 analyzer warnings.
2020-08-07 14:22:56 -06:00
Todd C. Miller
c87a47735d
Add ZFALLTHROUGH macro to use instead of /* FALLTHROUGH */ comments.
2020-08-01 13:43:27 -06:00
Todd C. Miller
03ad96e445
Use the fallthrough attribute instead of /* FALLTHROUGH */ comments.
2020-08-01 13:10:50 -06:00
Todd C. Miller
3175049e45
Fix typo, runas_uid should be runas_gid.
2020-07-06 12:17:58 -06:00
Todd C. Miller
95ba6645d2
Add FALLTHROUGH comments to quiet -Wimplicit-fallthrough
2020-06-20 14:23:19 -06:00
Todd C. Miller
d4739533fd
Add regress test to catch swapids() bug when called by iolog_mkdtemp()
2020-06-18 15:14:00 -06:00
Todd C. Miller
bc6e36e940
Fix a typo that prevented swapids() from restoring the original gid.
...
This led to a regression when the iolog_file setting ends in six or
more X's or when the I/O logs are stored on NFS.
2020-06-16 05:44:57 -06:00
Todd C. Miller
c63ba01e0e
In iolog_openat() enable the write bit on pre-existing files if needed.
...
This prevents problems caused by the change to strip the write bit
from the timing file when it is finished.
2020-05-19 13:14:31 -06:00
Todd C. Miller
0312292e99
Add iolog_clearerr() that acts like clearerr(3).
...
Works for both compressed and uncompressed I/O logs.
2020-05-18 14:16:47 -06:00
Todd C. Miller
8ef5c4cf9d
Set DEFAULT_TEXT_DOMAIN in lib/util's Makefile not individual .c files.
...
We no longer need to include sudo_gettext.h before sudo_compat.h
2020-05-18 11:19:58 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
aaea462277
Prefer SIGSYS if SIGUNUSED is defined to the same value.
...
Fixes a regress failure on musl libc where SIGSYS and SIGUNUSED
share the same value.
2020-05-15 19:25:30 -06:00
Todd C. Miller
36bbf629be
Add missing sys/types.h include; fixes a compilation problem on musl libc.
2020-05-15 18:56:40 -06:00
Todd C. Miller
83d1bee918
Rename sudo_parse_host_port -> iolog_parse_host_port and mv to lib/iolog
...
It is not used outside of the I/O log client and server and the
host:port syntax may change in the future.
2020-05-11 08:47:54 -06:00
Todd C. Miller
0cf2e09e0c
Apply spelling fixes.
...
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -06:00
Todd C. Miller
6901fc97ac
Add a ClientHello message that client sends to the server.
...
This makes it easier to detect a plaintext client sending to a
TLS port. Without this, the TLS server will be silent as it
waits for the client to initiate the TLS connection.
2020-05-05 13:23:26 -06:00
Todd C. Miller
e5f8214c0a
Remove the tls parameter from the ServerHello message.
...
The TLS connection is now initiated before ServerHello is received.
2020-05-05 13:23:26 -06:00
Todd C. Miller
b5a317aeb9
Add support for a tls flag in sudo_parse_host_port().
...
If the string "(tls)" appears at the end, the tls flag is set to true
and the default tls port is used if necessary.
2020-05-05 13:23:26 -06:00
Todd C. Miller
0460008c5b
Handle EAGAIN like we do ENOMEM from poll() and select().
...
On some systems, poll() and select() can return EAGAIN instead
of ENOMEM if there is a kernel resource shortage. In this case
we just re-enter the event loop and retry.
2020-05-04 11:23:35 -06:00
Todd C. Miller
2b1e986572
Do not call poll(2) or ppoll(2) with nfds > RLIMIT_NOFILE.
...
Both poll(2) and ppoll(2) will return EINVAL if the nfds function
argument is larger than the max files per process resource limit.
Prevent this by limiting the max number entries in the pfds[] array
to the RLIMIT_NOFILE soft limit.
2020-04-30 15:54:34 -06:00
Todd C. Miller
85fe30e49b
The timeout parameter of sudo_ev_add() should be const.
2020-04-29 11:27:30 -06:00
Todd C. Miller
99129ba41f
Make gl_pathc, gl_matchc and gl_offs size_t in glob_t to match POSIX.
2020-04-21 11:05:29 -06:00
Todd C. Miller
3bf4172272
Explicitly include stdio.h for getdelim(3)
2020-04-08 12:42:58 -06:00
Robert Manner
8f0370cd8e
lib/iolog/iolog_fileio.c: do not call fchown on invalid fd
...
Fixes the warning in the log:
iolog_write_info_file_json: unable to fchown 0:0 /var/log/...: Bad file descriptor
2020-04-06 07:31:01 -06:00
Todd C. Miller
01ceba0445
Simply the JSON parsing code a bit.
...
We can use a single stack for nested objects and arrays.
There is also no need to track the current object and array separately.
This allows us to remove the array special case when assigning a value.
2020-03-29 05:05:08 -06:00
Todd C. Miller
3cd9cbbadf
Add tests for the simple json parser.
2020-03-29 05:05:08 -06:00
Todd C. Miller
cffda82e20
Do not use JSON_ARRAY with sudo_json_add_value()
2020-03-29 05:05:08 -06:00
Todd C. Miller
056173e572
Parse I/O JSON info file in JSON if present.
...
The JSON version includes more information than the original "log"
file in the I/O log dir.
2020-03-29 05:05:08 -06:00
Todd C. Miller
ea9b711a70
Write an extended I/O info log in JSON format.
...
This will be used by sudoreplay if it exists to get more information
about the command being replayed.
2020-03-29 05:05:08 -06:00
Todd C. Miller
a644c1d1d2
iolog_parse_loginfo() now opens the log file itself.
2020-03-29 05:05:08 -06:00
Todd C. Miller
5034ea91be
Some new source files got created with my old email address.
2020-03-29 05:05:08 -06:00
Todd C. Miller
d75d36b68c
Include stdlib.h for malloc(3) prototype.
...
We shouldn't rely on it to be implicitly included via OpenSSL headers.
2020-03-17 17:24:46 -06:00
Todd C. Miller
d83c09fb66
Add SUDO_EV_MASK to mask off invalid event values.
...
Now used by sudo_ev_init() to avoid bogus events.
2020-03-12 14:00:15 -06:00
Todd C. Miller
5635c22f6b
Add --disable-log-server and --disable-log-client configure options.
...
These can be used to optionally disable building sudo_logsrvd and
support for remote I/O logging in the sudoers plugin respectively.
2020-02-26 13:17:40 -07:00
Todd C. Miller
7e5641bc76
Fix unlocking of an entire file with lockf().
...
Since lockf() uses the files's current offset, we need to seek to
the start of the file to unlock the entire file.
2020-02-22 16:09:59 -07:00
Todd C. Miller
1b930b585d
Add sudo_json_free_v1 to symbol exports file too.
2020-02-20 12:21:09 -07:00