PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Sun Oct 28 20:44:43 PDT 2007
polkit/polkit-authorization-db-dummy.c | 14 ++++++++++++++
polkit/polkit-authorization-db.c | 15 +++++++++++++++
polkit/polkit-policy-cache.c | 11 ++++++++++-
polkit/polkit-private.h | 8 ++++++++
4 files changed, 47 insertions(+), 1 deletion(-)
New commits:
commit dccf2be2c8e1fb9f0e0b8b2abde188c3db750a89
Author: David Zeuthen <davidz at redhat.com>
Date: Sun Oct 28 23:43:03 2007 -0400
let authdb backends synthesize policy file entries
diff --git a/polkit/polkit-authorization-db-dummy.c b/polkit/polkit-authorization-db-dummy.c
index 6fc093c..59d9209 100644
--- a/polkit/polkit-authorization-db-dummy.c
+++ b/polkit/polkit-authorization-db-dummy.c
@@ -67,6 +67,20 @@ _polkit_authorization_db_new (void)
return authdb;
}
+void
+_polkit_authorization_db_pfe_foreach (PolKitPolicyCache *policy_cache,
+ PolKitPolicyCacheForeachFunc callback,
+ void *user_data)
+{
+}
+
+PolKitPolicyFileEntry*
+_polkit_authorization_db_pfe_get_by_id (PolKitPolicyCache *policy_cache,
+ const char *action_id)
+{
+ return NULL;
+}
+
PolKitAuthorizationDB *
polkit_authorization_db_ref (PolKitAuthorizationDB *authdb)
{
diff --git a/polkit/polkit-authorization-db.c b/polkit/polkit-authorization-db.c
index ff31ba1..eab1da3 100644
--- a/polkit/polkit-authorization-db.c
+++ b/polkit/polkit-authorization-db.c
@@ -118,6 +118,21 @@ _polkit_authorization_db_new (void)
return authdb;
}
+void
+_polkit_authorization_db_pfe_foreach (PolKitPolicyCache *policy_cache,
+ PolKitPolicyCacheForeachFunc callback,
+ void *user_data)
+{
+}
+
+PolKitPolicyFileEntry*
+_polkit_authorization_db_pfe_get_by_id (PolKitPolicyCache *policy_cache,
+ const char *action_id)
+{
+ return NULL;
+}
+
+
/**
* polkit_authorization_db_ref:
* @authdb: the object
diff --git a/polkit/polkit-policy-cache.c b/polkit/polkit-policy-cache.c
index fb81fab..e9be5ea 100644
--- a/polkit/polkit-policy-cache.c
+++ b/polkit/polkit-policy-cache.c
@@ -235,7 +235,10 @@ polkit_policy_cache_get_entry_by_id (PolKitPolicyCache *policy_cache, const char
}
}
- pfe = NULL;
+ if (pfe == NULL) {
+ /* the authdb backend may want to synthesize pfe's */
+ pfe = _polkit_authorization_db_pfe_get_by_id (policy_cache, action_id);
+ }
out:
return pfe;
@@ -272,6 +275,7 @@ polkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
goto out;
pfe = polkit_policy_cache_get_entry_by_id (policy_cache, action_id);
+
out:
return pfe;
}
@@ -299,6 +303,11 @@ polkit_policy_cache_foreach (PolKitPolicyCache *policy_cache,
pfe = i->data;
callback (policy_cache, pfe, user_data);
}
+
+ /* the authdb backend may also want to return synthesized pfe's */
+ _polkit_authorization_db_pfe_foreach (policy_cache,
+ callback,
+ user_data);
}
/**
diff --git a/polkit/polkit-private.h b/polkit/polkit-private.h
index 3fd504b..1186620 100644
--- a/polkit/polkit-private.h
+++ b/polkit/polkit-private.h
@@ -52,6 +52,14 @@ const char *_polkit_authorization_get_authfile_entry (PolKitAuthorization *auth)
PolKitAuthorizationDB *_polkit_authorization_db_new (void);
void _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
+void _polkit_authorization_db_pfe_foreach (PolKitPolicyCache *policy_cache,
+ PolKitPolicyCacheForeachFunc callback,
+ void *user_data);
+
+PolKitPolicyFileEntry* _polkit_authorization_db_pfe_get_by_id (PolKitPolicyCache *policy_cache,
+ const char *action_id);
+
+
PolKitPolicyCache *_polkit_policy_cache_new (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
PolKitPolicyCache *_polkit_policy_cache_new (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
More information about the hal-commit
mailing list