[gdm/multi-stack: 49/49] Add lame check for smart card daemon



commit 8144b99a3ab9511d85ff6169ca9612c350010612
Author: Ray Strode <rstrode redhat com>
Date:   Thu Oct 29 00:46:34 2009 -0400

    Add lame check for smart card daemon
    
    We don't want to show the smart card bits if the daemon isn't running
    
    This is just a temporary hack.  We need a better solution.

 .../plugins/smartcard/gdm-smartcard-extension.c    |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c b/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
index 9967d5f..903e18d 100644
--- a/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
+++ b/gui/simple-greeter/plugins/smartcard/gdm-smartcard-extension.c
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -312,7 +313,22 @@ gdm_smartcard_extension_is_choosable (GdmTask *task)
 gboolean
 gdm_smartcard_extension_is_visible (GdmTask *task)
 {
-        return TRUE;
+        char *contents;
+        pid_t pid;
+
+        if (g_file_get_contents ("/var/run/pcscd.pid",
+                                 &contents, NULL, NULL) == FALSE) {
+                return FALSE;
+        }
+
+        pid = (pid_t) atoi (contents);
+        g_free (contents);
+
+        if (pid == 0) {
+                return FALSE;
+        }
+
+        return kill (pid, 0);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]