|
Lines 233-238
Link Here
|
| 233 |
pam_fp_log (pam_fp, LOG_NOTICE, "Aborting swipe (%s , %s).", driver_name, fstr); |
233 |
pam_fp_log (pam_fp, LOG_NOTICE, "Aborting swipe (%s , %s).", driver_name, fstr); |
| 234 |
goto out; |
234 |
goto out; |
| 235 |
} |
235 |
} |
|
|
236 |
pam_fp_log (pam_fp, LOG_NOTICE, "Received swipe (%s, %s).", driver_name, fstr); |
| 236 |
switch (ret) { |
237 |
switch (ret) { |
| 237 |
case FP_VERIFY_NO_MATCH: { |
238 |
case FP_VERIFY_NO_MATCH: { |
| 238 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s: no match.", __FUNCTION__); |
239 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s: no match.", __FUNCTION__); |
|
Lines 373-384
Link Here
|
| 373 |
return retval; |
374 |
return retval; |
| 374 |
} |
375 |
} |
| 375 |
|
376 |
|
|
|
377 |
static void pam_fp_libfprint_deinit (pam_fp_s *pam_fp) |
| 378 |
{ |
| 379 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
| 380 |
if (fprint->data!=NULL) { |
| 381 |
fp_print_data_free (fprint->data); |
| 382 |
fprint->data = NULL; |
| 383 |
} |
| 384 |
if (fprint->dev!=NULL) { |
| 385 |
fp_dev_close (fprint->dev); |
| 386 |
fprint->dev = NULL; |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
static void pam_fp_libfprint_reset (pam_fp_s *pam_fp) |
| 391 |
{ |
| 392 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
| 393 |
pam_fp_libfprint_deinit (pam_fp); |
| 394 |
pam_fp_libfprint_init (pam_fp); |
| 395 |
fp_dev_reset(fprint->dev); |
| 396 |
} |
| 397 |
|
| 376 |
static int pam_fp_libfprint_verify (pam_fp_s *pam_fp) |
398 |
static int pam_fp_libfprint_verify (pam_fp_s *pam_fp) |
| 377 |
{ |
399 |
{ |
| 378 |
int ret = -1; |
400 |
int ret = -1; |
| 379 |
int retry = 0; |
401 |
int retry = 0; |
| 380 |
int reclaim = 0; |
402 |
int reclaim = 0; |
| 381 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
403 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
|
|
404 |
int init_ret; |
| 382 |
|
405 |
|
| 383 |
while (retry++ <= FP_RETRY_MAX) { |
406 |
while (retry++ <= FP_RETRY_MAX) { |
| 384 |
ret = pam_fp_libfprint_user_swipe (pam_fp, fprint->data); |
407 |
ret = pam_fp_libfprint_user_swipe (pam_fp, fprint->data); |
|
Lines 389-402
Link Here
|
| 389 |
} |
412 |
} |
| 390 |
|
413 |
|
| 391 |
while (reclaim++ <= FP_RECLAIM_MAX) { |
414 |
while (reclaim++ <= FP_RECLAIM_MAX) { |
|
|
415 |
pam_fp_libfprint_deinit (pam_fp); |
| 392 |
/* surprise removal, e.g. suspend */ |
416 |
/* surprise removal, e.g. suspend */ |
| 393 |
pam_fp_log (pam_fp, LOG_NOTICE, |
417 |
pam_fp_log (pam_fp, LOG_NOTICE, |
| 394 |
"%s reclaim loop (#%i, retry %i).", __FUNCTION__, reclaim, retry); |
418 |
"%s reclaim loop (#%i, retry %i).", __FUNCTION__, reclaim, retry); |
| 395 |
usleep (250000); |
419 |
usleep (250000); |
| 396 |
if (pam_fp_libfprint_init (pam_fp) == 0) { |
420 |
init_ret = pam_fp_libfprint_init (pam_fp); |
|
|
421 |
if (init_ret == 0) { |
| 397 |
reclaim = 0; |
422 |
reclaim = 0; |
| 398 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s reclaim success.", __FUNCTION__); |
423 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s reclaim success.", __FUNCTION__); |
| 399 |
break; |
424 |
break; |
|
|
425 |
} else { |
| 426 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s returned %d", __FUNCTION__, init_ret); |
| 400 |
} |
427 |
} |
| 401 |
|
428 |
|
| 402 |
if (reclaim == FP_RECLAIM_MAX || retry == FP_RETRY_MAX) { |
429 |
if (reclaim == FP_RECLAIM_MAX || retry == FP_RETRY_MAX) { |
|
Lines 412-424
Link Here
|
| 412 |
return ret; |
439 |
return ret; |
| 413 |
} |
440 |
} |
| 414 |
|
441 |
|
| 415 |
static void pam_fp_libfprint_deinit (pam_fp_s *pam_fp) |
|
|
| 416 |
{ |
| 417 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
| 418 |
fp_print_data_free (fprint->data); |
| 419 |
fp_dev_close (fprint->dev); |
| 420 |
} |
| 421 |
|
| 422 |
static void pam_fp_swipe (pam_fp_s *pam_fp) |
442 |
static void pam_fp_swipe (pam_fp_s *pam_fp) |
| 423 |
{ |
443 |
{ |
| 424 |
int ret = -1; |
444 |
int ret = -1; |
|
Lines 445-450
Link Here
|
| 445 |
static void pam_fp_prompt (pam_fp_s *pam_fp) |
465 |
static void pam_fp_prompt (pam_fp_s *pam_fp) |
| 446 |
{ |
466 |
{ |
| 447 |
int ret = -1; |
467 |
int ret = -1; |
|
|
468 |
int ret_wait; |
| 469 |
int stat_loc; |
| 448 |
char *resp = NULL; |
470 |
char *resp = NULL; |
| 449 |
|
471 |
|
| 450 |
/* always returning from pam_prompt due to the CR sent by the keyboard or by uinput (child) */ |
472 |
/* always returning from pam_prompt due to the CR sent by the keyboard or by uinput (child) */ |
|
Lines 452-461
Link Here
|
| 452 |
pam_set_item (pam_fp->pamh, PAM_AUTHTOK, resp); |
474 |
pam_set_item (pam_fp->pamh, PAM_AUTHTOK, resp); |
| 453 |
|
475 |
|
| 454 |
if (strlen (resp) > 0) { |
476 |
if (strlen (resp) > 0) { |
| 455 |
/* password was given, authenticate based on the passwordD, if any */ |
477 |
/* password was given, authenticate based on the password, if any */ |
| 456 |
pam_fp_log (pam_fp, LOG_NOTICE, "Password received, stopping child process (pid %i).", pam_fp->child); |
478 |
pam_fp_log (pam_fp, LOG_NOTICE, "Password received, stopping child process (pid %i).", pam_fp->child); |
| 457 |
kill (pam_fp->child, SIGKILL); |
479 |
kill (pam_fp->child, SIGKILL); |
| 458 |
wait (NULL); |
480 |
ret_wait = waitpid ((pid_t) -1, &stat_loc, WNOHANG); |
|
|
481 |
pam_fp_log (pam_fp, LOG_NOTICE, "waitpid(2) returned with: stat_loc=%d, return value=%d.", stat_loc, ret_wait); |
| 482 |
/* the fingerprint USB device was busy, let's try to settle it */ |
| 483 |
pam_fp_log (pam_fp, LOG_NOTICE, "Settle fingerprint reader device."); |
| 484 |
pam_fp_libfprint_reset (pam_fp); |
| 459 |
goto out; |
485 |
goto out; |
| 460 |
} |
486 |
} |
| 461 |
|
487 |
|