Check-in [78b2c8546f]
Overview
Comment:Worked around bug in GDM (619297) that rejects a slotid of 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:78b2c8546f2f6be1be73590aaae078b21e2778e0
User & Date: rkeene on 2010-05-21 15:43:50
Other Links: manifest | tags
Context
2010-05-21
15:44
CACKey 0.5.5 check-in: c97d596fa2 user: rkeene tags: trunk, 0.5.5
15:43
Worked around bug in GDM (619297) that rejects a slotid of 0 check-in: 78b2c8546f user: rkeene tags: trunk
15:43
Updated to make target directory tree check-in: 627054cdf0 user: rkeene tags: trunk
Changes

Modified cackey.c from [1aac84790e] to [a529afaf0b].

  3107   3107   			pcsc_readers = malloc(pcsc_readers_len);
  3108   3108   			pcsc_readers_s = pcsc_readers;
  3109   3109   
  3110   3110   			scard_listreaders_ret = SCardListReaders(*cackey_pcsc_handle, NULL, pcsc_readers, &pcsc_readers_len);
  3111   3111   			if (scard_listreaders_ret == SCARD_S_SUCCESS) {
  3112   3112   				pcsc_readers_e = pcsc_readers + pcsc_readers_len;
  3113   3113   
  3114         -				currslot = 0;
         3114  +				/* Start with Slot ID 1, to avoid a bug in GDM */
         3115  +				/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
         3116  +				currslot = 1;
  3115   3117   				while (pcsc_readers < pcsc_readers_e) {
  3116   3118   					curr_reader_len = strlen(pcsc_readers);
  3117   3119   
  3118   3120   					if ((pcsc_readers + curr_reader_len) > pcsc_readers_e) {
  3119   3121   						break;
  3120   3122   					}
  3121   3123   
................................................................................
  3142   3144   						cackey_slots[currslot].label = NULL;
  3143   3145   					}
  3144   3146   					currslot++;
  3145   3147   
  3146   3148   					pcsc_readers += curr_reader_len + 1;
  3147   3149   				}
  3148   3150   
  3149         -				if (currslot > 0) {
  3150         -					slot_count = currslot;
         3151  +				/* Start with Slot ID 1, to avoid a bug in GDM */
         3152  +				/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
         3153  +				if (currslot > 1) {
         3154  +					/* Start with Slot ID 1, to avoid a bug in GDM */
         3155  +					/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
         3156  +					slot_count = currslot - 1;
  3151   3157   				}
  3152   3158   			} else {
  3153   3159   				CACKEY_DEBUG_PRINTF("Second call to SCardListReaders failed, return %s/%li", CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(scard_listreaders_ret), (long) scard_listreaders_ret);
  3154   3160   			}
  3155   3161   
  3156   3162   			free(pcsc_readers_s);
  3157   3163   		} else {
................................................................................
  3178   3184   	if (count < slot_count) {
  3179   3185   		CACKEY_DEBUG_PRINTF("Error. User allocated %lu entries, but we have %lu entries.", count, slot_count);
  3180   3186   
  3181   3187   		return(CKR_BUFFER_TOO_SMALL);	
  3182   3188   	}
  3183   3189   
  3184   3190   	for (currslot = 0; currslot < slot_count; currslot++) {
  3185         -		pSlotList[currslot] = currslot;
         3191  +		/* Start with Slot ID 1, to avoid a bug in GDM */
         3192  +		/* Bug 619297: https://bugzilla.gnome.org/show_bug.cgi?id=619297 */
         3193  +		pSlotList[currslot] = currslot + 1;
  3186   3194   	}
  3187   3195   
  3188   3196   	*pulCount = slot_count;
  3189   3197   
  3190   3198   	CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i).  Found %lu readers.", CKR_OK, (unsigned long) slot_count);
  3191   3199   
  3192   3200   	return(CKR_OK);