|
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 |
/* MISCHA added NULL checking, so that we can call deinit even if |
| 381 |
* already done. Also necessary to call deinit just before the reclaim loop, |
| 382 |
* otherwise device is taken. Hence have move deinit towards beginning. */ |
| 383 |
if (fprint->data!=NULL) |
| 384 |
fp_print_data_free (fprint->data); |
| 385 |
if (fprint->dev!=NULL) |
| 386 |
fp_dev_close (fprint->dev); |
| 387 |
} |
| 388 |
|
| 376 |
static int pam_fp_libfprint_verify (pam_fp_s *pam_fp) |
389 |
static int pam_fp_libfprint_verify (pam_fp_s *pam_fp) |
| 377 |
{ |
390 |
{ |
| 378 |
int ret = -1; |
391 |
int ret = -1; |
| 379 |
int retry = 0; |
392 |
int retry = 0; |
| 380 |
int reclaim = 0; |
393 |
int reclaim = 0; |
| 381 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
394 |
pam_fp_libfprint_s *fprint = &pam_fp->fprint; |
|
|
395 |
int init_ret; |
| 382 |
|
396 |
|
| 383 |
while (retry++ <= FP_RETRY_MAX) { |
397 |
while (retry++ <= FP_RETRY_MAX) { |
| 384 |
ret = pam_fp_libfprint_user_swipe (pam_fp, fprint->data); |
398 |
ret = pam_fp_libfprint_user_swipe (pam_fp, fprint->data); |
|
Lines 389-403
Link Here
|
| 389 |
} |
403 |
} |
| 390 |
|
404 |
|
| 391 |
while (reclaim++ <= FP_RECLAIM_MAX) { |
405 |
while (reclaim++ <= FP_RECLAIM_MAX) { |
|
|
406 |
/* MISCHA added pam_fp_libfprint_deinit here, otherwise |
| 407 |
* device cannot be reclaimed */ |
| 408 |
pam_fp_libfprint_deinit (pam_fp); |
| 392 |
/* surprise removal, e.g. suspend */ |
409 |
/* surprise removal, e.g. suspend */ |
| 393 |
pam_fp_log (pam_fp, LOG_NOTICE, |
410 |
pam_fp_log (pam_fp, LOG_NOTICE, |
| 394 |
"%s reclaim loop (#%i, retry %i).", __FUNCTION__, reclaim, retry); |
411 |
"%s reclaim loop (#%i, retry %i).", __FUNCTION__, reclaim, retry); |
| 395 |
usleep (250000); |
412 |
usleep (250000); |
| 396 |
if (pam_fp_libfprint_init (pam_fp) == 0) { |
413 |
/* MISCHA added logging of return val of init (in else) */ |
|
|
414 |
if ((init_ret=pam_fp_libfprint_init (pam_fp)) == 0) { |
| 397 |
reclaim = 0; |
415 |
reclaim = 0; |
| 398 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s reclaim success.", __FUNCTION__); |
416 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s reclaim success.", __FUNCTION__); |
| 399 |
break; |
417 |
break; |
| 400 |
} |
418 |
} else |
|
|
419 |
pam_fp_log (pam_fp, LOG_NOTICE, "%s returned %d", __FUNCTION__,init_ret); |
| 401 |
|
420 |
|
| 402 |
if (reclaim == FP_RECLAIM_MAX || retry == FP_RETRY_MAX) { |
421 |
if (reclaim == FP_RECLAIM_MAX || retry == FP_RETRY_MAX) { |
| 403 |
pam_fp_log (pam_fp, LOG_ERR, "Fingerprint reader did not return in time."); |
422 |
pam_fp_log (pam_fp, LOG_ERR, "Fingerprint reader did not return in time."); |
|
Lines 412-424
Link Here
|
| 412 |
return ret; |
431 |
return ret; |
| 413 |
} |
432 |
} |
| 414 |
|
433 |
|
| 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) |
434 |
static void pam_fp_swipe (pam_fp_s *pam_fp) |
| 423 |
{ |
435 |
{ |
| 424 |
int ret = -1; |
436 |
int ret = -1; |
|
Lines 445-450
Link Here
|
| 445 |
static void pam_fp_prompt (pam_fp_s *pam_fp) |
457 |
static void pam_fp_prompt (pam_fp_s *pam_fp) |
| 446 |
{ |
458 |
{ |
| 447 |
int ret = -1; |
459 |
int ret = -1; |
|
|
460 |
int stat_loc,wait_ret; /* for waitpid(), used to be wait() */ |
| 448 |
char *resp = NULL; |
461 |
char *resp = NULL; |
| 449 |
|
462 |
|
| 450 |
/* always returning from pam_prompt due to the CR sent by the keyboard or by uinput (child) */ |
463 |
/* always returning from pam_prompt due to the CR sent by the keyboard or by uinput (child) */ |
|
Lines 455-461
Link Here
|
| 455 |
/* password was given, authenticate based on the passwordD, if any */ |
468 |
/* password was given, authenticate based on the passwordD, if any */ |
| 456 |
pam_fp_log (pam_fp, LOG_NOTICE, "Password received, stopping child process (pid %i).", pam_fp->child); |
469 |
pam_fp_log (pam_fp, LOG_NOTICE, "Password received, stopping child process (pid %i).", pam_fp->child); |
| 457 |
kill (pam_fp->child, SIGKILL); |
470 |
kill (pam_fp->child, SIGKILL); |
| 458 |
wait (NULL); |
471 |
/* MISCHA changed: wait(NULL) would hang because child had |
|
|
472 |
* already disappeared (?); this caused kdm to crash; using |
| 473 |
* WNOHANG seems to have solved it. For WNOHANG need waitpid() |
| 474 |
* instead of wait() Also added LOG_NOTICE */ |
| 475 |
wait_ret=waitpid((pid_t)-1,&stat_loc,WNOHANG); |
| 476 |
pam_fp_log (pam_fp, LOG_NOTICE, "Waitpid() returned with: stat_loc=%d, return val=%d",stat_loc,wait_ret); |
| 477 |
|
| 459 |
goto out; |
478 |
goto out; |
| 460 |
} |
479 |
} |
| 461 |
|
480 |
|