mirror of https://gitee.com/openkylin/gvfs.git
close-cd#I6YKN6 【文件管理器】无法访问共享文件夹
This commit is contained in:
parent
cd251c38d4
commit
15409cd5a3
|
@ -49,7 +49,6 @@
|
|||
#include "gvfsjobqueryfsinfo.h"
|
||||
#include "gvfsjobqueryattributes.h"
|
||||
#include "gvfsjobenumerate.h"
|
||||
#include "gvfsjobmove.h"
|
||||
#include "gvfsdaemonprotocol.h"
|
||||
#include "gvfsdaemonutils.h"
|
||||
#include "gvfsutils.h"
|
||||
|
@ -78,7 +77,9 @@ struct _GVfsBackendSmb
|
|||
|
||||
GMountSource *mount_source; /* Only used/set during mount */
|
||||
int mount_try;
|
||||
gboolean mount_try_again;
|
||||
gboolean mount_cancelled;
|
||||
gboolean use_anonymous;
|
||||
|
||||
gboolean password_in_keyring;
|
||||
GPasswordSave password_save;
|
||||
|
@ -201,14 +202,25 @@ auth_callback (SMBCCTX *context,
|
|||
backend->user == NULL &&
|
||||
backend->domain == NULL)
|
||||
{
|
||||
/* Try again if kerberos login fails */
|
||||
backend->mount_try_again = TRUE;
|
||||
g_debug ("auth_callback - kerberos pass\n");
|
||||
}
|
||||
else if (backend->mount_try == 1 &&
|
||||
backend->user == NULL &&
|
||||
backend->domain == NULL)
|
||||
{
|
||||
/* Try again if ccache login fails */
|
||||
backend->mount_try_again = TRUE;
|
||||
g_debug ("auth_callback - ccache pass\n");
|
||||
}
|
||||
else if (backend->use_anonymous)
|
||||
{
|
||||
/* Try again if anonymous login fails */
|
||||
backend->use_anonymous = FALSE;
|
||||
backend->mount_try_again = TRUE;
|
||||
g_debug ("auth_callback - anonymous login pass\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
gboolean in_keyring = FALSE;
|
||||
|
@ -251,19 +263,9 @@ auth_callback (SMBCCTX *context,
|
|||
|
||||
g_debug ("auth_callback - asking for password...\n");
|
||||
|
||||
if (backend->user)
|
||||
{
|
||||
/* Translators: First %s is a share name, second is a server name */
|
||||
message = g_strdup_printf (_("Authentication Required\nEnter password for share “%s” on “%s”:"),
|
||||
share_name, server_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Translators: First %s is a share name, second is a server name */
|
||||
message = g_strdup_printf (_("Authentication Required\nEnter user and password for share “%s” on “%s”:"),
|
||||
share_name, server_name);
|
||||
}
|
||||
|
||||
/* translators: First %s is a share name, second is a server name */
|
||||
message = g_strdup_printf (_("Password required for share %s on %s"),
|
||||
share_name, server_name);
|
||||
handled = g_mount_source_ask_password (backend->mount_source,
|
||||
message,
|
||||
username_out,
|
||||
|
@ -288,13 +290,13 @@ auth_callback (SMBCCTX *context,
|
|||
}
|
||||
}
|
||||
|
||||
smbc_setOptionNoAutoAnonymousLogin (backend->smb_context,
|
||||
!anonymous);
|
||||
/* Try again if this fails */
|
||||
backend->mount_try_again = TRUE;
|
||||
|
||||
if (anonymous)
|
||||
{
|
||||
backend->use_anonymous = TRUE;
|
||||
backend->password_save = FALSE;
|
||||
g_debug ("auth_callback - anonymous enabled\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -484,6 +486,7 @@ do_mount (GVfsBackend *backend,
|
|||
*/
|
||||
do
|
||||
{
|
||||
op_backend->mount_try_again = FALSE;
|
||||
op_backend->mount_cancelled = FALSE;
|
||||
|
||||
g_debug ("do_mount - try #%d \n", op_backend->mount_try);
|
||||
|
@ -499,13 +502,7 @@ do_mount (GVfsBackend *backend,
|
|||
if (res == 0)
|
||||
break;
|
||||
|
||||
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))
|
||||
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;
|
||||
|
@ -521,9 +518,15 @@ do_mount (GVfsBackend *backend,
|
|||
smbc_setOptionFallbackAfterKerberos (op_backend->smb_context, 1);
|
||||
}
|
||||
|
||||
/* If the AskPassword reply requested anonymous login, enable the
|
||||
* anonymous fallback and try again.
|
||||
*/
|
||||
smbc_setOptionNoAutoAnonymousLogin (op_backend->smb_context,
|
||||
!op_backend->use_anonymous);
|
||||
|
||||
op_backend->mount_try ++;
|
||||
}
|
||||
while (TRUE);
|
||||
while (op_backend->mount_try_again);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
|
@ -1431,8 +1434,6 @@ set_info_from_stat (GVfsBackendSmb *backend,
|
|||
|
||||
if (g_file_attribute_matcher_matches (matcher,
|
||||
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE) ||
|
||||
g_file_attribute_matcher_matches (matcher,
|
||||
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE) ||
|
||||
g_file_attribute_matcher_matches (matcher,
|
||||
G_FILE_ATTRIBUTE_STANDARD_ICON) ||
|
||||
g_file_attribute_matcher_matches (matcher,
|
||||
|
@ -1586,7 +1587,6 @@ do_query_fs_info (GVfsBackend *backend,
|
|||
|
||||
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "cifs");
|
||||
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE, TRUE);
|
||||
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS);
|
||||
|
||||
if (g_file_attribute_matcher_matches (attribute_matcher,
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE) ||
|
||||
|
@ -2041,7 +2041,6 @@ do_move (GVfsBackend *backend,
|
|||
smbc_stat_fn smbc_stat;
|
||||
smbc_rename_fn smbc_rename;
|
||||
smbc_unlink_fn smbc_unlink;
|
||||
goffset size;
|
||||
|
||||
|
||||
source_uri = create_smb_uri (op_backend->server, op_backend->port, op_backend->share, source);
|
||||
|
@ -2063,9 +2062,8 @@ do_move (GVfsBackend *backend,
|
|||
g_free (source_uri);
|
||||
return;
|
||||
}
|
||||
|
||||
source_is_dir = S_ISDIR (statbuf.st_mode);
|
||||
size = statbuf.st_size;
|
||||
else
|
||||
source_is_dir = S_ISDIR (statbuf.st_mode);
|
||||
|
||||
dest_uri = create_smb_uri (op_backend->server, op_backend->port, op_backend->share, destination);
|
||||
|
||||
|
@ -2160,10 +2158,7 @@ do_move (GVfsBackend *backend,
|
|||
g_vfs_job_failed_from_errno (G_VFS_JOB (job), errsv);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_vfs_job_progress_callback (size, size, job);
|
||||
g_vfs_job_succeeded (G_VFS_JOB (job));
|
||||
}
|
||||
g_vfs_job_succeeded (G_VFS_JOB (job));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue