[csw-devel] SF.net SVN: opencsw:[437] catalog_signatures/bin/pinentry_timeout

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Thu Jul 21 05:12:21 CEST 2011


Revision: 437
          http://opencsw.svn.sourceforge.net/opencsw/?rev=437&view=rev
Author:   bdwalton
Date:     2011-07-21 03:12:20 +0000 (Thu, 21 Jul 2011)

Log Message:
-----------
add a wrapper for pinentry that forces a timeout of 30 seconds

Signed-off-by: Ben Walton <bwalton at opencsw.org>

Added Paths:
-----------
    catalog_signatures/bin/pinentry_timeout

Added: catalog_signatures/bin/pinentry_timeout
===================================================================
--- catalog_signatures/bin/pinentry_timeout	                        (rev 0)
+++ catalog_signatures/bin/pinentry_timeout	2011-07-21 03:12:20 UTC (rev 437)
@@ -0,0 +1,30 @@
+#!/opt/csw/bin/bash
+
+#Time to wait for pinentry before killing it
+export ALARMTIME=30
+
+PARENTPID=$$
+
+exit_timeout() {
+    echo "Timed out.  Killing pinentry."
+    kill -9 $CHILDPID >/dev/null 2>&1
+    reset
+    exit 1
+}
+
+/opt/csw/bin/pinentry-curses &
+CHILDPID=$!
+
+#Prepare to catch SIGALRM, call exit_timeout
+trap exit_timeout SIGALRM
+
+#Sleep in a subprocess, then signal parent with ALRM
+(sleep $ALARMTIME; kill -ALRM $PARENTPID) &
+
+ALARMPID=$!
+
+#Wait for child processes to complete normally
+wait $CHILDPID
+
+#Tidy up the Alarm subprocess
+kill $ALARMPID


Property changes on: catalog_signatures/bin/pinentry_timeout
___________________________________________________________________
Added: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list