If TCSASOFT is present, tcsetattr() will ignore c_cflag.
Fixes a bug where sudo_term_restore() would refuse to change
the terminal settings back if the PARENB control flag was set.
GitHub issue #326.
When matching debug files for AIX-style DSOs like sudoers.a(sudoers.so)
we want to match on the full name, the name without the member and
on the member itself. This makes it possible to use the existing
examples in the sudo.conf fiile on AIX.
1. Lock the terminal before tcgetattr/tcsetattr
2. Don't restore terminal settings if changed by another process
3. Don't set terminal to raw mode if it is already raw
GitHub issue #312
We rely on the include path to find many of these headers. It
especially doesn't make sense to use #include "foo.h" for headers
in the top-level include directory.
This fixes some -Wconversion warnings and fixes an inconsistency
between the libsudo_util event API and the plugin event API. The
actual struct internals still use shorts to avoid changing the ABI.
This is more portable and eliminates the need to check for SYMLOOP_MAX
(and provide it if missing) in configure. Also quiet some -Wconversion
warnings.
In most cases, these simply expand to a call to sudo_debug_printf2().
We need to keep the function versions around in libsudo_util for
backwards compatibility.
The format value has to be a string literal, every time.
Otherwise, you are not using these functions correctly. To reinforce this fact, I putrestrict over every non-contrib example of this I could find.
We should be checking for integer overflow, rather than checking if size is 0.
Additionally, we should set errno to ENOMEM when this overflow happens.
Finally, the most efficient implementation of the round-up-to-2 algorithm involves the clz intrinsic.
It was already unsigned in sudoers but not in the front-end or the
python plugin. Making this consistent resolves a lot of -Wconversion
warnings. Also clean up some other -Wconversion warnings in sudo_debug.c.
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.