[gdm/multi-stack: 49/50] Add lame check for smart card daemon
- From: Ray Strode <halfline src gnome org>
 
- To: svn-commits-list gnome org
 
- Cc: 
 
- Subject: [gdm/multi-stack: 49/50] Add lame check for smart card daemon
 
- Date: Tue, 26 Jan 2010 22:58:47 +0000 (UTC)
 
commit 9b3eb3f3b79f2169e43138575f33d6f0fefe812d
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]