plugins/python/example_*.py: document returning error string

This commit is contained in:
Robert Manner
2020-02-06 13:24:28 +01:00
committed by Todd C. Miller
parent 9c4f076f85
commit bbbcb39334
4 changed files with 31 additions and 18 deletions

View File

@@ -29,6 +29,12 @@ class SudoIOPlugin(sudo.Plugin):
sudo.RC.ERROR -1
sudo.RC.USAGE_ERROR -2
If the plugin encounters an error, instead of just returning sudo.RC.ERROR
result code it can also add a message describing the problem.
This can be done by raising the special exception:
raise sudo.PluginError("Message")
This added message will be used by the audit plugins.
If the function returns "None" (for example does not call return), it will
be considered sudo.RC.OK. If an exception other than sudo.PluginError is
raised, its backtrace will be shown to the user and the plugin function