Skip to content

Commit

Permalink
ssh-add: don't consider a sk_provider a key constraint
Browse files Browse the repository at this point in the history
unless explicitly specified, don't consider a sk_provider a
key constraint, allowing ssh-sk keys using the default internal
provider to be added with SSH2_AGENTC_ADD_IDENTITY instead of
SSH2_AGENTC_ADD_ID_CONSTRAINED.
  • Loading branch information
martelletto committed Dec 9, 2021
1 parent deecf32 commit 7393b48
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ssh-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag,
}
ssh_free_identitylist(idlist);
}

#ifndef WINDOWS
if (sshkey_is_sk(private)) {
if (skprovider == NULL) {
fprintf(stderr, "Cannot load FIDO key %s "
Expand All @@ -363,7 +363,10 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag,
/* Don't send provider constraint for other keys */
skprovider = NULL;
}

#else
if (!sshkey_is_sk(private))
skprovider = NULL;
#endif
if ((r = ssh_add_identity_constrained(agent_fd, private, comment,
lifetime, confirm, maxsign, skprovider)) == 0) {
ret = 0;
Expand Down Expand Up @@ -796,7 +799,7 @@ main(int argc, char **argv)
goto done;
}

#ifdef ENABLE_SK_INTERNAL
#if !defined(WINDOWS) && defined(ENABLE_SK_INTERNAL)
if (skprovider == NULL)
skprovider = "internal";
#endif
Expand Down

0 comments on commit 7393b48

Please sign in to comment.