1 Star 0 Fork 56

zhangxianjun/openssh

forked from src-openEuler/openssh 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-upstream-make-parsing-user-host-consistently-look-for-the-last-in.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
bitianyuan 提交于 2024-11-06 16:06 . backport some upstream patches
From a8ad7a2952111c6ce32949a775df94286550af6b Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Fri, 6 Sep 2024 02:30:44 +0000
Subject: [PATCH] upstream: make parsing user@host consistently look for the
last '@' in the string rather than the first. This makes it possible to
use usernames that contain '@' characters.
Conflict:NA
Reference:https://anongit.mindrot.org/openssh.git/commit/a8ad7a2952111c6ce32949a775df94286550af6b
---
match.c | 6 +++---
ssh-add.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/match.c b/match.c
index 3ac854d..b9a8225 100644
--- a/match.c
+++ b/match.c
@@ -241,17 +241,17 @@ match_user(const char *user, const char *host, const char *ipaddr,
/* test mode */
if (user == NULL && host == NULL && ipaddr == NULL) {
- if ((p = strchr(pattern, '@')) != NULL &&
+ if ((p = strrchr(pattern, '@')) != NULL &&
match_host_and_ip(NULL, NULL, p + 1) < 0)
return -1;
return 0;
}
- if ((p = strchr(pattern, '@')) == NULL)
+ if (strrchr(pattern, '@') == NULL)
return match_pattern(user, pattern);
pat = xstrdup(pattern);
- p = strchr(pat, '@');
+ p = strrchr(pat, '@');
*p++ = '\0';
if ((ret = match_pattern(user, pat)) == 1)
diff --git a/ssh-add.c b/ssh-add.c
index 8cba0a7..2b081d6 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -712,7 +712,7 @@ parse_dest_constraint_hop(const char *s, struct dest_constraint_hop *dch,
memset(dch, '\0', sizeof(*dch));
os = xstrdup(s);
- if ((host = strchr(os, '@')) == NULL)
+ if ((host = strrchr(os, '@')) == NULL)
host = os;
else {
*host++ = '\0';
--
2.43.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxianjun87/openssh.git
git@gitee.com:zhangxianjun87/openssh.git
zhangxianjun87
openssh
openssh
master

搜索帮助