1 Star 0 Fork 26

zhangxingrong/gvfs

forked from src-openEuler/gvfs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-ftp-Fix-data-connection-to-IPv6-link-local-address.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-07-17 14:24 . add some upstream patchs
From 60972c11189d7657eb3414a7763915bea8bb4a02 Mon Sep 17 00:00:00 2001
From: Ben Wolsieffer <[email protected]>
Date: Tue, 12 Mar 2024 21:34:43 -0400
Subject: [PATCH] ftp: Fix data connection to IPv6 link-local address
With IPv6, the passive mode data connection address is constructed by
taking the control socket address and replacing the port with the one
specified in the EPSV response. In doing so, we lose the scope-id and
flowinfo properties. The scope-id field in particular is required when
connecting to a link local address, as it determines which link the
address belongs to. Without it, the connection fails.
To fix this, manually construct the GInetSocketAddress instance, copying
all the fields except the port from the old address.
---
daemon/gvfsftptask.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index e44f80690..a1e457074 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -794,12 +794,20 @@ static GSocketAddress *
g_vfs_ftp_task_create_remote_address (GVfsFtpTask *task, guint port)
{
GSocketAddress *old, *new;
+ GInetSocketAddress *old_inet;
old = g_vfs_ftp_connection_get_address (task->conn, &task->error);
if (old == NULL)
return NULL;
g_assert (G_IS_INET_SOCKET_ADDRESS (old));
- new = g_inet_socket_address_new (g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (old)), port);
+ old_inet = G_INET_SOCKET_ADDRESS (old);
+
+ new = g_object_new (G_TYPE_INET_SOCKET_ADDRESS,
+ "address", g_inet_socket_address_get_address (old_inet),
+ "port", port,
+ "flowinfo", g_inet_socket_address_get_flowinfo (old_inet),
+ "scope-id", g_inet_socket_address_get_scope_id (old_inet),
+ NULL);
return new;
}
--
GitLab
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxingrong/gvfs.git
[email protected]:zhangxingrong/gvfs.git
zhangxingrong
gvfs
gvfs
master

搜索帮助