+1999-10-19 Kenichi OKADA <okada@opaopa.org>
+
+ * sasl.el: New file.
+ * smtp.el: (smtp-via-smtp): Use sasl.el for SASL.
+ * FLIM-ELS (flim-modules): Add `sasl'.
+
1999-08-17 MORIOKA Tomohiko <tomo@m17n.org>
* FLIM: Version 1.13.2 (Kasanui) released.
1999-08-03 Yuuichi Teranishi <teranisi@gohome.org>
-
+
* smtp.el (smtp-notify-success): New option.
* (smtp-via-smtp): Request return receipt (defined in RFC1891) to
SMTP server if `smtp-notify-success' is non-nil.
\f
1999-05-31 MORIOKA Tomohiko <tomo@m17n.org>
- * FLIM: Version 1.12.7 (Y\e-Dþzaki)\e-A released.
+ * FLIM: Version 1.12.7 (Y\e-D\ e~\ fzaki) released.
1999-05-31 MORIOKA Tomohiko <tomo@m17n.org>
\f
1999-05-11 MORIOKA Tomohiko <tomo@m17n.org>
- * FLIM: Version 1.12.6 (Family-K\e-Dòenmae)\e-A released.
+ * FLIM: Version 1.12.6 (Family-K\e-D\ er\ fenmae) released.
1999-04-27 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
1999-03-01 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* mel.el (mime-decode-string): Return STRING if return value of
- `(mel-find-function 'mime-decode-string encoding)' is nil.
+ `(mel-find-function 'mime-decode-string encoding)' is nil.
1999-02-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1999-01-23 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.12.3 (Kintetsu-K\e-Dòriyama)\e-A released.
+ * FLIM: Version 1.12.3 (Kintetsu-K\e-D\ er\ friyama) released.
1999-01-23 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1999-01-21 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.12.2 (Kuj\e-Dò)\e-A released.
+ * FLIM: Version 1.12.2 (Kuj\e-D\ er\ f) released.
1999-01-16 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-12-02 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.12.1 (Nishinoky\e-Dò)\e-A released.
+ * FLIM: Version 1.12.1 (Nishinoky\e-D\ er\ f) released.
1998-11-30 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-10-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.11.2 (Heij\e-Dò)\e-A was released.
+ * FLIM: Version 1.11.2 (Heij\e-D\ er\ f) was released.
* NEWS (Abolish variable `mime-temp-directory'): New subsection.
\f
1998-10-12 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.10.4 (Shin-H\e-Dòsono)\e-A was released.
+ * FLIM: Version 1.10.4 (Shin-H\e-D\ er\ fsono) was released.
1998-10-12 Katsumi Yamaoka <yamaoka@jpl.org>
\f
1998-09-29 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.10.0 (K\e-Dòdo)\e-A was released.
+ * FLIM: Version 1.10.0 (K\e-D\ er\ fdo) was released.
* README.en (What's FLIM): Add mel-ccl.el.
\f
1998-08-31 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.9.1 (Tonosh\e-Dò)\e-A was released.
+ * FLIM: Version 1.9.1 (Tonosh\e-D\ er\ f) was released.
* mime-en.sgml (mm-backend): Translate a little.
1998-08-28 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* eword-encode.el (eword-encode-field): Use `capitalize' instead
- of `downcase' for `field-name'.
+ of `downcase' for `field-name'.
* eword-encode.el (eword-encode-structured-field-body): New
- function.
+ function.
(eword-encode-field): Use `eword-encode-structured-field-body' for
- "MIME-Version" and "User-Agent" field.
+ "MIME-Version" and "User-Agent" field.
1998-08-26 Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
* eword-encode.el (eword-encode-address-list): New function.
(eword-encode-field): Use `eword-encode-address-list' instead of
- `tm-eword::encode-address-list'; abolish
- `tm-eword::encode-address-list'.
+ `tm-eword::encode-address-list'; abolish
+ `tm-eword::encode-address-list'.
* eword-encode.el (eword-encode-field): Use `eword-encode-string'
- instead of `tm-eword::encode-string'; abolish
- `tm-eword::encode-string'.
+ instead of `tm-eword::encode-string'; abolish
+ `tm-eword::encode-string'.
* eword-encode.el: Rename `tm-eword::make-rword' ->
- `make-ew-rword'; rename `tm-eword::rword-' -> `ew-rword-'.
+ `make-ew-rword'; rename `tm-eword::rword-' -> `ew-rword-'.
1998-08-26 Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
\f
1998-07-07 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM-Chao: Version 1.8.0 (Shij\e-Dò)\e-A was released.
+ * FLIM-Chao: Version 1.8.0 (Shij\e-D\ er\ f) was released.
1998-07-07 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-07-01 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.8.0 (\e-DÒkubo)\e-A was released.
+ * FLIM: Version 1.8.0 (\e-D\ eR\ fkubo) was released.
* README.en: Delete `How to use'.
\f
1998-06-28 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM-Chao: Version 1.7.0 (Goj\e-Dò)\e-A was released.
+ * FLIM-Chao: Version 1.7.0 (Goj\e-D\ er\ f) was released.
1998-06-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-06-19 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.4.1 (Momoyama-Gory\e-Dòmae)\e-A was released.
+ * FLIM: Version 1.4.1 (Momoyama-Gory\e-D\ er\ fmae) was released.
1998-06-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-05-06 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.2.0 (J\e-Dþjò)\e-A was released.
+ * FLIM: Version 1.2.0 (J\e-D\ e~\ fj\ er\ f) was released.
* README.en (What's FLIM): Delete description about
- std11-parse.el; add description about mailcap.el.
+ std11-parse.el; add description about mailcap.el.
1998-05-06 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-05-05 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.1.0 (T\e-Dòji)\e-A was released.
+ * FLIM: Version 1.1.0 (T\e-D\ er\ fji) was released.
1998-05-04 MORIOKA Tomohiko <morioka@jaist.ac.jp>
\f
1998-04-17 MORIOKA Tomohiko <morioka@jaist.ac.jp>
- * FLIM: Version 1.0.1 (Ky\e-Dòto)\e-A was released.
+ * FLIM: Version 1.0.1 (Ky\e-D\ er\ fto) was released.
* mime-def.el (mime-spadework-module-version-string): New
- constant.
+ constant.
* eword-encode.el: Abolish constant 'eword-encode-version.
* Makefile: New file.
* mime-def.el, std11-parse.el, std11.el, eword-decode.el,
- eword-encode.el: Copied from MEL, SEMI (mime-def.el
- eword-decode.el eword-encode.el) and APEL (std11-parse.el
- std11.el).
+ eword-encode.el: Copied from MEL, SEMI (mime-def.el
+ eword-decode.el eword-encode.el) and APEL (std11-parse.el
+ std11.el).
--- /dev/null
+;;; sasl.el --- basic functions for SASL
+
+;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+
+;; Author: Kenichi OKADA <okada@opaopa.org>
+;; Keywords: SMTP,
+
+;; This file is part of FLIM (Faithful Library about Internet Message).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'hmac-md5)
+(require 'hmac-util)
+
+(defun cram-md5-encode (user passphrase response)
+ (concat user " "
+ (hmac-hex-string
+ (hmac-md5 response passphrase))))
+
+(defun plain-encode (authorid authenid passphrase)
+ (concat authorid "\0" authenid "\0" passphrase))
+
+(provide 'sasl)
+
+;;; smtp.el ends here
;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
;; Simon Leinen <simon@switch.ch> (ESMTP support)
;; Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+;; Kenichi OKADA <okada@opaopa.org> (SASL support)
;; Keywords: SMTP, mail
;; This file is part of FLIM (Faithful Library about Internet Message).
(require 'poem)
(require 'pcustom)
(require 'mail-utils) ; mail-strip-quoted-names
+(require 'sasl)
(eval-when-compile (require 'cl)) ; push
(t
(error "Cannot generate valid FQDN. Set `smtp-local-domain' correctly.")))))
-(defun smtp-via-smtp (sender recipients smtp-text-buffer)
+(defun smtp-via-smtp (sender recipients smtp-text-buffer
+ &optional auth user passphrase)
(let ((server (if (functionp smtp-server)
(funcall smtp-server sender recipients)
smtp-server))
(not (integerp (car response)))
(>= (car response) 400))
(throw 'done (car (cdr response)))))
- (let ((extension-lines (cdr (cdr response))))
+ (let ((extension-lines (cdr (cdr response)))
+ extension)
(while extension-lines
- (push (intern (downcase (substring (car extension-lines) 4)))
- extensions)
+ (if (string-match
+ "^auth "
+ (setq extension
+ (downcase (substring (car extension-lines) 4))))
+ (while (string-match "\\([^ ]+\\)" extension (match-end 1))
+ (push (intern (match-string 1 extension)) extensions))
+ (push (intern extension) extensions))
(setq extension-lines (cdr extension-lines)))))
+ ;; AUTH --- SMTP Service Extension for Authentication (RFC2554)
+ (when auth
+ (if (null (memq (intern auth) extensions))
+ (throw 'done
+ (concat "AUTH mechanism " auth " not available")))
+
+ (cond ((string= "cram-md5" auth)
+ (smtp-send-command process "AUTH CRAM-MD5")
+ (setq response (smtp-read-response process))
+ (if (or (null (car response))
+ (not (integerp (car response)))
+ (>= (car response) 400))
+ (throw 'done (car (cdr response))))
+ (smtp-send-command
+ process
+ (base64-encode-string
+ (cram-md5-encode
+ user passphrase
+ (base64-decode-string
+ (substring (car (cdr response)) 4)))))
+ (setq response (smtp-read-response process))
+ (if (or (null (car response))
+ (not (integerp (car response)))
+ (>= (car response) 400))
+ (throw 'done (car (cdr response)))))
+
+ ((string= "plain" auth)
+ (smtp-send-command
+ process
+ (concat "AUTH PLAIN "
+ (base64-encode-string
+ (plain-encode "" user passphrase))))
+ (setq response (smtp-read-response process))
+ (if (or (null (car response))
+ (not (integerp (car response)))
+ (>= (car response) 400))
+ (throw 'done (car (cdr response)))))
+
+ ((string= "login" auth)
+ (smtp-send-command
+ process
+ (concat "AUTH LOGIN " user))
+ (setq response (smtp-read-response process))
+ (if (or (null (car response))
+ (not (integerp (car response)))
+ (>= (car response) 400))
+ (throw 'done (car (cdr response))))
+ (smtp-send-command
+ process
+ (base64-encode-string passphrase))
+ (setq response (smtp-read-response process))
+ (if (or (null (car response))
+ (not (integerp (car response)))
+ (>= (car response) 400))
+ (throw 'done (car (cdr response)))))
+
+ (t
+ (throw 'done (concat "AUTH " auth " not supported")))))
+
;; ONEX --- One message transaction only (sendmail extension?)
(if (or (memq 'onex extensions)
(memq 'xone extensions))