Download raw body.
[PATCH] ssh-add: Support @ in the user part of destination constraints
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.
Index: ssh-add.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/ssh-add.c,v
retrieving revision 1.172
diff -u -p -r1.172 ssh-add.c
--- ssh-add.c 11 Jan 2024 01:45:36 -0000 1.172
+++ ssh-add.c 19 Aug 2024 23:35:16 -0000
@@ -691,7 +691,7 @@ parse_dest_constraint_hop(const char *s,
memset(dch, '\0', sizeof(*dch));
os = xstrdup(s);
- if ((host = strchr(os, '@')) == NULL)
+ if ((host = strrchr(os, '@')) == NULL)
host = os;
else {
*host++ = '\0';
[PATCH] ssh-add: Support @ in the user part of destination constraints