PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Tue Jul 24 13:05:40 PDT 2007


 polkit/polkit-config.c         |    8 ++++----
 polkit/polkit-context.c        |   19 +++++++++----------
 polkit/polkit-grant-database.c |    2 +-
 polkit/polkit-policy-default.c |    1 -
 polkit/polkit-result.c         |    3 +--
 polkit/polkit-result.h         |    8 ++++----
 6 files changed, 19 insertions(+), 22 deletions(-)

New commits:
diff-tree e13a83721307711f257e9222a4d6adebda78f662 (from 4b20f49298850060274e4bba842181b7c033d1e7)
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Jul 24 16:05:43 2007 -0400

    remove RESULT_NOT_AUTHORIZED_TO_KNOW and s/RESULT_UNKNOWN_ACTION/RESULT_UNKNOWN/

diff --git a/polkit/polkit-config.c b/polkit/polkit-config.c
index aff9fb4..e969661 100644
--- a/polkit/polkit-config.c
+++ b/polkit/polkit-config.c
@@ -431,7 +431,7 @@ config_node_test (ConfigNode *node, PolK
         char *str2;
         uid_t uid;
 
-        result = POLKIT_RESULT_UNKNOWN_ACTION;
+        result = POLKIT_RESULT_UNKNOWN;
         recurse = FALSE;
 
         switch (node->node_type) {
@@ -499,7 +499,7 @@ config_node_test (ConfigNode *node, PolK
                 for (i = node->children; i != NULL; i = g_slist_next (i)) {
                         ConfigNode *child_node = i->data;
                         result = config_node_test (child_node, action, caller, session);
-                        if (result != POLKIT_RESULT_UNKNOWN_ACTION) {
+                        if (result != POLKIT_RESULT_UNKNOWN) {
                                 goto out;
                         }
                 }
@@ -518,7 +518,7 @@ polkit_config_can_session_do_action (Pol
         if (pk_config->top_config_node != NULL)
                 result = config_node_test (pk_config->top_config_node, action, NULL, session);
         else
-                result = POLKIT_RESULT_UNKNOWN_ACTION;
+                result = POLKIT_RESULT_UNKNOWN;
         return result;
 }
 
@@ -531,6 +531,6 @@ polkit_config_can_caller_do_action (PolK
         if (pk_config->top_config_node != NULL)
                 result = config_node_test (pk_config->top_config_node, action, caller, NULL);
         else
-                result = POLKIT_RESULT_UNKNOWN_ACTION;
+                result = POLKIT_RESULT_UNKNOWN;
         return result;
 }
diff --git a/polkit/polkit-context.c b/polkit/polkit-context.c
index 7224b76..987b6e9 100644
--- a/polkit/polkit-context.c
+++ b/polkit/polkit-context.c
@@ -373,7 +373,6 @@ polkit_context_get_policy_cache (PolKitC
  * Determine if a given session can do a given action.
  *
  * Returns: A #PolKitResult - can only be one of
- * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
  * #POLKIT_RESULT_YES, #POLKIT_RESULT_NO.
  */
 PolKitResult
@@ -414,7 +413,7 @@ polkit_context_can_session_do_action (Po
                 } else {
                         g_warning ("no action with name '%s'", action_name);
                 }
-                result = POLKIT_RESULT_UNKNOWN_ACTION;
+                result = POLKIT_RESULT_UNKNOWN;
                 goto out;
         }
 
@@ -422,7 +421,7 @@ polkit_context_can_session_do_action (Po
 
         /* check if the config file specifies a result */
         result = polkit_config_can_session_do_action (pk_context->config, action, session);
-        if (result != POLKIT_RESULT_UNKNOWN_ACTION)
+        if (result != POLKIT_RESULT_UNKNOWN)
                 goto found;
 
         /* if no, just use the defaults */
@@ -434,8 +433,8 @@ polkit_context_can_session_do_action (Po
         result = polkit_policy_default_can_session_do_action (policy_default, action, session);
 
 found:
-        /* Never return UNKNOWN_ACTION to user */
-        if (result == POLKIT_RESULT_UNKNOWN_ACTION)
+        /* Never return UNKNOWN to user */
+        if (result == POLKIT_RESULT_UNKNOWN)
                 result = POLKIT_RESULT_NO;
 
 out:
@@ -492,7 +491,7 @@ polkit_context_can_caller_do_action (Pol
                 } else {
                         g_warning ("no action with name '%s'", action_name);
                 }
-                result = POLKIT_RESULT_UNKNOWN_ACTION;
+                result = POLKIT_RESULT_UNKNOWN;
                 goto out;
         }
 
@@ -500,12 +499,12 @@ polkit_context_can_caller_do_action (Pol
 
         /* first, check if the grant database specifies a result */
         result = _polkit_grantdb_check_can_caller_do_action (pk_context, action, caller);
-        if (result != POLKIT_RESULT_UNKNOWN_ACTION)
+        if (result != POLKIT_RESULT_UNKNOWN)
                 goto found;
 
         /* second, check if the config file specifies a result */
         result = polkit_config_can_caller_do_action (pk_context->config, action, caller);
-        if (result != POLKIT_RESULT_UNKNOWN_ACTION)
+        if (result != POLKIT_RESULT_UNKNOWN)
                 goto found;
 
         /* if no, just use the defaults */
@@ -518,8 +517,8 @@ polkit_context_can_caller_do_action (Pol
 
 found:
 
-        /* Never return UNKNOWN_ACTION to user */
-        if (result == POLKIT_RESULT_UNKNOWN_ACTION)
+        /* Never return UNKNOWN to user */
+        if (result == POLKIT_RESULT_UNKNOWN)
                 result = POLKIT_RESULT_NO;
 out:
         _pk_debug ("... result was %s", polkit_result_to_string_representation (result));
diff --git a/polkit/polkit-grant-database.c b/polkit/polkit-grant-database.c
index c936e98..88685f2 100644
--- a/polkit/polkit-grant-database.c
+++ b/polkit/polkit-grant-database.c
@@ -229,7 +229,7 @@ _polkit_grantdb_check_can_caller_do_acti
         unsigned long long pid_start_time;
 
         grant_file = NULL;
-        result = POLKIT_RESULT_UNKNOWN_ACTION;
+        result = POLKIT_RESULT_UNKNOWN;
 
         if (caller == NULL)
                 goto out;
diff --git a/polkit/polkit-policy-default.c b/polkit/polkit-policy-default.c
index 510d6ad..f2e22fa 100644
--- a/polkit/polkit-policy-default.c
+++ b/polkit/polkit-policy-default.c
@@ -140,7 +140,6 @@ polkit_policy_default_debug (PolKitPolic
  * session can do a given action.
  * 
  * Returns: A #PolKitResult - can only be one of
- * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
  * #POLKIT_RESULT_YES, #POLKIT_RESULT_NO.
  **/
 PolKitResult
diff --git a/polkit/polkit-result.c b/polkit/polkit-result.c
index a5335dc..3c70750 100644
--- a/polkit/polkit-result.c
+++ b/polkit/polkit-result.c
@@ -52,8 +52,7 @@ static const struct {
         const char *str;
 } mapping[] = 
 {
-        {POLKIT_RESULT_UNKNOWN_ACTION, "unknown"},
-        {POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW, "not_authorized"},
+        {POLKIT_RESULT_UNKNOWN, "unknown"},
         {POLKIT_RESULT_NO, "no"},
         {POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH, "auth_admin"},
         {POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_SESSION, "auth_admin_keep_session"},
diff --git a/polkit/polkit-result.h b/polkit/polkit-result.h
index 60aefc2..92c6a8e 100644
--- a/polkit/polkit-result.h
+++ b/polkit/polkit-result.h
@@ -34,8 +34,8 @@
 
 /**
  * PolKitResult:
- * @POLKIT_RESULT_UNKNOWN_ACTION: The passed action is unknown.
- * @POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW: The caller of polkit is not sufficiently privilege to know the answer.
+ * @POLKIT_RESULT_UNKNOWN: The result is unknown / cannot be
+ * computed. This is mostly used internally in libpolkit.
  * @POLKIT_RESULT_NO: Access denied.
  * @POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH: Access denied, but
  * authentication by the caller as administrator (e.g. root or a
@@ -66,8 +66,8 @@
  */
 typedef enum
 {
-        POLKIT_RESULT_UNKNOWN_ACTION,
-        POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
+        POLKIT_RESULT_UNKNOWN,
+
         POLKIT_RESULT_NO,
 
         POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH,


More information about the hal-commit mailing list