Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
gvfs
gvfs-CVE-2019-12795.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gvfs-CVE-2019-12795.patch of Package gvfs
Index: gvfs-1.28.3/daemon/gvfsdaemon.c =================================================================== --- gvfs-1.28.3.orig/daemon/gvfsdaemon.c +++ gvfs-1.28.3/daemon/gvfsdaemon.c @@ -78,7 +78,8 @@ struct _GVfsDaemon guint exit_tag; gint mount_counter; - + + GDBusAuthObserver *auth_observer; GDBusConnection *conn; GVfsDBusDaemon *daemon_skeleton; GVfsDBusMountable *mountable_skeleton; @@ -171,6 +172,8 @@ g_vfs_daemon_finalize (GObject *object) } if (daemon->conn != NULL) g_object_unref (daemon->conn); + if (daemon->auth_observer != NULL) + g_object_unref (daemon->auth_observer); g_hash_table_destroy (daemon->registered_paths); g_hash_table_destroy (daemon->client_connections); @@ -236,6 +239,35 @@ name_vanished_handler (GDBusConnection * daemon->lost_main_daemon = TRUE; } +/* + * Authentication observer signal handler that authorizes connections + * from the same uid as this process. This matches the behaviour of a + * libdbus DBusServer/DBusConnection when no DBusAllowUnixUserFunction + * has been set, but is not the default in GDBus. + */ +static gboolean +authorize_authenticated_peer_cb (GDBusAuthObserver *observer, + G_GNUC_UNUSED GIOStream *stream, + GCredentials *credentials, + G_GNUC_UNUSED gpointer user_data) +{ + gboolean authorized = FALSE; + + if (credentials != NULL) + { + GCredentials *own_credentials; + + own_credentials = g_credentials_new (); + + if (g_credentials_is_same_user (credentials, own_credentials, NULL)) + authorized = TRUE; + + g_object_unref (own_credentials); + } + + return authorized; +} + static void g_vfs_daemon_init (GVfsDaemon *daemon) { @@ -265,6 +297,8 @@ g_vfs_daemon_init (GVfsDaemon *daemon) daemon->conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_assert (daemon->conn != NULL); + daemon->auth_observer = g_dbus_auth_observer_new (); + g_signal_connect (daemon->auth_observer, "authorize-authenticated-peer", G_CALLBACK (authorize_authenticated_peer_cb), NULL); daemon->daemon_skeleton = gvfs_dbus_daemon_skeleton_new (); g_signal_connect (daemon->daemon_skeleton, "handle-get-connection", G_CALLBACK (handle_get_connection), daemon); @@ -878,7 +912,7 @@ handle_get_connection (GVfsDBusDaemon *o server = g_dbus_server_new_sync (address1, G_DBUS_SERVER_FLAGS_NONE, guid, - NULL, /* GDBusAuthObserver */ + daemon->auth_observer, NULL, /* GCancellable */ &error); g_free (guid);
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