* Makefile.am (starttls_SOURCES): Add gnutls.c if USE_GNUTLS
[elisp/starttls.git] / starttls.el
index f2726ca..b2def02 100644 (file)
@@ -1,4 +1,4 @@
-;;; starttls.el --- TLSv1 functions
+;;; starttls.el --- STARTTLS functions
 
 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
 
 ;;; Commentary:
 
-;; This module defines some utility functions for TLSv1 functions.
-
-;; [RFC 2246] "The TLS Protocol Version 1.0"
-;;     by Christopher Allen <callen@certicom.com> and 
-;;     Tim Dierks <tdierks@certicom.com> (1999/01)
+;; This module defines some utility functions for STARTTLS profiles.
 
 ;; [RFC 2595] "Using TLS with IMAP, POP3 and ACAP"
 ;;     by Chris Newman <chris.newman@innosoft.com> (1999/06)
   "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.
@@ -65,7 +72,6 @@ BUFFER is the buffer (or `buffer-name') to associate with the process.
 Third arg is name of the host to connect to, or its IP address.
 Fourth arg SERVICE is name of the service desired, or an integer
 specifying a port number to connect to."
-
   (let* ((process-connection-type nil)
         (process (apply #'start-process
                         name buffer starttls-program