Bugzilla – Attachment 2906 Details for
Bug 2617
sign_and_send_pubkey: no separate private key for certificate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Allow for id->key being NULL before being passed to identity_sign()
allowidkeynull.patch (text/plain), 1.89 KB, created by
Adam Eijdenberg
on 2016-12-07 00:14:02 AEDT
(
hide
)
Description:
Allow for id->key being NULL before being passed to identity_sign()
Filename:
MIME Type:
Creator:
Adam Eijdenberg
Created:
2016-12-07 00:14:02 AEDT
Size:
1.89 KB
patch
obsolete
>diff --git a/sshconnect2.c b/sshconnect2.c >index 2143783..9f8f037 100644 >--- a/sshconnect2.c >+++ b/sshconnect2.c >@@ -996,11 +996,11 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) > } > > static const char * >-identity_sign_encode(struct identity *id) >+key_sign_encode(Key *key) > { > struct ssh *ssh = active_state; > >- if (id->key->type == KEY_RSA) { >+ if (key->type == KEY_RSA) { > switch (ssh->kex->rsa_sha2) { > case 256: > return "rsa-sha2-256"; >@@ -1008,8 +1008,13 @@ identity_sign_encode(struct identity *id) > return "rsa-sha2-512"; > } > } >+ return key_ssh_name(key); >+} > >- return key_ssh_name(id->key); >+static const char * >+identity_sign_encode(struct identity *id) >+{ >+ return key_sign_encode(id->key); > } > > static int >@@ -1018,26 +1023,24 @@ identity_sign(struct identity *id, u_char **sigp, size_t *lenp, > { > Key *prv; > int ret; >- const char *alg; >- >- alg = identity_sign_encode(id); > > /* the agent supports this key */ >- if (id->agent_fd != -1) >+ if (id->key != NULL && id->agent_fd != -1) > return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp, >- data, datalen, alg, compat); >+ data, datalen, identity_sign_encode(id), compat); > > /* > * we have already loaded the private key or > * the private key is stored in external hardware > */ >- if (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT)) >- return (sshkey_sign(id->key, sigp, lenp, data, datalen, alg, >- compat)); >+ if (id->key != NULL && (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT))) >+ return (sshkey_sign(id->key, sigp, lenp, data, datalen, >+ identity_sign_encode(id), compat)); >+ > /* load the private key from the file */ > if ((prv = load_identity_file(id)) == NULL) > return SSH_ERR_KEY_NOT_FOUND; >- ret = sshkey_sign(prv, sigp, lenp, data, datalen, alg, compat); >+ ret = sshkey_sign(prv, sigp, lenp, data, datalen, key_sign_encode(prv), compat); > sshkey_free(prv); > return (ret); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2617
:
2884
|
2886
|
2899
|
2901
|
2902
|
2903
|
2904
|
2905
| 2906 |
2909