dbus-daemon: fix forgotten counter increase while copying configured auth mechanisms
[platform/upstream/dbus.git] / bus / policy.c
index 2c1a354..4841f47 100644 (file)
  * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
+#include <config.h>
 #include "policy.h"
 #include "services.h"
 #include "test.h"
@@ -168,13 +169,13 @@ bus_policy_new (void)
 
   policy->refcount = 1;
   
-  policy->rules_by_uid = _dbus_hash_table_new (DBUS_HASH_ULONG,
+  policy->rules_by_uid = _dbus_hash_table_new (DBUS_HASH_UINTPTR,
                                                NULL,
                                                free_rule_list_func);
   if (policy->rules_by_uid == NULL)
     goto failed;
 
-  policy->rules_by_gid = _dbus_hash_table_new (DBUS_HASH_ULONG,
+  policy->rules_by_gid = _dbus_hash_table_new (DBUS_HASH_UINTPTR,
                                                NULL,
                                                free_rule_list_func);
   if (policy->rules_by_gid == NULL)
@@ -303,7 +304,7 @@ bus_policy_create_client_policy (BusPolicy      *policy,
         {
           DBusList **list;
           
-          list = _dbus_hash_table_lookup_ulong (policy->rules_by_gid,
+          list = _dbus_hash_table_lookup_uintptr (policy->rules_by_gid,
                                                 groups[i]);
           
           if (list != NULL)
@@ -327,7 +328,7 @@ bus_policy_create_client_policy (BusPolicy      *policy,
         {
           DBusList **list;
           
-          list = _dbus_hash_table_lookup_ulong (policy->rules_by_uid,
+          list = _dbus_hash_table_lookup_uintptr (policy->rules_by_uid,
                                                 uid);
           
           if (list != NULL)
@@ -402,8 +403,8 @@ list_allows_user (dbus_bool_t           def,
         }
       else if (rule->type == BUS_POLICY_RULE_GROUP)
         {
-          _dbus_verbose ("List %p group rule uid="DBUS_UID_FORMAT"\n",
-                         list, rule->d.user.uid);
+          _dbus_verbose ("List %p group rule gid="DBUS_GID_FORMAT"\n",
+                         list, rule->d.group.gid);
           
           if (rule->d.group.gid == DBUS_GID_UNSET)
             ;  /* '*' wildcard */
@@ -517,7 +518,7 @@ get_list (DBusHashTable *hash,
 {
   DBusList **list;
 
-  list = _dbus_hash_table_lookup_ulong (hash, key);
+  list = _dbus_hash_table_lookup_uintptr (hash, key);
 
   if (list == NULL)
     {
@@ -525,7 +526,7 @@ get_list (DBusHashTable *hash,
       if (list == NULL)
         return NULL;
 
-      if (!_dbus_hash_table_insert_ulong (hash, key, list))
+      if (!_dbus_hash_table_insert_uintptr (hash, key, list))
         {
           dbus_free (list);
           return NULL;
@@ -638,7 +639,7 @@ merge_id_hash (DBusHashTable *dest,
   _dbus_hash_iter_init (to_absorb, &iter);
   while (_dbus_hash_iter_next (&iter))
     {
-      unsigned long id = _dbus_hash_iter_get_ulong_key (&iter);
+      unsigned long id = _dbus_hash_iter_get_uintptr_key (&iter);
       DBusList **list = _dbus_hash_iter_get_value (&iter);
       DBusList **target = get_list (dest, id);
 
@@ -867,7 +868,8 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
                                   dbus_bool_t      requested_reply,
                                   DBusConnection  *receiver,
                                   DBusMessage     *message,
-                                  dbus_int32_t    *toggles)
+                                  dbus_int32_t    *toggles,
+                                  dbus_bool_t     *log)
 {
   DBusList *link;
   dbus_bool_t allowed;
@@ -1028,6 +1030,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
 
       /* Use this rule */
       allowed = rule->allow;
+      *log = rule->d.send.log;
       (*toggles)++;
 
       _dbus_verbose ("  (policy) used rule, allow now = %d\n",