Bugzilla – Attachment 327 Details for
Bug 593
fix a possible segfault. ask for passphrase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch against current cvs
patch.diff (text/plain), 1.61 KB, created by
Andreas Jellinghaus
on 2003-06-16 20:18:56 AEST
(
hide
)
Description:
patch against current cvs
Filename:
MIME Type:
Creator:
Andreas Jellinghaus
Created:
2003-06-16 20:18:56 AEST
Size:
1.61 KB
patch
obsolete
>diff -u -3 -p -r1.9 scard-opensc.c >--- scard-opensc.c 5 Jun 2003 09:19:35 -0000 1.9 >+++ scard-opensc.c 16 Jun 2003 10:13:43 -0000 >@@ -89,6 +89,12 @@ sc_init(void) > r = sc_establish_context(&ctx, "openssh"); > if (r) > goto err; >+ if (sc_reader_id >= ctx->reader_count) { >+ r=SC_ERROR_NO_READERS_FOUND; >+ error("Illegal reader number. Only %d reader(s) configured.\n", >+ ctx->reader_count); >+ goto err; >+ } > r = sc_connect_card(ctx->reader[sc_reader_id], 0, &card); > if (r) > goto err; >@@ -143,11 +149,42 @@ sc_prkey_op_init(RSA *rsa, struct sc_pkc > *key_obj_out = key_obj; > return 0; > } else if (r) { >+ /* some other OpenSC internal error */ > error("Unable to find PIN object from SmartCard: %s", > sc_strerror(r)); > goto err; > } > pin = pin_obj->data; >+ >+ if ((pin->auth_id.len > 0) && (! sc_pin)) { >+ /* we need a pin, we don't have one. let's ask. */ >+ char *passphrase; >+ passphrase = read_passphrase("Enter passphrase for key:", 0); >+ if (! passphrase) >+ goto err; >+ if (strcmp(passphrase, "") == 0) >+ goto err; >+ r = sc_lock(card); >+ if (r) { >+ error("Unable to lock smartcard: %s", >+ sc_strerror(r)); >+ memset(passphrase, 0, strlen(passphrase)); >+ xfree(passphrase); >+ goto err; >+ } >+ r = sc_pkcs15_verify_pin(p15card, pin, >+ passphrase, strlen(passphrase)); >+ memset(passphrase, 0, strlen(passphrase)); >+ xfree(passphrase); >+ if (r) { >+ sc_unlock(card); >+ error("PIN code verification failed: %s", >+ sc_strerror(r)); >+ goto err; >+ } >+ *key_obj_out = key_obj; >+ return 0; >+ } > r = sc_lock(card); > if (r) { > error("Unable to lock smartcard: %s", sc_strerror(r));
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 593
: 327