fix for overlapping penalty from auth-backends (eg pam's 3s timeout on wrong passwd) and alock itself
--HG-- extra : convert_revision : svn%3Aeebe1cee-a9af-4fe4-bd26-ad572b19c5ab/trunk%4083
This commit is contained in:
parent
84c7f93dbc
commit
c3a84e4ccb
1 changed files with 17 additions and 5 deletions
22
src/alock.c
22
src/alock.c
|
@ -283,18 +283,30 @@ static int eventLoop(struct aOpts* opts, struct aXInfo* xi) {
|
|||
if (rlen < sizeof(rbuf))
|
||||
rbuf[rlen] = 0;
|
||||
|
||||
// some auth() methods have their own penalty system
|
||||
// so we assume that the auth() fails, visualize 'failed'
|
||||
// for as long as the auth needs.
|
||||
//
|
||||
// if it comes back 'ok', the visualization frame is
|
||||
// destroyed anyway. if it comes back 'false', then
|
||||
// we would need to show it anyway + we measure the
|
||||
// auth() penalty time to use it for the timeout.
|
||||
|
||||
mode = WRONG;
|
||||
visualFeedback(frame, mode);
|
||||
XSync(dpy, True);
|
||||
XBell(dpy, 0);
|
||||
|
||||
if (opts->auth->auth(rbuf)) {
|
||||
alock_free_frame(frame);
|
||||
return 1;
|
||||
}
|
||||
|
||||
mode = WRONG;
|
||||
timeout = last_key_time;
|
||||
if (elapsedTime() - last_key_time < penalty)
|
||||
timeout += penalty;
|
||||
|
||||
XSync(dpy, True); /* discard pending events to start really fresh */
|
||||
XBell(dpy, 0);
|
||||
rlen = 0;
|
||||
|
||||
timeout = last_key_time + penalty;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Reference in a new issue