Skip to content

Commit

Permalink
backendduktape: Add searched rule directories and adjust the LOG_LEVEL
Browse files Browse the repository at this point in the history
Align polkit with other services (e.g. [sysctl](https://man7.org/linux/man-pages/man8/sysctl.8.html)) and search for rules in all the traditional config sources in the usual order.
  • Loading branch information
vmihalko authored and jrybar-rh committed Sep 26, 2024
1 parent d68a3b4 commit 6c5705e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/polkitbackend/polkitbackendduktapeauthority.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,7 @@ load_scripts (PolkitBackendJsAuthority *authority)
dir = g_dir_open (dir_name,
0,
&error);
if (dir == NULL)
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
LOG_LEVEL_ERROR,
"Error opening rules directory: %s (%s, %d)",
error->message, g_quark_to_string (error->domain), error->code);
g_clear_error (&error);
}
else
if (dir != NULL)
{
const gchar *name;
while ((name = g_dir_read_name (dir)) != NULL)
Expand All @@ -139,6 +131,14 @@ load_scripts (PolkitBackendJsAuthority *authority)
}
g_dir_close (dir);
}
else
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
LOG_LEVEL_DEBUG,
"Error opening rules directory: %s (%s, %d)",
error->message, g_quark_to_string (error->domain), error->code);
g_clear_error (&error);
}
}

files = g_list_sort (files, (GCompareFunc) polkit_backend_common_rules_file_name_cmp);
Expand Down Expand Up @@ -253,9 +253,11 @@ polkit_backend_common_js_authority_constructed (GObject *object)

if (authority->priv->rules_dirs == NULL)
{
authority->priv->rules_dirs = g_new0 (gchar *, 3);
authority->priv->rules_dirs = g_new0 (gchar *, 5);
authority->priv->rules_dirs[0] = g_strdup (PACKAGE_SYSCONF_DIR "/polkit-1/rules.d");
authority->priv->rules_dirs[1] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d");
authority->priv->rules_dirs[1] = g_strdup ("/run/polkit-1/rules.d");
authority->priv->rules_dirs[2] = g_strdup ("/usr/local/lib/polkit-1/rules.d");
authority->priv->rules_dirs[3] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d");
}

setup_file_monitors (authority);
Expand Down

0 comments on commit 6c5705e

Please sign in to comment.