From 23832672266bb4ff23b66247c0cfa1a2ed0cc97b Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 9 Jun 2007 21:53:20 +0000 Subject: 2007-06-09 Havoc Pennington * 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 --- dbus/dbus-sysdeps.c | 109 ++-------------------------------------------------- 1 file changed, 4 insertions(+), 105 deletions(-) (limited to 'dbus/dbus-sysdeps.c') diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 8ccdb3ff..cf689bc0 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -78,7 +78,7 @@ _dbus_abort (void) if (s && *s) { /* don't use _dbus_warn here since it can _dbus_abort() */ - fprintf (stderr, " Process %lu sleeping for gdb attach\n", (unsigned long) _dbus_getpid()); + fprintf (stderr, " Process %lu sleeping for gdb attach\n", _dbus_pid_for_log ()); _dbus_sleep_milliseconds (1000 * 180); } @@ -236,7 +236,8 @@ _dbus_pipe_invalidate (DBusPipe *pipe) } /** - * split pathes into a list of char strings + * Split paths into a list of char strings + * * @param dirs string with pathes * @param suffix string concated to each path in dirs * @param dir_list contains a list of splitted pathes @@ -251,7 +252,7 @@ _dbus_split_paths_and_append (DBusString *dirs, int i; int len; char *cpath; - const DBusString file_suffix; + DBusString file_suffix; start = 0; i = 0; @@ -770,68 +771,6 @@ _dbus_string_parse_double (const DBusString *str, * @{ */ -/** - * Frees the members of info - * (but not info itself) - * @param info the user info struct - */ -void -_dbus_user_info_free (DBusUserInfo *info) -{ - dbus_free (info->group_ids); - dbus_free (info->username); - dbus_free (info->homedir); -} - -/** - * Frees the members of info (but not info itself). - * - * @param info the group info - */ -void -_dbus_group_info_free (DBusGroupInfo *info) -{ - dbus_free (info->groupname); -} - -/** - * Sets fields in DBusCredentials to DBUS_PID_UNSET, - * DBUS_UID_UNSET, DBUS_GID_UNSET. - * - * @param credentials the credentials object to fill in - */ -void -_dbus_credentials_clear (DBusCredentials *credentials) -{ - credentials->pid = DBUS_PID_UNSET; - credentials->uid = DBUS_UID_UNSET; - credentials->gid = DBUS_GID_UNSET; -} - -/** - * Checks whether the provided_credentials are allowed to log in - * as the expected_credentials. - * - * @param expected_credentials credentials we're trying to log in as - * @param provided_credentials credentials we have - * @returns #TRUE if we can log in - */ -dbus_bool_t -_dbus_credentials_match (const DBusCredentials *expected_credentials, - const DBusCredentials *provided_credentials) -{ - if (provided_credentials->uid == DBUS_UID_UNSET) - return FALSE; - else if (expected_credentials->uid == DBUS_UID_UNSET) - return FALSE; - else if (provided_credentials->uid == 0) - return TRUE; - else if (provided_credentials->uid == expected_credentials->uid) - return TRUE; - else - return FALSE; -} - void _dbus_generate_pseudorandom_bytes_buffer (char *buffer, int n_bytes) @@ -928,46 +867,6 @@ _dbus_generate_random_ascii (DBusString *str, return TRUE; } -/** - * Gets a UID from a UID string. - * - * @param uid_str the UID in string form - * @param uid UID to fill in - * @returns #TRUE if successfully filled in UID - */ -dbus_bool_t -_dbus_parse_uid (const DBusString *uid_str, - dbus_uid_t *uid) -{ - int end; - long val; - - if (_dbus_string_get_length (uid_str) == 0) - { - _dbus_verbose ("UID string was zero length\n"); - return FALSE; - } - - val = -1; - end = 0; - if (!_dbus_string_parse_int (uid_str, 0, &val, - &end)) - { - _dbus_verbose ("could not parse string as a UID\n"); - return FALSE; - } - - if (end != _dbus_string_get_length (uid_str)) - { - _dbus_verbose ("string contained trailing stuff after UID\n"); - return FALSE; - } - - *uid = val; - - return TRUE; -} - /** * Converts a UNIX or Windows errno * into a #DBusError name. -- cgit