* Makefile.am (starttls_SOURCES): Add gnutls.c if USE_GNUTLS
[elisp/starttls.git] / starttls.el
index 1875dcb..b2def02 100644 (file)
   "The program to run in a subprocess to open an TLSv1 connection."
   :group 'starttls)
 
+(defcustom starttls-negotiation-by-kill-program nil
+  "Starting starttls negotiation by kill command if non-nil."
+  :group 'starttls)
+
+(defcustom starttls-kill-program "c:\\cygwin\\bin\kill"
+  "External kill command to send SIGALRM to starttls."
+  :group 'starttls)
+
 (defcustom starttls-extra-args nil
   "Extra arguments to `starttls-program'"
   :group 'starttls)
 
 (defun starttls-negotiate (process)
-  (signal-process (process-id process) 'SIGALRM))
+  (if starttls-negotiation-by-kill-program
+      (call-process starttls-kill-program nil nil nil
+                   "-ALRM" (format "%d" (process-id process)))
+    (signal-process (process-id process) 'SIGALRM)))
 
 (defun starttls-open-stream (name buffer host service)
   "Open a TLS connection for a service to a host.