summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendsmb.c
Commit message (Collapse)AuthorAgeFilesLines
* smb: Allow renaming a file to the same name with a different casegnome-42Corey 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 (cherry picked from commit a845ba0220fef72815ce091b92f74767d8025541)
* 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
* 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
* smb: Ignore EINVAL for kerberos/ccache loginOndrej Holy2022-04-131-1/+7
| | | | | | | | 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
* daemon: Set filesystem::use-preview explicitlyAntónio Fernandes2021-01-221-0/+1
| | | | | | | 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
* Use shorter strings for prompt dialog titlesJonas Dreßler2021-01-151-3/+13
| | | | | | | | | | | | | 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
* 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
* 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
* smb: Improve enumeration performanceOndrej Holy2019-11-051-8/+37
| | | | | | | | | | | | The samba backend calls stat for each file during the enumeration job. Unfortunately, this is significantly slower with the recent samba versions. However, smbc_readdirplus2() has been recently added and it can be used to improve the performance as all the necessary info is transferred in one network request. Let's use smbc_readdirplus2() if available. See: https://gitlab.com/samba-team/samba/merge_requests/302 Relates: https://gitlab.gnome.org/GNOME/gvfs/issues/306
* smb: Don't set a content-type that isn't certainBastien Nocera2019-10-111-2/+8
| | | | | | Don't ignore the result_uncertain flag from g_content_type_guess() as it might cause nautilus to incorrectly think that a particular file is of a certain type, and never check its magic.
* smb: Move variable to block where it's usedBastien Nocera2019-10-111-3/+1
| | | | | content_type was only used and initialised inside this block, so move it there.
* smb: Remove usage of deprecated GTimeValOndrej Holy2019-09-201-7/+4
| | | | | GTimeVal is deprecated. Let's remove it in order to prevent the deprecation warnings.
* daemon: Use "Operation not supported" consistentlyMayank Sharma2019-03-211-1/+1
| | | | | | | | | GVfs uses different forms of "Operation not supported" string, e.g. "Operation unsupported", "Operation not supported by backend". Let's use "Operation not supported" consistently as this is also used in GLib. https://gitlab.gnome.org/GNOME/gvfs/issues/170
* smb: Update comments and debug outputs for mount operationOndrej Holy2019-02-181-6/+9
| | | | | Update obsolete comments and misleading debug output to make the mount procedure more obvious.
* smb: Do not show password prompt when using winbind ccacheOndrej Holy2019-02-181-0/+8
| | | | | | | | | | | Recent samba releases seems invoke auth_callback even when using cached winbind credentials. It shows password prompt to user, which is unexpected. Add one more iteration in the mount procedure just for ccache. This will unfortunately make one fail attempt if the winbind ccache is not configured, but I don't see better way to fix this. Closes: https://gitlab.gnome.org/GNOME/gvfs/issues/369
* smb: Enable winbind ccache explicitelyOndrej Holy2019-02-181-0/+1
| | | | | The winbind ccache is enabled by default currently, but let's enable it explicitely to be obvious.
* Remove workaround for directory / folder iconswip/rishi/issue-2Debarshi Ray2018-08-141-2/+2
| | | | https://gitlab.gnome.org/GNOME/gvfs/issues/2
* smb: Use O_RDWR to fix fstat when writingOndrej Holy2018-05-141-5/+5
| | | | | | | | | fstat fails with EINVAL on Windows servers if O_WRONLY is used to open (though it works properly on SAMBA servers). O_RDWR is needed to make it work. This causes issues when copying files over gvfsd-fuse among others. https://bugzilla.gnome.org/show_bug.cgi?id=795805
* smb: Add workaround to fix removal of non-empty dirOndrej Holy2018-05-141-1/+13
| | | | | | | | smbc_rmdir returns 0 for non-empty dir currently even if the dir has not been removed. Add workaround and return G_IO_ERROR_NOT_EMPTY in this case. https://bugzilla.gnome.org/show_bug.cgi?id=792147
* smb: Avoid "Error: Success" failure messagesOndrej Holy2018-02-281-3/+7
| | | | | | | Save the failed errno as soon as possible to avoid "Error: Success" type of messages. https://bugzilla.gnome.org/show_bug.cgi?id=793515
* smb: Fix a warningRoss Lagerwall2017-02-261-0/+1
| | | | Fix a warning due to no previous prototype for create_smb_uri.
* client: Escape ":[]" chars in host if it is not IPv6Ondrej Holy2016-12-121-1/+1
| | | | | | | | | | | The "[]:" chars are omitted currently when encoding uri, because they are valid for IPv6. This causes problems in some cases, e.g. output from g_file_get_uri(g_file_new_for_uri("dav+sd://foo%3Abar._webdav._tcp.local")) is "dav+sd://foo:bar._webdav._tcp.local/", which is obviously wrong. Add gvfs_is_ipv6 in order to detect IPv6 addresses and encode also "[]:" chars in other cases. Use gvfs_is_ipv6 to detect IPv6 also in some backends. https://bugzilla.gnome.org/show_bug.cgi?id=772849
* smb: Drop custom GString functionalityOndrej Holy2016-11-161-45/+5
| | | | | | | | | Replace custom g_string_append_encoded() by g_string_append_uri_escaped(). The functions are identical except additional UTF-8 support, which can be simply disabled by allow_utf8 parameter. The custom function was used probably because the g_string_append_uri_escaped has been added later. https://bugzilla.gnome.org/show_bug.cgi?id=604116
* smbbrowse: Fix IPv6 handlingOndrej Holy2016-11-161-2/+7
| | | | | | | | IPv6 server includes brackets in GMountSpec, smbclient doesn't. Commit 4012d70 fixed IPv6 handling for SMB backend. Share and use the modified create_smb_uri() function in order to fix the IPv6 handling. https://bugzilla.gnome.org/show_bug.cgi?id=604116
* smb: Fix IPv6 uri handlingOndrej Holy2016-11-161-1/+10
| | | | | | | | | | | IPv6 server includes brackets in GMountSpec, smbclient doesn't. Remove the brackets from the uri before usage in smbclient functions. The IPv6 uris can be consequently used in the following format (port isn't mandatory), e.g.: gvfs-mount smb://[::1]:139/ https://bugzilla.gnome.org/show_bug.cgi?id=604116
* smb: Remove maximum read size during readsBastien Nocera2016-11-021-8/+0
| | | | | | | | | | | | | | The smb read call can take any arbitrary size and the both the libsmbclient SMB1 and SMB2 engines will break this down into as many simultaneous on the wire calls as needed to pipeline the reads / writes. Restricting this to 65534 will be slow, so remove this restriction. See https://lists.samba.org/archive/samba/2016-October/204225.html https://bugzilla.gnome.org/show_bug.cgi?id=773632
* smb: Remove redundant cache functionalityOndrej Holy2016-10-031-124/+0
| | | | | | | | | I'm convinced that our own server cache is not needed, because we are not using it in no way. Let's remove the cache and let samba use its internal cache instead: https://git.samba.org/cifs-utils.git/?p=samba.git;a=blob;f=source3/libsmb/libsmb_cache.c https://bugzilla.gnome.org/show_bug.cgi?id=771483
* smb: Remove some redundant codeOndrej Holy2016-10-031-8/+0
| | | | | | Remove some ancient comments, dead code, or duplicated code. https://bugzilla.gnome.org/show_bug.cgi?id=771483
* Use Unicode in translatable stringsPiotr Drąg2016-10-031-4/+4
| | | | | | See https://developer.gnome.org/hig/stable/typography.html https://bugzilla.gnome.org/show_bug.cgi?id=772219
* daemon: Set G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attributeOndrej Holy2016-06-281-0/+1
| | | | | | | Mark all network-based backends as remote. This is useful to remove some hardcoded lists of filesystem types in GTK+. Bump required GLib version accordingly.
* smb: Set always G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE for filesOndrej Holy2016-06-141-2/+2
| | | | | | | | | | G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE is set for regular files only when S_IWUSR is not set currently (i.e. FALSE only). It seems to me that it is reliable to set this to TRUE for regular files in other cases. Applications should not rely on those attributes, however it is crucial for some apps which rely on them still (e.g. File Roller). https://bugzilla.gnome.org/show_bug.cgi?id=724497
* smb: Be quiet by defaultRoss Lagerwall2016-01-181-25/+17
| | | | | | | Since daemons' stdout and stderr goes into the journal, make it quiet by default by using the existing debug logging mechanism. https://bugzilla.gnome.org/show_bug.cgi?id=740660
* Mark files as untrashable for main backendsOndrej Holy2015-09-231-0/+2
| | | | | | Otherwise nautilus will offer the wrong action in its UI. https://bugzilla.gnome.org/show_bug.cgi?id=753934
* smb: Fix a memory leakRoss Lagerwall2015-02-101-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=744078
* daemon: Move seek type conversion to shared libraryRoss Lagerwall2015-02-091-22/+2
| | | | | | | Since converting a GSeekType into an lseek type is repeated in a few places, move it into shared code. https://bugzilla.gnome.org/show_bug.cgi?id=738967
* daemon: Move random string generation into shared libRoss Lagerwall2015-02-091-11/+3
| | | | | | | Random string generation is used in a few different places, so share the implementation. https://bugzilla.gnome.org/show_bug.cgi?id=738967
* smb: Handle the anonymous flag when calling AskPasswordRoss Lagerwall2015-01-211-14/+36
| | | | | | | | | Previously, the smb backend would try logging in anonymously first if a user is not specified making it difficult to mount a share as a specific user from Nautilus. Instead, only try an anonymous login if the anonymous flag is TRUE after calling AskPassword. https://bugzilla.gnome.org/show_bug.cgi?id=742169
* smb: Remove old compatibility ifdefsRoss Lagerwall2014-10-231-4/+0
| | | | | Remove old compatibility ifdefs left over from ad521f604df7 ("Require libsmbclient from Samba 3.4.0 or higher").
* smb: Implement standard::allocated-sizeRoss Lagerwall2014-06-051-0/+3
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=505042
* smb: Fail properly if set_attribute type is wrongRoss Lagerwall2014-05-301-9/+11
| | | | | | | If given an invalid type when setting time::modified in do_set_attribute, don't try and change the mtime after failing the job. https://bugzilla.gnome.org/show_bug.cgi?id=730844
* smb: Improve batching when sending enumerate GFileInfosRoss Lagerwall2014-05-281-12/+4
| | | | | | | | | Instead of creating a list of GFileInfos and sending them when the entire directory has been read, call g_vfs_job_enumerate_add_info to send them in batches (default of 50). This simplifies the code and should reduce the memory usage when enumerating a large directory. https://bugzilla.gnome.org/show_bug.cgi?id=730856
* smb: Give correct error when unlink fails while closing fileRoss Lagerwall2014-04-021-1/+10
| | | | | | | | | When closing a file that is overwriting another file, don't ignore the error message when unlinking the old file. This is important when unlinking fails due to a permission denied error but the error message that was being returned was File Exists (from the subsequent rename). https://bugzilla.gnome.org/show_bug.cgi?id=726998
* smb: set context to NULL after it has been freedOndrej Holy2014-02-131-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=710986
* smb: Implement truncate support for output streamsRoss Lagerwall2013-12-051-0/+22
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=573837
* Require libsmbclient from Samba 3.4.0 or higherRoss Lagerwall2013-12-051-6/+2
| | | | | | Also remove the old libsmb-compat.h header file. https://bugzilla.gnome.org/show_bug.cgi?id=573837
* smb: Report number of bytes used on the filesystemRoss Lagerwall2013-11-151-2/+8
| | | | | | | Calculated the number of bytes used by subtracting the size from the number of bytes free, as done with local files. https://bugzilla.gnome.org/show_bug.cgi?id=711838
* smb: Unlink file before sending job replyRoss Lagerwall2013-10-311-2/+2
|
* smb: Set error from the errno of the correct operationRoss Lagerwall2013-10-311-5/+5
| | | | | | | | This prevents errors of the form "Error performing operation: Success" when doing a close after a replace that tries to overwrite a file but fails in the final rename. https://bugzilla.gnome.org/show_bug.cgi?id=603353