Commit Graph

10 Commits

Author SHA1 Message Date
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
a940a2c78e Fix some warnings from pvs-studio 2020-08-12 20:01:39 -06:00
Robert Manner
f387cdf53f plugins/python: make show_version display the plugin in verbose mode
Before it only displayed the plugin version, now it also displays
which python plugin is loaded to be more useful.
2020-02-26 13:15:52 -07:00
Robert Manner
b2ae79c2be plugins/python: add missing annotations to help cpychecker 2020-02-14 09:25:37 -07:00
Robert Manner
23af39b005 plugins/python: add python approval plugin wrapper 2020-02-12 11:16:00 -07:00
Robert Manner
b1d2ccecd0 plugins/python: make storing errstr more explicit
The error is always stored in plugin_ctx, but it is only set into errstr
if the API version is enough. (Previously it worked the opposite:
we only stored the error if API level was enough.)
2020-02-12 11:16:00 -07:00
Robert Manner
3dd5f37af7 plugins/python: add support for callback errstr arguments
Plugins can raise a sudo.PluginError exception to add context message
for the failure.

The callback's errstr gets filled up with the specified message.
But, as sudo expects a string constant (will not free the string),
we store it in the plugin context at least until next callback
invocation.
2020-02-10 05:24:16 -07:00
Robert Manner
36694fce86 plugins/python/python_plugin_common: close can get custom arguments
For the audit plugin.
Ensure we do not fail if plugin_ctx->py_instance is NULL (because
plugin init has failed).
2020-02-10 05:24:16 -07:00
Robert Manner
22c64f58c0 plugins/python: use separate python interpreter for each plugin
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.
2020-01-24 12:25:15 -07:00
Robert Manner
babdcbd031 plugins/python: a plugin which can load policy/io plugin written in python 2019-12-14 12:55:42 -07:00