summaryrefslogtreecommitdiff
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* smb: Allow renaming a file to the same name with a different caseHEADmasterCorey Berla2023-05-031-10/+21
| | | | | | | | | | | | | We check to see if the desired file name already exists before doing a renaming by stat'ing the file (to prevent smb from destroying an existing file). Since smb is not case sensitive, the check for an existing file mistakenly returns true if we are only changing the filename's case. Add a second check to see whether we are simply changing the case of the filename. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/672
* mtp: Make mtp backend support incrementally enumerate.re2zero2023-05-031-2/+45
| | | | | After libmtp has added get_children API, integrate this new API to get files incrementally. This LIBMTP_Get_Children API will be included in next libmtp release 1.1.21.
* mtp: Emit delete event on device when disconnected António Fernandes2023-04-291-0/+5
| | | | | Otherwise clients won't realize the root file is gone. Related to https://gitlab.gnome.org/GNOME/nautilus/-/issues/371
* Revert "smb: Allow renaming a file to the same name with a different case"Corey Berla2023-04-111-8/+1
| | | | This reverts commit f99b812d16d29f9fa6dd090f4ccb6058c004e012.
* smb: Allow renaming a file to the same name with a different caseCorey Berla2023-04-111-1/+8
| | | | | | | | | | | | | We check to see if the desired file name already exists before doing a renaming by stat'ing the file (to prevent smb from destroying an existing file). Since smb is not case sensitive, the check for an existing file mistakenly returns true if we are only changing the filename's case. Add a second check to see whether we are simply changing the case of the filename. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/672
* trash: Sync trash dir items when files changerong wang2023-03-311-2/+19
| | | | | | | | | | | | In the case of an application monitoring the trash can, delete a file on the mounted device to the trash can, and then unmount the device. At this time, if you check the status of the trash can, you will find that the number of files queried is inconsistent with the number of files obtained through the enumeration job. This is because the number of files queried includes some files that do not exist when the device is unmounted. The solution is to synchronize the status of the trash can in time to ensure that the trash can does not record files that do not exist.
* dav: Prevent g_object_unref call with NULL pointerOndrej Holy2023-02-281-1/+1
| | | | | | | | When the push method in DAV baclend is called with a nonexistent source file, the `GLib-GObject-CRITICAL **: 12:07:04.743: g_object_unref: assertion 'G_IS_OBJECT (object)' failed` message is printed because the `g_object_unref` function is called for a `NULL` pointer. Let's use `g_clear_object` instead to avoid this.
* http: Fill `GFileInfo` with uncompressed sizesLucas Chollet2023-02-081-0/+23
| | | | | | | | | | | | | Currently, using `FileProgressCallback` is quite confusing as `current_num_bytes` is in uncompressed bytes unlike `total_num_bytes` which is in compressed bytes. In order to solve this issue, we disable compression in `query_info` by setting the "Accept-Encoding" flag to `identity` (none). Then whenever `query_info_on_read` is called, we make sure that the request wasn't set to accept compresssion and fallback to `query_info` if it is the case. Fixes #195
* Fix string comparisonSergio Costas Rodriguez2023-02-062-2/+2
| | | | | | | | In several places, the code compares to strings by comparing their pointers instead of using g_strcmp0(). Although this seems to work, it is incorrect. This MR fixes it.
* dav: Prevent usage of NULL when user is not specifiedOndrej Holy2023-01-061-2/+4
| | | | | | | | | | | When the username is not part of an URI, then the following message is printed: `GVFS-CRITICAL **: 12:31:47.663: g_mount_spec_set_with_len_internal: assertion 'value != NULL' failed`. This is because `g_mount_spec_set` is called with `NULL`. It possibly lead to crash when it is build with the `G_DISABLE_CHECKS` option. This bug was introduced recently by the commit 6636d89f. Let's check the value before setting it to fix this. Related: https://gitlab.gnome.org/GNOME/gvfs/-/issues/644
* ftp: Update ftp->connections when the connection is releasedwangrong2023-01-051-0/+1
| | | | | | | | | | After gvfsd-ftp is connected to the ftp server, if the ftp server stops, the gvfsd-ftp sending request will be stuck, even after the ftp server is started, it still cannot be recovered. This is because ftp->connections is not updated when the connection is released,Thus let ftp->connections decrement by one when the connection is released. https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/149
* daemon: PATH-expand the sftp backend ssh clientAlex Stewart2022-12-141-1/+1
| | | | | | | | | | | | | | | | | Meson is currently configured to search the gvfs builder's PATH for an ssh client, and hardcode its fullpath as the canonical ssh client for the gvfs sftp backend. This setup breaks in cases where the builder has a different ssh client from the final runtime root, or where the client's pathes differ. Builders using OpenEmbedded or buildroot workspaces are particularly affected. Instead, set SSH_PROGRAM to `ssh` so that it gets PATH-expanded at runtime. Closes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/465 Signed-off-by: Alex Stewart <alex.stewart@ni.com>
* backend: Add support for xx-large and x-large thumbnailsOndrej Holy2022-12-131-19/+18
| | | | | | | | | GVfs doesn't support x-large and xx-large thumbnails currently. Consequently, thumbnails are not shown for remote locations in Nautilus on HiDPI screens. GLib added support for them over glib!2941 recently. Let's do the similar change for GVfs. Relates: glib#2767
* smb: Remove redundant variableOndrej Holy2022-05-051-10/+1
| | | | | The `mount_try_again` variable is redundant since it is set to `TRUE` in all cases. Let's remove it to sligtly improve readability of the code.
* smb: Rework anonymous handling to avoid EINVALOndrej Holy2022-05-051-15/+4
| | | | | | | | | | | After the recent samba change, the "Invalid Argument" error can be still returned when anonymous login is requested even after the commit 747c7f6. This is because `smbc_setOptionNoAutoAnonymousLogin` is called after returning from the `auth_callback` function (i.e. there is one redundant iteration). Let's rework the handling a bit and call that immediately, which bypasses the issue. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/619
* http: Unescape prefix to fix handling of encoded URIsOndrej Holy2022-05-031-1/+1
| | | | | | | | | | Currently, the HTTP backend fails with the "The specified location is not mounted" error for URIs with path containing escaped characters. This is because the mount prefix is not unescaped. This is unfortunatelly another libsoup3 port regression. Let's correctly unescape the prefix to make that work again. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/623
* dav: Fix build without Avahi supportOndrej Holy2022-04-281-7/+9
| | | | | | | | | The recent commits break build when Avahi support is disabled. Let's add the missing ifdef directive and move some variable declarations to fix the build. Part of this change was originally proposed by the reporter of GNOME/gvfs#621. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/621
* dav: Drop user from URI as a workaround for Nextcloud bugOndrej Holy2022-04-221-26/+31
| | | | | | | | | | | | | | | Currently, it is not possible to connect to some Nextcloud servers when a username is part of URI. So this also affects volumes configured over GOA. The main problem seems to be that Nextcloud doesn't send the `WWW-Authenticate` header as a part of 401 response in certain cases (e.g. when 2FA is enabled). A recent libsoup change leads to the situation that DAV backend doesn't have a chance to specify a password as the `authenticate` signal is not called at all. This is because libsoup tries to authenticate with an empty password first. Let's drop the username from URI to avoid the password-less login attempt so the backend has at least one chance to try some password in this case... Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/617
* dav: Port DNS-SD resolver to async API to fix hangs when mountingOndrej Holy2022-04-211-45/+68
| | | | | | | | | | The mount operation hangs for DNS-SD style URIs (i.e. with `dav+sd` and `davs+sd` schemes) after the recent commit 9203fad5. This is because the backend now uses the asynchronous APIs, but the `GVfsDnsSdResolver` is still used synchronously. Let's use asynchronous API for the resolver as well to fix the hangs. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/618
* smb: Ignore EINVAL for kerberos/ccache loginOndrej Holy2022-04-132-3/+15
| | | | | | | | With samba 4.16.0, mount operation fails with the "Invalid Argument" error when kerberos/ccache is misconfigured. Ignore this error, so user get a chance to login using the password... Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/611
* dav: Rewrite to libsoup async API to fix crashesDaniel Kolesa2022-04-071-725/+1189
| | | | | | | | | | | | | Since libsoup3 cannot deal with threads, we cannot use the do_ methods which execute in a thread pool. However, we can implement these in an async manner, which will bypass the thread pool and get rid of the issue. The write methods are left synchronous as they deal with a memory output stream and do not actually call libsoup. Therefore, we do not have to care whether they are threaded or not. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/609
* dav: Do not lose userinfo when copying URIsDaniel Kolesa2022-04-061-21/+7
| | | | | | | | | | The use of g_uri_build was also bad, since otherwise we would run into this: https://gitlab.gnome.org/GNOME/glib/-/issues/2619 While this should be fixed in glib, we need to work around this behavior for existing installations. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/614
* dav: Fix crashes caused by extra unrefOndrej Holy2022-03-231-1/+0
| | | | | | | | | The `mount_base` uri is unreffed twice. First time over the local `mount_base` pointer and for the second time over the `G_VFS_BACKEND_HTTP (backend)->mount_base` pointer. This leads to `SIGABRT` from the `__pthread_kill_implementation` function. Let's remove that extra unref to fix this crashes. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2066717
* dav, http: port to libsoup3Daniel Kolesa2022-02-015-865/+1051
| | | | | | | | | | | | | The dav and http backends of the daemon now use libsoup3. Things should work more or less the same as before. One caveat is that the soup session no longer defaults to ssl-strict, so it will no longer silently accept certificates. This does not affect the DAV backend (it has its own handling which is replicated in the soup3 port) but it does affect the http backend. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/208
* build: Remove incorrect i18n.merge_file argumentOndrej Holy2022-01-211-1/+0
| | | | | | | | The positional argument was being silently ignored until meson 0.60.0 where it fails with "ERROR: Function does not take positional arguments". Related: https://github.com/mesonbuild/meson/issues/9441 Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/599
* sftp: Adapt on new OpenSSH password promptsOndrej Holy2021-10-261-6/+6
| | | | | | | | | | SFTP backend fails when connecting with the "Timed out when logging in" error with the recent OpenSSH versions. This is because their password prompts are now prefixed by the `(user@host)` string, which breaks our `g_str_has_prefix` checks. Let's use `strstr` instead to fix this issue and also to not break compatibility with old versions and other vendors. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/584
* build: Improve the use of file generation on configure timeIñigo Martínez2021-10-251-15/+8
| | | | | | The files generated on configure time have been improved by the stacking multiple configuration processes, use of generator tags and the use of dictionaries.
* build: Move to string based include_directoriesIñigo Martínez2021-10-251-1/+1
| | | | | | To be consistent with the whole set of build files, the `include_directories` have been replaced by string based alternative.
* build: Use dictionary for easier unpackIñigo Martínez2021-10-251-27/+26
| | | | | | | | | Dictionaries can be used to ease `foreach` statements due to their natural unpacking system[0]. This system has been used to ease some loops. [0] https://mesonbuild.com/Syntax.html#foreach-with-a-dictionary
* build: Make use of the new full_path methodIñigo Martínez2021-10-251-1/+1
| | | | | | | | | | | | The external program object returned by `find_program()` has been fixed and its `path` method has been deprecated and `full_path` is the method to be called[0]. The deprecated `path` method has been updated in meson build files. Required meson version has also been bumped to 0.55. [0] https://mesonbuild.com/Release-notes-for-0-55-0.html#find_program-fixes-when-the-program-has-been-overridden-by-executable
* mount: Replace deprecated functionwip/oholy/ci-libsoup3Ondrej Holy2021-10-151-1/+1
| | | | | | The `g_spawn_check_exit_status` function is deprecated now and `g_spawn_check_wait_status` should be used instead. Let's make that change and bump the glib dependency accordingly.
* Add PartOf= to all systemd unitsHenri Chain2021-10-011-0/+1
| | | | | | | | | | | | | The `PartOf` directive sets up a one-way dependency between `graphical-session.target` and our services, so that when `graphical-session.target` is stopped or restarted, our services also get stopped or restarted. This ensures that gvfs daemons that were started in the context of a GUI login session (through dbus activation) do not continue to run after the user has logged out. See `systemd.unit(5)` for more info.
* Move systemd services to session sliceHenri Chain2021-10-011-0/+1
| | | | | | | | | | | | | | | | This puts all gvfs systemd services (which are all dbus-activated through `SystemdService=`) inside of the `session` slice that was introduced in v249 (https://github.com/systemd/systemd/pull/16603) and described in https://systemd.io/DESKTOP_ENVIRONMENTS/ and `systemd.special(7)` This allows sysadmins or OS integrators to assign higher-priority `systemd.resource-control(5)` on `session.slice` and have it propagate down to important session services such as gvfs, so that the gvfs daemons receive sufficient priority for resource allocations to keep the session running smoothly under load. Note that it still works on older systemd (the slice, which is just a cgroup inner directory, is created on demand)
* admin: Fix mount operation hang caused by pkexec failureOndrej Holy2021-06-071-1/+25
| | | | | | | | | Currently, the mount operation for the admin backend can hang when the authentication dialog is dismissed for example. This is because `pkexec` exits before spawning the `gvfsd-admin` daemon. Let's catch that case and return the "Permission denied" error. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/565
* admin: Make the privileged group configurableOndrej Holy2021-06-072-4/+11
| | | | | | | | | Currently, `wheel` group is hardcoded in the `.rules` file which is there to prevent redundant password prompt when starting gvfsd-admin. The Debian based systems obviously uses `sudo` group instead of `wheel`. Let's make the privileged group configurable. https://gitlab.gnome.org/GNOME/gvfs/-/issues/565
* admin: Fail when peer credentials are not availableOndrej Holy2021-04-151-0/+9
| | | | | | | | | Currently, critical errors are printed when peer credentials aren't available (i.e. session bus fallback is used). Let's return an error immediately to prevent the criticals. Also add warning with suggestion to allow `--filesystem=xdg-run/gvfsd` access. https://gitlab.gnome.org/GNOME/gvfs/-/issues/305
* admin: Pass also XDG_RUNTIME_DIR to pkexec environmentOndrej Holy2021-04-152-1/+6
| | | | | | | | | | | Recently, GVfs switched from abstract sockets to named sockets. The sockets are created in the `XDG_RUNTIME_DIR` directory. This directory is not unfortunatelly set for `gvfsd-admin` and thus the root's cache dir is used instead, which is wrong. Let's pass the `XDG_RUNTIME_DIR` environment variable to the `pkexec` environment similarly to `DBUS_SESSION_BUS_ADDRESS`. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/552
* 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-152-2/+7
| | | | | | | | | | | 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.
* admin: Fix typo in .rules fileRené Genz2021-02-241-1/+1
| | | | | The comment in the .rules file contains `another prompts` phrase which is wrong. Let's use `another prompt` instead of it.
* google: Add Shared drives folderOndrej Holy2021-02-121-13/+146
| | | | | | | | Currently, it is not possible to browse files available over Shared drives (formerly Team drives). Let's add Shared drives folder to the root to make them available. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/377
* google: Set G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE and _READ attributesOndrej Holy2021-02-121-0/+4
| | | | | | The G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE and G_FILE_ATTRIBUTE_ACCESS_CAN_READ attributes are not set currently. Let's use the newly added libgdata API to set them.
* google: Provide volatile entries for old URIsOndrej Holy2021-02-121-2/+20
| | | | | | The My Drive folder was added to the root, which changed URIs from /file-id to /root-id/file-id. Let's provide volatile entries in the old locations to not break user bookmarks...
* google: Add Shared with me folderOndrej Holy2021-02-121-32/+191
| | | | | | | | Currently, it is not possible to browse files which are shared with the user (the Shared with me folder on the web). Let's add My Drive and Shared with me folder to the root to make them available. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/444
* google: Increase number of results in batches for better performanceOndrej Holy2021-02-121-3/+1
| | | | | | | | | Currently, only 50 results are returned in one batch, which means that multiple network requests are needed for folders with a lot files, which makes it slow. I am not sure there was some reason for this limitation earlier (e.g. before the cache rework), however, I don't see any rationals for it currently. Let's increase this to its maximum for better performance.
* Drop use of volatile qualifierOndrej Holy2021-02-121-1/+1
| | | | | | | GVfs build with --werror fails currently because of glib!1719. Let's drop the volatile qualifier as it doesn't help with atomicity anyway. Relates: https://gitlab.gnome.org/GNOME/glib/-/issues/600
* daemon: Set filesystem::use-preview explicitlyAntónio Fernandes2021-01-2210-0/+16
| | | | | | | It can be correctly implied from the value of filesystem::remote for many backends, but let's make it explicit for them too. Fixes https://gitlab.gnome.org/GNOME/gvfs/-/issues/497
* daemon: Set G_FILESYSTEM_PREVIEW_TYPE_NEVER in browse backendsAntónio Fernandes2021-01-225-0/+5
| | | | | | | These backends are special and their "files" are links to locations from other backends. I doesn't make sense to preview them. https://gitlab.gnome.org/GNOME/gvfs/-/issues/497
* afc: Set G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYSAntónio Fernandes2021-01-221-0/+1
| | | | | | | | | | | | | filesystem::preview-type used to be IF_LOCAL for this backedn but it has been unset by commit a71469c79fd31adfc594a55afd29a7ce2202b270 The commit message says it should be treated as remote filesystems. However, filesystem::remote is set to FALSE, so application would still interpret this as local for previewing purposes. Set filesystem::preview-type to get the result expected by that commit. https://gitlab.gnome.org/GNOME/gvfs/-/issues/497