Function: imap-gssapi-open
imap-gssapi-open is a byte-compiled function defined in imap.el.gz.
Signature
(imap-gssapi-open NAME BUFFER SERVER PORT)
Source Code
;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-gssapi-open (name buffer server port)
(let ((cmds imap-gssapi-program)
cmd done)
(while (and (not done) (setq cmd (pop cmds)))
(message "Opening GSSAPI IMAP connection with `%s'..." cmd)
(erase-buffer)
(let* ((port (or port imap-default-port))
(coding-system-for-read imap-coding-system-for-read)
(coding-system-for-write imap-coding-system-for-write)
(process-connection-type imap-process-connection-type)
(process (start-process
name buffer shell-file-name shell-command-switch
(format-spec cmd `((?s . ,server)
(?p . ,(number-to-string port))
(?l . ,imap-default-user)))))
response)
(when process
(with-current-buffer buffer
(setq imap-client-eol "\n"
imap-calculate-literal-size-first t)
(while (and (memq (process-status process) '(open run))
(set-buffer buffer) ;; XXX "blue moon" nntp.el bug
(goto-char (point-min))
;; Athena IMTEST can output SSL verify errors
(or (while (looking-at "^verify error:num=")
(forward-line))
t)
(or (while (looking-at "^TLS connection established")
(forward-line))
t)
;; cyrus 1.6.x (13? < x <= 22) queries capabilities
(or (while (looking-at "^C:")
(forward-line))
t)
;; cyrus 1.6 imtest print "S: " before server greeting
(or (not (looking-at "S: "))
(forward-char 3)
t)
;; GNU SASL may print 'Trying ...' first.
(or (not (looking-at "Trying "))
(forward-line)
t)
(not (and (imap-parse-greeting)
;; success in imtest 1.6:
(re-search-forward
(concat "^\\(\\(Authenticat.*\\)\\|\\("
"Client authentication "
"finished.*\\)\\)")
nil t)
(setq response (match-string 1)))))
(accept-process-output process 1)
(sit-for 1))
(imap-log buffer)
(erase-buffer)
(message "GSSAPI IMAP connection: %s" (or response "failed"))
(if (and response (let ((case-fold-search nil))
(not (string-match "failed" response))))
(setq done process)
(if (memq (process-status process) '(open run))
(imap-logout))
(delete-process process)
nil)))))
done))