minidriver: make the parameter check be aware of pinpad capabilities
This commit is contained in:
parent
a5593afc78
commit
f331b35c4e
|
@ -2377,17 +2377,17 @@ DWORD WINAPI CardAuthenticatePin(__in PCARD_DATA pCardData,
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
if (wcscmp(wszCARD_USER_USER,pwszUserId) != 0 && wcscmp(wszCARD_USER_ADMIN,pwszUserId) != 0)
|
if (wcscmp(wszCARD_USER_USER,pwszUserId) != 0 && wcscmp(wszCARD_USER_ADMIN,pwszUserId) != 0)
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
if (NULL == pbPin)
|
if (!(vs->reader->capabilities & SC_READER_CAP_PIN_PAD) && NULL == pbPin)
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (cbPin < 4 || cbPin > 12)
|
if (!(vs->reader->capabilities & SC_READER_CAP_PIN_PAD) && (cbPin < 4 || cbPin > 12))
|
||||||
return SCARD_W_WRONG_CHV;
|
return SCARD_W_WRONG_CHV;
|
||||||
|
|
||||||
if (wcscmp(wszCARD_USER_ADMIN, pwszUserId) == 0)
|
if (wcscmp(wszCARD_USER_ADMIN, pwszUserId) == 0)
|
||||||
return SCARD_W_WRONG_CHV;
|
return SCARD_W_WRONG_CHV;
|
||||||
|
|
||||||
if(pcAttemptsRemaining)
|
if(pcAttemptsRemaining)
|
||||||
(*pcAttemptsRemaining) = 0;
|
(*pcAttemptsRemaining) = (DWORD) -1;
|
||||||
|
|
||||||
wcstombs(type, pwszUserId, 100);
|
wcstombs(type, pwszUserId, 100);
|
||||||
type[10] = 0;
|
type[10] = 0;
|
||||||
|
@ -2516,8 +2516,6 @@ DWORD WINAPI CardUnblockPin(__in PCARD_DATA pCardData,
|
||||||
|
|
||||||
if (pwszUserId == NULL)
|
if (pwszUserId == NULL)
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
if (pbAuthenticationData == NULL)
|
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
|
||||||
if (wcscmp(wszCARD_USER_USER, pwszUserId) != 0 && wcscmp(wszCARD_USER_ADMIN,pwszUserId) != 0)
|
if (wcscmp(wszCARD_USER_USER, pwszUserId) != 0 && wcscmp(wszCARD_USER_ADMIN,pwszUserId) != 0)
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
if (wcscmp(wszCARD_USER_ADMIN, pwszUserId) == 0)
|
if (wcscmp(wszCARD_USER_ADMIN, pwszUserId) == 0)
|
||||||
|
@ -2529,6 +2527,9 @@ DWORD WINAPI CardUnblockPin(__in PCARD_DATA pCardData,
|
||||||
|
|
||||||
vs = (VENDOR_SPECIFIC*)(pCardData->pvVendorSpecific);
|
vs = (VENDOR_SPECIFIC*)(pCardData->pvVendorSpecific);
|
||||||
|
|
||||||
|
if ((!(vs->reader->capabilities & SC_READER_CAP_PIN_PAD)) && pbAuthenticationData == NULL)
|
||||||
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
dw_rv = md_get_pin_by_role(pCardData, ROLE_USER, &pin_obj);
|
dw_rv = md_get_pin_by_role(pCardData, ROLE_USER, &pin_obj);
|
||||||
if (dw_rv != SCARD_S_SUCCESS) {
|
if (dw_rv != SCARD_S_SUCCESS) {
|
||||||
logprintf(pCardData, 2, "Cannot get User PIN object");
|
logprintf(pCardData, 2, "Cannot get User PIN object");
|
||||||
|
@ -2574,6 +2575,10 @@ DWORD WINAPI CardChangeAuthenticator(__in PCARD_DATA pCardData,
|
||||||
if (pwszUserId == NULL)
|
if (pwszUserId == NULL)
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
vs = (VENDOR_SPECIFIC*)(pCardData->pvVendorSpecific);
|
||||||
|
if (!vs) return SCARD_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (!(vs->reader->capabilities & SC_READER_CAP_PIN_PAD)) {
|
||||||
if (pbCurrentAuthenticator == NULL || cbCurrentAuthenticator == 0) {
|
if (pbCurrentAuthenticator == NULL || cbCurrentAuthenticator == 0) {
|
||||||
logprintf(pCardData, 1, "Invalid current PIN data\n");
|
logprintf(pCardData, 1, "Invalid current PIN data\n");
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
|
@ -2583,6 +2588,7 @@ DWORD WINAPI CardChangeAuthenticator(__in PCARD_DATA pCardData,
|
||||||
logprintf(pCardData, 1, "Invalid new PIN data\n");
|
logprintf(pCardData, 1, "Invalid new PIN data\n");
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dwFlags != CARD_AUTHENTICATE_PIN_PIN) {
|
if (dwFlags != CARD_AUTHENTICATE_PIN_PIN) {
|
||||||
logprintf(pCardData, 1, "Other then 'authentication' the PIN are not supported\n");
|
logprintf(pCardData, 1, "Other then 'authentication' the PIN are not supported\n");
|
||||||
|
@ -2599,8 +2605,6 @@ DWORD WINAPI CardChangeAuthenticator(__in PCARD_DATA pCardData,
|
||||||
pwszUserId, pbCurrentAuthenticator, cbCurrentAuthenticator, pbNewAuthenticator, cbNewAuthenticator,
|
pwszUserId, pbCurrentAuthenticator, cbCurrentAuthenticator, pbNewAuthenticator, cbNewAuthenticator,
|
||||||
cRetryCount, dwFlags);
|
cRetryCount, dwFlags);
|
||||||
|
|
||||||
vs = (VENDOR_SPECIFIC*)(pCardData->pvVendorSpecific);
|
|
||||||
|
|
||||||
if (wcscmp(wszCARD_USER_USER, pwszUserId) == 0)
|
if (wcscmp(wszCARD_USER_USER, pwszUserId) == 0)
|
||||||
dw_rv = md_get_pin_by_role(pCardData, ROLE_USER, &pin_obj);
|
dw_rv = md_get_pin_by_role(pCardData, ROLE_USER, &pin_obj);
|
||||||
else if (wcscmp(wszCARD_USER_ADMIN,pwszUserId) == 0)
|
else if (wcscmp(wszCARD_USER_ADMIN,pwszUserId) == 0)
|
||||||
|
@ -3468,7 +3472,7 @@ DWORD WINAPI CardAuthenticateEx(__in PCARD_DATA pCardData,
|
||||||
return SCARD_E_INVALID_PARAMETER;
|
return SCARD_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
if(pcAttemptsRemaining)
|
if(pcAttemptsRemaining)
|
||||||
(*pcAttemptsRemaining) = 0;
|
(*pcAttemptsRemaining) = (DWORD) -1;
|
||||||
|
|
||||||
r = md_get_pin_by_role(pCardData, PinId, &pin_obj);
|
r = md_get_pin_by_role(pCardData, PinId, &pin_obj);
|
||||||
if (r != SCARD_S_SUCCESS) {
|
if (r != SCARD_S_SUCCESS) {
|
||||||
|
|
Loading…
Reference in New Issue