slock.git
8 years agoMove screen unlocking inside cleanup()
Quentin Rameau [Thu, 1 Sep 2016 11:47:05 +0000 (13:47 +0200)]
Move screen unlocking inside cleanup()

8 years agoRe-introduce the waiting loop for input grabbing
Quentin Rameau [Thu, 1 Sep 2016 11:46:51 +0000 (13:46 +0200)]
Re-introduce the waiting loop for input grabbing

We actually “need” to wait a little for input to be released before
locking for cases where slock is spawned from other graphical
applications using keybindings.
This undoes the misbehaviour I introduced in c2f9757, sorry for the mess.

8 years agoAdd cleanup() to do free(locks) + XCloseDisplay()
Quentin Rameau [Thu, 1 Sep 2016 11:46:19 +0000 (13:46 +0200)]
Add cleanup() to do free(locks) + XCloseDisplay()

8 years agoRefactor dontkillme()
FRIGN [Mon, 22 Aug 2016 23:45:46 +0000 (01:45 +0200)]
Refactor dontkillme()

- Use file pointers instead of raw I/O, inspired by Kernel code.
- Use OOM_SCORE_ADJ_MIN from linux/oom.h instead of working with
  magic values.
- Stricter error checking and descriptive error messages.

The reasoning for using the constant rather than magic values lies
in the fact that this ensures people get the message.
With "-1000", a code reviewer would question if that is really the
lowest possible number or just an arbitrary value.
The kernel ABI probably won't change, but even in the case, we wouldn't
have to modify the code. The OOM killer only is guaranteed to not
kill you if you have OOM_SCORE_ADJ_MIN.

8 years agoConvert manpage to mandoc and fix usage
FRIGN [Tue, 23 Aug 2016 08:55:34 +0000 (10:55 +0200)]
Convert manpage to mandoc and fix usage

In all honor, the previous usage was formally more correct, but for the
sake of consistency across all the tools having the v-flag, I separated
it from the command-string.

Also, make use of the mandoc macros for the manpage. This makes it
easier to maintain, extend and change in the future.

8 years agofix CVE-2016-6866
Markus Teich [Tue, 30 Aug 2016 22:59:06 +0000 (00:59 +0200)]
fix CVE-2016-6866

8 years agoUpdate bsd-auth string.
Markus Teich [Tue, 30 Aug 2016 22:56:13 +0000 (00:56 +0200)]
Update bsd-auth string.

Thanks to Hiltjo for discovering this.

8 years agoExit as soon as possible on input grabbing error
Quentin Rameau [Tue, 30 Aug 2016 15:33:09 +0000 (17:33 +0200)]
Exit as soon as possible on input grabbing error

We want to know at once if slock failed or not to lock the screen, not
seing a black screen for a whole second (or two) and then die.
Thanks to ^7heo for reporting this.

8 years agoRefactor main()
FRIGN [Sun, 21 Aug 2016 22:25:21 +0000 (00:25 +0200)]
Refactor main()

- Add arg.h and fix usage
Given slock is suid we don't want to have half-measures in place to
parse the arguments in case the code is changed in the future with
somebody not paying enough attention.

Also, fix the usage string output to be more consistent across the
suckless toolbase and make it reflect the manpage entry.

- Comments
Use proper block comments and add/change them where necessary
to help in studying the code.

- Error messages
Consistently prepend them with "slock:" and fix wording and
do a proper cleanup before quitting (XCloseDisplay and free
the locks), making the die() semantics consistent with st's.

- getpwuid() error reporting
Properly present an error message if getpwuid() fails.

- fork() error reporting
Properly present an error message if fork() fails. If we cannot
close the connection within the fork context we abort the
operation and report an error.

- execvp() error handling
If execvp fails, we cannot call die() afterwards as this implies
calling exit(). We must use _exit() to prevent the libc from
doing now "illegal" cleanup-work.

8 years agoclear passwords with explicit_bzero
Hiltjo Posthuma [Sun, 31 Jul 2016 11:43:00 +0000 (13:43 +0200)]
clear passwords with explicit_bzero

