diff --git a/plugins/python/example_audit_plugin.py b/plugins/python/example_audit_plugin.py index d582e28b2..ede69c930 100644 --- a/plugins/python/example_audit_plugin.py +++ b/plugins/python/example_audit_plugin.py @@ -16,7 +16,7 @@ class SudoAuditPlugin(sudo.Plugin): user_info_dict = sudo.options_as_dict(user_info) user = user_info_dict.get("user", "???") uid = user_info_dict.get("uid", "???") - self._log("-- Started by user {} ({}) -- ".format(user, uid)) + self._log("-- Started by user {} ({}) --".format(user, uid)) def __del__(self): self._log("-- Finished --") diff --git a/plugins/python/pyhelpers.c b/plugins/python/pyhelpers.c index ca55036d0..580e11c65 100644 --- a/plugins/python/pyhelpers.c +++ b/plugins/python/pyhelpers.c @@ -363,9 +363,9 @@ _py_debug_python_function(const char *class_name, const char *function_name, con Py_DECREF(py_kwargs_sorted); } - sudo_debug_printf(SUDO_DEBUG_DIAG, "%s.%s %s: %s %s\n", class_name, + sudo_debug_printf(SUDO_DEBUG_DIAG, "%s.%s %s: %s%s%s\n", class_name, function_name, message, args_str ? args_str : "()", - kwargs_str ? kwargs_str : ""); + kwargs_str ? " " : "", kwargs_str ? kwargs_str : ""); free(args_str); free(kwargs_str); } diff --git a/plugins/python/regress/testdata/check_example_audit_plugin_receives_accept.stdout b/plugins/python/regress/testdata/check_example_audit_plugin_receives_accept.stdout index 2c8397228..352f42116 100644 --- a/plugins/python/regress/testdata/check_example_audit_plugin_receives_accept.stdout +++ b/plugins/python/regress/testdata/check_example_audit_plugin_receives_accept.stdout @@ -1,4 +1,4 @@ -(AUDIT) -- Started by user testuser1 (123) -- +(AUDIT) -- Started by user testuser1 (123) -- (AUDIT) Requested command: id --help (AUDIT) Accepted command: /sbin/id --help (AUDIT) By the plugin: accepter plugin name (type=POLICY) diff --git a/plugins/python/regress/testdata/check_example_audit_plugin_receives_error.stdout b/plugins/python/regress/testdata/check_example_audit_plugin_receives_error.stdout index cb7068dff..d56929129 100644 --- a/plugins/python/regress/testdata/check_example_audit_plugin_receives_error.stdout +++ b/plugins/python/regress/testdata/check_example_audit_plugin_receives_error.stdout @@ -1,4 +1,4 @@ -(AUDIT) -- Started by user ??? (???) -- +(AUDIT) -- Started by user ??? (???) -- (AUDIT) Requested command: id (AUDIT) Plugin errorer plugin name (type=AUDIT) got an error: Some error has happened (AUDIT) Sudo has run into an error: 222 diff --git a/plugins/python/regress/testdata/check_example_audit_plugin_receives_reject.stdout b/plugins/python/regress/testdata/check_example_audit_plugin_receives_reject.stdout index c6e8a5abf..574b0587d 100644 --- a/plugins/python/regress/testdata/check_example_audit_plugin_receives_reject.stdout +++ b/plugins/python/regress/testdata/check_example_audit_plugin_receives_reject.stdout @@ -1,4 +1,4 @@ -(AUDIT) -- Started by user root (0) -- +(AUDIT) -- Started by user root (0) -- (AUDIT) Requested command: passwd (AUDIT) Rejected by plugin rejecter plugin name (type=IO): Rejected just because! (AUDIT) The command was not executed diff --git a/plugins/python/regress/testdata/check_example_audit_plugin_version_display.stdout b/plugins/python/regress/testdata/check_example_audit_plugin_version_display.stdout index 1586f462d..9c0ba9eae 100644 --- a/plugins/python/regress/testdata/check_example_audit_plugin_version_display.stdout +++ b/plugins/python/regress/testdata/check_example_audit_plugin_version_display.stdout @@ -1,4 +1,4 @@ -(AUDIT) -- Started by user root (0) -- +(AUDIT) -- Started by user root (0) -- Python Example Audit Plugin Python audit plugin (API 1.0): SudoAuditPlugin (loaded from 'SRC_DIR/example_audit_plugin.py') Python Example Audit Plugin (version=1.0) diff --git a/plugins/python/regress/testdata/check_example_audit_plugin_workflow_multiple.stdout b/plugins/python/regress/testdata/check_example_audit_plugin_workflow_multiple.stdout index aa5ee5893..b80c5e6f9 100644 --- a/plugins/python/regress/testdata/check_example_audit_plugin_workflow_multiple.stdout +++ b/plugins/python/regress/testdata/check_example_audit_plugin_workflow_multiple.stdout @@ -1,6 +1,6 @@ -(AUDIT1) -- Started by user default (1000) -- +(AUDIT1) -- Started by user default (1000) -- (AUDIT1) Requested command: id --help -(AUDIT2) -- Started by user default (1000) -- +(AUDIT2) -- Started by user default (1000) -- (AUDIT2) Requested command: id --help (AUDIT1) Accepted command: /sbin/id --help (AUDIT1) By the plugin: accepter plugin name (type=POLICY) diff --git a/plugins/python/regress/testdata/check_example_debugging_c_calls@diag.log b/plugins/python/regress/testdata/check_example_debugging_c_calls@diag.log index c5cd98c92..1a73a59ff 100644 --- a/plugins/python/regress/testdata/check_example_debugging_c_calls@diag.log +++ b/plugins/python/regress/testdata/check_example_debugging_c_calls@diag.log @@ -1,6 +1,6 @@ -sudo.debug was called with arguments: (DEBUG.ERROR, 'My demo purpose plugin shows this ERROR level debug message') -sudo.debug was called with arguments: (DEBUG.INFO, 'My demo purpose plugin shows this INFO level debug message') +sudo.debug was called with arguments: (DEBUG.ERROR, 'My demo purpose plugin shows this ERROR level debug message') +sudo.debug was called with arguments: (DEBUG.INFO, 'My demo purpose plugin shows this INFO level debug message') LogHandler.emit was called LogHandler.emit was called -sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),) -sudo.options_as_dict returned result: [('ClassName', 'DebugDemoPlugin'), ('ModulePath', 'SRC_DIR/example_debugging.py')] +sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),) +sudo.options_as_dict returned result: [('ClassName', 'DebugDemoPlugin'), ('ModulePath', 'SRC_DIR/example_debugging.py')] diff --git a/plugins/python/regress/testdata/check_example_debugging_c_calls@info.log b/plugins/python/regress/testdata/check_example_debugging_c_calls@info.log index 7258618ed..b7bbe7690 100644 --- a/plugins/python/regress/testdata/check_example_debugging_c_calls@info.log +++ b/plugins/python/regress/testdata/check_example_debugging_c_calls@info.log @@ -1,11 +1,11 @@ __init__ @ SRC_DIR/example_debugging.py:58 calls C function: -sudo.debug was called with arguments: (DEBUG.ERROR, 'My demo purpose plugin shows this ERROR level debug message') +sudo.debug was called with arguments: (DEBUG.ERROR, 'My demo purpose plugin shows this ERROR level debug message') __init__ @ SRC_DIR/example_debugging.py:63 calls C function: -sudo.debug was called with arguments: (DEBUG.INFO, 'My demo purpose plugin shows this INFO level debug message') +sudo.debug was called with arguments: (DEBUG.INFO, 'My demo purpose plugin shows this INFO level debug message') handle @ logging/__init__.py calls C function: LogHandler.emit was called handle @ logging/__init__.py calls C function: LogHandler.emit was called __init__ @ SRC_DIR/example_debugging.py:85 calls C function: -sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),) -sudo.options_as_dict returned result: [('ClassName', 'DebugDemoPlugin'), ('ModulePath', 'SRC_DIR/example_debugging.py')] +sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),) +sudo.options_as_dict returned result: [('ClassName', 'DebugDemoPlugin'), ('ModulePath', 'SRC_DIR/example_debugging.py')] diff --git a/plugins/python/regress/testdata/check_example_group_plugin_is_able_to_debug.log b/plugins/python/regress/testdata/check_example_group_plugin_is_able_to_debug.log index 6def4623a..b25007a82 100644 --- a/plugins/python/regress/testdata/check_example_group_plugin_is_able_to_debug.log +++ b/plugins/python/regress/testdata/check_example_group_plugin_is_able_to_debug.log @@ -1,4 +1,4 @@ SudoGroupPlugin.__init__ was called with arguments: () [('args', ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin')), ('version', '1.0')] SudoGroupPlugin.__init__ returned result: -SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) -SudoGroupPlugin.query returned result: 0 +SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell')) +SudoGroupPlugin.query returned result: 0 diff --git a/plugins/python/regress/testdata/check_example_policy_plugin_validate_invalidate.log b/plugins/python/regress/testdata/check_example_policy_plugin_validate_invalidate.log index 6f1479ab4..db4ac2720 100644 --- a/plugins/python/regress/testdata/check_example_policy_plugin_validate_invalidate.log +++ b/plugins/python/regress/testdata/check_example_policy_plugin_validate_invalidate.log @@ -1,8 +1,8 @@ SudoPolicyPlugin.__init__ was called with arguments: () [('plugin_options', ('ModulePath=SRC_DIR/example_policy_plugin.py', 'ClassName=SudoPolicyPlugin')), ('settings', ()), ('user_env', ()), ('user_info', ()), ('version', '1.0')] SudoPolicyPlugin.__init__ returned result: -SudoPolicyPlugin.validate was called with arguments: () -SudoPolicyPlugin.validate returned result: None -SudoPolicyPlugin.invalidate was called with arguments: (1,) -SudoPolicyPlugin.invalidate returned result: None -SudoPolicyPlugin.invalidate was called with arguments: (0,) -SudoPolicyPlugin.invalidate returned result: None +SudoPolicyPlugin.validate was called with arguments: () +SudoPolicyPlugin.validate returned result: None +SudoPolicyPlugin.invalidate was called with arguments: (1,) +SudoPolicyPlugin.invalidate returned result: None +SudoPolicyPlugin.invalidate was called with arguments: (0,) +SudoPolicyPlugin.invalidate returned result: None