[dwm] slock and fingerprint

From: pancake <pancake_AT_youterm.com>
Date: Mon, 29 Jan 2007 00:45:48 +0100

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.

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;
 }
Received on Mon Jan 29 2007 - 00:45:57 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:35:35 UTC