Mercurial > emacs
annotate lisp/gnus/starttls.el @ 82979:d1399f1fa67e
Changes from arch/CVS synchronization
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 04 Sep 2004 11:37:49 +0000 |
parents | 0fde48feb604 |
children |
rev | line source |
---|---|
34219 | 1 ;;; starttls.el --- STARTTLS functions |
2 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
34219 | 4 |
5 ;; Author: Daiki Ueno <ueno@unixuser.org> | |
6 ;; Created: 1999/11/20 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
7 ;; Keywords: TLS, SSL, OpenSSL, mail, news |
34219 | 8 |
34220 | 9 ;; This file is part of GNU Emacs. |
34219 | 10 |
34220 | 11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
34219 | 15 |
34220 | 16 ;; GNU Emacs is distributed in the hope that it will be useful, |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
34219 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; This module defines some utility functions for STARTTLS profiles. | |
29 | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
30 ;; Get "starttls" from ftp://ftp.opaopa.org/pub/elisp/. |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
31 |
34219 | 32 ;; [RFC 2595] "Using TLS with IMAP, POP3 and ACAP" |
33 ;; by Chris Newman <chris.newman@innosoft.com> (1999/06) | |
34 | |
35 ;;; Code: | |
36 | |
37 (defgroup starttls nil | |
38 "Support for `Transport Layer Security' protocol." | |
34220 | 39 :version "21.1" |
40 :group 'mail) | |
34219 | 41 |
42 (defcustom starttls-program "starttls" | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
43 "The program to run in a subprocess to open an TLSv1 connection." |
34220 | 44 :type 'string |
34219 | 45 :group 'starttls) |
46 | |
47 (defcustom starttls-extra-args nil | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
48 "Extra arguments to `starttls-program'." |
34220 | 49 :type '(repeat string) |
34219 | 50 :group 'starttls) |
51 | |
52 (defun starttls-negotiate (process) | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
53 (signal-process (process-id process) 'SIGALRM)) |
34219 | 54 |
55 (defun starttls-open-stream (name buffer host service) | |
56 "Open a TLS connection for a service to a host. | |
57 Returns a subprocess-object to represent the connection. | |
58 Input and output work as for subprocesses; `delete-process' closes it. | |
59 Args are NAME BUFFER HOST SERVICE. | |
60 NAME is name for process. It is modified if necessary to make it unique. | |
61 BUFFER is the buffer (or `buffer-name') to associate with the process. | |
62 Process output goes at end of that buffer, unless you specify | |
63 an output stream or filter function to handle the output. | |
64 BUFFER may be also nil, meaning that this process is not associated | |
65 with any buffer | |
66 Third arg is name of the host to connect to, or its IP address. | |
67 Fourth arg SERVICE is name of the service desired, or an integer | |
68 specifying a port number to connect to." | |
82951
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
69 (let* ((process-connection-type nil) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
70 (process (apply #'start-process |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
71 name buffer starttls-program |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
72 host (format "%s" service) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
73 starttls-extra-args))) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
74 (process-kill-without-query process) |
0fde48feb604
Import Gnus 5.10 from the v5_10 branch of the Gnus repository.
Andreas Schwab <schwab@suse.de>
parents:
55783
diff
changeset
|
75 process)) |
34219 | 76 |
77 (provide 'starttls) | |
78 | |
52401 | 79 ;;; arch-tag: 648b3bd8-63bd-47f5-904c-7c819aea2297 |
34219 | 80 ;;; starttls.el ends here |