1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-22 10:26:20 +00:00
emacs/lisp/gnus/gssapi.el

107 lines
3.3 KiB
EmacsLisp
Raw Normal View History

;;; gssapi.el --- GSSAPI/Kerberos 5 interface for Emacs
;; Copyright (C) 2011-2014 Free Software Foundation, Inc.
;; Author: Simon Josefsson <simon@josefsson.org>
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: network
;; This file is part of GNU Emacs.
;; GNU Emacs 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 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'format-spec)
(defcustom gssapi-program (list
(concat "gsasl %s %p "
"--mechanism GSSAPI "
"--authentication-id %l")
"imtest -m gssapi -u %l -p %p %s")
"List of strings containing commands for GSSAPI (krb5) authentication.
Merge Gnus' changes. gnus.texi (Listing Groups): Document gnus-group-list-ticked. gssapi.el (open-gssapi-stream): Remove the last mentions of the IMAP stuff. gnus-score.el (gnus-score-string): Fix calling convention of `gnus-simplify-buffer-fuzzy' after last patches. gnus-sum.el (gnus-update-marks): Don't send any marks updates to the server for articles we didn't get any headers for. This is a sanity check. nnimap.el (nnimap-open-connection-1): Is the login responds with a new CAPABILITY, use it. gnus-agent.el (gnus-agent-fetch-headers): Don't message if we're not downloading anything. gnus.el (gnus-splash-svg-color-symbols): Removed superfluous `and'. gnus.el (gnus-group-startup-message): Prefer svg file and replace colors. (gnus-splash-svg-color-symbols): New function. gnus-sum.el (gnus-simplify-buffer-fuzzy): Take the regexp explicitly instead of using the global gnus-simplify-subject-fuzzy-regexp. (gnus-simplify-subject-fuzzy): Use the local gnus-simplify-subject-fuzzy-regex instead of the global one. This makes using this variable in group parameters work. gnus-registry.el (gnus-registry-unfollowed-groups): Add "archive:sent" to the unfollowed group regex (for the recent Gnus archive:sent-YYYY-MM-DD groups). (gnus-registry-split-fancy-with-parent): Bail out early in sender tracking if there are more than `gnus-registry-max-track-groups' matches. message.el (message--yank-original-internal): New function to do the insertion cleanly inside eval in `message-yank-original'. (message-yank-original): Use it.
2011-03-30 14:59:42 +00:00
%s is replaced with server hostname, %p with port to connect to,
and %l with the user name. The program should accept commands on
stdin and return responses to stdout. Each entry in the list is
tried until a successful connection is made."
Add missing :version tags to new defgroups and defcustoms * window.el (window-sides-slots): * tool-bar.el (tool-bar-position): * term/xterm.el (xterm-extra-capabilities): * ses.el (ses-self-reference-early-detection): * progmodes/verilog-mode.el (verilog-auto-declare-nettype) (verilog-auto-wire-type) (verilog-auto-delete-trailing-whitespace) (verilog-auto-reset-blocking-in-non, verilog-auto-inst-sort) (verilog-auto-tieoff-declaration): * progmodes/sql.el (sql-login-hook, sql-ansi-statement-starters) (sql-oracle-statement-starters, sql-oracle-scan-on): * progmodes/prolog.el (prolog-align-comments-flag) (prolog-indent-mline-comments-flag, prolog-object-end-to-0-flag) (prolog-left-indent-regexp, prolog-paren-indent-p) (prolog-paren-indent, prolog-parse-mode, prolog-keywords) (prolog-types, prolog-mode-specificators) (prolog-determinism-specificators, prolog-directives) (prolog-electric-newline-flag, prolog-hungry-delete-key-flag) (prolog-electric-dot-flag) (prolog-electric-dot-full-predicate-template) (prolog-electric-underscore-flag, prolog-electric-tab-flag) (prolog-electric-if-then-else-flag, prolog-electric-colon-flag) (prolog-electric-dash-flag, prolog-old-sicstus-keys-flag) (prolog-program-switches, prolog-prompt-regexp) (prolog-debug-on-string, prolog-debug-off-string) (prolog-trace-on-string, prolog-trace-off-string) (prolog-zip-on-string, prolog-zip-off-string) (prolog-use-standard-consult-compile-method-flag) (prolog-use-prolog-tokenizer-flag, prolog-imenu-flag) (prolog-imenu-max-lines, prolog-info-predicate-index) (prolog-underscore-wordchar-flag, prolog-use-sicstus-sd) (prolog-char-quote-workaround): * progmodes/cc-vars.el (c-defun-tactic): * net/tramp.el (tramp-encoding-command-interactive) (tramp-local-end-of-line): * net/soap-client.el (soap-client): * net/netrc.el (netrc-file): * net/gnutls.el (gnutls): * minibuffer.el (completion-category-overrides) (completion-cycle-threshold) (completion-pcm-complete-word-inserts-delimiters): * man.el (Man-name-local-regexp): * mail/feedmail.el (feedmail-display-full-frame): * international/characters.el (glyphless-char-display-control): * eshell/em-ls.el (eshell-ls-date-format): * emacs-lisp/cl-indent.el (lisp-lambda-list-keyword-alignment) (lisp-lambda-list-keyword-parameter-indentation) (lisp-lambda-list-keyword-parameter-alignment): * doc-view.el (doc-view-image-width, doc-view-unoconv-program): * dired-x.el (dired-omit-verbose): * cus-theme.el (custom-theme-allow-multiple-selections): * calc/calc.el (calc-highlight-selections-with-faces) (calc-lu-field-reference, calc-lu-power-reference) (calc-note-threshold): * battery.el (battery-mode-line-limit): * arc-mode.el (archive-7z-extract, archive-7z-expunge) (archive-7z-update): * allout.el (allout-prefixed-keybindings) (allout-unprefixed-keybindings) (allout-inhibit-auto-fill-on-headline) (allout-flattened-numbering-abbreviation): * allout-widgets.el (allout-widgets-auto-activation) (allout-widgets-icons-dark-subdir) (allout-widgets-icons-light-subdir, allout-widgets-icon-types) (allout-widgets-theme-dark-background) (allout-widgets-theme-light-background) (allout-widgets-item-image-properties-emacs) (allout-widgets-item-image-properties-xemacs) (allout-widgets-run-unit-tests-on-load) (allout-widgets-time-decoration-activity) (allout-widgets-hook-error-post-time) (allout-widgets-track-decoration): * gnus/sieve-manage.el (sieve-manage-default-stream): * gnus/shr.el (shr): * gnus/nnir.el (nnir-ignored-newsgroups, nnir-summary-line-format) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-notmuch-program) (nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix) (nnir-method-default-engines): * gnus/message.el (message-cite-reply-position): * gnus/gssapi.el (gssapi-program): * gnus/gravatar.el (gravatar): * gnus/gnus-sum.el (gnus-refer-thread-use-nnir): * gnus/gnus-registry.el (gnus-registry-unfollowed-addresses) (gnus-registry-max-pruned-entries): * gnus/gnus-picon.el (gnus-picon-inhibit-top-level-domains): * gnus/gnus-int.el (gnus-after-set-mark-hook) (gnus-before-update-mark-hook): * gnus/gnus-async.el (gnus-async-post-fetch-function): * gnus/auth-source.el (auth-source-cache-expiry): Add missing :version tags to new defcustoms and defgroups.
2012-02-11 22:13:29 +00:00
:version "24.1"
:group 'network
:type '(repeat string))
Merge Gnus' changes. gnus.texi (Listing Groups): Document gnus-group-list-ticked. gssapi.el (open-gssapi-stream): Remove the last mentions of the IMAP stuff. gnus-score.el (gnus-score-string): Fix calling convention of `gnus-simplify-buffer-fuzzy' after last patches. gnus-sum.el (gnus-update-marks): Don't send any marks updates to the server for articles we didn't get any headers for. This is a sanity check. nnimap.el (nnimap-open-connection-1): Is the login responds with a new CAPABILITY, use it. gnus-agent.el (gnus-agent-fetch-headers): Don't message if we're not downloading anything. gnus.el (gnus-splash-svg-color-symbols): Removed superfluous `and'. gnus.el (gnus-group-startup-message): Prefer svg file and replace colors. (gnus-splash-svg-color-symbols): New function. gnus-sum.el (gnus-simplify-buffer-fuzzy): Take the regexp explicitly instead of using the global gnus-simplify-subject-fuzzy-regexp. (gnus-simplify-subject-fuzzy): Use the local gnus-simplify-subject-fuzzy-regex instead of the global one. This makes using this variable in group parameters work. gnus-registry.el (gnus-registry-unfollowed-groups): Add "archive:sent" to the unfollowed group regex (for the recent Gnus archive:sent-YYYY-MM-DD groups). (gnus-registry-split-fancy-with-parent): Bail out early in sender tracking if there are more than `gnus-registry-max-track-groups' matches. message.el (message--yank-original-internal): New function to do the insertion cleanly inside eval in `message-yank-original'. (message-yank-original): Use it.
2011-03-30 14:59:42 +00:00
(defun open-gssapi-stream (name buffer server port user)
(let ((cmds gssapi-program)
cmd done)
(with-current-buffer buffer
(while (and (not done)
(setq cmd (pop cmds)))
(message "Opening GSSAPI connection with `%s'..." cmd)
(erase-buffer)
(let* ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)
(process (start-process
name buffer shell-file-name shell-command-switch
(format-spec
cmd
(format-spec-make
?s server
?p (number-to-string port)
Merge Gnus' changes. gnus.texi (Listing Groups): Document gnus-group-list-ticked. gssapi.el (open-gssapi-stream): Remove the last mentions of the IMAP stuff. gnus-score.el (gnus-score-string): Fix calling convention of `gnus-simplify-buffer-fuzzy' after last patches. gnus-sum.el (gnus-update-marks): Don't send any marks updates to the server for articles we didn't get any headers for. This is a sanity check. nnimap.el (nnimap-open-connection-1): Is the login responds with a new CAPABILITY, use it. gnus-agent.el (gnus-agent-fetch-headers): Don't message if we're not downloading anything. gnus.el (gnus-splash-svg-color-symbols): Removed superfluous `and'. gnus.el (gnus-group-startup-message): Prefer svg file and replace colors. (gnus-splash-svg-color-symbols): New function. gnus-sum.el (gnus-simplify-buffer-fuzzy): Take the regexp explicitly instead of using the global gnus-simplify-subject-fuzzy-regexp. (gnus-simplify-subject-fuzzy): Use the local gnus-simplify-subject-fuzzy-regex instead of the global one. This makes using this variable in group parameters work. gnus-registry.el (gnus-registry-unfollowed-groups): Add "archive:sent" to the unfollowed group regex (for the recent Gnus archive:sent-YYYY-MM-DD groups). (gnus-registry-split-fancy-with-parent): Bail out early in sender tracking if there are more than `gnus-registry-max-track-groups' matches. message.el (message--yank-original-internal): New function to do the insertion cleanly inside eval in `message-yank-original'. (message-yank-original): Use it.
2011-03-30 14:59:42 +00:00
?l user))))
response)
(when process
(while (and (memq (process-status process) '(open run))
(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 (looking-at "\\* \\(OK\\|PREAUTH\\|BYE\\) ")
;; 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))
(erase-buffer)
Merge Gnus' changes. gnus.texi (Listing Groups): Document gnus-group-list-ticked. gssapi.el (open-gssapi-stream): Remove the last mentions of the IMAP stuff. gnus-score.el (gnus-score-string): Fix calling convention of `gnus-simplify-buffer-fuzzy' after last patches. gnus-sum.el (gnus-update-marks): Don't send any marks updates to the server for articles we didn't get any headers for. This is a sanity check. nnimap.el (nnimap-open-connection-1): Is the login responds with a new CAPABILITY, use it. gnus-agent.el (gnus-agent-fetch-headers): Don't message if we're not downloading anything. gnus.el (gnus-splash-svg-color-symbols): Removed superfluous `and'. gnus.el (gnus-group-startup-message): Prefer svg file and replace colors. (gnus-splash-svg-color-symbols): New function. gnus-sum.el (gnus-simplify-buffer-fuzzy): Take the regexp explicitly instead of using the global gnus-simplify-subject-fuzzy-regexp. (gnus-simplify-subject-fuzzy): Use the local gnus-simplify-subject-fuzzy-regex instead of the global one. This makes using this variable in group parameters work. gnus-registry.el (gnus-registry-unfollowed-groups): Add "archive:sent" to the unfollowed group regex (for the recent Gnus archive:sent-YYYY-MM-DD groups). (gnus-registry-split-fancy-with-parent): Bail out early in sender tracking if there are more than `gnus-registry-max-track-groups' matches. message.el (message--yank-original-internal): New function to do the insertion cleanly inside eval in `message-yank-original'. (message-yank-original): Use it.
2011-03-30 14:59:42 +00:00
(message "GSSAPI connection: %s" (or response "failed"))
(if (and response (let ((case-fold-search nil))
(not (string-match "failed" response))))
(setq done process)
(delete-process process)
nil))))
done)))
(provide 'gssapi)
;;; gssapi.el ends here