o whitespace cleanup
o show_version doesn't have an errstr argument
o document runas_user and runas_group in command_info[]
o add missing .El at before start of audit section
We should already have displayed a more useful error message.
Otherwise, we can get two "error in event loop" warnings if
the TLS handshake fails (in addition to other error messages).
This can be used to implement logging-only plugins.
The plugin functions now take an errstr argument that can be used
to return an error string to be logged on failure or error.
In getln() if the user enters ^U (erase line) and the write(2) fails,
the remaining buffer size is reset but the current pointer is not.
While here, fix an incorrect break for erase when write(2) fails.
Also disable pwfeedback when input is not a tty as it cannot work.
CVE-2019-18634
Credit: Joe Vennix from Apple Information Security.
PyArg_ParseTuple sets the py_config_tuple pointer, but it does not
increment the reference count, so by decrementing, we end up freeing
the argument passed in.
On each plugin initialization we create a separate python interpreter
which gets stored in the plugin_ctx. The main interpreter is
stored in py_ctx and is used for creating more interpreters (if more plugins
get loaded) and final python deinitialization.
The "traceback" module import and the ImportBlocker initialization was
moved, because it has to happen inside the plugin specific interpreters.
The closure pointer in sudo_conv_callback was being filled in with
a struct getpass_closure ** instead of a struct getpass_closure *.
The bug was introduced in the fix for Bug #910; previously the
closure variable was a struct getpass_closure, not a pointer.
Fix from Michael Norton; Bug #914.
Adapted the default sudo_printf from sudoers plugin to be able to print
errors before plugin open() gets called. (This is used by the multiple io
plugin loading to display error for too much plugin load.)
Since this makes us always have a sudo_log, I have removed the logic about
whether it is available or not.
Separate sudo io plugin symbols are created which stores wrapper
functions adding the context of which python plugin the callback is
about.
These sudo io plugin "slots" get generated with macros by the preprocessor.
This makes sudo support loading multiple python IO plugins like this:
(note the differences in the symbol names)
Plugin python_io python_plugin.so ModulePath=... ClassName=SudoIOPlugin1
Plugin python_io1 python_plugin.so ModulePath=... ClassName=SudoIOPlugin2
Plugin python_io2 python_plugin.so ModulePath=... ClassName=SudoIOPlugin3