Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
dbus-1-x11.20201
fix-upstream-userdb-constpointer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-upstream-userdb-constpointer.patch of Package dbus-1-x11.20201
commit 6ee66ff7bcc91803111d950512f02651e664f74f Author: Simon McVittie <smcv@collabora.com> Date: Tue Jun 30 19:13:17 2020 +0100 userdb: Make lookups return a const pointer This makes it more obvious that the returned pointer points to a struct owned by the userdb, which must not be freed or have its contents modified, and is only valid to dereference until the next modification to the userdb's underlying hash tables (which in practice means until the lock is released, because after that we have no guarantees about what might be going on in another thread). Signed-off-by: Simon McVittie <smcv@collabora.com> Index: dbus-1.12.2/dbus/dbus-userdb-util.c =================================================================== --- dbus-1.12.2.orig/dbus/dbus-userdb-util.c +++ dbus-1.12.2/dbus/dbus-userdb-util.c @@ -240,9 +240,9 @@ _dbus_get_user_id_and_primary_group (con * @param gid the group ID or #DBUS_GID_UNSET * @param groupname group name or #NULL * @param error error to fill in - * @returns the entry in the database + * @returns the entry in the database (borrowed, do not free) */ -DBusGroupInfo* +const DBusGroupInfo * _dbus_user_database_lookup_group (DBusUserDatabase *db, dbus_gid_t gid, const DBusString *groupname, @@ -328,6 +328,8 @@ _dbus_user_database_lookup_group (DBusUs return NULL; } + /* Return a borrowed reference to the DBusGroupInfo owned by the + * two hash tables */ return info; } } Index: dbus-1.12.2/dbus/dbus-userdb.c =================================================================== --- dbus-1.12.2.orig/dbus/dbus-userdb.c +++ dbus-1.12.2/dbus/dbus-userdb.c @@ -122,9 +122,9 @@ _dbus_is_a_number (const DBusString *str * @param uid the user ID or #DBUS_UID_UNSET * @param username username or #NULL * @param error error to fill in - * @returns the entry in the database + * @returns the entry in the database (borrowed, do not free) */ -DBusUserInfo* +const DBusUserInfo * _dbus_user_database_lookup (DBusUserDatabase *db, dbus_uid_t uid, const DBusString *username, @@ -211,6 +211,8 @@ _dbus_user_database_lookup (DBusUserData return NULL; } + /* Return a borrowed pointer to the DBusUserInfo owned by the + * hash tables */ return info; } } Index: dbus-1.12.2/dbus/dbus-userdb.h =================================================================== --- dbus-1.12.2.orig/dbus/dbus-userdb.h +++ dbus-1.12.2/dbus/dbus-userdb.h @@ -76,15 +76,15 @@ dbus_bool_t _dbus_user_database_ge DBusError *error); DBUS_PRIVATE_EXPORT -DBusUserInfo* _dbus_user_database_lookup (DBusUserDatabase *db, +const DBusUserInfo *_dbus_user_database_lookup (DBusUserDatabase *db, dbus_uid_t uid, const DBusString *username, DBusError *error); DBUS_PRIVATE_EXPORT -DBusGroupInfo* _dbus_user_database_lookup_group (DBusUserDatabase *db, - dbus_gid_t gid, - const DBusString *groupname, - DBusError *error); +const DBusGroupInfo* _dbus_user_database_lookup_group (DBusUserDatabase *db, + dbus_gid_t gid, + const DBusString *groupname, + DBusError *error); DBUS_PRIVATE_EXPORT void _dbus_user_info_free_allocated (DBusUserInfo *info); DBUS_PRIVATE_EXPORT
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor