Diff

Differences From Artifact [1aac84790e]:

To Artifact [a529afaf0b]:


3107
3108
3109
3110
3111
3112
3113


3114

3115
3116
3117
3118
3119
3120
3121
3107
3108
3109
3110
3111
3112
3113
3114
3115

3116
3117
3118
3119
3120
3121
3122
3123







+
+
-
+







			pcsc_readers = malloc(pcsc_readers_len);
			pcsc_readers_s = pcsc_readers;

			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, pcsc_readers, &pcsc_readers_len);
			if (scard_listreaders_ret == SCARD_S_SUCCESS) {
				pcsc_readers_e = pcsc_readers + pcsc_readers_len;

				/* Start with Slot ID 1, to avoid a bug in GDM */
				/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
				currslot = 0;
				currslot = 1;
				while (pcsc_readers < pcsc_readers_e) {
					curr_reader_len = strlen(pcsc_readers);

					if ((pcsc_readers + curr_reader_len) > pcsc_readers_e) {
						break;
					}

3142
3143
3144
3145
3146
3147
3148


3149
3150




3151
3152
3153
3154
3155
3156
3157
3144
3145
3146
3147
3148
3149
3150
3151
3152


3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163







+
+
-
-
+
+
+
+







						cackey_slots[currslot].label = NULL;
					}
					currslot++;

					pcsc_readers += curr_reader_len + 1;
				}

				/* Start with Slot ID 1, to avoid a bug in GDM */
				/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
				if (currslot > 0) {
					slot_count = currslot;
				if (currslot > 1) {
					/* Start with Slot ID 1, to avoid a bug in GDM */
					/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
					slot_count = currslot - 1;
				}
			} else {
				CACKEY_DEBUG_PRINTF("Second call to SCardListReaders failed, return %s/%li", CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(scard_listreaders_ret), (long) scard_listreaders_ret);
			}

			free(pcsc_readers_s);
		} else {
3178
3179
3180
3181
3182
3183
3184


3185

3186
3187
3188
3189
3190
3191
3192
3184
3185
3186
3187
3188
3189
3190
3191
3192

3193
3194
3195
3196
3197
3198
3199
3200







+
+
-
+







	if (count < slot_count) {
		CACKEY_DEBUG_PRINTF("Error. User allocated %lu entries, but we have %lu entries.", count, slot_count);

		return(CKR_BUFFER_TOO_SMALL);	
	}

	for (currslot = 0; currslot < slot_count; currslot++) {
		/* Start with Slot ID 1, to avoid a bug in GDM */
		/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
		pSlotList[currslot] = currslot;
		pSlotList[currslot] = currslot + 1;
	}

	*pulCount = slot_count;

	CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i).  Found %lu readers.", CKR_OK, (unsigned long) slot_count);

	return(CKR_OK);