Skip to content

Commit

Permalink
Fix handling of prefix type in login CLI
Browse files Browse the repository at this point in the history
Key index is the common case we want to support here:

If the MSB is set, the low bits are interpreted as a 7 bit integer,
which the server should interpret as the index of the key its supposed
to use.
  • Loading branch information
Valentin Vidic committed Mar 7, 2024
1 parent a5033bb commit 6b8b25a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ int login(int argc, char **argv) {
fprintf(stderr, "handshake size is invalid in path %s\n", path);
goto out;
}
if ((handshake[0] & 0x80) != 0) {
if ((handshake[0] & 0x80) == 0) {
fprintf(stderr,
"only \"service-key-indicator\" prefix type is supported\n");
goto out;
Expand Down
2 changes: 1 addition & 1 deletion cli/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ for n in 1 2; do
done

key="$t/vector-2/a"
path="v2/R4cvQ1u4uJ0OOtYqouURB07hleHDnvaogAFBi-ZW48N2/myhost/exec=%2Fbin%2Fsh/"
path="v2/x4cvQ1u4uJ0OOtYqouURB07hleHDnvaogAFBi-ZW48N2/myhost/exec=%2Fbin%2Fsh/"
expected_tag="ZmxczN4x3g4goXu-A2AuuEEVftgS6xM-6gYj-dRrlis="
tag=$("$binary" login --key "$key" "$path")
if [ "$tag" != "$expected_tag" ]; then
Expand Down

0 comments on commit 6b8b25a

Please sign in to comment.