summaryrefslogtreecommitdiff
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* build: Remove incorrect i18n.merge_file argumentOndrej Holy2022-05-261-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 (cherry picked from commit 17a067b9)
* 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 (cherry picked from commit 8c7e79042d819304ea38408d0d90313eef7a3869)
* smb: Ignore EINVAL for kerberos/ccache loginOndrej Holy2022-05-052-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 (cherry picked from commit 747c7f6ea6c8b6a7ccd008bb47996ba7eb169bcc)
* 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 (cherry picked from commit 15bf21e5dd2532ebf98400bd128e78d5bbd17938)
* 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
* Use shorter strings for prompt dialog titlesJonas Dreßler2021-01-158-31/+53
| | | | | | | | | | | | | The layout of the modal dialogs in gnome-shell changed [1] and the title now is larger and uses the style of a headline. Make sure all titles remain fully visible and use shorter strings for those. Also unify the generic "Enter password" strings a bit to make work easier for translators and use this string for most cases: "Authentication Required\nEnter password for “%s”:" [1] https://gitlab.gnome.org/GNOME/gnome-shell/issues/1343
* mtp: Use G_FILESYSTEM_PREVIEW_TYPE_NEVERAntónio Fernandes2020-12-181-0/+1
| | | | | | | | gphoto2 does this since commit 983186766060ec82e260f8cd9a5160b93b2ae958 The same rationale applies to MTP. https://gitlab.gnome.org/GNOME/gvfs/-/issues/497
* mtp: Fix crashes when `LIBMTP_devicestorage_t` `StorageDescription = NULL`.Niklas Hambüchen2020-12-161-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MTP spec section 5.2.2.7 allows `StorageDescription` to be an empty string. `libmtp` currently translates this to char * StorageDescription = NULL instead of `""` in `ptp_unpack_SI()` via `ptp_unpack_string()`. (I'm not sure if it's good that it does that, to be followed up on separately.) `create_storage_name()` until now returned `g_strdup(storage->StorageDescription)`, which returns `NULL` if `NULL` is given, and thus `get_storage_info()` would eventually call char *storage_name = NULL = create_storage_name(storage); g_file_info_set_name (info, storage_name = NULL); g_file_info_set_display_name (info, storage_name = NULL); resulting in assertion failures in `gvfsd`: g_file_info_set_name: assertion 'name != NULL' failed g_file_info_set_display_name: assertion 'display_name != NULL' failed as well as crashes in file managers like Thunar: g_file_get_child: assertion 'name != NULL' failed and warnings in Nautilus like: Got GFileInfo with NULL name in mtp://Ricoh_Company__Ltd._RICOH_THETA_V_00165759/, ignoring. This shouldn't happen unless the gvfs backend is broken. This commit fixes it by adding a contract to `create_storage_name()` that it will never represent empty strings as NULL.
* mtp: Add TODO about introducing storage name duplicatesNiklas Hambüchen2020-12-161-0/+3
|
* trash: Explicitly cancel file monitor to prevent deadlockOndrej Holy2020-12-111-1/+5
| | | | | | | | It seems that if file monitor is not canceled before unreffing, it can cause deadlock. Let's explicitly cancel it before unreffing to prevent this. See https://gitlab.gnome.org/GNOME/glib/-/issues/1941. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/485
* admin: Add push implementation for better performanceOndrej Holy2020-12-091-0/+35
| | | | | | | | Copying file from file:// to admin:// is slow. This is because push vfunc is not implemented and thus read-write fallback is used. Let's implement push to improve performance in this case as well. https://gitlab.gnome.org/GNOME/gvfs/-/issues/530
* admin: Add copy implementation for better performanceOndrej Holy2020-12-091-0/+31
| | | | | | | | Copying file within admin backend is slow in comparison to file://. This is because copy vfunc is not implemented and thus read-write fallback is used. Let's implement native copy to improve performance. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/530
* 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
* smb: Set fast content type independently of other attributesOndrej Holy2020-12-071-0/+2
| | | | | | | | | | The G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE attribute is currently set only if the G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE or some other attributes are requested. Thus it is not set when the fast content type attribute is requested separately. Let's set the attribute independently to fix this issue. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/529
* ftp: Prevent source file removal in case of transfer failureOndrej Holy2020-12-011-1/+1
| | | | | | When moving file from FTP to local filesystem, the remote file is removed regradless of transfer failure. This is pretty bad as it might lead to data loss. Let's delete the remote file only if the transfer suceeded.
* ftp: Close output stream properly in pull jobOndrej Holy2020-12-011-48/+8
| | | | | | The output stream is not properly closed in pull job, which might potentially lead to data loss. Let's use the recently added splice function and close the output stream with the help of G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET flag.
* google: Report progress for file transfers from local filesystemOndrej Holy2020-12-013-9/+94
| | | | | | | | | Google backend doesn't report progress from push job. As a consequence, Nautilus shows wierd time estimations when moving/copying file from local filesystem. Let's add custom splice function and report progress from it. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/463
* sftp: Add support for two factor authenticationOndrej Holy2020-11-301-0/+49
| | | | | | | | Currently, SFTP backend timeouts when two factor authentication is used as it doesn't expect another prompt. Let's handle "Verification code" and "One-time password" prompts and ask user to enter the code. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/480
* sftp: Use connection multiplexing instead of multiple connectionsOndrej Holy2020-11-301-3/+9
| | | | | | | | | Currently, two connections are established in order to be responsive even during file transfers. However, this causes duplicated prompts when ssh-askpass is used. Let's use connection multiplexing instead to avoid those duplicated prompts. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/510
* smb: Report progress when move operation is doneOndrej Holy2020-11-201-3/+9
| | | | | | | | | The move operation doesn't report progress currently, however, the documentation says that it is guaranteed that the prorgress_callback is called after all data has been transferred. Let's report the the total number of bytes moved during the operation. https://gitlab.gnome.org/GNOME/nautilus/-/issues/1635
* google: Set the display name for the root folder alsowip/oholy/google-display-nameOndrej Holy2020-10-211-5/+11
| | | | | | | | | As per the documentation, it is guaranteed that the display name attribute is always set. The same applies for the name attribute. However, this is not true for the root of the google backend. This sometimes causes file chooser crashes currently. Let's set those attributes also for root. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/523
* trash: Do not fail when G_FILE_COPY_NO_FALLBACK_FOR_MOVE is usedwip/oholy/trash-performanceOndrej Holy2020-09-246-0/+60
| | | | | | | | | | | | | | Restoring files from the trash folder is slow in Nautilus as it attempts to do it recursively. This is because G_IO_ERROR_NOT_SUPPORTED is returned from g_file_move when G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag is used. The error is returned from client-side for pull/push operations after commit 2e765449 as in the most cases the copy-and-delete approach is really used there. But the problem is that it is not in all cases, like in the trash backend case, where the native move operation is used in fact. Let's handle the G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag directly in the backends, but not in the trash backend. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1589
* dav: Be sure that enumeration is possible when looking for a rootOndrej Holy2020-09-231-3/+4
| | | | | | | | | | | | | | | | | | | | | The DAV backend tries to find the top-most directory when mounting. Unfortunatelly, for example with nextcloud.com, the enumeration job fails with `Method not allowed` error for the root directory found by this logic: ``` <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\DAV\Exception\MethodNotAllowed</s:exception> <s:message>Listing members of this collection is disabled</s:message> </d:error> ``` This is because nextcloud.com prevents listing of its users. Let's change the mount logic and always require info about children to be sure that enumeration won't fail later. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/468
* trash: Add support for x-gvfs-notrash option to ignore mountsOndrej Holy2020-08-051-1/+29
| | | | | | | | Add support for x-gvfs-notrash mount option, which allows to ignore trash folder on certain mounts. This might be especially useful e.g. to prevent wakeups of autofs mounts... https://bugzilla.redhat.com/show_bug.cgi?id=1096200
* recent: Port to GDateTimeOndrej Holy2020-07-031-8/+12
| | | | | | g_bookmark_file_get_modified is deprecated. Let's port the code to use g_bookmark_file_get_modified_date_time instead in order to prevent the deprecation warnings.
* sftp: Copy file timestamps on push/pullMaxim Mikityanskiy2020-05-121-23/+89
| | | | | | | | | | | | | | | | Copy and move operations preserve file attributes (such as modification time) in most of existing scenarios: local copy/move, remote copy/move, file_copy_fallback in glib. However, one case remains special: copy/move between local and remote (gvfs) locations. It's implemented by push and pull operations in backends, which don't attempt to preserve the usual attributes (e.g., mtime and atime). This commit implements the missing piece of functionality in sftp backend. Modification time is preserved on copy and move, and access time is preserved on move only, complying to the settable attributes list of sftp backend. Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
* dav: Add support for NTLM authenticationOndrej Holy2020-05-121-0/+1
| | | | | | | Currently, only Basic and Digest authentication is possible for webdav backend. Let's add support for NTLM also. https://gitlab.gnome.org/GNOME/gvfs/issues/342
* dav: Add support for Negotiate authenticationOndrej Holy2020-05-121-0/+2
| | | | | | | Currently, only Basic and Digest authentication is possible for webdav backend. Let's add support for Negotiate also. https://gitlab.gnome.org/GNOME/gvfs/issues/342
* afc: Handle permission denied errorBastien Nocera2020-02-111-0/+4
| | | | | | | The new string is not a string freeze breakage, it's already used in a number of other backends. Closes: #453
* afc: Remove unused error code conversionBastien Nocera2020-02-111-64/+0
| | | | We're doing it manually now.
* afc: Simplify setting error codesBastien Nocera2020-02-111-10/+7
| | | | | | | | | We don't need to go to another function to get an error code when our switch function does that already. The "unhandled" AFC errors are now slightly less precise, but it's still possible to get the meaning of that code from the AFC headers directly (for developers), and not visible for end-users anyway.
* google: Changed copy, move and push to enable overwriting filesMayank Sharma2020-01-311-110/+487
| | | | | | | | | | | | | | | | | | | | Until this commit, copy and move operations weren't capable of performing an actual overwrite of file contents and used to report an error (G_IO_ERROR_NOT_SUPPORTED). This commit adds the functionality to perform an overwrite operation if there exists another file with the same title in the destination directory. This behaviour is desired because it conforms to how normal copy/move operations happen in normal POSIX world. Since, multiple files with same title can exist in destination folder, the copy/move operation now explicity checks and only allows the overwrite operation in case there exists a single file with same title as the source file, otherwise it performs a blind copy/move. (Blind copy here means that a completely new file gets created with same title as source in case of copy, whereas for move the source file simply gets moved). The push function has been modified as well to behave similar to copy/move.
* google: Fixed a bug in copy function which caused crash after renameMayank Sharma2020-01-311-18/+41
| | | | | | | | | | | | | Copy function had the classic time-of-check-to-time-of-use (TOCTOU) bug with the source_entry, which resulted into backend crash due to an entry getting invalidated between two uses. More precisely, we used to check for `existing_entry` using `resolve_child()` which internally calls `rebuild_dir()`. At the beginning of function, we resolve `source_entry`, but if resolve_child rebuilds the directory, our initial reference to source_entry will get freed, resulting into a crash. This commit refactors some of the copy function's code to fix this issue.
* build: Bump libgdata dependency to support latest featuresMayank Sharma2020-01-311-16/+0
| | | | | | | | | libgdata API has been augmented with GDataDocumentsProperty API in the latest release 0.17.11. Since, we're using that API to support copy/move operations, we bump the required dependency version accordingly. We also remove the HAVE_LIBGDATA_* ifdefs since we require libgdata version >= 0.17.11 for the google backend to work properly.