Diff

Differences From Artifact [e6fa629162]:

To Artifact [6eb21adaf8]:


  2868   2868   			/* End transaction */
  2869   2869   			cackey_end_transaction(slot);
  2870   2870   
  2871   2871   			if (respcode == 0x6982 || respcode == 0x6e00) {
  2872   2872   				CACKEY_DEBUG_PRINTF("Security status not satisified (respcode = 0x%04x).  Returning NEEDLOGIN", (int) respcode);
  2873   2873   
  2874   2874   				cackey_mark_slot_reset(slot);
  2875         -				slot->token_flags = CKF_LOGIN_REQUIRED;
  2876   2875   
  2877   2876   				return(CACKEY_PCSC_E_NEEDLOGIN);
  2878   2877   			}
  2879   2878   
  2880   2879   			if (respcode == 0x6E00) {
  2881   2880   				CACKEY_DEBUG_PRINTF("Got \"WRONG CLASS\", this means we are talking to the wrong object (likely because the card went away) -- resetting");
  2882   2881   
  2883   2882   				cackey_mark_slot_reset(slot);
  2884         -				slot->token_flags = CKF_LOGIN_REQUIRED;
  2885   2883   
  2886   2884   				return(CACKEY_PCSC_E_NEEDLOGIN);
  2887   2885   			}
  2888   2886   
  2889   2887   			if (send_ret == CACKEY_PCSC_E_TOKENABSENT) {
  2890   2888   				CACKEY_DEBUG_PRINTF("Token absent.  Returning TOKENABSENT");
  2891   2889   
................................................................................
  4430   4428   
  4431   4429   					if (currslot >= (sizeof(cackey_slots) / sizeof(cackey_slots[0]))) {
  4432   4430   						CACKEY_DEBUG_PRINTF("Found more readers than slots are available!");
  4433   4431   
  4434   4432   						break;
  4435   4433   					}
  4436   4434   
  4437         -					CACKEY_DEBUG_PRINTF("Found reader: %s", pcsc_readers);
         4435  +					CACKEY_DEBUG_PRINTF("Found reader: %s (currslot = %lu)", pcsc_readers, (unsigned long) currslot);
  4438   4436   
  4439   4437   					/* Only update the list of slots if we are actually being asked supply the slot information */
  4440   4438   					if (pSlotList) {
  4441   4439   						if (slot_reset) {
  4442   4440   							cackey_slots[currslot].active = 1;
  4443   4441   							cackey_slots[currslot].internal = 0;
  4444   4442   							cackey_slots[currslot].pcsc_reader = strdup(pcsc_readers);
................................................................................
  4447   4445   							cackey_slots[currslot].transaction_need_hw_lock = 0;
  4448   4446   							cackey_slots[currslot].token_flags = CKF_LOGIN_REQUIRED;
  4449   4447   							cackey_slots[currslot].label = NULL;
  4450   4448   
  4451   4449   							cackey_mark_slot_reset(&cackey_slots[currslot]);
  4452   4450   						}
  4453   4451   					} else {
  4454         -						/* Artificially increase the number of active slots by what will become active */
  4455         -						slot_count++;
         4452  +						if (!cackey_slots[currslot].active) {
         4453  +							/* Artificially increase the number of active slots by what will become active */
         4454  +							CACKEY_DEBUG_PRINTF("Found in-active slot %lu, but it will be active after a reset -- marking as active for accounting purposes", (unsigned long) currslot);
         4455  +
         4456  +							slot_count++;
         4457  +						}
  4456   4458   					}
  4457   4459   					currslot++;
  4458   4460   
  4459   4461   					pcsc_readers += curr_reader_len + 1;
  4460   4462   				}
  4461   4463   
  4462   4464   				for (currslot = 0; currslot < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); currslot++) {
  4463   4465   					if (cackey_slots[currslot].active) {
  4464         -						CACKEY_DEBUG_PRINTF("Found active slot %lu", (unsigned long) currslot);
         4466  +						CACKEY_DEBUG_PRINTF("Found active slot %lu, reader = %s", (unsigned long) currslot, cackey_slots[currslot].pcsc_reader);
  4465   4467   
  4466   4468   						slot_count++;
  4467   4469   					}
  4468   4470   				}
  4469   4471   			} else {
  4470   4472   				CACKEY_DEBUG_PRINTF("Second call to SCardListReaders failed, return %s/%li", CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(scard_listreaders_ret), (long) scard_listreaders_ret);
  4471   4473   			}