From f8fe2a3fb1fcaa1c2ea92cb5d9394df73da36131 Mon Sep 17 00:00:00 2001 From: okada Date: Thu, 18 Nov 1999 17:12:24 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 68 ++++++++++++++++++++++++++++------------------------ FLIM-ELS | 2 +- Makefile | 2 +- mime-def.el | 2 +- sasl.el | 40 +++++++++++++++++++++++++++++++ smtp.el | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 152 insertions(+), 38 deletions(-) create mode 100644 sasl.el diff --git a/ChangeLog b/ChangeLog index a451c90..8f86d0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,15 @@ +1999-10-19 Kenichi OKADA + + * 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 * FLIM: Version 1.13.2 (Kasanui) released. 1999-08-03 Yuuichi Teranishi - + * 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. @@ -377,7 +383,7 @@ 1999-05-31 MORIOKA Tomohiko - * FLIM: Version 1.12.7 (Y-Dþzaki)-A released. + * FLIM: Version 1.12.7 (Y-D~zaki) released. 1999-05-31 MORIOKA Tomohiko @@ -552,7 +558,7 @@ 1999-05-11 MORIOKA Tomohiko - * FLIM: Version 1.12.6 (Family-K-Dòenmae)-A released. + * FLIM: Version 1.12.6 (Family-K-Drenmae) released. 1999-04-27 Shuhei KOBAYASHI @@ -608,7 +614,7 @@ 1999-03-01 MORIOKA Tomohiko * 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 @@ -669,7 +675,7 @@ 1999-01-23 MORIOKA Tomohiko - * FLIM: Version 1.12.3 (Kintetsu-K-Dòriyama)-A released. + * FLIM: Version 1.12.3 (Kintetsu-K-Drriyama) released. 1999-01-23 MORIOKA Tomohiko @@ -712,7 +718,7 @@ 1999-01-21 MORIOKA Tomohiko - * FLIM: Version 1.12.2 (Kuj-Dò)-A released. + * FLIM: Version 1.12.2 (Kuj-Dr) released. 1999-01-16 MORIOKA Tomohiko @@ -898,7 +904,7 @@ 1998-12-02 MORIOKA Tomohiko - * FLIM: Version 1.12.1 (Nishinoky-Dò)-A released. + * FLIM: Version 1.12.1 (Nishinoky-Dr) released. 1998-11-30 MORIOKA Tomohiko @@ -1116,7 +1122,7 @@ 1998-10-26 MORIOKA Tomohiko - * FLIM: Version 1.11.2 (Heij-Dò)-A was released. + * FLIM: Version 1.11.2 (Heij-Dr) was released. * NEWS (Abolish variable `mime-temp-directory'): New subsection. @@ -1396,7 +1402,7 @@ 1998-10-12 MORIOKA Tomohiko - * FLIM: Version 1.10.4 (Shin-H-Dòsono)-A was released. + * FLIM: Version 1.10.4 (Shin-H-Drsono) was released. 1998-10-12 Katsumi Yamaoka @@ -1581,7 +1587,7 @@ 1998-09-29 MORIOKA Tomohiko - * FLIM: Version 1.10.0 (K-Dòdo)-A was released. + * FLIM: Version 1.10.0 (K-Drdo) was released. * README.en (What's FLIM): Add mel-ccl.el. @@ -1868,7 +1874,7 @@ 1998-08-31 MORIOKA Tomohiko - * FLIM: Version 1.9.1 (Tonosh-Dò)-A was released. + * FLIM: Version 1.9.1 (Tonosh-Dr) was released. * mime-en.sgml (mm-backend): Translate a little. @@ -1929,12 +1935,12 @@ 1998-08-28 MORIOKA Tomohiko * 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 @@ -1944,15 +1950,15 @@ * 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 @@ -2011,7 +2017,7 @@ 1998-07-07 MORIOKA Tomohiko - * FLIM-Chao: Version 1.8.0 (Shij-Dò)-A was released. + * FLIM-Chao: Version 1.8.0 (Shij-Dr) was released. 1998-07-07 MORIOKA Tomohiko @@ -2123,7 +2129,7 @@ 1998-07-01 MORIOKA Tomohiko - * FLIM: Version 1.8.0 (-DÒkubo)-A was released. + * FLIM: Version 1.8.0 (-DRkubo) was released. * README.en: Delete `How to use'. @@ -2248,7 +2254,7 @@ 1998-06-28 MORIOKA Tomohiko - * FLIM-Chao: Version 1.7.0 (Goj-Dò)-A was released. + * FLIM-Chao: Version 1.7.0 (Goj-Dr) was released. 1998-06-26 MORIOKA Tomohiko @@ -2507,7 +2513,7 @@ 1998-06-19 MORIOKA Tomohiko - * FLIM: Version 1.4.1 (Momoyama-Gory-Dòmae)-A was released. + * FLIM: Version 1.4.1 (Momoyama-Gory-Drmae) was released. 1998-06-18 MORIOKA Tomohiko @@ -2627,10 +2633,10 @@ 1998-05-06 MORIOKA Tomohiko - * FLIM: Version 1.2.0 (J-Dþjò)-A was released. + * FLIM: Version 1.2.0 (J-D~jr) 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 @@ -2678,7 +2684,7 @@ 1998-05-05 MORIOKA Tomohiko - * FLIM: Version 1.1.0 (T-Dòji)-A was released. + * FLIM: Version 1.1.0 (T-Drji) was released. 1998-05-04 MORIOKA Tomohiko @@ -2714,10 +2720,10 @@ 1998-04-17 MORIOKA Tomohiko - * FLIM: Version 1.0.1 (Ky-Dòto)-A was released. + * FLIM: Version 1.0.1 (Ky-Drto) was released. * mime-def.el (mime-spadework-module-version-string): New - constant. + constant. * eword-encode.el: Abolish constant 'eword-encode-version. @@ -2754,6 +2760,6 @@ * 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). diff --git a/FLIM-ELS b/FLIM-ELS index 904ec74..23bc7b9 100644 --- a/FLIM-ELS +++ b/FLIM-ELS @@ -10,7 +10,7 @@ eword-decode eword-encode mime mime-parse mmbuffer mmcooked mmdbuffer mailcap - smtp smtpmail)) + smtp smtpmail sasl)) (unless (and (fboundp 'base64-encode-string) (subrp (symbol-function 'base64-encode-string))) diff --git a/Makefile b/Makefile index 996e16c..6fbc152 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for FLIM. # -PACKAGE = flim +PACKAGE = slim API = 1.13 RELEASE = 2 diff --git a/mime-def.el b/mime-def.el index 276dadd..4253ead 100644 --- a/mime-def.el +++ b/mime-def.el @@ -35,7 +35,7 @@ (eval-when-compile (require 'cl)) ; list* (eval-and-compile - (defconst mime-library-product ["FLIM" (1 13 2) "Kasanui"] + (defconst mime-library-product ["SLIM" (1 13 0) "$BF#865*9a(B"] "Product name, version number and code name of MIME-library package.") ) diff --git a/sasl.el b/sasl.el new file mode 100644 index 0000000..5c2c824 --- /dev/null +++ b/sasl.el @@ -0,0 +1,40 @@ +;;; sasl.el --- basic functions for SASL + +;; Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. + +;; Author: Kenichi OKADA +;; 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 diff --git a/smtp.el b/smtp.el index 532bb14..79e4620 100644 --- a/smtp.el +++ b/smtp.el @@ -5,6 +5,7 @@ ;; Author: Tomoji Kagatani ;; Simon Leinen (ESMTP support) ;; Shuhei KOBAYASHI +;; Kenichi OKADA (SASL support) ;; Keywords: SMTP, mail ;; This file is part of FLIM (Faithful Library about Internet Message). @@ -30,6 +31,7 @@ (require 'poem) (require 'pcustom) (require 'mail-utils) ; mail-strip-quoted-names +(require 'sasl) (eval-when-compile (require 'cl)) ; push @@ -91,7 +93,8 @@ don't define this value." (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)) @@ -135,12 +138,77 @@ don't define this value." (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)) -- 1.7.10.4