2024-11-06 16:06:41 +08:00
|
|
|
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
|
2024-12-09 06:17:22 +00:00
|
|
|
Subject: upstream: make parsing user@host consistently look for the last '@'
|
|
|
|
|
in
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
2024-11-06 16:06:41 +08:00
|
|
|
|
2024-12-09 06:17:22 +00:00
|
|
|
the string rather than the first. This makes it possible to use usernames
|
|
|
|
|
that contain '@' characters.
|
|
|
|
|
MIME-Version: 1.0
|
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
|
Content-Transfer-Encoding: 8bit
|
2024-11-06 16:06:41 +08:00
|
|
|
|
2024-12-09 06:17:22 +00:00
|
|
|
Prompted by Max Zettlmeißl; feedback/ok millert@
|
|
|
|
|
|
|
|
|
|
OpenBSD-Commit-ID: 0b16eec246cda15469ebdcf3b1e2479810e394c5
|
2024-11-06 16:06:41 +08:00
|
|
|
---
|
2024-12-09 06:17:22 +00:00
|
|
|
match.c | 8 ++++----
|
|
|
|
|
ssh-add.c | 4 ++--
|
|
|
|
|
2 files changed, 6 insertions(+), 6 deletions(-)
|
2024-11-06 16:06:41 +08:00
|
|
|
|
|
|
|
|
diff --git a/match.c b/match.c
|
2024-12-09 06:17:22 +00:00
|
|
|
index d6af2561..3ef53693 100644
|
2024-11-06 16:06:41 +08:00
|
|
|
--- a/match.c
|
|
|
|
|
+++ b/match.c
|
2024-12-09 06:17:22 +00:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
-/* $OpenBSD: match.c,v 1.44 2023/04/06 03:19:32 djm Exp $ */
|
|
|
|
|
+/* $OpenBSD: match.c,v 1.45 2024/09/06 02:30:44 djm Exp $ */
|
|
|
|
|
/*
|
|
|
|
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
|
|
|
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
|
|
|
|
@@ -241,7 +241,7 @@ match_user(const char *user, const char *host, const char *ipaddr,
|
2024-11-06 16:06:41 +08:00
|
|
|
|
|
|
|
|
/* 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;
|
2024-12-09 06:17:22 +00:00
|
|
|
@@ -250,11 +250,11 @@ match_user(const char *user, const char *host, const char *ipaddr,
|
|
|
|
|
if (user == NULL)
|
|
|
|
|
return 0; /* shouldn't happen */
|
2024-11-06 16:06:41 +08:00
|
|
|
|
|
|
|
|
- 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
|
2024-12-09 06:17:22 +00:00
|
|
|
index e532d5ce..0035cb84 100644
|
2024-11-06 16:06:41 +08:00
|
|
|
--- a/ssh-add.c
|
|
|
|
|
+++ b/ssh-add.c
|
2024-12-09 06:17:22 +00:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
-/* $OpenBSD: ssh-add.c,v 1.169 2023/12/18 14:46:56 djm Exp $ */
|
|
|
|
|
+/* $OpenBSD: ssh-add.c,v 1.173 2024/09/06 02:30:44 djm Exp $ */
|
|
|
|
|
/*
|
|
|
|
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
|
|
|
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
|
|
|
|
@@ -696,7 +696,7 @@ parse_dest_constraint_hop(const char *s, struct dest_constraint_hop *dch,
|
2024-11-06 16:06:41 +08:00
|
|
|
|
|
|
|
|
memset(dch, '\0', sizeof(*dch));
|
|
|
|
|
os = xstrdup(s);
|
|
|
|
|
- if ((host = strchr(os, '@')) == NULL)
|
|
|
|
|
+ if ((host = strrchr(os, '@')) == NULL)
|
|
|
|
|
host = os;
|
|
|
|
|
else {
|
|
|
|
|
*host++ = '\0';
|
|
|
|
|
--
|
2024-12-09 06:17:22 +00:00
|
|
|
cgit v1.2.3
|