diff options
author | Havoc Pennington <hp@redhat.com> | 2007-06-09 21:53:20 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2007-06-09 21:53:20 +0000 |
commit | 23832672266bb4ff23b66247c0cfa1a2ed0cc97b (patch) | |
tree | 119e37411f14923780de3ca7a759707508f1ec63 /bus | |
parent | b80a8fe6b364543aa4b32a02a5ad913faf97173b (diff) |
2007-06-09 Havoc Pennington <hp@redhat.com>
* bus/dispatch.c (check_get_connection_unix_process_id): adapt
since sysdeps-unix.h stuff isn't included anymore
* bus/bus.c (bus_context_new): use more abstract functions to
change user, so they can be no-ops on Windows
* dbus/dbus-credentials.c, dbus/dbus-credentials.h,
dbus/dbus-credentials-util.c: new files containing a fully opaque
DBusCredentials data type to replace the old not opaque one.
* configure.in (DBUS_UNIX): define DBUS_UNIX to match DBUS_WIN on
windows
* dbus/dbus-userdb.h: prohibit on Windows, next step is to clean
up the uses of it in bus/*.c and factor out the parts of
cookie auth that depend on it
Diffstat (limited to 'bus')
-rw-r--r-- | bus/bus.c | 11 | ||||
-rw-r--r-- | bus/dispatch.c | 6 | ||||
-rw-r--r-- | bus/policy.c | 4 |
3 files changed, 7 insertions, 14 deletions
@@ -533,7 +533,6 @@ bus_context_new (const DBusString *config_file, { BusContext *context; BusConfigParser *parser; - DBusCredentials creds; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -660,13 +659,7 @@ bus_context_new (const DBusString *config_file, /* check user before we fork */ if (context->user != NULL) { - DBusString u; - - _dbus_string_init_const (&u, context->user); - - if (!_dbus_credentials_from_username (&u, &creds) || - creds.uid < 0 || - creds.gid < 0) + if (!_dbus_verify_daemon_user (context->user)) { dbus_set_error (error, DBUS_ERROR_FAILED, "Could not get UID and GID for username \"%s\"", @@ -769,7 +762,7 @@ bus_context_new (const DBusString *config_file, */ if (context->user != NULL) { - if (!_dbus_change_identity (creds.uid, creds.gid, error)) + if (!_dbus_change_to_daemon_user (context->user, error)) { _DBUS_ASSERT_ERROR_IS_SET (error); goto failed; diff --git a/bus/dispatch.c b/bus/dispatch.c index f491ef44..ef75933f 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -399,6 +399,10 @@ bus_dispatch_remove_connection (DBusConnection *connection) #ifdef DBUS_BUILD_TESTS #include <stdio.h> +#ifdef DBUS_UNIX +#include <sys/types.h> +#include <unistd.h> +#endif /* This is used to know whether we need to block in order to finish * sending a message, or whether the initial dbus_connection_send() @@ -1313,7 +1317,7 @@ check_get_connection_unix_process_id (BusContext *context, * cause then we can test that the pid returned matches * getppid() */ - if (pid != (dbus_uint32_t) _dbus_getpid ()) + if (pid != (dbus_uint32_t) getpid ()) { _dbus_assert (dbus_error_is_set (&error)); _dbus_warn ("Result from GetConnectionUnixProcessID is not our own pid\n"); diff --git a/bus/policy.c b/bus/policy.c index 52ae72a4..7782563b 100644 --- a/bus/policy.c +++ b/bus/policy.c @@ -324,13 +324,9 @@ bus_policy_create_client_policy (BusPolicy *policy, if (!dbus_connection_get_unix_user (connection, &uid)) { -#ifdef DBUS_WIN_FIXME - _dbus_verbose ("policy.c: dbus_connection_get_unix_user check disabled under windows\n"); -#else dbus_set_error (error, DBUS_ERROR_FAILED, "No user ID known for connection, cannot determine security policy\n"); goto failed; -#endif } if (_dbus_hash_table_get_n_entries (policy->rules_by_uid) > 0) |