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.)
This commit is contained in:
Robert Manner
2020-02-12 15:48:02 +01:00
committed by Todd C. Miller
parent b165242035
commit b1d2ccecd0
5 changed files with 52 additions and 64 deletions

View File

@@ -138,12 +138,7 @@ python_plugin_handle_plugin_error_exception(PyObject **py_result, struct PluginC
sudo_debug_printf(SUDO_DEBUG_INFO, "received sudo.PluginError exception with message '%s'",
message == NULL ? "(null)" : message);
if (message != NULL && plugin_ctx->sudo_api_version < SUDO_API_MKVERSION(1, 15)) {
py_sudo_log(SUDO_CONV_ERROR_MSG, "%s", message);
free(message);
} else {
plugin_ctx->callback_error = message;
}
plugin_ctx->callback_error = message;
Py_CLEAR(py_type);
Py_CLEAR(py_message);