Data Structures | |
struct | DBusBabysitter |
Babysitter implementation details. More... | |
struct | DBusDirIter |
Internals of directory iterator. More... | |
Defines | |
#define | _dbus_assert(condition) |
Aborts with an error message if the condition is false. | |
#define | _dbus_assert_not_reached(explanation) |
Aborts with an error message if called. | |
#define | _DBUS_N_ELEMENTS(array) ((int) (sizeof ((array)) / sizeof ((array)[0]))) |
Computes the number of elements in a fixed-size array using sizeof(). | |
#define | _DBUS_POINTER_TO_INT(pointer) ((long)(pointer)) |
Safely casts a void* to an integer; should only be used on void* that actually contain integers, for example one created with _DBUS_INT_TO_POINTER. | |
#define | _DBUS_INT_TO_POINTER(integer) ((void*)((long)(integer))) |
Safely stuffs an integer into a pointer, to be extracted later with _DBUS_POINTER_TO_INT. | |
#define | _DBUS_ZERO(object) (memset (&(object), '\0', sizeof ((object)))) |
Sets all bits in an object to zero. | |
#define | _DBUS_INT16_MIN ((dbus_int16_t) 0x8000) |
Minimum value of type "int16". | |
#define | _DBUS_INT16_MAX ((dbus_int16_t) 0x7fff) |
Maximum value of type "int16". | |
#define | _DBUS_UINT16_MAX ((dbus_uint16_t)0xffff) |
Maximum value of type "uint16". | |
#define | _DBUS_INT32_MIN ((dbus_int32_t) 0x80000000) |
Minimum value of type "int32". | |
#define | _DBUS_INT32_MAX ((dbus_int32_t) 0x7fffffff) |
Maximum value of type "int32". | |
#define | _DBUS_UINT32_MAX ((dbus_uint32_t)0xffffffff) |
Maximum value of type "uint32". | |
#define | _DBUS_INT_MIN _DBUS_INT32_MIN |
Minimum value of type "int". | |
#define | _DBUS_INT_MAX _DBUS_INT32_MAX |
Maximum value of type "int". | |
#define | _DBUS_UINT_MAX _DBUS_UINT32_MAX |
Maximum value of type "uint". | |
#define | _DBUS_LOCK_NAME(name) _dbus_lock_##name |
Expands to name of a global lock variable. | |
#define | _DBUS_DEFINE_GLOBAL_LOCK(name) DBusMutex *_dbus_lock_##name |
Defines a global lock variable with the given name. | |
#define | _DBUS_DECLARE_GLOBAL_LOCK(name) extern DBusMutex *_dbus_lock_##name |
Expands to declaration of a global lock defined with _DBUS_DEFINE_GLOBAL_LOCK. | |
#define | _DBUS_LOCK(name) _dbus_mutex_lock (_dbus_lock_##name) |
Locks a global lock. | |
#define | _DBUS_UNLOCK(name) _dbus_mutex_unlock (_dbus_lock_##name) |
Unlocks a global lock. | |
#define | LIVE_CHILDREN(sitter) ((sitter)->socket_to_babysitter >= 0 || (sitter)->error_pipe_from_child >= 0) |
Macro returns TRUE if the babysitter still has live sockets open to the babysitter child or the grandchild. | |
#define | READ_END 0 |
Helps remember which end of the pipe is which. | |
#define | WRITE_END 1 |
Helps remember which end of the pipe is which. | |
Typedefs | |
typedef void(* | DBusForeachFunction )(void *element, void *data) |
Used to iterate over each item in a collection, such as a DBusList. | |
Enumerations | |
enum | ReadStatus { READ_STATUS_OK, READ_STATUS_ERROR, READ_STATUS_EOF } |
Enumeration for status of a read(). More... | |
enum | { CHILD_EXITED, CHILD_FORK_FAILED, CHILD_EXEC_FAILED, CHILD_PID } |
Functions | |
void | _dbus_warn (const char *format,...) |
Prints a warning message to stderr. | |
void | _dbus_warn_check_failed (const char *format,...) |
Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in that it prefixes the pid and defaults to fatal. | |
char * | _dbus_strdup (const char *str) |
Duplicates a string. | |
void * | _dbus_memdup (const void *mem, size_t n_bytes) |
Duplicates a block of memory. | |
char ** | _dbus_dup_string_array (const char **array) |
Duplicates a string array. | |
dbus_bool_t | _dbus_string_array_contains (const char **array, const char *str) |
Checks whether a string array contains the given string. | |
void | _dbus_generate_uuid (DBusGUID *uuid) |
Generates a new UUID. | |
dbus_bool_t | _dbus_uuid_encode (const DBusGUID *uuid, DBusString *encoded) |
Hex-encode a UUID. | |
dbus_bool_t | _dbus_read_uuid_file (const DBusString *filename, DBusGUID *uuid, dbus_bool_t create_if_not_found, DBusError *error) |
Reads (and optionally writes) a uuid to a file. | |
dbus_bool_t | _dbus_get_local_machine_uuid_encoded (DBusString *uuid_str) |
Gets the hex-encoded UUID of the machine this function is executed on. | |
DBusBabysitter * | _dbus_babysitter_ref (DBusBabysitter *sitter) |
Increment the reference count on the babysitter object. | |
void | _dbus_babysitter_unref (DBusBabysitter *sitter) |
Decrement the reference count on the babysitter object. | |
void | _dbus_babysitter_kill_child (DBusBabysitter *sitter) |
Blocks until the babysitter process gives us the PID of the spawned grandchild, then kills the spawned grandchild. | |
dbus_bool_t | _dbus_babysitter_get_child_exited (DBusBabysitter *sitter) |
Checks whether the child has exited, without blocking. | |
void | _dbus_babysitter_set_child_exit_error (DBusBabysitter *sitter, DBusError *error) |
Sets the DBusError with an explanation of why the spawned child process exited (on a signal, or whatever). | |
dbus_bool_t | _dbus_babysitter_set_watch_functions (DBusBabysitter *sitter, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function) |
Sets watch functions to notify us when the babysitter object needs to read/write file descriptors. | |
dbus_bool_t | _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p, char **argv, DBusSpawnChildSetupFunc child_setup, void *user_data, DBusError *error) |
Spawns a new process. | |
dbus_bool_t | _dbus_become_daemon (const DBusString *pidfile, int print_pid_fd, DBusError *error) |
Does the chdir, fork, setsid, etc. | |
dbus_bool_t | _dbus_write_pid_file (const DBusString *filename, unsigned long pid, DBusError *error) |
Creates a file containing the process ID. | |
dbus_bool_t | _dbus_change_identity (dbus_uid_t uid, dbus_gid_t gid, DBusError *error) |
Changes the user and group the bus is running as. | |
void | _dbus_set_signal_handler (int sig, DBusSignalHandler handler) |
Installs a UNIX signal handler. | |
dbus_bool_t | _dbus_delete_directory (const DBusString *filename, DBusError *error) |
Removes a directory; Directory must be empty. | |
dbus_bool_t | _dbus_file_exists (const char *file) |
File/directory interface. | |
dbus_bool_t | _dbus_user_at_console (const char *username, DBusError *error) |
Checks if user is at the console. | |
dbus_bool_t | _dbus_path_is_absolute (const DBusString *filename) |
Checks whether the filename is an absolute path. | |
dbus_bool_t | _dbus_stat (const DBusString *filename, DBusStat *statbuf, DBusError *error) |
stat() wrapper. | |
DBusDirIter * | _dbus_directory_open (const DBusString *filename, DBusError *error) |
Open a directory to iterate over. | |
dbus_bool_t | _dbus_directory_get_next_file (DBusDirIter *iter, DBusString *filename, DBusError *error) |
Get next file in the directory. | |
void | _dbus_directory_close (DBusDirIter *iter) |
Closes a directory iteration. | |
dbus_bool_t | _dbus_group_info_fill (DBusGroupInfo *info, const DBusString *groupname, DBusError *error) |
Initializes the given DBusGroupInfo struct with information about the given group name. | |
dbus_bool_t | _dbus_group_info_fill_gid (DBusGroupInfo *info, dbus_gid_t gid, DBusError *error) |
Initializes the given DBusGroupInfo struct with information about the given group ID. | |
void | _dbus_user_info_free (DBusUserInfo *info) |
Frees the members of info (but not info itself). | |
void | _dbus_group_info_free (DBusGroupInfo *info) |
Frees the members of info (but not info itself). | |
void | _dbus_credentials_clear (DBusCredentials *credentials) |
Sets fields in DBusCredentials to DBUS_PID_UNSET, DBUS_UID_UNSET, DBUS_GID_UNSET. | |
dbus_bool_t | _dbus_credentials_match (const DBusCredentials *expected_credentials, const DBusCredentials *provided_credentials) |
Checks whether the provided_credentials are allowed to log in as the expected_credentials. | |
dbus_int32_t | _dbus_atomic_inc (DBusAtomic *atomic) |
Atomically increments an integer. | |
dbus_int32_t | _dbus_atomic_dec (DBusAtomic *atomic) |
Atomically decrement an integer. | |
void | _dbus_generate_pseudorandom_bytes_buffer (char *buffer, int n_bytes) |
Random numbers. | |
void | _dbus_generate_random_bytes_buffer (char *buffer, int n_bytes) |
Fills n_bytes of the given buffer with random bytes. | |
dbus_bool_t | _dbus_generate_random_ascii (DBusString *str, int n_bytes) |
Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII subset. | |
dbus_bool_t | _dbus_parse_uid (const DBusString *uid_str, dbus_uid_t *uid) |
Gets a UID from a UID string. | |
const char * | _dbus_error_from_errno (int error_number) |
Converts a UNIX or Windows errno into a DBusError name. | |
dbus_bool_t | _dbus_is_console_user (dbus_uid_t uid, DBusError *error) |
Checks to see if the UID sent in is the console user. | |
dbus_bool_t | _dbus_credentials_from_uid (dbus_uid_t uid, DBusCredentials *credentials) |
Gets the credentials corresponding to the given UID. | |
dbus_bool_t | _dbus_get_user_id (const DBusString *username, dbus_uid_t *uid) |
Gets user ID given username. | |
dbus_bool_t | _dbus_get_group_id (const DBusString *groupname, dbus_gid_t *gid) |
Gets group ID given groupname. | |
DBusGroupInfo * | _dbus_user_database_lookup_group (DBusUserDatabase *db, dbus_gid_t gid, const DBusString *groupname, DBusError *error) |
Looks up a gid or group name in the user database. | |
dbus_bool_t | _dbus_user_database_get_groupname (DBusUserDatabase *db, const DBusString *groupname, const DBusGroupInfo **info, DBusError *error) |
Gets the user information for the given group name, returned group info should not be freed. | |
dbus_bool_t | _dbus_user_database_get_gid (DBusUserDatabase *db, dbus_gid_t gid, const DBusGroupInfo **info, DBusError *error) |
Gets the user information for the given GID, returned group info should not be freed. | |
dbus_bool_t | _dbus_user_database_get_groups (DBusUserDatabase *db, dbus_uid_t uid, dbus_gid_t **group_ids, int *n_group_ids, DBusError *error) |
Gets all groups for a particular user. | |
void | _dbus_user_info_free_allocated (DBusUserInfo *info) |
Frees the given DBusUserInfo's members with _dbus_user_info_free() and also calls dbus_free() on the block itself. | |
void | _dbus_group_info_free_allocated (DBusGroupInfo *info) |
Frees the given DBusGroupInfo's members with _dbus_group_info_free() and also calls dbus_free() on the block itself. | |
dbus_bool_t | _dbus_is_a_number (const DBusString *str, unsigned long *num) |
Checks if a given string is actually a number and converts it if it is. | |
DBusUserInfo * | _dbus_user_database_lookup (DBusUserDatabase *db, dbus_uid_t uid, const DBusString *username, DBusError *error) |
Looks up a uid or username in the user database. | |
void | _dbus_user_database_lock_system (void) |
Locks global system user database. | |
void | _dbus_user_database_unlock_system (void) |
Unlocks global system user database. | |
DBusUserDatabase * | _dbus_user_database_get_system (void) |
Gets the system global user database; must be called with lock held (_dbus_user_database_lock_system()). | |
dbus_bool_t | _dbus_username_from_current_process (const DBusString **username) |
Gets username of user owning current process. | |
dbus_bool_t | _dbus_homedir_from_current_process (const DBusString **homedir) |
Gets homedir of user owning current process. | |
dbus_bool_t | _dbus_homedir_from_username (const DBusString *username, DBusString *homedir) |
Gets the home directory for the given user. | |
dbus_bool_t | _dbus_credentials_from_username (const DBusString *username, DBusCredentials *credentials) |
Gets the credentials corresponding to the given username. | |
DBusUserDatabase * | _dbus_user_database_new (void) |
Creates a new user database object used to look up and cache user information. | |
void | _dbus_user_database_flush (DBusUserDatabase *db) |
Flush all information out of the user database. | |
void | _dbus_user_database_unref (DBusUserDatabase *db) |
Decrements refcount of user database. | |
dbus_bool_t | _dbus_user_database_get_uid (DBusUserDatabase *db, dbus_uid_t uid, const DBusUserInfo **info, DBusError *error) |
Gets the user information for the given UID, returned user info should not be freed. | |
dbus_bool_t | _dbus_user_database_get_username (DBusUserDatabase *db, const DBusString *username, const DBusUserInfo **info, DBusError *error) |
Gets the user information for the given username. | |
Variables | |
const char | _dbus_no_memory_message [] = "Not enough memory" |
Fixed "out of memory" error message, just to avoid making up a different string every time and wasting space. | |
const char | _dbus_return_if_fail_warning_format [] |
String used in _dbus_return_if_fail macro. |
)
|
|
Aborts with an error message if called. The given explanation will be printed.
Definition at line 121 of file dbus-internals.h. Referenced by _dbus_become_daemon(), _dbus_data_slot_allocator_alloc(), _dbus_hash_table_new(), _dbus_header_set_field_basic(), _dbus_marshal_read_basic(), _dbus_marshal_set_basic(), _dbus_marshal_skip_basic(), _dbus_marshal_write_basic(), _dbus_marshal_write_fixed_multi(), _dbus_mem_pool_dealloc(), _dbus_spawn_async_with_babysitter(), _dbus_timeout_list_remove_timeout(), _dbus_type_get_alignment(), _dbus_type_reader_recurse(), _dbus_type_writer_write_basic(), _dbus_type_writer_write_fixed_multi(), _dbus_watch_list_remove_watch(), and dbus_threads_init(). |
|
Expands to declaration of a global lock defined with _DBUS_DEFINE_GLOBAL_LOCK. The lock must be added to the list to initialize in dbus_threads_init(). Definition at line 285 of file dbus-internals.h. |
|
Defines a global lock variable with the given name. The lock must be added to the list to initialize in dbus_threads_init(). Definition at line 286 of file dbus-internals.h. |
|
Safely stuffs an integer into a pointer, to be extracted later with _DBUS_POINTER_TO_INT. Only guaranteed to preserve 32 bits.
Definition at line 157 of file dbus-internals.h. Referenced by _dbus_hash_table_insert_int(), _dbus_hash_table_lookup_int(), _dbus_hash_table_remove_int(), and _dbus_validate_signature_with_reason(). |
|
Computes the number of elements in a fixed-size array using sizeof().
Definition at line 154 of file dbus-internals.h. Referenced by _dbus_get_autolaunch_address(), _dbus_hash_table_new(), _dbus_transport_open(), and dbus_server_listen(). |
|
Safely casts a void* to an integer; should only be used on void* that actually contain integers, for example one created with _DBUS_INT_TO_POINTER. Only guaranteed to preserve 32 bits. (i.e. it's used to store 32-bit ints in pointers, but can't be used to store 64-bit pointers in ints.)
Definition at line 156 of file dbus-internals.h. Referenced by _dbus_hash_iter_get_int_key(), and _dbus_validate_signature_with_reason(). |
|
Sets all bits in an object to zero.
Definition at line 159 of file dbus-internals.h. Referenced by _dbus_connect_tcp_socket(), _dbus_connect_unix_socket(), _dbus_listen_tcp_socket(), and _dbus_listen_unix_socket(). |
|
Enumeration for status of a read().
Definition at line 50 of file dbus-spawn.c. |
|
Atomically decrement an integer.
Definition at line 697 of file dbus-sysdeps.c. References _DBUS_LOCK, _DBUS_UNLOCK, and DBusAtomic::value. Referenced by _dbus_connection_unref_unlocked(), _dbus_server_unref_unlocked(), dbus_connection_unref(), dbus_free(), dbus_message_unref(), dbus_pending_call_unref(), and dbus_server_unref(). |
|
Atomically increments an integer.
Definition at line 674 of file dbus-sysdeps.c. References _DBUS_LOCK, _DBUS_UNLOCK, and DBusAtomic::value. Referenced by _dbus_connection_ref_unlocked(), _dbus_server_ref_unlocked(), dbus_connection_ref(), dbus_malloc(), dbus_malloc0(), dbus_message_ref(), dbus_pending_call_ref(), dbus_realloc(), and dbus_server_ref(). |
|
Checks whether the child has exited, without blocking.
Definition at line 611 of file dbus-spawn.c. References FALSE, and LIVE_CHILDREN. Referenced by _dbus_babysitter_set_child_exit_error(). |
|
Blocks until the babysitter process gives us the PID of the spawned grandchild, then kills the spawned grandchild.
Definition at line 589 of file dbus-spawn.c. References LIVE_CHILDREN, and TRUE. |
|
Increment the reference count on the babysitter object.
Definition at line 243 of file dbus-spawn.c. References _dbus_assert, NULL, and DBusBabysitter::refcount. |
|
Sets the DBusError with an explanation of why the spawned child process exited (on a signal, or whatever). If the child process has not exited, does nothing (error will remain unset).
Definition at line 633 of file dbus-spawn.c. References _dbus_babysitter_get_child_exited(), DBUS_ERROR_FAILED, DBUS_ERROR_NO_MEMORY, DBUS_ERROR_SPAWN_CHILD_EXITED, DBUS_ERROR_SPAWN_CHILD_SIGNALED, DBUS_ERROR_SPAWN_EXEC_FAILED, and dbus_set_error(). |
|
Sets watch functions to notify us when the babysitter object needs to read/write file descriptors.
Definition at line 691 of file dbus-spawn.c. References _dbus_watch_list_set_functions(), and DBusBabysitter::watches. |
|
Decrement the reference count on the babysitter object. When the reference count of the babysitter object reaches zero, the babysitter is killed and the child that was being babysat gets emancipated.
Definition at line 262 of file dbus-spawn.c. References _dbus_assert, _dbus_close_socket(), _dbus_warn(), _dbus_watch_invalidate(), _dbus_watch_list_free(), _dbus_watch_unref(), dbus_free(), DBusBabysitter::error_pipe_from_child, DBusBabysitter::error_watch, DBusBabysitter::executable, NULL, DBusBabysitter::refcount, DBusBabysitter::sitter_pid, DBusBabysitter::sitter_watch, DBusBabysitter::socket_to_babysitter, DBusBabysitter::status, and DBusBabysitter::watches. Referenced by _dbus_spawn_async_with_babysitter(). |
|
Does the chdir, fork, setsid, etc. to become a daemon process.
Definition at line 70 of file dbus-sysdeps-util-unix.c. References _dbus_assert_not_reached, _dbus_error_from_errno(), _dbus_getenv(), _dbus_string_append(), _dbus_string_append_int(), _dbus_string_free(), _dbus_string_init(), _dbus_write_pid_file(), _dbus_write_socket(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, and TRUE. |
|
Changes the user and group the bus is running as.
Definition at line 254 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), dbus_set_error(), FALSE, NULL, and TRUE. |
|
Sets fields in DBusCredentials to DBUS_PID_UNSET, DBUS_UID_UNSET, DBUS_GID_UNSET.
Definition at line 616 of file dbus-sysdeps.c. References DBUS_GID_UNSET, DBUS_PID_UNSET, DBUS_UID_UNSET, DBusCredentials::gid, DBusCredentials::pid, and DBusCredentials::uid. Referenced by _dbus_auth_get_identity(), and _dbus_read_credentials_unix_socket(). |
|
Gets the credentials corresponding to the given UID.
Definition at line 113 of file dbus-userdb-util.c. References _dbus_assert, _dbus_user_database_get_system(), _dbus_user_database_get_uid(), _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), DBusTransport::credentials, DBUS_PID_UNSET, FALSE, DBusCredentials::gid, NULL, DBusCredentials::pid, DBusUserInfo::primary_gid, TRUE, DBusUserInfo::uid, and DBusCredentials::uid. |
|
Gets the credentials corresponding to the given username.
Definition at line 405 of file dbus-userdb.c. References _dbus_user_database_get_system(), _dbus_user_database_get_username(), _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), DBusTransport::credentials, DBUS_PID_UNSET, FALSE, DBusCredentials::gid, NULL, DBusCredentials::pid, DBusUserInfo::primary_gid, TRUE, DBusCredentials::uid, and DBusUserInfo::uid. Referenced by _dbus_get_user_id(). |
|
Checks whether the provided_credentials are allowed to log in as the expected_credentials.
Definition at line 632 of file dbus-sysdeps.c. References DBUS_UID_UNSET, FALSE, TRUE, and DBusCredentials::uid. Referenced by _dbus_transport_get_is_authenticated(). |
|
Removes a directory; Directory must be empty.
Definition at line 325 of file dbus-sysdeps-util-unix.c. References DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. |
|
Get next file in the directory. Will not return "." or ".." on UNIX. If an error occurs, the contents of "filename" are undefined. The error is never set if the function succeeds.
Definition at line 561 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), _dbus_string_append(), _dbus_string_set_length(), DBusDirIter::d, DBUS_ERROR_FAILED, DBUS_ERROR_NO_MEMORY, dbus_free(), dbus_malloc(), dbus_set_error(), FALSE, and TRUE. |
|
Open a directory to iterate over.
Definition at line 471 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), DBusDirIter::d, DBUS_ERROR_NO_MEMORY, dbus_new0, dbus_set_error(), and NULL. |
|
Duplicates a string array. Result may be freed with dbus_free_string_array(). Returns NULL if memory allocation fails. If the array to be duplicated is NULL, returns NULL.
Definition at line 443 of file dbus-internals.c. References _dbus_strdup(), dbus_free_string_array(), dbus_new0, and NULL. Referenced by _dbus_auth_set_mechanisms(), and dbus_server_set_auth_mechanisms(). |
|
Converts a UNIX or Windows errno into a DBusError name.
Definition at line 859 of file dbus-sysdeps.c. References DBUS_ERROR_ACCESS_DENIED, DBUS_ERROR_ADDRESS_IN_USE, DBUS_ERROR_FAILED, DBUS_ERROR_FILE_EXISTS, DBUS_ERROR_FILE_NOT_FOUND, DBUS_ERROR_LIMITS_EXCEEDED, DBUS_ERROR_NO_MEMORY, DBUS_ERROR_NO_NETWORK, DBUS_ERROR_NO_SERVER, DBUS_ERROR_NOT_SUPPORTED, and DBUS_ERROR_TIMEOUT. Referenced by _dbus_become_daemon(), _dbus_change_identity(), _dbus_check_dir_is_private_to_user(), _dbus_close(), _dbus_connect_tcp_socket(), _dbus_connect_unix_socket(), _dbus_directory_get_next_file(), _dbus_directory_open(), _dbus_file_get_contents(), _dbus_full_duplex_pipe(), _dbus_get_autolaunch_address(), _dbus_listen_tcp_socket(), _dbus_listen_unix_socket(), _dbus_read_credentials_unix_socket(), _dbus_stat(), _dbus_string_save_to_file(), and _dbus_write_pid_file(). |
|
File/directory interface.
Definition at line 351 of file dbus-sysdeps-util-unix.c. Referenced by _dbus_user_at_console(). |
|
Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII subset.
Definition at line 780 of file dbus-sysdeps.c. References _dbus_assert, _dbus_generate_random_bytes(), _dbus_string_validate_ascii(), FALSE, and TRUE. Referenced by _dbus_server_listen_platform_specific(), and _dbus_string_save_to_file(). |
|
Fills n_bytes of the given buffer with random bytes.
Definition at line 748 of file dbus-sysdeps.c. References _dbus_generate_pseudorandom_bytes_buffer(), _dbus_generate_random_bytes(), _dbus_string_copy_to_buffer(), _dbus_string_free(), and _dbus_string_init(). Referenced by _dbus_generate_uuid(). |
|
Generates a new UUID. If you change how this is done, there's some text about it in the spec that should also change.
Definition at line 506 of file dbus-internals.c. References _dbus_generate_random_bytes_buffer(), _dbus_get_current_time(), DBusGUID::as_bytes, DBusGUID::as_uint32s, and NULL. Referenced by _dbus_get_local_machine_uuid_encoded(), _dbus_server_init_base(), and dbus_internal_do_not_use_create_uuid(). |
|
Gets group ID given groupname.
Definition at line 177 of file dbus-userdb-util.c. References _dbus_user_database_get_groupname(), _dbus_user_database_get_system(), _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), FALSE, DBusGroupInfo::gid, NULL, and TRUE. |
|
Gets the hex-encoded UUID of the machine this function is executed on. This UUID is guaranteed to be the same for a given machine at least until it next reboots, though it also makes some effort to be the same forever, it may change if the machine is reconfigured or its hardware is modified.
Definition at line 711 of file dbus-internals.c. References _dbus_current_generation, _dbus_generate_uuid(), _DBUS_LOCK, _dbus_read_local_machine_uuid(), _DBUS_UNLOCK, _dbus_uuid_encode(), _dbus_warn_check_failed(), dbus_error_free(), dbus_error_init(), FALSE, and DBusError::message. Referenced by _dbus_get_autolaunch_address(), and dbus_get_local_machine_id(). |
|
Gets user ID given username.
Definition at line 153 of file dbus-userdb-util.c. References _dbus_credentials_from_username(), DBUS_UID_UNSET, FALSE, TRUE, and DBusCredentials::uid. |
|
Initializes the given DBusGroupInfo struct with information about the given group name.
Definition at line 736 of file dbus-sysdeps-util-unix.c. References DBUS_GID_UNSET. Referenced by _dbus_user_database_lookup_group(). |
|
Initializes the given DBusGroupInfo struct with information about the given group ID.
Definition at line 755 of file dbus-sysdeps-util-unix.c. References NULL. Referenced by _dbus_user_database_lookup_group(). |
|
Frees the members of info (but not info itself).
Definition at line 604 of file dbus-sysdeps.c. References dbus_free(), and DBusGroupInfo::groupname. Referenced by _dbus_group_info_free_allocated(). |
|
Frees the given DBusGroupInfo's members with _dbus_group_info_free() and also calls dbus_free() on the block itself.
Definition at line 59 of file dbus-userdb.c. References _dbus_group_info_free(), dbus_free(), and NULL. Referenced by _dbus_user_database_lookup_group(), and _dbus_user_database_new(). |
|
Gets homedir of user owning current process. The returned string is valid until dbus_shutdown() is called.
Definition at line 344 of file dbus-userdb.c. References _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), FALSE, and TRUE. Referenced by _dbus_get_standard_session_servicedirs(), and _dbus_keyring_new_homedir(). |
|
Gets the home directory for the given user.
Definition at line 366 of file dbus-userdb.c. References _dbus_string_append(), _dbus_user_database_get_system(), _dbus_user_database_get_username(), _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), FALSE, DBusUserInfo::homedir, NULL, and TRUE. Referenced by _dbus_keyring_new_homedir(). |
|
Checks if a given string is actually a number and converts it if it is.
Definition at line 77 of file dbus-userdb.c. References _dbus_string_parse_int(), FALSE, and TRUE. Referenced by _dbus_user_database_lookup(), and _dbus_user_database_lookup_group(). |
|
Checks to see if the UID sent in is the console user.
Definition at line 43 of file dbus-userdb-util.c. References _dbus_stat(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), _dbus_user_at_console(), _dbus_user_database_get_system(), _dbus_user_database_lock_system(), _dbus_user_database_lookup(), _dbus_user_database_unlock_system(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, TRUE, DBusStat::uid, and DBusUserInfo::username. |
|
Duplicates a block of memory. Returns NULL on failure.
Definition at line 420 of file dbus-internals.c. References dbus_malloc(), and NULL. Referenced by _dbus_decompose_path(). |
|
Gets a UID from a UID string.
Definition at line 816 of file dbus-sysdeps.c. References _dbus_string_parse_int(), FALSE, and TRUE. |
|
Checks whether the filename is an absolute path.
Definition at line 406 of file dbus-sysdeps-util-unix.c. References FALSE. |
|
Reads (and optionally writes) a uuid to a file. Initializes the uuid unless an error is returned.
Definition at line 662 of file dbus-internals.c. References dbus_error_free(), dbus_error_has_name(), dbus_error_init(), DBUS_ERROR_INVALID_FILE_CONTENT, dbus_move_error(), FALSE, and TRUE. Referenced by _dbus_read_local_machine_uuid(), and dbus_internal_do_not_use_get_uuid(). |
|
Installs a UNIX signal handler.
Definition at line 303 of file dbus-sysdeps-util-unix.c. References NULL. |
|
Spawns a new process. The executable name and argv[0] are the same, both are provided in argv[0]. The child_setup function is passed the given user_data and is run in the child just before calling exec(). Also creates a "babysitter" which tracks the status of the child process, advising the parent if the child exits. If the spawn fails, no babysitter is created. If sitter_p is NULL, no babysitter is kept.
Definition at line 1037 of file dbus-spawn.c. References _dbus_assert_not_reached, _dbus_babysitter_unref(), _dbus_fd_set_close_on_exec(), _dbus_full_duplex_pipe(), _dbus_strdup(), _dbus_warn(), _dbus_watch_list_add_watch(), _dbus_watch_new(), DBUS_ERROR_NO_MEMORY, DBUS_ERROR_SPAWN_FORK_FAILED, dbus_set_error(), DBusBabysitter::error_pipe_from_child, DBusBabysitter::error_watch, DBusBabysitter::executable, FALSE, NULL, READ_END, DBusBabysitter::sitter_pid, DBusBabysitter::sitter_watch, DBusBabysitter::socket_to_babysitter, TRUE, DBusBabysitter::watches, and WRITE_END. |
|
stat() wrapper.
Definition at line 423 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), DBusStat::atime, DBusStat::ctime, dbus_set_error(), FALSE, DBusStat::gid, DBusStat::mode, DBusStat::mtime, DBusStat::nlink, DBusStat::size, TRUE, and DBusStat::uid. Referenced by _dbus_is_console_user(). |
|
Duplicates a string. Result must be freed with dbus_free(). Returns NULL if memory allocation fails. If the string to be duplicated is NULL, returns NULL.
Definition at line 392 of file dbus-internals.c. References dbus_malloc(), and NULL. Referenced by _dbus_dup_string_array(), _dbus_message_iter_get_args_valist(), _dbus_server_new_for_domain_socket(), _dbus_spawn_async_with_babysitter(), _dbus_transport_get_is_authenticated(), _dbus_transport_open(), dbus_bus_register(), dbus_bus_set_unique_name(), dbus_server_get_address(), and dbus_set_error(). |
|
Checks whether a string array contains the given string.
Definition at line 483 of file dbus-internals.c. |
|
Checks if user is at the console.
Definition at line 363 of file dbus-sysdeps-util-unix.c. References _dbus_file_exists(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), and FALSE. Referenced by _dbus_is_console_user(). |
|
Gets the user information for the given GID, returned group info should not be freed.
Definition at line 339 of file dbus-userdb-util.c. References _dbus_user_database_lookup_group(), and NULL. |
|
Gets the user information for the given group name, returned group info should not be freed.
Definition at line 319 of file dbus-userdb-util.c. References _dbus_user_database_lookup_group(), DBUS_GID_UNSET, and NULL. Referenced by _dbus_get_group_id(). |
|
Gets all groups for a particular user. Returns FALSE if no memory, or user isn't known, but always initializes group_ids to a NULL array. Sets error to the reason for returning FALSE.
Definition at line 363 of file dbus-userdb-util.c. References _dbus_user_database_lookup(), DBUS_ERROR_NO_MEMORY, dbus_new, dbus_set_error(), FALSE, DBusUserInfo::group_ids, DBusUserInfo::n_group_ids, NULL, and TRUE. |
|
Gets the system global user database; must be called with lock held (_dbus_user_database_lock_system()).
Definition at line 305 of file dbus-userdb.c. References _dbus_assert. Referenced by _dbus_credentials_from_uid(), _dbus_credentials_from_username(), _dbus_get_group_id(), _dbus_homedir_from_username(), and _dbus_is_console_user(). |
|
Gets the user information for the given UID, returned user info should not be freed.
Definition at line 547 of file dbus-userdb.c. References _dbus_user_database_lookup(), and NULL. Referenced by _dbus_credentials_from_uid(). |
|
Gets the user information for the given username.
Definition at line 566 of file dbus-userdb.c. References _dbus_user_database_lookup(), DBUS_UID_UNSET, and NULL. Referenced by _dbus_credentials_from_username(), and _dbus_homedir_from_username(). |
|
Looks up a uid or username in the user database. Only one of name or UID can be provided. There are wrapper functions for this that are better to use, this one does no locking or anything on the database and otherwise sort of sucks.
Definition at line 102 of file dbus-userdb.c. References _dbus_assert, _dbus_hash_table_insert_string(), _dbus_hash_table_insert_ulong(), _dbus_hash_table_lookup_string(), _dbus_hash_table_lookup_ulong(), _dbus_hash_table_remove_ulong(), _dbus_is_a_number(), _dbus_user_info_fill(), _dbus_user_info_fill_uid(), _dbus_user_info_free_allocated(), DBUS_ERROR_NO_MEMORY, dbus_new0, dbus_set_error(), DBUS_UID_FORMAT, DBUS_UID_UNSET, NULL, DBusUserInfo::uid, and DBusUserInfo::username. Referenced by _dbus_is_console_user(), _dbus_user_database_get_groups(), _dbus_user_database_get_uid(), and _dbus_user_database_get_username(). |
|
Looks up a gid or group name in the user database. Only one of name or GID can be provided. There are wrapper functions for this that are better to use, this one does no locking or anything on the database and otherwise sort of sucks.
Definition at line 217 of file dbus-userdb-util.c. References _dbus_group_info_fill(), _dbus_group_info_fill_gid(), _dbus_group_info_free_allocated(), _dbus_hash_table_insert_string(), _dbus_hash_table_insert_ulong(), _dbus_hash_table_lookup_string(), _dbus_hash_table_lookup_ulong(), _dbus_hash_table_remove_ulong(), _dbus_is_a_number(), DBUS_ERROR_NO_MEMORY, DBUS_GID_FORMAT, DBUS_GID_UNSET, dbus_new0, dbus_set_error(), DBUS_UID_UNSET, DBusGroupInfo::gid, DBusGroupInfo::groupname, and NULL. Referenced by _dbus_user_database_get_gid(), and _dbus_user_database_get_groupname(). |
|
Creates a new user database object used to look up and cache user information.
Definition at line 440 of file dbus-userdb.c. References _dbus_group_info_free_allocated(), _dbus_hash_table_new(), _dbus_user_database_unref(), _dbus_user_info_free_allocated(), DBUS_HASH_STRING, DBUS_HASH_ULONG, dbus_new0, and NULL. |
|
Decrements refcount of user database.
Definition at line 513 of file dbus-userdb.c. References _dbus_assert, _dbus_hash_table_unref(), and dbus_free(). Referenced by _dbus_user_database_new(). |
|
Frees the members of info (but not info itself).
Definition at line 591 of file dbus-sysdeps.c. References dbus_free(), DBusUserInfo::group_ids, DBusUserInfo::homedir, and DBusUserInfo::username. Referenced by _dbus_user_info_free_allocated(). |
|
Frees the given DBusUserInfo's members with _dbus_user_info_free() and also calls dbus_free() on the block itself.
Definition at line 43 of file dbus-userdb.c. References _dbus_user_info_free(), dbus_free(), and NULL. Referenced by _dbus_user_database_lookup(), and _dbus_user_database_new(). |
|
Gets username of user owning current process. The returned string is valid until dbus_shutdown() is called.
Definition at line 322 of file dbus-userdb.c. References _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), FALSE, and TRUE. Referenced by _dbus_keyring_new_homedir(). |
|
Hex-encode a UUID.
Definition at line 525 of file dbus-internals.c. References _dbus_string_hex_encode(), _dbus_string_init_const_len(), and DBusGUID::as_bytes. Referenced by _dbus_get_local_machine_uuid_encoded(), and _dbus_server_init_base(). |
|
Prints a warning message to stderr. Can optionally be made to exit fatally by setting DBUS_FATAL_WARNINGS, but this is rarely used. This function should be considered pretty much equivalent to fprintf(stderr). _dbus_warn_check_failed() on the other hand is suitable for use when a programming mistake has been made.
Definition at line 238 of file dbus-internals.c. References _dbus_abort(). Referenced by _dbus_babysitter_unref(), _dbus_full_duplex_pipe(), _dbus_keyring_new_homedir(), _dbus_listen_unix_socket(), _dbus_marshal_skip_basic(), _dbus_message_iter_get_args_valist(), _dbus_object_tree_register(), _dbus_object_tree_unregister_and_unlock(), _dbus_poll(), _dbus_spawn_async_with_babysitter(), and dbus_message_append_args_valist(). |
|
Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in that it prefixes the pid and defaults to fatal. This should be used only when a programming error has been detected. (NOT for unavoidable errors that an app might handle - those should be returned as DBusError.) Calling this means "there is a bug" Definition at line 266 of file dbus-internals.c. References _dbus_abort(), and _dbus_getpid(). Referenced by _dbus_data_slot_allocator_alloc(), _dbus_get_local_machine_uuid_encoded(), _dbus_marshal_read_basic(), _dbus_transport_handle_watch(), _dbus_type_reader_recurse(), dbus_connection_close(), dbus_connection_remove_filter(), dbus_connection_set_timeout_functions(), dbus_connection_set_watch_functions(), dbus_connection_unref(), dbus_server_set_timeout_functions(), dbus_server_set_watch_functions(), and dbus_watch_handle(). |
|
Creates a file containing the process ID.
Definition at line 195 of file dbus-sysdeps-util-unix.c. References _dbus_close(), _dbus_error_from_errno(), dbus_set_error(), FALSE, NULL, and TRUE. Referenced by _dbus_become_daemon(). |
|
Initial value: "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\n" "This is normally a bug in some application using the D-Bus library.\n"
Definition at line 784 of file dbus-internals.c. |