plugins/python/sudo_module: let a reject also supply error message

Same as sudo.PluginError exception, have a sudo.PluginReject exception
as well. Added common base exception as well.
This commit is contained in:
Robert Manner
2020-02-11 14:46:23 +01:00
committed by Todd C. Miller
parent d1f94c857c
commit b165242035
3 changed files with 27 additions and 7 deletions

View File

@@ -31,7 +31,9 @@ PyAPI_FUNC(PyObject *) PyStructSequence_GetItem(PyObject *, Py_ssize_t);
// exceptions:
PyObject *sudo_exc_SudoException;
PyObject *sudo_exc_PluginException;
PyObject *sudo_exc_PluginError;
PyObject *sudo_exc_PluginReject;
static PyObject *sudo_exc_ConversationInterrupted;
// the methods exposed in the "sudo" python module
@@ -563,7 +565,11 @@ sudo_module_init(void)
} while(0);
MODULE_ADD_EXCEPTION(SudoException, NULL);
MODULE_ADD_EXCEPTION(PluginError, NULL);
MODULE_ADD_EXCEPTION(PluginException, NULL);
MODULE_ADD_EXCEPTION(PluginError, EXC_VAR(PluginException));
MODULE_ADD_EXCEPTION(PluginReject, EXC_VAR(PluginException));
MODULE_ADD_EXCEPTION(ConversationInterrupted, EXC_VAR(SudoException));
#define MODULE_REGISTER_ENUM(name, key_values) \