Make sure to explicitly clear memory that is used for password input. memset
is often optimized out by the compiler.

Brought to attention by the OpenBSD community, see:
https://marc.info/?t=146989502600003&r=1&w=2
Thread subject: x11/slock: clear passwords with explicit_bzero

Changes:

- explicit_bzero.c import from libressl-portable.
- Makefile: add COMPATSRC for compatibility src.
- config.mk: add separate *BSD section in config.mk to simply uncomment it on
  these platforms.

8 years agoRevert "No need for usage()"
Markus Teich [Mon, 15 Feb 2016 13:15:45 +0000 (14:15 +0100)]
Revert "No need for usage()"

This reverts most of commit a6dc051e3744ce5b14c54d2d246d3e8258207e76 and fixes
some related stuff:

- keep spelling fixes from original commit
- make -h and -v also work when followed by more arguments
- any unknown flag prints usage
- fix output of -v to display "slock: version 1.3" instead of "slock: slock-1.3"

8 years agorevert using argv0 and minor fixup
Markus Teich [Mon, 15 Feb 2016 13:00:56 +0000 (14:00 +0100)]
revert using argv0 and minor fixup

- use hardcoded "slock" instead of argv[0]
- add "slock: " to fprintf calls, where it was missing
- revert `argc--, argv++` shifting

8 years agoUse argv0 instead of passing "slock:" to die every time
FRIGN [Sun, 14 Feb 2016 01:13:54 +0000 (02:13 +0100)]
Use argv0 instead of passing "slock:" to die every time

8 years agoNo need for usage()
FRIGN [Sun, 14 Feb 2016 00:48:48 +0000 (01:48 +0100)]
No need for usage()

There are 2 arguments why -v and -h are broken:

1) if you are running off git, -v will show the last stable
           release, effectively making this option useless.
           people running stable versions leave open an attack surface
           this way in case there are vulnerabilities found.
           99% of the people are also using package managers to keep
           their software up to date, instead of running $TOOL -v to
           check how old it is.
        2) -h is a sad excuse for not just looking at the manual page
           (man 1 slock). Given we accept a post_lock_command, we can't
           be as liberal and just intercept certain flags.

I changed the manpage to reflect this change.

8 years agoClarify config.def.h
FRIGN [Sun, 14 Feb 2016 00:32:02 +0000 (01:32 +0100)]
Clarify config.def.h

Clear up the wording a bit and explain what failonclear means.

8 years agoSimplify the oom-taming-function
FRIGN [Sun, 14 Feb 2016 00:28:37 +0000 (01:28 +0100)]
Simplify the oom-taming-function

There really is no need to source a defined variable from a linux
header. The OOM-rank ranges from -1000 to 1000, so we can safely
hardcode -1000, which is a sane thing to do given slock is suid and
we don't want to play around too much here anyway.

