Download raw body.
[PATCH] ssh-add: Support @ in the user part of destination constraints
On Tue, 20 Aug 2024 04:13:23 +0200, Max =?utf-8?Q?Zettlmei=C3=9Fl?= wrote:
> Properly adding a (complete) host constraint for one of my Git SSH
> identities was impossible because the string got split into username
> and host at the first @ sign, yet the username itself contains an @
> sign.
>
> This patch changes the behaviour to split on the last @ sign.
>
> In addition to running the patched version against all my constraints,
> I also tested it with the additional line `debug3_f("User: \"%s\"
> Host: \"%s\"", dch->user, dch->hostname);` to make sure that I have no
> off-by-one error which would lead to wrongly parsed components. I
> decided against including that in the patch.
This looks correct to me and is consistent with how we parse user@host
in other parts of the code. For example, parse_user_host_path()
and parse_user_host_port() in misc.c all use strrchr(). So does
ssh.c when parsing something other than a uri.
It may be worth adding a parse_user_host() function to misc.c so
we parse this consistently everywhere. But for now, this simple
one-liner seems fine.
- todd
[PATCH] ssh-add: Support @ in the user part of destination constraints