summaryrefslogtreecommitdiff
path: root/daemon/gvfsdaemon.c
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Fix socket owner for gvfsd-adminOndrej Holy2021-04-151-0/+13
| | | | | | | | | | Recently, GVfs switched from abstract sockets to named sockets. The named sockets honors file permissions and thus the socket owner is root in the case `gvfsd-admin`. This obviously prevents client from connecting. Let's change the owner to the value of `PKEXEC_UID` to ensure that the socket is usable by the client. https://gitlab.gnome.org/GNOME/gvfs/-/issues/552
* daemon: Create socket dir from gvfsd daemonOndrej Holy2021-04-151-2/+1
| | | | | | | | | | | Recently, GVfs switched from abstract sockets to named sockets. The socket dir is currently created by the individual daemons immediately before starting DBus server. If gvfsd-admin is started at first, the socket dir is owned by root user and thus it isn't accesible for other daemons and clients. Let's create the socket dir early from the gvfsd daemon to ensure correct ownership. https://gitlab.gnome.org/GNOME/gvfs/-/issues/552
* daemon: Remove connection socket properlyJan Alexander Steffens (heftig)2021-03-241-67/+28
| | | | | | | | | | The naming scheme for the non-abstract socket was changed but `new_connection_data_free` was not adjusted to match. `GDBusServer` will remove the socket when it stops, but only if `g_dbus_server_start` was called. So we can simplify the process somewhat. Also don't bother removing the directory now that all sockets share it.
* daemon: Use named sockets to avoid network permission requirementOndrej Holy2020-12-081-107/+9
| | | | | | | | | | Flatpak applications don't work with gvfs if network access is not granted. This is because GVfs for peer-to-peer communication uses abstract sockets, which are tied to the network namespace. Let's use named sockets under /run/user/$UID/gvfsd/ instead, which will allow applications to use --filesystem=xdg-run/gvfsd to grant access. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/515
* gvfsdaemon: Only accept EXTERNAL authenticationSimon McVittie2019-06-061-0/+17
| | | | | | | | | | EXTERNAL is the mechanism recommended in the D-Bus Specification for all platforms where it is supported (including Linux, *BSD, Solaris and Hurd), and is the only mechanism allowed by the session or system dbus-daemon in their default configurations. It is considerably simpler than DBUS_COOKIE_SHA1 and relies on fewer assumptions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* gvfsdaemon: Check that the connecting client is the same userSimon McVittie2019-06-061-1/+35
| | | | | | | | Otherwise, an attacker who learns the abstract socket address from netstat(8) or similar could connect to it and issue D-Bus method calls. Signed-off-by: Simon McVittie <smcv@collabora.com>
* daemon: Prevent deadlock and invalid read when closing channelsOndrej Holy2018-04-131-6/+22
| | | | | | | | | | | | | | | | Commit e147e48 added missing mutex guards for job_sources, which may unfortunately lead to deadlock because g_vfs_channel_force_close synchronously calls g_vfs_job_source_closed which is also guarded by the same mutex. The deadlock reveals another bug which was in that code. The code iterates over job_sources list, but g_vfs_job_source_closed removes current element of the list, which leads to invalid reads and potentially to segfaults also. This patch tries to fix the both mentioned issues. https://bugzilla.gnome.org/show_bug.cgi?id=794957
* daemon: Add debug print with blocking jobOndrej Holy2018-03-231-0/+1
| | | | | | | | Unmounting may finish with "File system is busy" error, but doesn't have to be obvious why. Let's print one job which blocks for easier debugging. https://bugzilla.gnome.org/show_bug.cgi?id=794487
* daemon: Add missing guards for job_sourcesOndrej Holy2018-02-191-4/+12
| | | | | | | Use daemon->lock when accessing daemon->job_sources as on other places. This might potentially help to fix some segfaults. https://bugzilla.gnome.org/show_bug.cgi?id=787992
* daemon: Port GVfsBackend to GTaskOndrej Holy2017-11-281-4/+2
| | | | | | | | | | | | GSimpleAsyncResult is deprecated in favour of GTask and should be replaced. This patch also introduce g_vfs_backend_register_mount_finish() and g_vfs_backend_unregister_mount_finish() functions to make the code nicer. Based on patch from Dan Winship. https://bugzilla.gnome.org/show_bug.cgi?id=747412
* Avoid crash when no monitor implementations exist.Tristan Van Berkom2015-10-061-1/+1
| | | | | | | | | | | The GVariantBuilder is unable to create any GVariant for an untyped array - while an empty vector is a valid variant, it is not valid for an untyped array. Passing the resulting null to gvfs_dbus_daemon_complete_cancel() causes gvfs to abort with a g_error(). https://bugzilla.gnome.org/show_bug.cgi?id=756105
* daemon: Move random string generation into shared libRoss Lagerwall2015-02-091-14/+5
| | | | | | | Random string generation is used in a few different places, so share the implementation. https://bugzilla.gnome.org/show_bug.cgi?id=738967
* ProxyVolumeMonitor: Load list of installed remote monitors via dbusAlexander Larsson2015-01-261-0/+33
| | | | | | We used to just load the files from this, but that does not work in a sandboxed environment. For backwards compat we keep loading the old files if the dbus api is not implemented yet.
* daemon: Don't abort if jobs != NULL when finalizingRoss Lagerwall2014-10-121-1/+3
| | | | | | | Don't abort if there are outstanding jobs when finalizing. This may happen if the backend is force unmounted. Use a warning instead. https://bugzilla.gnome.org/show_bug.cgi?id=710986
* daemon: consider all jobs excepting unmount as blocking processesOndrej Holy2014-08-091-1/+32
| | | | | | | User can wait to finish all jobs (not only those with opened channel) before unmount to avoid potencial crashes. https://bugzilla.gnome.org/show_bug.cgi?id=710986
* gvfsdaemon: properly remove socket_dirAntoine Jacoutot2014-01-231-9/+10
| | | | | | | | When not using abstract sockets, gvfs tries to rmdir the socket directory but it still contains the socket so the call fails. We now make sure to remove the socket first. https://bugzilla.gnome.org/show_bug.cgi?id=720482
* GVfsDaemon: Don't deadlock on cliend disconnectAlexander Larsson2013-09-261-10/+26
| | | | | | | | | | | There was a deadlock that could happen on client disconnect in peer_connection_closed(). If the cancelled job immediately called back into job_finished_callback() we would deadlock on daemon->mutex. So, make sure we cancel jobs without holding the lock, just like handle_cancel() does. https://bugzilla.gnome.org/show_bug.cgi?id=708816
* Adds infrastructure for the backends to exit cleanlyTimothy Arceri2013-04-151-3/+19
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=511802
* Fix g_vfs_daemon_close_active_channels() to take a GVfsBackend argument and ↵Timothy Arceri2013-04-101-2/+4
| | | | | | only close channels with that backend as a single daemon may handle multiple mounts/backends. https://bugzilla.gnome.org/show_bug.cgi?id=511802
* Return correct error for invalid backendsAlexander Larsson2012-08-231-2/+2
|
* gdbus: Remove debug printsTomas Bzatek2012-07-311-31/+2
|
* gdbus: Use casting macros where possibleTomas Bzatek2012-07-311-9/+9
|
* gdbus: Use g_clear_error() where appropriateTomas Bzatek2012-07-311-2/+1
|
* gdbus: Remove unused extra_fd stuffTomas Bzatek2012-07-311-139/+7
|
* gdbus: More signal handler disconnectionTomas Bzatek2012-07-311-0/+1
| | | | Not really a problem in this case, but let's be on a safe side.
* gdbus: Make cancellation workTomas Bzatek2012-07-311-1/+0
| | | | | | This mimics the old behaviour and works for sync and async. Requires new glib for g_dbus_connection_get_last_serial().
* gdbus: Improve registered paths activation on daemon sideTomas Bzatek2012-07-311-33/+67
| | | | | | | | | | | | | | | | | This changes the way registered paths (i.e. interface skeleton exports) are activated on daemon side. We're keeping a list of connections on which every registered path is exported so that if connection is closed or the path is unregistered we always free the right interface skeletons. We also keep track of active client (peer-to-peer) connections so that if a new path is registered, it's automatically exported to all active connections. Needed since client connections are usually shared. It also has a nice side-effect of reacting to dirty disconnects (e.g. the client dies). This whole registration machinery needs unique object paths (for the hash table) but that's not a problem in the current state.
* gdbus: Core daemon and client portTomas Bzatek2012-07-311-342/+377
| | | | | | | | | | | Port of most of the gvfs core, few bits still missing. Lot of debug prints around, will be removed in further commits. Same amount of TODOs and FIXMEs. Notes: * kill serials? * get rid of mainloops where applicable (copy/move progress callback, enumerator) * fix keyring integration * use gdbus builtin fd passing within gvfsdaemon.c, kill the extra_fd stuff
* Update the Address of the FSFFelix Möller2012-07-301-2/+2
| | | | | | | | | | | | | | | Updating the address of the FSF. This has been done by: while read file; do sed -i 's:59 Temple Place:51 Franklin Street:' $file sed -i 's:Suite 330:Fifth Floor:' $file sed -i 's:02111-1307:02110-1301:' $file done https://bugzilla.gnome.org/show_bug.cgi?id=656598 Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
* Explicitly intialize mutexes on stackTomas Bzatek2011-11-141-0/+2
| | | | | | Turned out zeroing memory is not enough in some cases so let's be on the safe side and properly initialize all non-static mutexes. Also, don't initialize/clear the static ones.
* Adapt to glib mutex API changesTomas Bzatek2011-10-251-17/+16
| | | | A continuation to https://bugzilla.gnome.org/show_bug.cgi?id=661148
* daemon: Add logic to force close active channelsChristian Kellner2011-06-061-0/+10
| | | | | | This includes logic in a GVfsChannel to force close is as well as a function in the GVfsDaemon to iterate over all active channels and call the force-close function.
* daemon: Function to schedule a job in a threadChristian Kellner2011-06-061-0/+6
| | | | | | Add a public function to schedule a job in the daemon's threadpool making it possible for e.g. a job to "manually" implement the try() / run() stages of job execution.
* Rename gdbusutils.h to avoid conflict with GIO1.6.2Matthias Clasen2010-05-271-1/+1
| | | | This makes gvfs build with recent glib again, see bug #619537
* Don't leak mount job operationHans de Goede2010-01-121-0/+1
| | | | | | | | | | | | | | | | | gvfs <= 1.5.1 does not properly call the finalize function of backends, due to a missing unref call. This causes the cleanup functions of the libraries underlying the backends to not get called. In case of the gphoto2 backend, this causes the kernel driver for dual mode webcams (which have a kernel space webcam driver and a userspace stillcam driver), to not get re-attached to the device when then the gvfs mount gets unmounted. This patch fixes this by adding a g_object_unref (job) to g_vfs_daemon_initiate_mount, which is needed as g_vfs_daemon_queue_job takes a reference itself. https://bugzilla.gnome.org/show_bug.cgi?id=606194
* When a p2p connection is closed, cancel all pending jobsBenjamin Otte2009-07-201-0/+15
| | | | | | Not cancelling them caused long running jobs - like a GvfsJobPull for a multi-GB file on a remote ftp mount - to not stop running and finish downloading the file.
* Use dash for proeprty name, not underlineBenjamin Otte2009-07-201-1/+1
|
* Bug 587484 – Interaction when unmounting mounts and misc fixesDavid Zeuthen2009-07-081-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Port everything to use _with_operation() variants of unmount/eject methods - Add support for g_file_poll_mountable() - new job class: GVfsJobPollMountable - Pass mount operation for unmount/eject ops on GDaemonFile and GDaemonMount - receive in the appropriate GVfsJob classes - also pass unmount flags where it was missing - port all backends to use this - Teach GMountSource and GMountOperationDBus about the new GMountOperation::show-processes signal - also provide new API - g_mount_source_is_dummy() - e.g. when the client didn't passed NULL for the GMountOperation - g_mount_source_abort() - to send the ::abort signal to the client-side GMountOperation - make the client-side of GMountSource return ::reply with NOT_HANDLED when we do an abort - Refactor the mount operation handling in GProxyVolumeMonitor - Pass mount operation for unmount/ejects in GProxyVolumeMonitor - Pass the process id of the actual reader/writer in OpenForRead and OpenForWrite daemon methods - add some private API for making the FUSE client set the pid of the POSIX client (otherwise it looks like the FUSE client is blocking) and pass the right pid. This is because the FUSE client is basically impersonating the POSIX processes. - Make the process id mentioned above available in appropriate GVfsJob classes - GVfsJobOpenForRead - GVfsJobOpenForWrite - GVfsChannel - Provide API to get a list of all blocking clients, e.g. an array of GPid - g_vfs_daemon_get_blocking_processes() - Provide convenience API to easily doing the right thing on unmount; e.g. interact with the user about blocking processes - see the gphoto2 backend for example usage - g_vfs_backend_has_blocking_processes() - g_vfs_backend_unmount_with_operation() and g_vfs_backend_unmount_with_operation_finish() - Only the gphoto2 backend supports ::show-processes right now. Support for other backends will be added shortly. - Implement support for ::show-processes in the GDU volume monitor - right now we don't support "Unmount Anyway" since it requires ABI changes in libgdu.so - this will be changed as soon as there's a new gnome-disk-utility release
* Add g_vfs_backend_is_mounted()Alexander Larsson2009-04-161-1/+8
| | | | | | | | | | | | | | | | 2009-04-16 Alexander Larsson <alexl@redhat.com> * daemon/gvfsbackend.[ch]: Add g_vfs_backend_is_mounted() * daemon/gvfsdaemon.c: (g_vfs_daemon_re_register_job_sources): Don't re-register backends that have not finished mounted yet. (#578861) svn path=/trunk/; revision=2378
* Convert all spew to g_debug()Alexander Larsson2009-03-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-03-06 Alexander Larsson <alexl@redhat.com> * daemon/daemon-main.c: * daemon/gvfsbackend.c: * daemon/gvfsbackendburn.c: * daemon/gvfsbackenddav.c: * daemon/gvfsbackendhttp.c: * daemon/gvfsbackendobexftp.c: * daemon/gvfsbackendtrash.c: * daemon/gvfsdaemon.c: * daemon/gvfsjobcloseread.c: * daemon/gvfsjobclosewrite.c: * daemon/gvfsjobcopy.c: * daemon/gvfsjobdbus.c: * daemon/gvfsjobenumerate.c: * daemon/gvfsjobmount.c: * daemon/gvfsjobmove.c: * daemon/gvfsjobpull.c: * daemon/gvfsjobpush.c: * daemon/gvfsjobread.c: * daemon/gvfsjobseekread.c: * daemon/gvfsjobseekwrite.c: * daemon/gvfsjobunmount.c: * daemon/gvfsjobwrite.c: * daemon/mount.c: Convert all spew to g_debug() svn path=/trunk/; revision=2297
* Use g_timeout_add_seconds() instead of g_timeout_add() to save some power.A. Walton2009-01-221-1/+1
| | | | | | | | | | | | 2009-01-21 A. Walton <awalton@gnome.org> * daemon/gvfsdaemon.c (daemon_schedule_exit): * daemon/gvfsjobcreatemonitor.c (create_reply): Use g_timeout_add_seconds() instead of g_timeout_add() to save some power. svn path=/trunk/; revision=2177
* Fix memory leaks.Carlos Garcia Campos2008-03-041-0/+1
| | | | | | | | | | | 2008-03-04 Carlos Garcia Campos <carlosgc@gnome.org> * common/gmountspec.c: (g_mount_spec_copy): * daemon/gvfsdaemon.c: (g_vfs_daemon_initiate_mount): * daemon/main.c: (main): Fix memory leaks. svn path=/trunk/; revision=1519
* Code cleanup from Kjartan: Removes unused code/variables. Uses rightAlexander Larsson2008-02-191-3/+5
| | | | | | | | | | | | | | | 2008-02-19 Alexander Larsson <alexl@redhat.com> * lots of *.c files: Code cleanup from Kjartan: Removes unused code/variables. Uses right printf types Uses non-deprecated dbus calls. Removes spurious ; and , deleted extra checks for NULL for g_free svn path=/trunk/; revision=1302
* Indentation fixAlexander Larsson2008-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-01-24 Alexander Larsson <alexl@redhat.com> * daemon/gvfsdaemon.c: Indentation fix * hal/ghaldrive.[ch]: * hal/hal-device.c: * hal/ghalvolume.c: * hal/ghalmount.c: Clean up coding style * hal/ghalvolumemonitor.[ch]: Clean up coding style Don't show drives if we're ignoring all their volumes (and there are volumes) * hal/hal-pool.c: Clean up coding style Actually look at cap_only. Free private dbus_connection on error svn path=/trunk/; revision=1176
* Don't translate g_warning stringsAlexander Larsson2008-01-141-3/+3
| | | | | | | | | | 2008-01-14 Alexander Larsson <alexl@redhat.com> * daemon/gvfsdaemon.c: Don't translate g_warning strings svn path=/trunk/; revision=1122
* Code cleanups from Kjartan Maraas.Alexander Larsson2007-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 2007-11-16 Alexander Larsson <alexl@redhat.com> * client/gdaemonfile.c: * client/gdaemonfileinputstream.c: * client/gdaemonfileoutputstream.c: * client/smburi.c: * common/gdbusutils.c: * common/gmountsource.c: * daemon/gvfsbackendftp.c: * daemon/gvfsbackendtrash.c: * daemon/gvfsdaemon.c: * daemon/gvfsjob.c: * daemon/gvfsjobdbus.c: * daemon/gvfsjobopenforwrite.h: * daemon/mount.c: * daemon/pty_open.c: * test/benchmark-gvfs-big-files.c: * test/benchmark-gvfs-small-files.c: * test/benchmark-posix-small-files.c: Code cleanups from Kjartan Maraas. svn path=/trunk/; revision=1031
* Handle NULL callback in _g_dbus_connection_call_asyncAlexander Larsson2007-11-141-2/+51
| | | | | | | | | | | | | 2007-11-14 Alexander Larsson <alexl@redhat.com> * common/gdbusutils.c: Handle NULL callback in _g_dbus_connection_call_async * daemon/gvfsdaemon.c: Re-register backends with new main daemons svn path=/trunk/; revision=1024
* Fixes for solaris build. Patches from Damien CarberyAlexander Larsson2007-11-081-0/+1
| | | | | | | | | | | | | 2007-11-08 Alexander Larsson <alexl@redhat.com> * daemon/gvfsdaemon.c: * daemon/gvfsjobmove.c: * test/benchmark-common.c: Fixes for solaris build. Patches from Damien Carbery svn path=/trunk/; revision=1019
* Add copyright information to source files.Christian Kellner2007-11-011-0/+22
| | | | | | | | | | | | 2007-11-01 Christian Kellner <gicmo@gnome.org> * client/*.[ch]: * common/*.[ch]: * daemon/*.[ch]: * test/*.[ch]: Add copyright information to source files. svn path=/trunk/; revision=1007
* Build fixes Patch from Milosz Derezynski <internalerror@gmail.com>Alexander Larsson2007-10-121-0/+3
| | | | | | | | | | | 2007-10-12 Alexander Larsson <alexl@redhat.com> * daemon/gvfsdaemon.c: Build fixes Patch from Milosz Derezynski <internalerror@gmail.com> svn path=/trunk/; revision=979