On another notice, let's not forget that this still is a shitty
heuristic. The OOM-killer still can kill us (thus I also changed
the wording in the error-message. We do not disable the OOM-killer,
we're just hiding.

8 years agoadd slock.1 man page
Markus Teich [Thu, 11 Feb 2016 15:49:59 +0000 (16:49 +0100)]
add slock.1 man page

8 years agoUpdate license year
FRIGN [Thu, 11 Feb 2016 15:30:52 +0000 (16:30 +0100)]
Update license year

It actually was 2014 and not 2015.

8 years agoDon't forget the E-Mail
FRIGN [Thu, 11 Feb 2016 15:29:26 +0000 (16:29 +0100)]
Don't forget the E-Mail

8 years agoAdd myself to License
FRIGN [Thu, 11 Feb 2016 15:28:41 +0000 (16:28 +0100)]
Add myself to License

forgot that a while ago

8 years agoupdate copyright year in -v output
Markus Teich [Thu, 11 Feb 2016 15:26:12 +0000 (16:26 +0100)]
update copyright year in -v output

8 years agoprepare 1.3 release
Markus Teich [Thu, 11 Feb 2016 15:23:48 +0000 (16:23 +0100)]
prepare 1.3 release

8 years agoremove .hgtags
Markus Teich [Thu, 11 Feb 2016 15:22:34 +0000 (16:22 +0100)]
remove .hgtags

8 years agoadd hint for suid to oom error message
Markus Teich [Fri, 29 Jan 2016 21:11:18 +0000 (22:11 +0100)]
add hint for suid to oom error message

8 years agoerror messages on grab failure
Markus Teich [Mon, 18 Jan 2016 15:49:15 +0000 (16:49 +0100)]
error messages on grab failure

8 years agocode style fix
Markus Teich [Sat, 16 Jan 2016 11:38:36 +0000 (12:38 +0100)]
code style fix

8 years agoadd option to run command after screen is locked
Markus Teich [Sat, 26 Dec 2015 12:13:25 +0000 (13:13 +0100)]
add option to run command after screen is locked

9 years agoDon't change to failure colour on success
David Phillips [Thu, 27 Aug 2015 04:16:25 +0000 (06:16 +0200)]
Don't change to failure colour on success

9 years agoSlightly safer OOM killer disablement in linux
David Phillips [Fri, 19 Jun 2015 11:42:15 +0000 (23:42 +1200)]
Slightly safer OOM killer disablement in linux

9 years agorework setting window color
Markus Teich [Fri, 8 May 2015 15:10:15 +0000 (17:10 +0200)]
rework setting window color

9 years agoconsistently use () with sizeof
Markus Teich [Fri, 8 May 2015 14:43:13 +0000 (16:43 +0200)]
consistently use () with sizeof

9 years agoOption to not show failure color on clear
Nick Currier [Wed, 6 May 2015 16:18:50 +0000 (10:18 -0600)]
Option to not show failure color on clear

9 years agoresize lockscreen window after Xrandr resize
Markus Teich [Wed, 25 Feb 2015 22:06:45 +0000 (23:06 +0100)]
resize lockscreen window after Xrandr resize

9 years agoBlank the screen with color 0, add third color for failed logins
David Phillips [Wed, 11 Feb 2015 22:56:35 +0000 (11:56 +1300)]
Blank the screen with color 0, add third color for failed logins

- Adds another color in config.def.h, COLOR_INIT
- Renames the colours from numerical ones to ones with meaningful names;
  COLOR_INPUT for when there is content in the input buffer and COLOR_EMPTY
  for when the input buffer has been cleared (backspaced or a failed attempt).
- Ensures XFreeColors frees the right number of colours. This is now derived
  from the size of `Lock->colors` rather than being an integer literal.
- Makes slock exhibit the behaviour described by Markus

The default colours are the same as the ones slock currently uses, with the
exception of the new color, which I have set to red, as it indicates someone
has either failed an attempt to unlock, or that they have entered input and
erased it all.

9 years agoapplied Dimitris' style patch from Dec'14, with some minor modifications
Anselm R Garbe [Tue, 27 Jan 2015 21:16:52 +0000 (22:16 +0100)]
applied Dimitris' style patch from Dec'14, with some minor modifications

9 years agofixed usage string
Anselm R Garbe [Mon, 22 Dec 2014 10:17:45 +0000 (11:17 +0100)]
fixed usage string

9 years agoapplied sin's patch and prepared new release
Anselm R Garbe [Mon, 22 Dec 2014 10:16:26 +0000 (11:16 +0100)]
applied sin's patch and prepared new release

9 years agoend{pw,sp}ent() can only be called after get{pw,sp}ent()
sin [Fri, 7 Nov 2014 13:20:13 +0000 (13:20 +0000)]
end{pw,sp}ent() can only be called after get{pw,sp}ent()

Calling them unconditionally can result in memory corruption.

10 years agoOnly check errno if getpwuid() fails
sin [Wed, 9 Jul 2014 13:40:49 +0000 (14:40 +0100)]
Only check errno if getpwuid() fails

Checking errno otherwise is unspecified.

10 years agoAdd /etc/passwd support
FRIGN [Tue, 3 Jun 2014 17:19:10 +0000 (19:19 +0200)]
Add /etc/passwd support

Fix slock to work with /etc/passwd without /etc/shadow.
while we're at it, remove an occurence of trailing whitespace.

10 years agoSet errno to 0 before getpwuid() and check it afterwards
sin [Thu, 14 Nov 2013 11:24:08 +0000 (11:24 +0000)]
Set errno to 0 before getpwuid() and check it afterwards

11 years agoapplied Robert Schneider's Linux suggestions, also bumped version and updated LICENSE...
Anselm R Garbe [Fri, 2 Aug 2013 20:11:18 +0000 (22:11 +0200)]
applied Robert Schneider's Linux suggestions, also bumped version and updated LICENSE file's copyright notice

12 years agoprepared 1.1
anselm@garbe.us [Thu, 25 Oct 2012 18:59:50 +0000 (20:59 +0200)]
prepared 1.1

12 years agoapplied andres' multi-slock fix, thanks for spotting this issue
garbeam@gmail.com [Thu, 2 Aug 2012 19:54:18 +0000 (21:54 +0200)]
applied andres' multi-slock fix, thanks for spotting this issue

12 years agoadded Ben's password placeholder entry kludge
anselm@garbe.us [Sun, 15 Apr 2012 09:58:16 +0000 (11:58 +0200)]
added Ben's password placeholder entry kludge

12 years agoapplied Eckehard Bern's dualcolor patch to slock
anselm@garbe.us [Sat, 17 Mar 2012 17:03:25 +0000 (18:03 +0100)]
applied Eckehard Bern's dualcolor patch to slock

12 years agoAdded tag 1.0 for changeset 05b949016e85
anselm@garbe.us [Sat, 11 Feb 2012 09:51:31 +0000 (10:51 +0100)]
Added tag 1.0 for changeset 05b949016e85

12 years agopreparing 1.0
anselm@garbe.us [Sat, 11 Feb 2012 09:51:26 +0000 (10:51 +0100)]
preparing 1.0

12 years agoselect for SubstructureRedirectMask as well
anselm@garbe.us [Thu, 9 Feb 2012 19:56:34 +0000 (20:56 +0100)]
select for SubstructureRedirectMask as well

12 years agofixed missing new lines
anselm@garbe.us [Thu, 9 Feb 2012 19:18:49 +0000 (20:18 +0100)]
fixed missing new lines

12 years agotypo fix
anselm@garbe.us [Sun, 5 Feb 2012 15:41:31 +0000 (16:41 +0100)]
typo fix

12 years agoadded XRaiseWindow workaround when new clients are launched
anselm@garbe.us [Sun, 5 Feb 2012 15:38:58 +0000 (16:38 +0100)]
added XRaiseWindow workaround when new clients are launched

12 years agoapplied Michaels patch
garbeam@gmail.com [Tue, 24 Jan 2012 21:10:02 +0000 (22:10 +0100)]
applied Michaels patch

12 years agoadded dummy error handler to prevent X from terminating slock just in case
anselm@garbe.us [Sun, 22 Jan 2012 17:58:10 +0000 (18:58 +0100)]
added dummy error handler to prevent X from terminating slock just in case

13 years agoapplied Markus' patch to die in case /etc/passwd is unavailable
Anselm R Garbe [Thu, 21 Apr 2011 08:22:47 +0000 (08:22 +0000)]
applied Markus' patch to die in case /etc/passwd is unavailable

14 years agoapplied Fernando Silveira's multiscreen patch for old style multihead setups
Anselm R Garbe [Thu, 26 Nov 2009 12:53:26 +0000 (12:53 +0000)]
applied Fernando Silveira's multiscreen patch for old style multihead setups

15 years agoapplied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence
a@null [Fri, 12 Dec 2008 19:34:43 +0000 (19:34 +0000)]
applied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence

16 years agoAdded tag 0.9 for changeset 1e8a77601cb9
Anselm R Garbe [Tue, 29 Jul 2008 18:23:21 +0000 (19:23 +0100)]
Added tag 0.9 for changeset 1e8a77601cb9

16 years agofix
Anselm R Garbe [Tue, 29 Jul 2008 18:17:24 +0000 (19:17 +0100)]
fix

16 years agoprepared release
Anselm R Garbe [Tue, 29 Jul 2008 18:14:53 +0000 (19:14 +0100)]
prepared release

16 years agoremoved useless chars, prepared release
Anselm R Garbe [Tue, 29 Jul 2008 18:08:18 +0000 (19:08 +0100)]
removed useless chars, prepared release

16 years agos/d//
Anselm R Garbe [Wed, 9 Apr 2008 22:42:50 +0000 (23:42 +0100)]
s/d//

16 years agoyet another DPMS fix, still trying to prevent the error handler
Anselm R Garbe [Wed, 9 Apr 2008 22:42:19 +0000 (23:42 +0100)]
yet another DPMS fix, still trying to prevent the error handler

16 years agofixed DPMS crashing issue
Anselm R Garbe [Tue, 8 Apr 2008 08:55:46 +0000 (09:55 +0100)]
fixed DPMS crashing issue

16 years agoAdded tag 0.8 for changeset c0eb8221ba49
Anselm R Garbe [Thu, 13 Mar 2008 16:59:24 +0000 (16:59 +0000)]
Added tag 0.8 for changeset c0eb8221ba49

16 years agoapplied two patches, BSD_AUTH patch and Gottox' DPMS support patch
Anselm R Garbe [Fri, 22 Feb 2008 10:13:12 +0000 (10:13 +0000)]
applied two patches, BSD_AUTH patch and Gottox' DPMS support patch

16 years agoremoved Sander from -v by request
Anselm R. Garbe [Sun, 25 Nov 2007 11:17:33 +0000 (12:17 +0100)]
removed Sander from -v by request

16 years agonext version will be 0.8
Anselm R. Garbe [Sat, 24 Nov 2007 20:27:44 +0000 (21:27 +0100)]
next version will be 0.8

16 years agoAdded tag 0.7 for changeset c4635bb35a45
Anselm R. Garbe [Sat, 24 Nov 2007 20:18:06 +0000 (21:18 +0100)]
Added tag 0.7 for changeset c4635bb35a45

16 years agofinal fixes and cleanups
Anselm R. Garbe [Sat, 24 Nov 2007 20:17:32 +0000 (21:17 +0100)]
final fixes and cleanups

16 years agoapplied Ryan Sorensen bugfix which allows slock to acquire the keyboard grab asynchro...
arg@suckless.org [Tue, 13 Nov 2007 17:16:18 +0000 (18:16 +0100)]
applied Ryan Sorensen bugfix which allows slock to acquire the keyboard grab asynchroneously

17 years agoupdating copyright stuff in slock as well
Anselm R. Garbe [Fri, 13 Apr 2007 09:48:17 +0000 (11:48 +0200)]
updating copyright stuff in slock as well

17 years agoAdded tag 0.6 for changeset dd226a81c09a
Anselm R. Garbe [Wed, 7 Mar 2007 12:31:49 +0000 (13:31 +0100)]
Added tag 0.6 for changeset dd226a81c09a

17 years agograb on the root window, it is correct, all lockers do that
Anselm R. Garbe [Wed, 7 Mar 2007 09:57:23 +0000 (10:57 +0100)]
grab on the root window, it is correct, all lockers do that

17 years agoAdded tag 0.5 for changeset bd24ea7fcca2
Anselm R. Garbe [Mon, 5 Mar 2007 10:28:53 +0000 (11:28 +0100)]
Added tag 0.5 for changeset bd24ea7fcca2

17 years agograb on the slock window instead on the root window
Anselm R. Garbe [Fri, 2 Mar 2007 20:50:05 +0000 (21:50 +0100)]
grab on the slock window instead on the root window

17 years agomade slock more readable, added root variable because we intend to call RootWindow...
Anselm R. Garbe [Wed, 21 Feb 2007 21:16:23 +0000 (22:16 +0100)]
made slock more readable, added root variable because we intend to call RootWindow(...) quite a lot

17 years agomade slock more aggressive, DenisG please recheck
Anselm R. Garbe [Wed, 21 Feb 2007 20:25:53 +0000 (21:25 +0100)]
made slock more aggressive, DenisG please recheck

17 years agofoobar
Anselm R. Garbe [Thu, 1 Feb 2007 12:52:36 +0000 (13:52 +0100)]
foobar

17 years agoAdded tag 0.4 for changeset 4c2cf4d6a2d0
Anselm R. Garbe [Sat, 13 Jan 2007 13:10:56 +0000 (14:10 +0100)]
Added tag 0.4 for changeset 4c2cf4d6a2d0

17 years agofixed a potential buffer overflow bug on the stack (thanks to Ghassan Misherg)
Anselm R. Garbe [Sat, 13 Jan 2007 13:09:41 +0000 (14:09 +0100)]
fixed a potential buffer overflow bug on the stack (thanks to Ghassan Misherg)

17 years agothanks to Jack for this hint
arg@mig29 [Fri, 8 Dec 2006 09:53:35 +0000 (10:53 +0100)]
thanks to Jack for this hint

17 years agofixed sizeof stuff
arg@mig29 [Sun, 26 Nov 2006 14:50:18 +0000 (15:50 +0100)]
fixed sizeof stuff

18 years agoAdded tag 0.3 for changeset f9157b1864388ad8f1920e5fde7c5849e73d8327
arg@mig29 [Fri, 3 Nov 2006 10:35:48 +0000 (11:35 +0100)]
Added tag 0.3 for changeset f9157b1864388ad8f1920e5fde7c5849e73d8327

18 years agosmall fix of Vincent's patch
arg@mig29 [Tue, 31 Oct 2006 07:43:25 +0000 (08:43 +0100)]
small fix of Vincent's patch

18 years agoapplied Vincent's path with some modifications
arg@mig29 [Tue, 31 Oct 2006 07:35:54 +0000 (08:35 +0100)]
applied Vincent's path with some modifications

18 years agoapplied somwhat similiar patch like Alex Elide proposed
Anselm R. Garbe [Wed, 18 Oct 2006 16:44:19 +0000 (18:44 +0200)]
applied somwhat similiar patch like Alex Elide proposed

18 years agoAdded tag 0.2 for changeset da5cb1f0a685258d5315ea109860bacbc2871a57
Anselm R. Garbe [Mon, 16 Oct 2006 15:06:45 +0000 (17:06 +0200)]
Added tag 0.2 for changeset da5cb1f0a685258d5315ea109860bacbc2871a57

18 years agoadded pointer grab
Anselm R. Garbe [Mon, 16 Oct 2006 10:59:37 +0000 (12:59 +0200)]
added pointer grab

18 years agoAdded tag 0.1 for changeset 0a95c73c7374fbc2342b6040d9f35ddf597729e1
Anselm R. Garbe [Fri, 13 Oct 2006 09:11:17 +0000 (11:11 +0200)]
Added tag 0.1 for changeset 0a95c73c7374fbc2342b6040d9f35ddf597729e1

18 years agoremoved control mask handling for slock (quite useless in my eyes)
Anselm R. Garbe [Thu, 12 Oct 2006 07:44:02 +0000 (09:44 +0200)]
removed control mask handling for slock (quite useless in my eyes)

18 years agoapplied Salmi's patch
Anselm R. Garbe [Thu, 12 Oct 2006 07:33:38 +0000 (09:33 +0200)]
applied Salmi's patch

18 years agoapplied BSD support patch
Anselm R. Garbe [Thu, 12 Oct 2006 06:11:08 +0000 (08:11 +0200)]
applied BSD support patch

18 years agoadding black cursor
Anselm R. Garbe [Wed, 11 Oct 2006 15:04:04 +0000 (17:04 +0200)]
adding black cursor

18 years agoadding a coffee mug cursor
Anselm R. Garbe [Wed, 11 Oct 2006 14:46:55 +0000 (16:46 +0200)]
adding a coffee mug cursor

18 years agoadded black window
Anselm R. Garbe [Wed, 11 Oct 2006 11:33:04 +0000 (13:33 +0200)]
added black window

18 years agoinitial commit
arg@suckless.org [Wed, 11 Oct 2006 10:35:21 +0000 (12:35 +0200)]
initial commit