]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problem when creating an .authinfo entry with an existing machine name
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 30 Jun 2021 12:27:49 +0000 (14:27 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 30 Jun 2021 12:27:49 +0000 (14:27 +0200)
* lisp/auth-source.el (auth-source-netrc-create): Don't return the
incorrect data if there's a matching host entry but the wrong user
name (bug#49289).

lisp/auth-source.el

index 9ca28ebb0a967f4ddb9ef58e93ca3519edae24e4..6919738398214e015772b27d2a094f7e4304f796 100644 (file)
@@ -1270,7 +1270,7 @@ See `auth-source-search' for details on SPEC."
 ;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t :create-extra-keys '((A "default A") (B)))
 
 (cl-defun auth-source-netrc-create (&rest spec
-                                    &key backend host port create
+                                    &key backend host port create user
                                     &allow-other-keys)
   (let* ((base-required '(host user port secret))
          ;; we know (because of an assertion in auth-source-search) that the
@@ -1278,6 +1278,7 @@ See `auth-source-search' for details on SPEC."
          (create-extra (if (eq t create) nil create))
          (current-data (car (auth-source-search :max 1
                                                 :host host
+                                                :user user
                                                 :port port)))
          (required (append base-required create-extra))
          (file (oref backend source))