Commit Graph

166 Commits (main)

Author SHA1 Message Date
Ingo Bürk b4c97bddf7 Only redraw the screen if the unlock indicator is actually used.
fixes #12
2015-04-24 23:36:24 +02:00
Deiz dda29f93a1 Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-21 11:53:09 -04:00
Deiz b4f6dae10e List generic pressed modifiers on failure 2015-03-29 16:22:31 -04:00
Alexandre Boeglin a9ecf1e0c9 Add capslock and numlock indicators
When the unlock indicator warns the user that a password was typed
wrong, it now also reports the state of the capslock and numlock
modifiers.

Signed-off-by: Alexandre Boeglin <alex@boeglin.org>
2015-03-28 14:50:05 -04:00
James Cassidy aaad9c0e7a refresh pam credentials on successful authentication 2015-03-26 09:26:48 -04:00
Michael Stapelberg 68b78a7f57 clang-format -i **/*.[ch]
From here on, we’ll use clang-format to automatically format the source.

This has worked well in i3, so we are introducing it for i3lock.
2015-03-16 18:47:16 +01:00
Daniel Otero 86323f6e04 Update the key symbol if the composing ends. 2015-02-12 21:38:37 +01:00
Daniel Otero 9e48c74be1 Avoid handle a keysym if the compose state gets cancelled
This is the approach taken by libX11, and feels more consistent.
2015-02-12 11:22:58 +01:00
Daniel Otero 562e824246 Remove xkb_context initialization code from load_compose_table
xkb_context is guaranteed to be initializated from load_keymap.
2015-02-12 11:12:38 +01:00
Daniel Otero ef3ef30400 Add support for Compose and dead-keys with libxkbcommon 2015-02-12 00:37:23 +01:00
Martin Stiborsky 665ce3e215 getpwuid call moved 2015-01-06 00:02:23 +01:00
Martin Stiborsky 6ffe86ca12 null check for getpwuid and pw_name 2015-01-05 22:54:32 +01:00
Martin Stiborsky 7d52029ae3 removed the whoami function, replaced with an inline getpwuid call 2015-01-05 19:54:48 +01:00
Martin Stiborsky a3839aa69f getting current user with whoami like function rather than from env variable 2015-01-05 11:46:11 +01:00
Neodyblue 8a630bec65 Ignore password validation is pam is in wrong state
This add a protection against wrong password spamming
2014-10-13 17:53:49 +02:00
koebi 0cbf483cb4 implemented logging the number of failed attempts
This closes #1243
2014-08-24 23:27:00 +02:00
Michael Stapelberg 7f450a52f6 Die when the X11 connection breaks during runtime (Thanks Eduan) 2014-08-21 09:34:03 +02:00
Michael Stapelberg 4724d4abf0 remove obsolete xkb_state_update_key() calls (Thanks Ran) 2014-06-21 16:32:18 +02:00
Michael Stapelberg 1b89709ae7 listen for XKB events instead of the MappingNotify event (Thanks Ran) 2014-06-21 16:32:18 +02:00
Michael Stapelberg 7eb43aeabd little cleanups thanks to Ran Benita’s review 2014-06-21 16:32:18 +02:00
Michael Stapelberg 0beb9a47b1 use libxkbcommon-x11 instead of libX11 2014-06-21 16:32:18 +02:00
Vytautas Šaltenis e2dd1543e9 Cleanup scattered timer calls to use macros 2014-03-23 18:56:00 +01:00
Vytautas Šaltenis 4ff1d7fc5c Ignore empty passwd after repeated Enter keypress
When no ignore_empty_password flag is specified, but Enter key is held
down for some time, i3lock enters a finite, but hours-long loop
verifying empty password. Don't do that, skip empty password
verification if nothing was pressed after last Enter keypress.

Again, making the software cat-proof.
2014-03-23 10:07:03 +01:00
Vytautas Šaltenis e5f86339bc Fix typo 2014-03-23 10:02:10 +01:00
Vytautas Šaltenis 52541fb7ee Discard half-entered passwd after some inactivity
When you start typing a password and then wander off, let's discard that
attempt after a few minutes of inactivity (and turn off the monitors if
dpms is on).

This is a real actual case of making the software cat-proof: when my cat
treads over the keyboard at night, I don't want the monitors to shine
for the rest of the night.
2014-03-23 10:01:59 +01:00
Vytautas Šaltenis c7cd4cd3b5 Delay to turn off the screen after wrong passwd
Also add flag for number of seconds to wait for it.

When user cancels the password or enters a wrong one, i3lock will wait
for some time before putting the monitors back to sleep. By default it's
30 seconds, but this flag allows to control that.
2014-03-23 09:32:44 +01:00
TheKK 15ddf304be Replace '1' with "EXIT_FAILURE" 2014-03-16 16:25:15 +01:00
Vytautas Šaltenis 2509c987d1 Extract start/stop timer code to reusable funcs 2014-03-11 09:11:20 +01:00
Vytautas Šaltenis d91fdc368e Extract if(dpms) calls to wrapper functions 2014-03-11 09:09:02 +01:00
Philippe Virouleau 6c34f6aa40 Turn on the screen on successful authentication
As described in ticket #1114, the screen may be left turned off on successful
authentication. This commit fixes this behaviour by turning the screen back on
after the authentication.

Fixes #1114
2013-11-12 08:24:14 +01:00
Michael Stapelberg ac8bbad523 Re-raise i3lock when obscured in a separate process
This is cleaner than commit a305e62 (running authentication in a
separate process) because we don’t lose the feature that X11 will buffer
KeyPresses for us while the process blocks on PAM. See
http://cr.i3wm.org/patch/305 for the amount of code (and new known bugs)
that would have to be introduced to make a305e62 work.
2013-11-10 20:43:08 +01:00
Michael Stapelberg d7fd058f0c Revert "Run authentification in different process"
This reverts commit a305e622a6.

In the next commit, the same functionality will be achieved in a cleaner
way.
2013-11-10 20:42:53 +01:00
Michael Stapelberg df760b6e9e Revert "Bug fix: Call clear_input() when the password is wrong."
This reverts commit 33d953fbdf,
in preparation for reverting commit a305e62
2013-11-10 20:42:39 +01:00
oblique 33d953fbdf Bug fix: Call clear_input() when the password is wrong.
clear_input() calls start_clear_indicator_timeout() to clear the
indicator after 1 second. This had as a result the screen to be cleared
when the "verifying…" message was showed, so the "wrong!" message didn't
show up when the password was wrong.

First bad commit: a305e62
2013-10-20 22:34:22 +02:00
koebi a305e622a6 Run authentification in different process
When having i3bar in “hide” mode, it could previously be brought up
while the authentication was running. This is not 100% fixed with this
change, but a lot better, as the normal “raise i3lock to the top”
behavior is not blocked now anymore.

fixes #895
2013-09-19 06:18:41 +02:00
Michael Stapelberg 2f17b73e20 Bugfix: update the initial keyboard modifier state (Thanks lee, Ran)
This should make the numpad work correctly.
2013-09-01 10:01:38 +02:00
Michael Stapelberg ad47d80e22 Add -e to --help 2013-08-31 20:42:06 +02:00
Vincent Bernat 5627a11174 Add `-e` option to not validate empty password.
When the XF86ScreenSaver key is used to put a laptop to sleep (or to
trigger the screensaver), the key may "bounce" on resume. This is
annoying as i3lock will try to validate several empty passwords and
wait several seconds before accepting a legit password.

Some users may want to validate an empty password: PAM may rely on
other sources to unlock the screen, like the presence of a token or
the proximity of some Bluetooth device. Hence, we don't forbid this
possibility and provide an command-line option for users not willing
to validate empty passwords.
2013-08-31 20:41:12 +02:00
Bas Pape 3e136769be Use cairo_status_to_string for descriptive errors. 2013-07-30 20:08:21 +02:00
Michael Stapelberg d4d589a7dd fix ctrl-u handling 2013-03-29 10:13:01 +01:00
Sebastian Ullrich 1495903e5d Fix resetting the password after failed authentications
This has been broken by commit 661344.
2013-03-29 10:02:35 +01:00
Philip Dexter 661344463a Add ctrl+u password reset 2013-03-24 14:30:07 +01:00
Baptiste Daroussin d8a1da69fb Use ev_loop_fork after fork, this fix forking on kqueue based OSes 2013-03-20 21:28:14 +01:00
Quentin Glidic b1a6e2ebe3 Limit the debug print to the actual password size
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2013-02-07 17:15:16 +01:00
Vivien Didelot 2c9e46dfee RGB color notation is 3-byte hexadecimal
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
2012-12-06 09:40:23 +01:00
Moritz Augsburger d6b9e33e28 Allow passwordless PAM conversations (e.g. fingerprint) 2012-11-04 19:01:52 +01:00
Moritz Augsburger e84a1203a6 Allow XKB_KEY_XF86ScreenSaver as synonm for enter
This keysym is generated on convertible tablets by pressing a hardware
lock/unlock button.
2012-11-04 19:01:48 +01:00
Michael Stapelberg fba88476dd remove support for NOLIBCAIRO, cairo-xcb is widespread by now 2012-10-26 20:42:26 +02:00
Michael Stapelberg e1d86a3279 use libxkbcommon for input handling
Thanks to Ran Benita and Daniel Stone (the libxkbcommon authors) for
answering my questions and reviewing this code.

With this commit, input handling should be more correct with using less
code (in i3lock, that is).
2012-10-26 20:39:59 +02:00
Michael Stapelberg 2cadf22c67 s/pam_message/pam_response/ (Thanks Tucos)
The previous code didn’t cause any issues since both types (currently!)
have the same size.
2012-10-15 22:40:29 +02:00
Michael Stapelberg 603c90e985 promote the "could not load image" message from debug to normal 2012-09-26 11:21:48 +02:00
Michael Stapelberg 1e55f0dc6f only use mlock() on Linux, FreeBSD (for example) requires root 2012-08-22 20:49:10 +02:00
Fernando Tarlá Cardoso Lemos 65795be0a9 getopt_long returns int, don't cast to char.
On ARM, casting -1 to char turns it into something else. Fixes
argument parsing on ARM. Thanks Chipaca for reporting.
2012-06-29 16:30:23 +02:00
Michael Stapelberg dd02dff44a revert shift lock handling (broke uppercase letters)
With some layouts, this broke uppercase letters in your passwords.

I think that explicit shiftlock handling is unnecessary. X11 seems to do
it on its own. Here is what leads me to that conclusion:

  $ setxkbmap de
  $ xmodmap -e 'keycode 66 = Shift_Lock'
  $ xev

Now enter a character, say "a", then press CapsLk (which is now
Shift_Lock), then press "a" again. The event state is 0x1, thereby
undistinguishable from normal shift.
2012-05-30 16:08:12 +02:00
Michael Stapelberg 9b29ae7afd Bugfix: Correctly center unlock indicator after reconfiguring screens (Thanks xn)
Fixes: #712
2012-05-19 21:13:03 +02:00
Michael Stapelberg dc2b6e5f39 Use (void) instead of () for functions without args (Thanks fernandotcl)
See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors, such
as the one which was fixed with commit 0ea64ae4.
2012-04-01 12:28:28 +02:00
Michael Stapelberg 3c2436cb71 Bugfix: fallback when the image cannot be loaded
If the specified file does not exist or is invalid, previously, the unlock
indicator wouldn’t show up at all, because the invalid surface was still used.

With this commit, i3lock will react like if you didn’t specify an image at all.
2012-03-28 21:00:49 +02:00
Michael Stapelberg be21951062 Only output text when in debug mode (fixes problems with xautolock) 2012-03-26 19:54:47 +02:00
Michael Stapelberg b5bbd2fe04 Properly handle Caps Lock (Thanks Damien) 2012-03-10 16:42:10 +01:00
Michael Stapelberg 34c8108c06 Bugfix: Check for waiting X11 events before entering the event loop 2012-01-05 22:27:01 +00:00
Michael Stapelberg cab5e6b1de Change the unlock indicator properly after pressing the 'escape' key 2012-01-05 01:07:29 +00:00
Michael Stapelberg fd64bde0cb Implement Xinerama support (not used yet) 2012-01-03 23:10:56 +00:00
Michael Stapelberg 0e7e009f45 Properly free timeouts, move one of the timeouts to unlock_indicator.c 2012-01-03 22:18:33 +00:00
Michael Stapelberg f94fb9b5f8 remove the dead variable modeswitchmask 2012-01-03 21:01:16 +00:00
Michael Stapelberg 6ea3fbdc21 Properly free the reply of xcb_get_geometry 2012-01-03 21:01:05 +00:00
Michael Stapelberg 57585bef70 Refactor the unlock indicator into its own source code file 2012-01-03 20:56:05 +00:00
Michael Stapelberg 009a0b1a51 Fork after the window is visible, not before 2012-01-03 20:19:17 +00:00
Michael Stapelberg 6f50a997b8 change ALL the copyrights! 2012-01-03 18:20:37 +00:00
Michael Stapelberg 52f96e78f2 Lock the password buffer in memory, clear it in RAM after verifying 2012-01-03 18:06:59 +00:00
Michael Stapelberg 2dd03ce7db support ISO_Level5_Shift (Thanks roland) 2011-12-30 03:13:24 +01:00
Michael Stapelberg 7fdda76a51 Fix the timeouts for hiding the unlock indicator (Thanks Merovius) 2011-12-29 02:56:28 +01:00
Michael Stapelberg 1b757b2aa9 Properly free X11 resources (fixes DoS bug) (Thanks Merovius) 2011-12-28 23:05:02 +01:00
Michael Stapelberg f216517bb0 Implement a visual unlock indicator 2011-12-28 20:28:18 +01:00
Michael Stapelberg 8e3c506c90 Properly implement -h (fixes error message about unknown option) 2011-11-06 14:11:20 +00:00
Michael Stapelberg 409025c7cc Get rid of superfluous \n in --version 2011-11-06 14:08:33 +00:00
Michael Stapelberg 28fe00c765 Bugfix: Properly detect the release of ISO_Level3_Shift (Thanks bacardi55) 2011-10-30 13:22:50 +00:00
Michael Stapelberg 9f6ef91337 Introduce --debug and some debugging options related to the Mode_switch / ISO_Level3_Shift thing 2011-10-29 23:28:11 +01:00
Michael Stapelberg 8e153411b5 Correctly handle Mode_switch/ISO_Level3_Shift (Thanks bacardi55)
I tested this with the following experiment:
$ setxkbmap 'us(intl)'
$ xmodmap ~/configfiles/midna/Xmodmap
$ xmodmap -e 'keycode 38 = a A adiaeresis Adiaeresis o O'
$ xmodmap -e 'keycode 49 = ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift'
Then, Mode_switch + a yields ä, but ` + a yields o.

In i3lock, these were swapped (Mode_switch + a yielded o, while ä was not
reachable at all). The comment in the code explains it

(See http://code.stapelberg.de/git/configfiles for the Xmodmap)
2011-10-29 23:23:41 +01:00
Michael Stapelberg a803ba931e Bugfix: Don’t re-grab pointer/keyboard on MappingNotify (Thanks wilmer)
This fixes bug http://bugs.i3wm.org/545, where characters (of your password)
would rarely slip through when entering your password (especially) after
resuming your notebook from suspend to RAM.

The reason is that when resuming, X triggers one or more MappingNotify events.
At the same time, CPU load is high. This leads to a race-condition between the
ungrab and re-grab in which i3lock temporarily does not grab the keyboard.

One way to fix this is using xcb_grab_server() before and xcb_ungrab_server()
after the ungrab/re-grab. However, I think we actually don’t need to
ungrab/re-grab at all. I seem to have put that code in here by mistake – in i3,
we re-grab after MappingNotify, but there we only grab specific keys. In
i3lock, we grab the whole pointer/keyboard, so there should be no need.

If I’m incorrect and this breaks some subtle use-cases for people with strange
layout setup, at least we can properly document on why we need it, after we put
it back in ;).
2011-10-24 21:23:33 +01:00
Michael Stapelberg 5932ee24a7 Throw an error when specifying an invalid pointer argument (-p) (Thanks TrickSTer) 2011-09-25 13:26:51 +01:00
Thorsten Töpper c81f8e8284 Fixed handle_screen_resize to build with NOLIBCAIRO enabled 2011-08-24 01:26:45 +02:00
Stefan Breunig c8eecefe83 handle screen resolution images and redraw the lock window 2011-08-17 15:46:52 +02:00
Michael Stapelberg e03e93fd1b optimization: render to pixmap which is used as background for the window
Before this commit, the background color (white by default) was visible for
about 100ms until the image was drawn. This flickering is now eliminated.

Also, we don’t need to handle Expose-events anymore, as X11 will use the
window’s background pixmap automatically.
2011-04-02 19:49:38 +02:00
Michael Stapelberg e7201e2df5 Mark handle_visibility_notify and handle_mapping_notify as static 2011-04-02 19:32:59 +02:00
Michael Stapelberg 6b0ce0d5aa cleanup indention left-overs 2011-03-13 20:24:25 +01:00
Michael Stapelberg 7128f80020 bump copyright 2011-03-13 20:23:39 +01:00
Michael Stapelberg c14cb4a250 Handle MappingNotify-events (Thanks Pascal) 2011-03-13 19:31:08 +01:00
Michael Stapelberg 53987df490 Bugfix: correctly check for errors when connecting to X11 2011-01-15 14:47:06 +01:00
Michael Stapelberg 7ba6f07322 add XK_KP_Enter as synonym for XK_Return 2010-11-09 19:35:16 +01:00
Michael Stapelberg f891929d34 Bugfix: Handle numpad keys correctly (Thanks Pascal) 2010-11-08 14:43:07 +01:00
Michael Stapelberg 3a22727bff Bugfix: When entering 512 characters, you could use neither return nor backspace (Thanks carl) 2010-11-06 18:02:44 +01:00
Michael Stapelberg c3affb1c61 Add a hint to the error message 'unknown option' when compiled with NOLIBCAIRO 2010-10-06 23:39:18 +02:00
Thorsten Töpper c643bb8e2f Make it possible to build i3lock without cairo. 2010-10-06 23:37:31 +02:00
Michael Stapelberg bdf6c6b45d comment out debug output (Thanks Ciprian) 2010-09-09 15:39:27 +02:00
Michael Stapelberg efde6a170d print version number when invoked with -v 2010-07-23 23:13:41 +02:00
Michael Stapelberg 3f168a54ce Re-implement tiling of image (-t) 2010-07-20 23:44:58 +02:00
Michael Stapelberg c1a34e7aa5 Fix compilation warning by including cairo-xcb 2010-07-20 23:09:09 +02:00
Axel Wagner 0c4b4df75e Port the pointer-code to xcb 2010-07-20 22:56:47 +02:00
Michael Stapelberg 89434b4a88 disable debug output which reveals the password
(full debug output will be disabled for the next release)
2010-07-20 21:18:53 +02:00
Michael Stapelberg 4e5c203cd9 Raise the i3lock window upon visibility notifies 2010-07-20 20:30:44 +02:00