dbus/bus bus.c, 1.72, 1.73 bus.h, 1.27, 1.28 connection.c, 1.65, 1.66 policy.c, 1.23, 1.24 policy.h, 1.16, 1.17

Tim Dijkstra tdykstra at kemper.freedesktop.org
Tue Dec 12 13:24:09 PST 2006


Update of /cvs/dbus/dbus/bus
In directory kemper:/tmp/cvs-serv8740/bus

Modified Files:
	bus.c bus.h connection.c policy.c policy.h 
Log Message:
commit.msg

Index: bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- bus.c	6 Nov 2006 16:02:19 -0000	1.72
+++ bus.c	12 Dec 2006 21:24:07 -0000	1.73
@@ -34,6 +34,7 @@
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-userdb.h>
 
 struct BusContext
 {
@@ -50,7 +51,6 @@
   BusRegistry *registry;
   BusPolicy *policy;
   BusMatchmaker *matchmaker;
-  DBusUserDatabase *user_database;
   BusLimits limits;
   unsigned int fork : 1;
 };
@@ -596,13 +596,6 @@
   if (!dbus_server_allocate_data_slot (&server_data_slot))
     _dbus_assert_not_reached ("second ref of server data slot failed");
 
-  context->user_database = _dbus_user_database_new ();
-  if (context->user_database == NULL)
-    {
-      BUS_SET_OOM (error);
-      goto failed;
-    }
-  
   /* Note that we don't know whether the print_addr_fd is
    * one of the sockets we're using to listen on, or some
    * other random thing. But I think the answer is "don't do
@@ -800,7 +793,7 @@
   dbus_bool_t ret;
 
   /* Flush the user database cache */
-  _dbus_user_database_flush(context->user_database);
+  _dbus_user_database_flush_system ();
 
   ret = FALSE;
   _dbus_string_init_const (&config_file, context->config_file);
@@ -951,10 +944,6 @@
 
           dbus_free (context->pidfile); 
 	}
-
-      if (context->user_database != NULL)
-	_dbus_user_database_unref (context->user_database);
-      
       dbus_free (context);
 
       dbus_server_free_data_slot (&server_data_slot);
@@ -1004,18 +993,11 @@
   return context->loop;
 }
 
-DBusUserDatabase*
-bus_context_get_user_database (BusContext *context)
-{
-  return context->user_database;
-}
-
 dbus_bool_t
 bus_context_allow_user (BusContext   *context,
                         unsigned long uid)
 {
   return bus_policy_allow_user (context->policy,
-                                context->user_database,
                                 uid);
 }
 

Index: bus.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- bus.h	22 Nov 2005 20:37:00 -0000	1.27
+++ bus.h	12 Dec 2006 21:24:07 -0000	1.28
@@ -29,7 +29,6 @@
 #include <dbus/dbus.h>
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-mainloop.h>
-#include <dbus/dbus-userdb.h>
 
 typedef struct BusActivation    BusActivation;
 typedef struct BusConnections   BusConnections;
@@ -86,8 +85,6 @@
 BusActivation*    bus_context_get_activation                     (BusContext       *context);
 BusMatchmaker*    bus_context_get_matchmaker                     (BusContext       *context);
 DBusLoop*         bus_context_get_loop                           (BusContext       *context);
-DBusUserDatabase* bus_context_get_user_database                  (BusContext       *context);
-
 dbus_bool_t       bus_context_allow_user                         (BusContext       *context,
                                                                   unsigned long     uid);
 BusPolicy*        bus_context_get_policy                         (BusContext       *context);

Index: connection.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/connection.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- connection.c	1 Oct 2006 03:18:47 -0000	1.65
+++ connection.c	12 Dec 2006 21:24:07 -0000	1.66
@@ -31,6 +31,7 @@
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-timeout.h>
+#include <dbus/dbus-userdb.h>
 
 static void bus_connection_remove_transactions (DBusConnection *connection);
 
@@ -778,24 +779,18 @@
 {
   BusConnectionData *d;
   unsigned long uid;
-  DBusUserDatabase *user_database;
   
   d = BUS_CONNECTION_DATA (connection);
 
   _dbus_assert (d != NULL);
 
-  user_database = bus_context_get_user_database (d->connections->context);
-  
   *groups = NULL;
   *n_groups = 0;
 
   if (dbus_connection_get_unix_user (connection, &uid))
     {
-      if (!_dbus_user_database_get_groups (user_database,
-                                           uid, groups, n_groups,
-                                           error))
+      if (!_dbus_groups_from_uid (uid, groups, n_groups))
         {
-          _DBUS_ASSERT_ERROR_IS_SET (error);
           _dbus_verbose ("Did not get any groups for UID %lu\n",
                          uid);
           return FALSE;

Index: policy.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/policy.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- policy.c	29 Aug 2005 20:19:19 -0000	1.23
+++ policy.c	12 Dec 2006 21:24:07 -0000	1.24
@@ -28,6 +28,7 @@
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-userdb.h>
 
 BusPolicyRule*
 bus_policy_rule_new (BusPolicyRuleType type,
@@ -438,7 +439,6 @@
 
 dbus_bool_t
 bus_policy_allow_user (BusPolicy        *policy,
-                       DBusUserDatabase *user_database,
                        unsigned long     uid)
 {
   dbus_bool_t allowed;
@@ -446,8 +446,7 @@
   int n_group_ids;
 
   /* On OOM or error we always reject the user */
-  if (!_dbus_user_database_get_groups (user_database,
-                                       uid, &group_ids, &n_group_ids, NULL))
+  if (!_dbus_groups_from_uid (uid, &group_ids, &n_group_ids))
     {
       _dbus_verbose ("Did not get any groups for UID %lu\n",
                      uid);

Index: policy.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/policy.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- policy.h	25 Aug 2004 22:11:49 -0000	1.16
+++ policy.h	12 Dec 2006 21:24:07 -0000	1.17
@@ -113,7 +113,6 @@
                                                    DBusConnection   *connection,
                                                    DBusError        *error);
 dbus_bool_t      bus_policy_allow_user            (BusPolicy        *policy,
-                                                   DBusUserDatabase *user_database,
                                                    unsigned long     uid);
 dbus_bool_t      bus_policy_append_default_rule   (BusPolicy        *policy,
                                                    BusPolicyRule    *rule);



More information about the dbus-commit mailing list