(signal 'elmo-authenticate-error
'(elmo-pop3-auth-apop))))
(signal 'elmo-open-error '(elmo-pop-auth-user))))
-
-(defun elmo-pop3-auth-cram-md5 (session)
- (let ((process (elmo-network-session-process-internal session))
- response)
- (elmo-pop3-send-command process "auth cram-md5")
- (or (setq response
- (elmo-pop3-read-response process t))
- (signal 'elmo-open-error '(elmo-pop-auth-cram-md5)))
- (elmo-pop3-send-command
- process
- (elmo-base64-encode-string
- (sasl-cram-md5 (elmo-network-session-user-internal session)
- (elmo-get-passwd
- (elmo-network-session-password-key session))
- (elmo-base64-decode-string
- (cadr (split-string response " "))))))
- (or (elmo-pop3-read-response process t)
- (signal 'elmo-authenticate-error
- '(elmo-pop-auth-cram-md5)))))
-
-(defun elmo-pop3-auth-scram-md5 (session)
- (let ((process (elmo-network-session-process-internal session))
- server-msg-1 server-msg-2 client-msg-1 client-msg-2
- salted-pass response)
- (elmo-pop3-send-command
- process
- (format "auth scram-md5 %s"
- (elmo-base64-encode-string
- (setq client-msg-1
- (sasl-scram-md5-client-msg-1
- (elmo-network-session-user-internal session))))))
- (or (elmo-pop3-read-response process t)
- (signal 'elmo-open-error '(elmo-pop-auth-scram-md5)))
- (setq server-msg-1
- (elmo-base64-decode-string (cadr (split-string response " "))))
- (elmo-pop3-send-command
- process
- (elmo-base64-encode-string
- (sasl-scram-md5-client-msg-2
- server-msg-1
- client-msg-1
- (setq salted-pass
- (sasl-scram-md5-make-salted-pass
- server-msg-1
- (elmo-get-passwd
- (elmo-network-session-password-key session)))))))
- (or (setq response (elmo-pop3-read-response process t))
- (signal 'elmo-authenticate-error
- '(elmo-pop-auth-scram-md5)))
- (setq server-msg-2 (elmo-base64-decode-string
- (cadr (split-string response " "))))
- (or (sasl-scram-md5-authenticate-server server-msg-1
- server-msg-2
- client-msg-1
- salted-pass)
- (signal 'elmo-authenticate-error
- '(elmo-pop-auth-scram-md5)))
- (elmo-pop3-send-command process "")
- (or (setq response (elmo-pop3-read-response process t))
- (signal 'elmo-authenticate-error
- '(elmo-pop-auth-scram-md5)))))
-
-(defun elmo-pop3-auth-digest-md5 (session)
- (let ((process (elmo-network-session-process-internal session))
- response)
- (elmo-pop3-send-command process "auth digest-md5")
- (or (setq response
- (elmo-pop3-read-response process t))
- (signal 'elmo-open-error
- '(elmo-pop-auth-digest-md5)))
- (elmo-pop3-send-command
- process
- (elmo-base64-encode-string
- (sasl-digest-md5-digest-response
- (elmo-base64-decode-string
- (cadr (split-string response " ")))
- (elmo-network-session-user-internal session)
- (elmo-get-passwd
- (elmo-network-session-password-key session))
- "pop"
- (elmo-network-session-host-internal session))
- 'no-line-break))
- (or (elmo-pop3-read-response process t)
- (signal 'elmo-authenticate-error
- '(elmo-pop-auth-digest-md5)))
- (elmo-pop3-send-command process "")
- (or (elmo-pop3-read-response process t)
- (signal 'elmo-open-error
- '(elmo-pop-auth-digest-md5)))))
;;; dirty hack
(defconst sasl-pop3-user-steps