summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--polkit/polkit-context.c22
2 files changed, 25 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 4255172..2c87014 100644
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ be audited.
Changes from PolicyKit 0.3 "No Man's Land"
-David Zeuthen (16):
+David Zeuthen (18):
post-release version bump
remove the notion of modules
replace configuration reload mechanism
@@ -29,6 +29,8 @@ David Zeuthen (16):
fix docs
fix up proper naming of some methods on the PolKitPolicyFileEntry class
for PolKitContext, mention that a mechanism need to provide .policy files
+ update NEWS
+ actually reload config and policy files when they change
Requirements for PolicyKit 0.4 ""
diff --git a/polkit/polkit-context.c b/polkit/polkit-context.c
index 14953f7..d8f2ed0 100644
--- a/polkit/polkit-context.c
+++ b/polkit/polkit-context.c
@@ -297,7 +297,29 @@ again:
event->wd, event->mask, event->cookie, event->len);
if (event->wd == pk_context->inotify_reload_wd) {
+ PolKitConfig *new_config;
+
_pk_debug ("config changed!");
+
+ /* purge existing policy files */
+ _pk_debug ("purging policy files");
+ if (pk_context->priv_cache == NULL) {
+ polkit_policy_cache_unref (pk_context->priv_cache);
+ pk_context->priv_cache = NULL;
+ }
+
+ /* Reload configuration file */
+ _pk_debug ("reload configuration file");
+ new_config = polkit_config_new (NULL);
+ if (pk_context->config == NULL) {
+ _pk_debug ("failed to reload configuration file: %s", strerror (errno));
+ /* TODO: set error. TODO: should we error out if the config file is bad?!? Or recover and go without a config file? */
+ } else {
+ if (pk_context->config != NULL)
+ polkit_config_unref (pk_context->config);
+ pk_context->config = new_config;
+ }
+
if (pk_context->config_changed_cb != NULL) {
pk_context->config_changed_cb (pk_context,
pk_context->config_changed_user_data);