Ensure that non-superuser should be able to debug the function. Fixes #5760

This commit is contained in:
Khushboo Vashi
2020-10-30 15:03:18 +05:30
committed by Akshay Joshi
parent 183c83f0d2
commit 14a5d05b80
2 changed files with 26 additions and 23 deletions

View File

@@ -23,6 +23,7 @@ Bug fixes
| `Issue #4639 <https://redmine.postgresql.org/issues/4639>`_ - Ensure that some fields should be disabled for the trigger in edit mode. | `Issue #4639 <https://redmine.postgresql.org/issues/4639>`_ - Ensure that some fields should be disabled for the trigger in edit mode.
| `Issue #5736 <https://redmine.postgresql.org/issues/5736>`_ - Fixed an issue where the validation error message is shown twice. | `Issue #5736 <https://redmine.postgresql.org/issues/5736>`_ - Fixed an issue where the validation error message is shown twice.
| `Issue #5760 <https://redmine.postgresql.org/issues/5760>`_ - Ensure that non-superuser should be able to debug the function.
| `Issue #5842 <https://redmine.postgresql.org/issues/5842>`_ - Ensure that query history should be listed by date/time in descending order. | `Issue #5842 <https://redmine.postgresql.org/issues/5842>`_ - Ensure that query history should be listed by date/time in descending order.
| `Issue #5858 <https://redmine.postgresql.org/issues/5858>`_ - Ensure that search object functionality works with case insensitive string. | `Issue #5858 <https://redmine.postgresql.org/issues/5858>`_ - Ensure that search object functionality works with case insensitive string.
| `Issue #5895 <https://redmine.postgresql.org/issues/5895>`_ - Fixed an issue where the suffix for Toast table size is not visible in the Statistics tab. | `Issue #5895 <https://redmine.postgresql.org/issues/5895>`_ - Fixed an issue where the suffix for Toast table size is not visible in the Statistics tab.

View File

@@ -686,7 +686,8 @@ def validate_debug(conn, debug_type, is_superuser):
:param is_superuser: :param is_superuser:
:return: :return:
""" """
if debug_type == 'indirect' and not is_superuser: if debug_type == 'indirect':
if not is_superuser:
# If user is super user then we should check debugger library is # If user is super user then we should check debugger library is
# loaded or not # loaded or not
msg = gettext("You must be a superuser to set a global breakpoint" msg = gettext("You must be a superuser to set a global breakpoint"
@@ -696,6 +697,7 @@ def validate_debug(conn, debug_type, is_superuser):
status, rid_pre = conn.execute_scalar( status, rid_pre = conn.execute_scalar(
"SHOW shared_preload_libraries" "SHOW shared_preload_libraries"
) )
if not status: if not status:
return False, internal_server_error( return False, internal_server_error(
gettext("Could not fetch debugger plugin information.") gettext("Could not fetch debugger plugin information.")
@@ -703,7 +705,7 @@ def validate_debug(conn, debug_type, is_superuser):
# Need to check if plugin is really loaded or not with # Need to check if plugin is really loaded or not with
# "plugin_debugger" string # "plugin_debugger" string
if debug_type == 'indirect' and "plugin_debugger" not in rid_pre: if "plugin_debugger" not in rid_pre:
msg = gettext( msg = gettext(
"The debugger plugin is not enabled. " "The debugger plugin is not enabled. "
"Please add the plugin to the shared_preload_libraries " "Please add the plugin to the shared_preload_libraries "