apply Stef's patch which puts all public objects in first slot if only one pin is present (and hide_empty_tokens is true)

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2448 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2005-07-24 14:06:02 +00:00
parent c26dde1a82
commit f59a51397c
2 changed files with 10 additions and 7 deletions

View File

@ -295,7 +295,7 @@ app opensc-pkcs11 {
# #
# Set this option to true to hide these empty # Set this option to true to hide these empty
# slots. # slots.
hide_empty_tokens = false; hide_empty_tokens = yes;
# By default, the OpenSC PKCS#11 module will # By default, the OpenSC PKCS#11 module will
# try to lock this card once you have authenticated # try to lock this card once you have authenticated

View File

@ -674,18 +674,21 @@ static CK_RV pkcs15_create_tokens(struct sc_pkcs11_card *p11card)
continue; continue;
if (is_privkey(obj)) { if (is_privkey(obj)) {
sc_debug(context, "Adding private key %d to PIN %d\n", j, i); sc_debug(context, "Adding private key %d to PIN %d\n", j, i);
pkcs15_add_object(slot, obj, NULL); pkcs15_add_object(slot, obj, NULL);
} } else if (is_data(obj)) {
else if (is_data(obj)) {
sc_debug(context, "Adding data object %d to PIN %d\n", j, i); sc_debug(context, "Adding data object %d to PIN %d\n", j, i);
pkcs15_add_object(slot, obj, NULL); pkcs15_add_object(slot, obj, NULL);
} }
} }
} }
/* Add all public objects to a virtual slot without pin protection */ /* Add all public objects to a virtual slot without pin protection.
slot = NULL; * If there's only 1 pin and the hide_empty_tokens option is set,
* add the public objects to the slot that corresponds to that pin.
*/
if (!(auth_count == 1 && sc_pkcs11_conf.hide_empty_tokens))
slot = NULL;
/* Add all the remaining objects */ /* Add all the remaining objects */
for (j = 0; j < fw_data->num_objects; j++) { for (j = 0; j < fw_data->num_objects; j++) {