Bugzilla – Attachment 330 Details for
Bug 591
use PKCS#15 private key label as a comment in case of OpenSC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fix: sc_get_key_label should *not* return NULL
patch.diff (text/plain), 3.08 KB, created by
Nils Larsch
on 2003-06-17 23:28:18 AEST
(
hide
)
Description:
fix: sc_get_key_label should *not* return NULL
Filename:
MIME Type:
Creator:
Nils Larsch
Created:
2003-06-17 23:28:18 AEST
Size:
3.08 KB
patch
obsolete
>Index: scard-opensc.c >=================================================================== >RCS file: /cvs/openssh/scard-opensc.c,v >retrieving revision 1.9 >diff -u -r1.9 scard-opensc.c >--- scard-opensc.c 5 Jun 2003 09:19:35 -0000 1.9 >+++ scard-opensc.c 17 Jun 2003 13:20:34 -0000 >@@ -474,4 +474,30 @@ > return -1; > } > >+char * >+sc_get_key_label(Key *key) >+{ >+ int r; >+ const struct sc_priv_data *priv; >+ struct sc_pkcs15_object *key_obj; >+ >+ priv = (const struct sc_priv_data *) RSA_get_app_data(key->rsa); >+ if (priv == NULL || p15card == NULL) { >+ logit("SmartCard key not loaded"); >+ /* internal error => return default label */ >+ return xstrdup("smartcard key"); >+ } >+ r = sc_pkcs15_find_prkey_by_id(p15card, &priv->cert_id, &key_obj); >+ if (r) { >+ logit("Unable to find private key from SmartCard: %s", >+ sc_strerror(r)); >+ return xstrdup("smartcard key"); >+ } >+ if (key_obj == NULL || key_obj->label == NULL) >+ /* the optional PKCS#15 label does not exists >+ * => return the default label */ >+ return xstrdup("smartcard key"); >+ return xstrdup(key_obj->label); >+} >+ > #endif /* SMARTCARD */ >Index: scard.c >=================================================================== >RCS file: /cvs/openssh/scard.c,v >retrieving revision 1.26 >diff -u -r1.26 scard.c >--- scard.c 14 May 2003 03:40:07 -0000 1.26 >+++ scard.c 17 Jun 2003 13:20:34 -0000 >@@ -554,4 +554,11 @@ > sectok_close(fd); > return (status); > } >+ >+char * >+sc_get_key_label(Key *key) >+{ >+ return xstrdup("smartcard key"); >+} >+ > #endif /* SMARTCARD && USE_SECTOK */ >Index: scard.h >=================================================================== >RCS file: /cvs/openssh/scard.h,v >retrieving revision 1.9 >diff -u -r1.9 scard.h >--- scard.h 4 Jul 2002 00:14:18 -0000 1.9 >+++ scard.h 17 Jun 2003 13:20:34 -0000 >@@ -36,5 +36,6 @@ > Key **sc_get_keys(const char *, const char *); > void sc_close(void); > int sc_put_key(Key *, const char *); >+char *sc_get_key_label(Key *); > > #endif >Index: ssh-agent.c >=================================================================== >RCS file: /cvs/openssh/ssh-agent.c,v >retrieving revision 1.120 >diff -u -r1.120 ssh-agent.c >--- ssh-agent.c 11 Jun 2003 12:06:33 -0000 1.120 >+++ ssh-agent.c 17 Jun 2003 13:20:34 -0000 >@@ -618,7 +618,7 @@ > if (lookup_identity(k, version) == NULL) { > id = xmalloc(sizeof(Identity)); > id->key = k; >- id->comment = xstrdup("smartcard key"); >+ id->comment = sc_get_key_label(k); > id->death = death; > id->confirm = confirm; > TAILQ_INSERT_TAIL(&tab->idlist, id, next); >Index: ssh.c >=================================================================== >RCS file: /cvs/openssh/ssh.c,v >retrieving revision 1.172 >diff -u -r1.172 ssh.c >--- ssh.c 18 May 2003 10:52:40 -0000 1.172 >+++ ssh.c 17 Jun 2003 13:20:34 -0000 >@@ -1180,7 +1180,7 @@ > sizeof(Key *) * (SSH_MAX_IDENTITY_FILES - 1)); > options.num_identity_files++; > options.identity_keys[0] = keys[i]; >- options.identity_files[0] = xstrdup("smartcard key");; >+ options.identity_files[0] = sc_get_key_label(keys[i]); > } > if (options.num_identity_files > SSH_MAX_IDENTITY_FILES) > options.num_identity_files = SSH_MAX_IDENTITY_FILES;
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 591
:
325
|
326
|
329
| 330