diff options
| author | Teodor Zlatanov | 2011-02-17 12:08:48 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-02-17 12:08:48 +0000 |
| commit | 35123c042e9154a0f2b1ebfddba06ba01596f07d (patch) | |
| tree | b8e2a42ee315b247fabd18051d58405c1e34a11c | |
| parent | 73057ba922a026e5416d2e432c6bc1cce127648a (diff) | |
| download | emacs-35123c042e9154a0f2b1ebfddba06ba01596f07d.tar.gz emacs-35123c042e9154a0f2b1ebfddba06ba01596f07d.zip | |
auth.texi (Help for users): Use :port instead of :protocol for all auth-source docs.
auth-source.el (auth-source-netrc-parse): Use :port instead of :protocol and accept a missing user, host, or port as a wildcard match.
(auth-source-netrc-search, auth-source-netrc-create)
(auth-source-secrets-search, auth-source-secrets-create)
(auth-source-user-or-password, auth-source-backend, auth-sources)
(auth-source-backend-parse-parameters, auth-source-search): Use :port instead of :protocol.
nnimap.el (nnimap-credentials): Pass a port default to `auth-source-search' in case an entry needs to be created.
(nnimap-open-connection-1): Use :port instead of :protocol.
| -rw-r--r-- | doc/misc/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/misc/auth.texi | 7 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 120 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 5 |
5 files changed, 87 insertions, 65 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 4a03caee911..9a292c03c8d 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-02-17 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * auth.texi (Help for users): Use :port instead of :protocol for all | ||
| 4 | auth-source docs. | ||
| 5 | |||
| 1 | 2011-02-16 Glenn Morris <rgm@gnu.org> | 6 | 2011-02-16 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * dired-x.texi: Use emacsver.texi to get Emacs version. | 8 | * dired-x.texi: Use emacsver.texi to get Emacs version. |
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index 020c582305c..0e19bce0b9f 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi | |||
| @@ -105,8 +105,7 @@ It's known as @var{:host} in @code{auth-source-search} queries. You | |||
| 105 | can also use @code{host}. | 105 | can also use @code{host}. |
| 106 | 106 | ||
| 107 | The @code{port} is the connection port or protocol. It's known as | 107 | The @code{port} is the connection port or protocol. It's known as |
| 108 | @var{:port} in @code{auth-source-search} queries. You can also use | 108 | @var{:port} in @code{auth-source-search} queries. |
| 109 | @code{protocol}. | ||
| 110 | 109 | ||
| 111 | The @code{user} is the user name. It's known as @var{:user} in | 110 | The @code{user} is the user name. It's known as @var{:user} in |
| 112 | @code{auth-source-search} queries. You can also use @code{login} and | 111 | @code{auth-source-search} queries. You can also use @code{login} and |
| @@ -155,8 +154,8 @@ particular host and protocol. While you can get fancy, the default | |||
| 155 | and simplest configuration is: | 154 | and simplest configuration is: |
| 156 | 155 | ||
| 157 | @lisp | 156 | @lisp |
| 158 | ;;; old default: required :host and :protocol, not needed anymore | 157 | ;;; old default: required :host and :port, not needed anymore |
| 159 | (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) | 158 | (setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t))) |
| 160 | ;;; mostly equivalent (see below about fallbacks) but shorter: | 159 | ;;; mostly equivalent (see below about fallbacks) but shorter: |
| 161 | (setq auth-sources '((:source "~/.authinfo.gpg"))) | 160 | (setq auth-sources '((:source "~/.authinfo.gpg"))) |
| 162 | ;;; even shorter and the @emph{default}: | 161 | ;;; even shorter and the @emph{default}: |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c98c86d46f2..0e5a248c0b2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2011-02-17 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * auth-source.el (auth-source-netrc-parse): Use :port instead of | ||
| 4 | :protocol and accept a missing user, host, or port as a wildcard match. | ||
| 5 | |||
| 6 | (auth-source-netrc-search, auth-source-netrc-create) | ||
| 7 | (auth-source-secrets-search, auth-source-secrets-create) | ||
| 8 | (auth-source-user-or-password, auth-source-backend, auth-sources) | ||
| 9 | (auth-source-backend-parse-parameters, auth-source-search): Use :port | ||
| 10 | instead of :protocol. | ||
| 11 | |||
| 12 | * nnimap.el (nnimap-credentials): Pass a port default to | ||
| 13 | `auth-source-search' in case an entry needs to be created. | ||
| 14 | (nnimap-open-connection-1): Use :port instead of :protocol. | ||
| 15 | |||
| 1 | 2011-02-17 Katsumi Yamaoka <yamaoka@jpl.org> | 16 | 2011-02-17 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 17 | ||
| 3 | * auth-source.el (auth-source-secrets-search): Use mm-delete-duplicates | 18 | * auth-source.el (auth-source-secrets-search): Use mm-delete-duplicates |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index c3f0f2d5ba5..42386250c4f 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -94,11 +94,11 @@ let-binding." | |||
| 94 | :type t | 94 | :type t |
| 95 | :custom string | 95 | :custom string |
| 96 | :documentation "The backend user.") | 96 | :documentation "The backend user.") |
| 97 | (protocol :initarg :protocol | 97 | (port :initarg :port |
| 98 | :initform t | 98 | :initform t |
| 99 | :type t | 99 | :type t |
| 100 | :custom string | 100 | :custom string |
| 101 | :documentation "The backend protocol.") | 101 | :documentation "The backend protocol.") |
| 102 | (create-function :initarg :create-function | 102 | (create-function :initarg :create-function |
| 103 | :initform ignore | 103 | :initform ignore |
| 104 | :type function | 104 | :type function |
| @@ -213,7 +213,7 @@ can get pretty complex." | |||
| 213 | :tag "Regular expression"))) | 213 | :tag "Regular expression"))) |
| 214 | (list | 214 | (list |
| 215 | :tag "Protocol" | 215 | :tag "Protocol" |
| 216 | (const :format "" :value :protocol) | 216 | (const :format "" :value :port) |
| 217 | (choice | 217 | (choice |
| 218 | :tag "Protocol" | 218 | :tag "Protocol" |
| 219 | (const :tag "Any" t) | 219 | (const :tag "Any" t) |
| @@ -266,19 +266,19 @@ If the value is not a list, symmetric encryption will be used." | |||
| 266 | msg)) | 266 | msg)) |
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | ;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe") | 269 | ;; (auth-source-pick nil :host "any" :port 'imap :user "joe") |
| 270 | ;; (auth-source-pick t :host "any" :protocol 'imap :user "joe") | 270 | ;; (auth-source-pick t :host "any" :port 'imap :user "joe") |
| 271 | ;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") | 271 | ;; (setq auth-sources '((:source (:secrets default) :host t :port t :user "joe") |
| 272 | ;; (:source (:secrets "session") :host t :protocol t :user "joe") | 272 | ;; (:source (:secrets "session") :host t :port t :user "joe") |
| 273 | ;; (:source (:secrets "Login") :host t :protocol t) | 273 | ;; (:source (:secrets "Login") :host t :port t) |
| 274 | ;; (:source "~/.authinfo.gpg" :host t :protocol t))) | 274 | ;; (:source "~/.authinfo.gpg" :host t :port t))) |
| 275 | 275 | ||
| 276 | ;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") | 276 | ;; (setq auth-sources '((:source (:secrets default) :host t :port t :user "joe") |
| 277 | ;; (:source (:secrets "session") :host t :protocol t :user "joe") | 277 | ;; (:source (:secrets "session") :host t :port t :user "joe") |
| 278 | ;; (:source (:secrets "Login") :host t :protocol t) | 278 | ;; (:source (:secrets "Login") :host t :port t) |
| 279 | ;; )) | 279 | ;; )) |
| 280 | 280 | ||
| 281 | ;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) | 281 | ;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t))) |
| 282 | 282 | ||
| 283 | ;; (auth-source-backend-parse "myfile.gpg") | 283 | ;; (auth-source-backend-parse "myfile.gpg") |
| 284 | ;; (auth-source-backend-parse 'default) | 284 | ;; (auth-source-backend-parse 'default) |
| @@ -355,8 +355,8 @@ If the value is not a list, symmetric encryption will be used." | |||
| 355 | 355 | ||
| 356 | (defun auth-source-backend-parse-parameters (entry backend) | 356 | (defun auth-source-backend-parse-parameters (entry backend) |
| 357 | "Fills in the extra auth-source-backend parameters of ENTRY. | 357 | "Fills in the extra auth-source-backend parameters of ENTRY. |
| 358 | Using the plist ENTRY, get the :host, :protocol, and :user search | 358 | Using the plist ENTRY, get the :host, :port, and :user search |
| 359 | parameters. Accepts :port as an alias to :protocol." | 359 | parameters." |
| 360 | (let ((entry (if (stringp entry) | 360 | (let ((entry (if (stringp entry) |
| 361 | nil | 361 | nil |
| 362 | entry)) | 362 | entry)) |
| @@ -365,15 +365,14 @@ parameters. Accepts :port as an alias to :protocol." | |||
| 365 | (oset backend host val)) | 365 | (oset backend host val)) |
| 366 | (when (setq val (plist-get entry :user)) | 366 | (when (setq val (plist-get entry :user)) |
| 367 | (oset backend user val)) | 367 | (oset backend user val)) |
| 368 | ;; accept :port as an alias for :protocol | 368 | (when (setq val (plist-get entry :port)) |
| 369 | (when (setq val (or (plist-get entry :protocol) (plist-get entry :port))) | 369 | (oset backend port val))) |
| 370 | (oset backend protocol val))) | ||
| 371 | backend) | 370 | backend) |
| 372 | 371 | ||
| 373 | ;; (mapcar 'auth-source-backend-parse auth-sources) | 372 | ;; (mapcar 'auth-source-backend-parse auth-sources) |
| 374 | 373 | ||
| 375 | (defun* auth-source-search (&rest spec | 374 | (defun* auth-source-search (&rest spec |
| 376 | &key type max host user protocol secret | 375 | &key type max host user port secret |
| 377 | create delete | 376 | create delete |
| 378 | &allow-other-keys) | 377 | &allow-other-keys) |
| 379 | "Search or modify authentication backends according to SPEC. | 378 | "Search or modify authentication backends according to SPEC. |
| @@ -386,7 +385,7 @@ other properties will always hold scalar values. | |||
| 386 | 385 | ||
| 387 | Typically the :secret property, if present, contains a password. | 386 | Typically the :secret property, if present, contains a password. |
| 388 | 387 | ||
| 389 | Common search keys are :max, :host, :protocol, and :user. In | 388 | Common search keys are :max, :host, :port, and :user. In |
| 390 | addition, :create specifies how tokens will be or created. | 389 | addition, :create specifies how tokens will be or created. |
| 391 | Finally, :type can specify which backend types you want to check. | 390 | Finally, :type can specify which backend types you want to check. |
| 392 | 391 | ||
| @@ -400,7 +399,7 @@ any of the search terms matches). | |||
| 400 | A new token will be created if no matching tokens were found. | 399 | A new token will be created if no matching tokens were found. |
| 401 | The new token will have only the keys the backend requires. For | 400 | The new token will have only the keys the backend requires. For |
| 402 | the netrc backend, for instance, that's the user, host, and | 401 | the netrc backend, for instance, that's the user, host, and |
| 403 | protocol keys. | 402 | port keys. |
| 404 | 403 | ||
| 405 | Here's an example: | 404 | Here's an example: |
| 406 | 405 | ||
| @@ -416,11 +415,11 @@ which says: | |||
| 416 | 'netrc', maximum one result. | 415 | 'netrc', maximum one result. |
| 417 | 416 | ||
| 418 | Create a new entry if you found none. The netrc backend will | 417 | Create a new entry if you found none. The netrc backend will |
| 419 | automatically require host, user, and protocol. The host will be | 418 | automatically require host, user, and port. The host will be |
| 420 | 'mine'. We prompt for the user with default 'defaultUser' and | 419 | 'mine'. We prompt for the user with default 'defaultUser' and |
| 421 | for the protocol without a default. We will not prompt for A, Q, | 420 | for the port without a default. We will not prompt for A, Q, |
| 422 | or P. The resulting token will only have keys user, host, and | 421 | or P. The resulting token will only have keys user, host, and |
| 423 | protocol.\" | 422 | port.\" |
| 424 | 423 | ||
| 425 | :create '(A B C) also means to create a token if possible. | 424 | :create '(A B C) also means to create a token if possible. |
| 426 | 425 | ||
| @@ -445,11 +444,11 @@ which says: | |||
| 445 | or 'twosuch' in backends of type 'netrc', maximum one result. | 444 | or 'twosuch' in backends of type 'netrc', maximum one result. |
| 446 | 445 | ||
| 447 | Create a new entry if you found none. The netrc backend will | 446 | Create a new entry if you found none. The netrc backend will |
| 448 | automatically require host, user, and protocol. The host will be | 447 | automatically require host, user, and port. The host will be |
| 449 | 'nonesuch' and Q will be 'qqqq'. We prompt for A with default | 448 | 'nonesuch' and Q will be 'qqqq'. We prompt for A with default |
| 450 | 'default A', for B and protocol with default nil, and for the | 449 | 'default A', for B and port with default nil, and for the |
| 451 | user with default 'defaultUser'. We will not prompt for Q. The | 450 | user with default 'defaultUser'. We will not prompt for Q. The |
| 452 | resulting token will have keys user, host, protocol, A, B, and Q. | 451 | resulting token will have keys user, host, port, A, B, and Q. |
| 453 | It will not have P with any value, even though P is used in the | 452 | It will not have P with any value, even though P is used in the |
| 454 | search to find only entries that have P set to 'pppp'.\" | 453 | search to find only entries that have P set to 'pppp'.\" |
| 455 | 454 | ||
| @@ -481,14 +480,14 @@ the match rules above. Defaults to t. | |||
| 481 | :user (X Y Z) means to match only users X, Y, or Z according to | 480 | :user (X Y Z) means to match only users X, Y, or Z according to |
| 482 | the match rules above. Defaults to t. | 481 | the match rules above. Defaults to t. |
| 483 | 482 | ||
| 484 | :protocol (P Q R) means to match only protocols P, Q, or R. | 483 | :port (P Q R) means to match only protocols P, Q, or R. |
| 485 | Defaults to t. | 484 | Defaults to t. |
| 486 | 485 | ||
| 487 | :K (V1 V2 V3) for any other key K will match values V1, V2, or | 486 | :K (V1 V2 V3) for any other key K will match values V1, V2, or |
| 488 | V3 (note the match rules above). | 487 | V3 (note the match rules above). |
| 489 | 488 | ||
| 490 | The return value is a list with at most :max tokens. Each token | 489 | The return value is a list with at most :max tokens. Each token |
| 491 | is a plist with keys :backend :host :protocol :user, plus any other | 490 | is a plist with keys :backend :host :port :user, plus any other |
| 492 | keys provided by the backend (notably :secret). But note the | 491 | keys provided by the backend (notably :secret). But note the |
| 493 | exception for :max 0, which see above. | 492 | exception for :max 0, which see above. |
| 494 | 493 | ||
| @@ -662,7 +661,7 @@ while \(:host t) would find all host entries." | |||
| 662 | ;;; (auth-source-netrc-parse "~/.authinfo.gpg") | 661 | ;;; (auth-source-netrc-parse "~/.authinfo.gpg") |
| 663 | (defun* auth-source-netrc-parse (&rest | 662 | (defun* auth-source-netrc-parse (&rest |
| 664 | spec | 663 | spec |
| 665 | &key file max host user protocol delete | 664 | &key file max host user port delete |
| 666 | &allow-other-keys) | 665 | &allow-other-keys) |
| 667 | "Parse FILE and return a list of all entries in the file. | 666 | "Parse FILE and return a list of all entries in the file. |
| 668 | Note that the MAX parameter is used so we can exit the parse early." | 667 | Note that the MAX parameter is used so we can exit the parse early." |
| @@ -724,18 +723,21 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 724 | host | 723 | host |
| 725 | (or | 724 | (or |
| 726 | (aget alist "machine") | 725 | (aget alist "machine") |
| 727 | (aget alist "host"))) | 726 | (aget alist "host") |
| 727 | t)) | ||
| 728 | (auth-source-search-collection | 728 | (auth-source-search-collection |
| 729 | user | 729 | user |
| 730 | (or | 730 | (or |
| 731 | (aget alist "login") | 731 | (aget alist "login") |
| 732 | (aget alist "account") | 732 | (aget alist "account") |
| 733 | (aget alist "user"))) | 733 | (aget alist "user") |
| 734 | t)) | ||
| 734 | (auth-source-search-collection | 735 | (auth-source-search-collection |
| 735 | protocol | 736 | port |
| 736 | (or | 737 | (or |
| 737 | (aget alist "port") | 738 | (aget alist "port") |
| 738 | (aget alist "protocol")))) | 739 | (aget alist "protocol") |
| 740 | t))) | ||
| 739 | (decf max) | 741 | (decf max) |
| 740 | (push (nreverse alist) result) | 742 | (push (nreverse alist) result) |
| 741 | ;; to delete a line, we just comment it out | 743 | ;; to delete a line, we just comment it out |
| @@ -801,7 +803,7 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 801 | (defun* auth-source-netrc-search (&rest | 803 | (defun* auth-source-netrc-search (&rest |
| 802 | spec | 804 | spec |
| 803 | &key backend create delete | 805 | &key backend create delete |
| 804 | type max host user protocol | 806 | type max host user port |
| 805 | &allow-other-keys) | 807 | &allow-other-keys) |
| 806 | "Given a property list SPEC, return search matches from the :backend. | 808 | "Given a property list SPEC, return search matches from the :backend. |
| 807 | See `auth-source-search' for details on SPEC." | 809 | See `auth-source-search' for details on SPEC." |
| @@ -816,7 +818,7 @@ See `auth-source-search' for details on SPEC." | |||
| 816 | :file (oref backend source) | 818 | :file (oref backend source) |
| 817 | :host (or host t) | 819 | :host (or host t) |
| 818 | :user (or user t) | 820 | :user (or user t) |
| 819 | :protocol (or protocol t))))) | 821 | :port (or port t))))) |
| 820 | 822 | ||
| 821 | ;; if we need to create an entry AND none were found to match | 823 | ;; if we need to create an entry AND none were found to match |
| 822 | (when (and create | 824 | (when (and create |
| @@ -840,9 +842,9 @@ See `auth-source-search' for details on SPEC." | |||
| 840 | 842 | ||
| 841 | (defun* auth-source-netrc-create (&rest spec | 843 | (defun* auth-source-netrc-create (&rest spec |
| 842 | &key backend | 844 | &key backend |
| 843 | secret host user protocol create | 845 | secret host user port create |
| 844 | &allow-other-keys) | 846 | &allow-other-keys) |
| 845 | (let* ((base-required '(host user protocol secret)) | 847 | (let* ((base-required '(host user port secret)) |
| 846 | ;; we know (because of an assertion in auth-source-search) that the | 848 | ;; we know (because of an assertion in auth-source-search) that the |
| 847 | ;; :create parameter is either t or a list (which includes nil) | 849 | ;; :create parameter is either t or a list (which includes nil) |
| 848 | (create-extra (if (eq t create) nil create)) | 850 | (create-extra (if (eq t create) nil create)) |
| @@ -881,7 +883,7 @@ See `auth-source-search' for details on SPEC." | |||
| 881 | ((and (not given-default) (eq r 'user)) | 883 | ((and (not given-default) (eq r 'user)) |
| 882 | (user-login-name)) | 884 | (user-login-name)) |
| 883 | ;; note we need this empty string | 885 | ;; note we need this empty string |
| 884 | ((and (not given-default) (eq r 'protocol)) | 886 | ((and (not given-default) (eq r 'port)) |
| 885 | "") | 887 | "") |
| 886 | (t given-default))) | 888 | (t given-default))) |
| 887 | ;; the prompt's default string depends on the data so far | 889 | ;; the prompt's default string depends on the data so far |
| @@ -891,20 +893,20 @@ See `auth-source-search' for details on SPEC." | |||
| 891 | ;; the prompt should also show what's entered so far | 893 | ;; the prompt should also show what's entered so far |
| 892 | (user-value (aget valist 'user)) | 894 | (user-value (aget valist 'user)) |
| 893 | (host-value (aget valist 'host)) | 895 | (host-value (aget valist 'host)) |
| 894 | (protocol-value (aget valist 'protocol)) | 896 | (port-value (aget valist 'port)) |
| 895 | (info-so-far (concat (if user-value | 897 | (info-so-far (concat (if user-value |
| 896 | (format "%s@" user-value) | 898 | (format "%s@" user-value) |
| 897 | "[USER?]") | 899 | "[USER?]") |
| 898 | (if host-value | 900 | (if host-value |
| 899 | (format "%s" host-value) | 901 | (format "%s" host-value) |
| 900 | "[HOST?]") | 902 | "[HOST?]") |
| 901 | (if protocol-value | 903 | (if port-value |
| 902 | ;; this distinguishes protocol between | 904 | ;; this distinguishes protocol between |
| 903 | (if (zerop (length protocol-value)) | 905 | (if (zerop (length port-value)) |
| 904 | "" ; 'entered as "no default"' vs. | 906 | "" ; 'entered as "no default"' vs. |
| 905 | (format ":%s" protocol-value)) ; given | 907 | (format ":%s" port-value)) ; given |
| 906 | ;; and this is when the protocol is unknown | 908 | ;; and this is when the protocol is unknown |
| 907 | "[PROTOCOL?]")))) | 909 | "[PORT?]")))) |
| 908 | 910 | ||
| 909 | ;; now prompt if the search SPEC did not include a required key; | 911 | ;; now prompt if the search SPEC did not include a required key; |
| 910 | ;; take the result and put it in `data' AND store it in `valist' | 912 | ;; take the result and put it in `data' AND store it in `valist' |
| @@ -942,7 +944,7 @@ See `auth-source-search' for details on SPEC." | |||
| 942 | ('user "login") | 944 | ('user "login") |
| 943 | ('host "machine") | 945 | ('host "machine") |
| 944 | ('secret "password") | 946 | ('secret "password") |
| 945 | ('protocol "port") | 947 | ('port "port") ; redundant but clearer |
| 946 | (t (symbol-name r))) | 948 | (t (symbol-name r))) |
| 947 | ;; the value will be printed in %S format | 949 | ;; the value will be printed in %S format |
| 948 | data)))))) | 950 | data)))))) |
| @@ -986,7 +988,7 @@ See `auth-source-search' for details on SPEC." | |||
| 986 | (defun* auth-source-secrets-search (&rest | 988 | (defun* auth-source-secrets-search (&rest |
| 987 | spec | 989 | spec |
| 988 | &key backend create delete label | 990 | &key backend create delete label |
| 989 | type max host user protocol | 991 | type max host user port |
| 990 | &allow-other-keys) | 992 | &allow-other-keys) |
| 991 | "Search the Secrets API; spec is like `auth-source'. | 993 | "Search the Secrets API; spec is like `auth-source'. |
| 992 | 994 | ||
| @@ -1042,9 +1044,9 @@ authentication tokens: | |||
| 1042 | nil | 1044 | nil |
| 1043 | (list k (plist-get spec k)))) | 1045 | (list k (plist-get spec k)))) |
| 1044 | search-keys))) | 1046 | search-keys))) |
| 1045 | ;; needed keys (always including host, login, protocol, and secret) | 1047 | ;; needed keys (always including host, login, port, and secret) |
| 1046 | (returned-keys (mm-delete-duplicates (append | 1048 | (returned-keys (mm-delete-duplicates (append |
| 1047 | '(:host :login :protocol :secret) | 1049 | '(:host :login :port :secret) |
| 1048 | search-keys))) | 1050 | search-keys))) |
| 1049 | (items (loop for item in (apply 'secrets-search-items coll search-spec) | 1051 | (items (loop for item in (apply 'secrets-search-items coll search-spec) |
| 1050 | unless (and (stringp label) | 1052 | unless (and (stringp label) |
| @@ -1081,7 +1083,7 @@ authentication tokens: | |||
| 1081 | 1083 | ||
| 1082 | (defun* auth-source-secrets-create (&rest | 1084 | (defun* auth-source-secrets-create (&rest |
| 1083 | spec | 1085 | spec |
| 1084 | &key backend type max host user protocol | 1086 | &key backend type max host user port |
| 1085 | &allow-other-keys) | 1087 | &allow-other-keys) |
| 1086 | ;; TODO | 1088 | ;; TODO |
| 1087 | ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec) | 1089 | ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec) |
| @@ -1098,8 +1100,8 @@ authentication tokens: | |||
| 1098 | 'auth-source-forget "Emacs 24.1") | 1100 | 'auth-source-forget "Emacs 24.1") |
| 1099 | 1101 | ||
| 1100 | (defun auth-source-user-or-password | 1102 | (defun auth-source-user-or-password |
| 1101 | (mode host protocol &optional username create-missing delete-existing) | 1103 | (mode host port &optional username create-missing delete-existing) |
| 1102 | "Find MODE (string or list of strings) matching HOST and PROTOCOL. | 1104 | "Find MODE (string or list of strings) matching HOST and PORT. |
| 1103 | 1105 | ||
| 1104 | DEPRECATED in favor of `auth-source-search'! | 1106 | DEPRECATED in favor of `auth-source-search'! |
| 1105 | 1107 | ||
| @@ -1122,14 +1124,14 @@ stored in the password database which matches best (see | |||
| 1122 | MODE can be \"login\" or \"password\"." | 1124 | MODE can be \"login\" or \"password\"." |
| 1123 | (auth-source-do-debug | 1125 | (auth-source-do-debug |
| 1124 | "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s" | 1126 | "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s" |
| 1125 | mode host protocol username) | 1127 | mode host port username) |
| 1126 | 1128 | ||
| 1127 | (let* ((listy (listp mode)) | 1129 | (let* ((listy (listp mode)) |
| 1128 | (mode (if listy mode (list mode))) | 1130 | (mode (if listy mode (list mode))) |
| 1129 | (cname (if username | 1131 | (cname (if username |
| 1130 | (format "%s %s:%s %s" mode host protocol username) | 1132 | (format "%s %s:%s %s" mode host port username) |
| 1131 | (format "%s %s:%s" mode host protocol))) | 1133 | (format "%s %s:%s" mode host port))) |
| 1132 | (search (list :host host :protocol protocol)) | 1134 | (search (list :host host :port port)) |
| 1133 | (search (if username (append search (list :user username)) search)) | 1135 | (search (if username (append search (list :user username)) search)) |
| 1134 | (search (if create-missing | 1136 | (search (if create-missing |
| 1135 | (append search (list :create t)) | 1137 | (append search (list :create t)) |
| @@ -1151,7 +1153,7 @@ MODE can be \"login\" or \"password\"." | |||
| 1151 | (if (and (member "password" mode) t) | 1153 | (if (and (member "password" mode) t) |
| 1152 | "SECRET" | 1154 | "SECRET" |
| 1153 | found) | 1155 | found) |
| 1154 | host protocol username) | 1156 | host port username) |
| 1155 | found) ; return the found data | 1157 | found) ; return the found data |
| 1156 | ;; else, if not found, search with a max of 1 | 1158 | ;; else, if not found, search with a max of 1 |
| 1157 | (let ((choice (nth 0 (apply 'auth-source-search | 1159 | (let ((choice (nth 0 (apply 'auth-source-search |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 4e220bc7553..fc8873ff565 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -277,7 +277,8 @@ textual parts.") | |||
| 277 | (current-buffer))) | 277 | (current-buffer))) |
| 278 | 278 | ||
| 279 | (defun nnimap-credentials (address ports) | 279 | (defun nnimap-credentials (address ports) |
| 280 | (let* ((found (nth 0 (auth-source-search :max 1 | 280 | (let* ((auth-source-creation-defaults `((port . ,(nth 0 ports)))) |
| 281 | (found (nth 0 (auth-source-search :max 1 | ||
| 281 | :host address | 282 | :host address |
| 282 | :port ports | 283 | :port ports |
| 283 | :create t))) | 284 | :create t))) |
| @@ -398,7 +399,7 @@ textual parts.") | |||
| 398 | (dolist (host (list (nnoo-current-server 'nnimap) | 399 | (dolist (host (list (nnoo-current-server 'nnimap) |
| 399 | nnimap-address)) | 400 | nnimap-address)) |
| 400 | (dolist (port ports) | 401 | (dolist (port ports) |
| 401 | (auth-source-forget+ :host host :protocol port))) | 402 | (auth-source-forget+ :host host :port port))) |
| 402 | (delete-process (nnimap-process nnimap-object)) | 403 | (delete-process (nnimap-process nnimap-object)) |
| 403 | (setq nnimap-object nil)))) | 404 | (setq nnimap-object nil)))) |
| 404 | (when nnimap-object | 405 | (when nnimap-object |