annotate lisp/gnus/starttls.el @ 46112:4918c64cf502

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Mon, 01 Jul 2002 08:07:40 +0000
parents 3984e8b6d0c5
children 695cf19ef79e d7ddb3e565de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
1 ;;; starttls.el --- STARTTLS functions
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
2
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
4
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
5 ;; Author: Daiki Ueno <ueno@unixuser.org>
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
6 ;; Created: 1999/11/20
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
7 ;; Keywords: TLS, SSL, OpenSSL, mail, news
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
8
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
9 ;; This file is part of GNU Emacs.
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
10
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
14 ;; any later version.
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
15
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
19 ;; GNU General Public License for more details.
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
20
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
25
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
27
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
28 ;; This module defines some utility functions for STARTTLS profiles.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
29
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
30 ;; [RFC 2595] "Using TLS with IMAP, POP3 and ACAP"
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
31 ;; by Chris Newman <chris.newman@innosoft.com> (1999/06)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
32
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
33 ;;; Code:
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
34
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
35 (defgroup starttls nil
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
36 "Support for `Transport Layer Security' protocol."
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
37 :version "21.1"
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
38 :group 'mail)
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
39
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
40 (defcustom starttls-program "starttls"
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
41 "The program to run in a subprocess to open an TLSv1 connection."
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
42 :type 'string
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
43 :group 'starttls)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
44
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
45 (defcustom starttls-extra-args nil
34220
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
46 "Extra arguments to `starttls-program'."
3984e8b6d0c5 Fix header and customization.
Dave Love <fx@gnu.org>
parents: 34219
diff changeset
47 :type '(repeat string)
34219
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
48 :group 'starttls)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
49
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
50 (defun starttls-negotiate (process)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
51 (signal-process (process-id process) 'SIGALRM))
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
52
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
53 (defun starttls-open-stream (name buffer host service)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
54 "Open a TLS connection for a service to a host.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
55 Returns a subprocess-object to represent the connection.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
56 Input and output work as for subprocesses; `delete-process' closes it.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
57 Args are NAME BUFFER HOST SERVICE.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
58 NAME is name for process. It is modified if necessary to make it unique.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
59 BUFFER is the buffer (or `buffer-name') to associate with the process.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
60 Process output goes at end of that buffer, unless you specify
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
61 an output stream or filter function to handle the output.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
62 BUFFER may be also nil, meaning that this process is not associated
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
63 with any buffer
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
64 Third arg is name of the host to connect to, or its IP address.
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
65 Fourth arg SERVICE is name of the service desired, or an integer
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
66 specifying a port number to connect to."
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
67 (let* ((process-connection-type nil)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
68 (process (apply #'start-process
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
69 name buffer starttls-program
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
70 host (format "%s" service)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
71 starttls-extra-args)))
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
72 (process-kill-without-query process)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
73 process))
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
74
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
75 (provide 'starttls)
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
76
d940776a9d6d *** empty log message ***
Dave Love <fx@gnu.org>
parents:
diff changeset
77 ;;; starttls.el ends here