Discussion:
[Thinkfinger-devel] slock and fingerprint
pancake
2007-01-28 23:48:46 UTC
Permalink
I've written a small patch for slock for those who want to unlock
the X windows using a fingerprint device.

It's using thinkfinger.sf.net driver and utilities.

$ hg clone http://suckless.org/cgi-bin/hgwebdir.cgi/slock

You'll need to install lt-tf-tool tf-init elf binaries (.libs/*)
with 4755 perms on /usr/bin, and create an rc script for initializing
the fingerprint device on boot time.

Enjoy.

--pancake

pancake@~/prg/slock$ hg diff
diff -r 03007b1332bc slock.c
--- a/slock.c Sat Jan 13 14:10:56 2007 +0100
+++ b/slock.c Mon Jan 29 00:41:51 2007 +0100
@@ -6,6 +6,7 @@
#include <shadow.h>
#endif

+#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <stdlib.h>
@@ -62,11 +63,19 @@ main(int argc, char **argv) {
XColor black, dummy;
XEvent ev;
XSetWindowAttributes wa;
+ pid_t pid;

if((argc > 1) && !strncmp(argv[1], "-v", 3)) {
fputs("slock-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS);
}
+
+ if (!(pid=fork())) {
+ setuid(geteuid());
+ system("while : ; do lt-tf-tool --no-init --verify && pkill slock && break ; sleep 1; done");
+ exit(1);
+ }
+
pws = get_password();
if(!(dpy = XOpenDisplay(0))) {
fputs("slock: cannot open display\n", stderr);
@@ -133,5 +142,6 @@ main(int argc, char **argv) {
XFreePixmap(dpy, pmap);
XDestroyWindow(dpy, w);
XCloseDisplay(dpy);
+ kill(pid,SIGKILL);
return 0;
}
Timo Hoenig
2007-01-29 08:49:53 UTC
Permalink
Hi,
Post by pancake
I've written a small patch for slock for those who want to unlock
the X windows using a fingerprint device.
I'm not using slock, but I have some comments on the patch anyway ;-)
Post by pancake
diff -r 03007b1332bc slock.c
--- a/slock.c Sat Jan 13 14:10:56 2007 +0100
+++ b/slock.c Mon Jan 29 00:41:51 2007 +0100
@@ -6,6 +6,7 @@
#include <shadow.h>
#endif
+#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <stdlib.h>
@@ -62,11 +63,19 @@ main(int argc, char **argv) {
XColor black, dummy;
XEvent ev;
XSetWindowAttributes wa;
+ pid_t pid;
if((argc > 1) && !strncmp(argv[1], "-v", 3)) {
fputs("slock-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS);
}
+
+ if (!(pid=fork())) {
+ setuid(geteuid());
+ system("while : ; do lt-tf-tool --no-init --verify && pkill slock && break ; sleep 1; done");
+ exit(1);
+ }
+
Uh, this is ugly. Please do not try to get this upstream. Please use
an similar approach as it is done by the PAM module. Do not use
system() with tf-tool. That's why libthinkfinger exists.

Also, the above approach will only work for a single user.

Please get in touch with the slock developers for a proper integration.
Best would be a proper integration of PAM.

Thanks,

Timo

Loading...