Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
b89cf34b53
Replace sudo_fatal(NULL) with an "unable to allocate memory" message
...
that includes the function name.
2018-10-12 08:39:12 -06:00
Todd C. Miller
a71eb86a71
Add new -S option to sleep while the command was suspended.
...
The default behavior is now to not consider the time the command
was suspended as part of the normal inter-event delay.
2018-10-05 14:48:35 -06:00
Todd C. Miller
cf07dc0757
Add a suspend event type to the I/O log to log suspend/resume of
...
the command so we can skip that delay during replay.
2018-10-05 14:16:08 -06:00
Todd C. Miller
e318f27fba
When parsing an I/O log timing line, store the result in a timespec,
...
not a double. The speed factor (for scaling the delay) in sudoreplay
is still a double but we only need to adjust the delay if the factor
is something other than 1.0.
2018-08-29 09:57:12 -06:00
Todd C. Miller
04d1f56d90
Use struct timespec, not struct timeval in the event subsystem.
...
Use ppoll() or pselect() if avaialble which use timespec.
2018-08-25 21:02:05 -06:00
Todd C. Miller
aaad554cda
Add regress test for I/O log plugin endpoints
2018-08-23 15:35:02 -06:00
Todd C. Miller
1cb5ab8b9c
Make "sudoreplay -m 0" skip the pauses entirely.
2018-03-08 07:53:29 -07:00
Todd C. Miller
42fe0409f6
Add sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
...
Similar the dispatch function in libevent.
2018-02-19 11:00:10 -07:00
Todd C. Miller
a885b952fb
Remove use of AC_HEADER_TIME, only obsolete platforms actually
...
need this. Also stop removing sys/time.h unless the source file
uses struct timeval.
2018-01-17 09:52:15 -07:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
01587b1b14
Add missing carriage return before prompt when replay is done.
2017-12-02 21:32:24 -07:00
Todd C. Miller
e100259619
Fix replaying sessions that contain input logs. When the inter-record
...
timeout expires we need to read the next record if there is nothing
to output.
2017-09-01 09:00:17 -06:00
Todd C. Miller
5ab1d724a9
fix playback of stdout/stderr without embedded carriage returns
2017-07-31 10:44:39 -06:00
Todd C. Miller
4b51622914
Quiet a coverity false positive.
2017-07-27 11:36:10 -06:00
Todd C. Miller
2d30c42a03
Change to a single event loop in sudoreplay and use signal events.
2017-07-27 09:45:35 -06:00
Todd C. Miller
1918ec4a55
When reading a single character via a switch() use "default: instead
...
of "case 1:" to quiet a coverity warning.
2017-07-17 14:44:18 -06:00
Todd C. Miller
6509482bfd
Initialize ch in getsize_cb() in case we are called with the wrong
...
initial state.
2017-07-17 14:13:08 -06:00
Todd C. Miller
58858513f0
remove unused variable
2017-07-17 14:09:48 -06:00
Todd C. Miller
28fe335017
don't restore the cursor when setting terminal size, we don't want the cursor to move
2017-07-14 14:30:43 -06:00
Todd C. Miller
dbddf1bc36
Read the xterm terminal size using an event so we can easily time
...
out if needed.
2017-07-14 10:10:00 -06:00
Todd C. Miller
9a76678317
Allow sudoreplay to adjust the window size on xterm-like terminals.
2017-07-13 11:20:45 -06:00
Todd C. Miller
f79a236533
Log window size change events in the sudoers I/O plugin.
...
Let sudoreplay parse a timing file with window change events
(currently ignored).
2017-07-12 05:47:28 -06:00
Todd C. Miller
d979898e71
Remove use of non-standard sigaction_t
2017-05-12 10:02:18 -06:00
Todd C. Miller
e453c97976
Restore the error message for sudo_ev_add() failure.
2017-05-12 10:02:17 -06:00
Todd C. Miller
0244f931dd
Only display string version of errno if sudo_ev_add() fails for now
2017-05-10 09:22:07 -06:00
Todd C. Miller
4e67ac56bd
In check_input() when switch()ing on the return value of read(),
...
use the default label instead of 1 for the success case. It is
only reading a single byte so the two are equivalent but it reads
better using default.
2017-05-04 12:25:51 -06:00
Todd C. Miller
1a047b156d
Check sudo_ev_add() return value. Coverity CID 168362
2017-05-04 11:10:42 -06:00
Todd C. Miller
cb1f044017
Allow stdin and ttyin to be displayed too. The only one that is
...
really useful in sudoreplay is stdin when input is from a pipe.
2016-11-30 13:38:01 -07:00
Todd C. Miller
1aea3f6e3e
Just use malloc_options "S" on OpenBSD instead of "AFGJPR".
2016-11-25 09:04:00 -07:00
Todd C. Miller
9b886f6b2c
The flush parameter of sudo_term_restore() is bool, not int.
2016-10-17 08:57:17 -06:00
Todd C. Miller
3f022419ae
Be consistent with the naming of the variable used to store the
...
function return value. Previously, some code used "rval", some
used "ret". This standardizes on "ret" and uses "rc" for temporary
return codes.
2016-09-08 16:38:08 -06:00
Todd C. Miller
398ddd0467
In replay_session() free iov at the end of the function (if needed)
...
instead of after processing each line from the timing file.
Coverity CID 104843.
2016-05-09 14:54:26 -06:00
Todd C. Miller
e528cad795
Add io_log_read() and io_log_gets() to hide differences between
...
gzread/fread and gzgets/fgets. Check for premature EOF and error
from io_log_read(). Also sanity check the index in the timing file.
Coverity CID 104630.
2016-05-09 14:27:33 -06:00
Todd C. Miller
b84b2e6805
Free the events and event base before returning from replay_session().
...
Coverity CID 104116, 104117.
2016-05-07 05:16:03 -06:00
Todd C. Miller
bf734419bf
In parse_expr(), move the "bad" label after the "default" case in
...
the switch(), not before it. This seemed to confuse Covertity,
resulting in a false positive, CID 104095.
2016-05-04 16:48:02 -06:00
Todd C. Miller
67183d74f4
Remove include/compat/timespec.h. Systems old enough to lack struct
...
timespec are too old to build a modern sudo.
2015-09-09 11:13:22 -06:00
Todd C. Miller
0c70df5de9
Implement suspend/resume callbacks for the conversation function.
...
If suspended, close the timestamp file (dropping all locks). On
resume, lock the record before reading the password.
For this to work properly we need to be able to run th callback
when tsetattr() suspends us, not just when the user does. To
accomplish this the term_* functions now return EINTR if SIGTTOU
would be generated. The caller now has to restart the term_*
function (and send itself SIGTTOU) instead of it being done
automatically.
2015-09-07 06:06:08 -06:00
Todd C. Miller
445e6f2e9a
Check sudo_conf_read() return value and exit on fatal error (a
...
warning was already printed by sudo_conf_read()).
2015-07-07 13:17:50 -06:00
Todd C. Miller
d77941c2be
We require POSIX so no need to conditionally include dirent.h.
...
Add a check for d_namlen and use the result in the NAMLEN macro.
2015-07-02 09:24:48 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
aedaac8cca
Silence clang analyzer warning on glibc systems where the first
...
argument to qsort() is marked as non-NULL.
2015-06-23 16:37:01 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
c36415417f
Add function name to "unable to allocate memory" warnings.
2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
e2328479dd
Use strtok_r() instead of strtok()
2015-06-19 12:35:51 -06:00
Todd C. Miller
4f9cabd005
Remove obsolete memory.h include.
2015-06-18 21:02:57 -06:00
Todd C. Miller
d004b02fc6
Use non-exiting allocatings in the sudoers plugin.
2015-06-17 06:49:59 -06:00
Todd C. Miller
8bb5897091
All modern systems should have LINE_MAX.
2015-02-19 09:59:25 -07:00