Subject: bug#19074: Bug in auth-source.el's search of OS X Keychain

From: John Mastro <[email-masked]>
Date: Sun, 16 Nov 2014 21:38:32 -0800

I accidentally copied only part of the patch in my original email. The
full thing (via `git format-patch') follows.

-- 
jbm

>From 2b968a29ff2a01e316e09faa4d765aca08cf0121 Mon Sep 17 00:00:00 2001
From: John Mastro <[email-masked]>
Date: Sun, 16 Nov 2014 19:41:10 -0800
Subject: [PATCH] Fix auth-source.el bug regarding the OS X Keychain

In `auth-source-macos-keychain-search-items', the return value of
`auth-source-macos-keychain-result-append' was being ignored. This
caused the intended result not to be returned.
---
 lisp/gnus/auth-source.el | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index a50ad75..72ec5f4 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -1779,29 +1779,29 @@ entries for git.gnus.org:
         (while (not (eobp))
           (cond
            ((looking-at "^password: \"\\(.+\\)\"$")
-            (auth-source-macos-keychain-result-append
-             ret
-             keychain-generic
-             "secret"
-             (lexical-let ((v (match-string 1)))
-               (lambda () v))))
+            (setq ret (auth-source-macos-keychain-result-append
+                       ret
+                       keychain-generic
+                       "secret"
+                       (lexical-let ((v (match-string 1)))
+                         (lambda () v)))))
            ;; TODO: check if this is really the label
            ;; match 0x00000007 <blob>="AppleID"
            ((looking-at "^[ ]+0x00000007 <blob>=\"\\(.+\\)\"")
-            (auth-source-macos-keychain-result-append
-             ret
-             keychain-generic
-             "label"
-             (match-string 1)))
+            (setq ret (auth-source-macos-keychain-result-append
+                       ret
+                       keychain-generic
+                       "label"
+                       (match-string 1))))
            ;; match "crtr"<uint32>="aapl"
            ;; match "svce"<blob>="AppleID"
            ((looking-at "^[ ]+\"\\([a-z]+\\)\"[^=]+=\"\\(.+\\)\"")
-            (auth-source-macos-keychain-result-append
-             ret
-             keychain-generic
-             (match-string 1)
-             (match-string 2))))
-            (forward-line)))
+            (setq ret (auth-source-macos-keychain-result-append
+                       ret
+                       keychain-generic
+                       (match-string 1)
+                       (match-string 2)))))
+          (forward-line)))
       ;; return `ret' iff it has the :secret key
       (and (plist-get ret :secret) (list ret))))
 
-- 
2.1.3