Ignore EINVAL for kerberos/ccache login to fix SMB mounting

Resolves: #2068976, #2072885
This commit is contained in:
Ondrej Holy 2022-04-13 10:47:49 +02:00
parent 4bdf3da7b0
commit f220eb954a
2 changed files with 66 additions and 1 deletions

View File

@ -22,7 +22,7 @@
Name: gvfs Name: gvfs
Version: 1.50.0 Version: 1.50.0
Release: 3%{?dist} Release: 4%{?dist}
Summary: Backends for the gio framework in GLib Summary: Backends for the gio framework in GLib
License: GPLv3 and LGPLv2+ and BSD and MPLv2.0 License: GPLv3 and LGPLv2+ and BSD and MPLv2.0
@ -36,6 +36,10 @@ Patch0: dav-Fix-crashes-caused-by-extra-unref.patch
Patch1: dav-Do-not-lose-userinfo-when-copying-URIs.patch Patch1: dav-Do-not-lose-userinfo-when-copying-URIs.patch
Patch2: dav-Rewrite-to-libsoup-async-API-to-fix-crashes.patch Patch2: dav-Rewrite-to-libsoup-async-API-to-fix-crashes.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2068976
# https://bugzilla.redhat.com/show_bug.cgi?id=2072885
Patch3: smb-Ignore-EINVAL-for-kerberos-ccache-login.patch
BuildRequires: meson BuildRequires: meson
BuildRequires: gcc BuildRequires: gcc
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
@ -428,6 +432,9 @@ killall -USR1 gvfsd >&/dev/null || :
%{_datadir}/installed-tests %{_datadir}/installed-tests
%changelog %changelog
* Wed Apr 13 2022 Ondrej Holy <oholy@redhat.com> - 1.50.0-4
- Ignore EINVAL for kerberos/ccache login to fix SMB mounting (#2068976, #2072885)
* Fri Apr 8 2022 Ondrej Holy <oholy@redhat.com> - 1.50.0-3 * Fri Apr 8 2022 Ondrej Holy <oholy@redhat.com> - 1.50.0-3
- Rewrite DAV backend to libsoup async API to fix crashes (#2062465) - Rewrite DAV backend to libsoup async API to fix crashes (#2062465)

View File

@ -0,0 +1,58 @@
From 747c7f6ea6c8b6a7ccd008bb47996ba7eb169bcc Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Mon, 11 Apr 2022 10:54:04 +0200
Subject: [PATCH] smb: Ignore EINVAL for kerberos/ccache login
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/gvfsbackendsmb.c | 8 +++++++-
daemon/gvfsbackendsmbbrowse.c | 10 ++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 33d1a209..776b67bc 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -513,7 +513,13 @@ do_mount (GVfsBackend *backend,
if (res == 0)
break;
- if (op_backend->mount_cancelled || (errsv != EACCES && errsv != EPERM))
+ if (errsv == EINVAL && op_backend->mount_try <= 1 && op_backend->user == NULL)
+ {
+ /* EINVAL is "expected" when kerberos/ccache is misconfigured, see:
+ * https://gitlab.gnome.org/GNOME/gvfs/-/issues/611
+ */
+ }
+ else if (op_backend->mount_cancelled || (errsv != EACCES && errsv != EPERM))
{
g_debug ("do_mount - (errno != EPERM && errno != EACCES), cancelled = %d, breaking\n", op_backend->mount_cancelled);
break;
diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c
index 57bae9db..7e8facfb 100644
--- a/daemon/gvfsbackendsmbbrowse.c
+++ b/daemon/gvfsbackendsmbbrowse.c
@@ -967,8 +967,14 @@ do_mount (GVfsBackend *backend,
uri, op_backend->mount_try, dir, op_backend->mount_cancelled,
errsv, g_strerror (errsv));
- if (dir == NULL &&
- (op_backend->mount_cancelled || (errsv != EPERM && errsv != EACCES)))
+ if (errsv == EINVAL && op_backend->mount_try == 0 && op_backend->user == NULL)
+ {
+ /* EINVAL is "expected" when kerberos is misconfigured, see:
+ * https://gitlab.gnome.org/GNOME/gvfs/-/issues/611
+ */
+ }
+ else if (dir == NULL &&
+ (op_backend->mount_cancelled || (errsv != EPERM && errsv != EACCES)))
{
g_debug ("do_mount - (errno != EPERM && errno != EACCES), cancelled = %d, breaking\n", op_backend->mount_cancelled);
break;
--
2.35.1