From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.bugs Subject: bug#19074: 24.4; Bug in auth-source.el's search of OS X Keychain Date: Sun, 16 Nov 2014 20:04:42 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1416200247 28374 80.91.229.3 (17 Nov 2014 04:57:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2014 04:57:27 +0000 (UTC) To: 19074@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 17 05:57:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XqENL-00021q-40 for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Nov 2014 05:57:19 +0100 Original-Received: from localhost ([::1]:46091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqENK-00005v-Mr for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Nov 2014 23:57:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqENB-00005p-Td for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:57:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqEN5-0002so-BM for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:57:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqEN5-0002sk-2I for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:57:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XqEN4-0004vD-Lw for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: John Mastro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Nov 2014 04:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141620016918760 (code B ref -1); Mon, 17 Nov 2014 04:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Nov 2014 04:56:09 +0000 Original-Received: from localhost ([127.0.0.1]:35691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqEMC-0004sR-Hq for submit@debbugs.gnu.org; Sun, 16 Nov 2014 23:56:09 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54139) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqDYu-0002Eg-RY for submit@debbugs.gnu.org; Sun, 16 Nov 2014 23:05:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqDYo-000655-H1 for submit@debbugs.gnu.org; Sun, 16 Nov 2014 23:05:12 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqDYo-00064t-Em for submit@debbugs.gnu.org; Sun, 16 Nov 2014 23:05:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqDYj-0004lk-0v for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:05:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqDYd-0005vM-6j for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:05:00 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:54472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqDYc-0005uo-Tu for bug-gnu-emacs@gnu.org; Sun, 16 Nov 2014 23:04:55 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 2A80D20979 for ; Sun, 16 Nov 2014 23:04:53 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Sun, 16 Nov 2014 23:04:53 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=jbm.io; h= x-sasl-enc:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=mesmtp; bh=1QIDSAS4Yq TVaCvQp0xoGWgsL5E=; b=pQFn1wtOZNgu/qqvpiSkA95kIKXK9wBVdZEiaN8+X+ zOa2/OAsPfwc0ZBpzAzNYCgnGNRhvbj7B/EHO/g6aoHOoxY9bzyf3SG4bvp+/lzK Fhs+SBmMZ2wsyfn/LhjHBYGmZ5/Ihxl4XkqPkiQ4VTWQOcq7oMNtk7vSR1sLVp0Y E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; s=smtpout; bh=1QIDSAS4YqTVaCvQp0xoGWgsL5E=; b=UgdDjCaW5cJkhphxX BRbSkKIdwxj55jyJJEyUzM525Lfe5+thrVNjazYOOQwpWQ0c2cXFA6L+WQQQOV26 FpgiA8xyUaYr3F+QsXmntjbmSKhoVdkFPec9ZDJWa2jYw3xzmGiVzkI/kruEGNkh 65TYviKufVXlvJhV0cvXE19Sas= X-Sasl-enc: 5xqETGdJ+U4pntUUWQr5wckB5Y7Dd6AvTt33sU1gGMgU 1416197092 Original-Received: from nebula.local (unknown [23.240.150.50]) by mail.messagingengine.com (Postfix) with ESMTPA id 9A903C0000E for ; Sun, 16 Nov 2014 23:04:52 -0500 (EST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 16 Nov 2014 23:56:07 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96142 The library `auth-source.el' contains code to search OS X's Keychain (the backends `macos-keychain-generic' and `macos-keychain-internet'). Both backends are implemented by parsing the results of OS X's /usr/bin/security. This parsing is done by `auth-source-macos-keychain-search-items'. However, there's currently a problem with this code in both the master and emacs-24 branches. Specifically, the function `auth-source-macos-keychain-result-append' is called three times, but each time its result is ignored. A precise recipe from `emacs -Q' is a little difficult, because it depends on OS X and what you have in your keychain. However, the below is an example of what will work with the fix but not with the current code. A simple patch (against the emacs-24 batch) is attached. I don't yet have paperwork on file with FSF, but I believe this is short/trivial enough to be accepted anyway. ;; Example. With appropriate user/host, will be nil before patch but ;; return expected output after patch. (progn (require 'auth-source) (auth-source-macos-keychain-search :backend (auth-source-backend-parse 'macos-keychain-internet) :user "MY-USER" :host "MY-HOST")) Patch: 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 ="AppleID" ((looking-at "^[ ]+0x00000007 =\"\\(.+\\)\"") - (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"="aapl" ;; match "svce"="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)))) In GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14) of 2014-11-09 on nebula.local Windowing system distributor `Apple', version 10.3.1343 Configured using: `configure --prefix=/usr/local/Cellar/emacs/24.4 --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs/24.4/share/info/emacs --without-dbus --with-gnutls --with-imagemagick --with-ns --disable-ns-self-contained' Important settings: locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: magit-auto-revert-mode: t diff-auto-refine-mode: t shell-dirtrack-mode: t flyspell-mode: t paredit-mode: t eldoc-mode: t elisp-slime-nav-mode: t whitespace-mode: t global-company-mode: t company-mode: t smartparens-global-strict-mode: t projectile-global-mode: t projectile-mode: t ido-vertical-mode: t ido-ubiquitous-mode: t flx-ido-mode: t ido-everywhere: t savehist-mode: t global-undo-tree-mode: t undo-tree-mode: t guide-key-mode: t global-discover-mode: t discover-mode: t recentf-mode: t winner-mode: t global-auto-revert-mode: t global-page-break-lines-mode: t page-break-lines-mode: t delete-selection-mode: t show-paren-mode: t global-hl-line-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: SPC f u n c t i o n SPC A-H-s-÷µ¹¶ M-o C-x b M-= M-= M-w C-x b C-g C-v C-v C-x b M-o C-q ` C-y ' M-q SPC l o o p s SPC t h r o u A-H-s-÷µ¹¶ g h SPC C-a C-e a n d SPC u s e s SPC M-o C-x b C-p C-p C-p M-f M-f M-f M-= M-= M-w C-x b M-o C-q ` C-y ' SPC t o SPC c o l l e A-H-s-÷µ¹¶ c t SPC i n f o r m a t i o n . SPC H o w e v e r , SPC t h e SPC r e s A-H-s-÷µ¹¶ u l C-h C-h C-g C-n C-k I n A-H-s-÷µ¹¶ C-c C-j C-c C-j M-^ M-e C-k , SPC t h e SPC r e t u r n SPC c v a l u e SPC o f A-H-s-÷µ¹¶ C-n w a s SPC b e i n g SPC i g n o r e d . SPC T h i A-H-s-÷µ¹¶ s SPC c a u s e d SPC t h e SPC i n t e n d e d SPC r e s u l t A-H-s-÷µ¹¶ SPC n o t SPC t o SPC b e SPC r e t u r n e d . C-n C-a C-k C-k C-p C-p C-p C-c C-c C-x C-f d r o e m p a t C-n C-h C-k q M-x r e p o r t - e m a c s - b u g Recent messages: Quit Indenting region...done Indenting region...done Indenting region...done Indenting region...done Indenting region...done Indenting region...done Saving file /Users/jbm/src/emacs/emacs/.git/COMMIT_EDITMSG... Wrote /Users/jbm/src/emacs/emacs/.git/COMMIT_EDITMSG Git finished Load-path shadows: None found. Features: (shadow emacsbug expand-region text-mode-expansions the-org-mode-expansions er-basic-expansions expand-region-core expand-region-custom magit-key-mode magit view tramp tramp-compat tramp-loaddefs trampver git-rebase-mode git-commit-mode log-edit pcvs-util add-log idomenu imenu eieio-opt ace-window ace-jump-mode diff-mode gnutls network-stream starttls tls mailalias mail-extr sort hippie-exp org-rmail org-mhe org-irc org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-w3m ob-sh shell ob-python ob-clojure org org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu calendar cal-loaddefs mule-util mu4e mu4e-speedbar speedbar sb-image ezimage dframe mu4e-main mu4e-view epa derived epg browse-url mu4e-headers mu4e-compose mu4e-draft mu4e-actions rfc2368 smtpmail sendmail mu4e-mark mu4e-message html2text mu4e-proc mu4e-utils doc-view image-mode find-dired dired+ image-dired image-file dired-x dired-aux dired mu4e-lists mu4e-about mu4e-vars message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader mu4e-meta smex misearch multi-isearch auth-source gnus-util mm-util mail-prsvr password-cache pp vc-git flyspell ispell jka-compr disp-table paredit eldoc elisp-slime-nav help-mode whitespace company-files company-keywords company-etags etags company-gtags company-dabbrev-code company-dabbrev company-capf company skewer-setup smartparens redshank-loader projectile ibuffer-vc ibuf-ext ibuffer pkg-info find-func lisp-mnt epl grep compile comint thingatpt ido-at-point ido-vertical-mode ido-ubiquitous warnings flx-ido flx ido ibuf-macs savehist saveplace undo-tree diff key-chord guide-key face-remap popwin discover makey man ansi-color recentf tree-widget wid-edit browse-kill-ring winner ring diminish solarized-dark-theme solarized-definitions cl autorevert filenotify page-break-lines delsel paren hl-line server exec-path-from-shell rx easy-mmode advice help-fns s ucs-normalize dash-functional dash subr-x pcase cl-macs gv finder-inf eieio byte-opt bytecomp byte-compile cconv eieio-core edmacro kmacro info easymenu slime-autoloads package epg-config cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process cocoa ns multi-tty emacs) Memory information: ((conses 16 759686 83978) (symbols 48 45387 18) (miscs 40 1637 1304) (strings 32 105380 22526) (string-bytes 1 3126833) (vectors 16 136035) (vector-slots 8 3699462 25228) (floats 8 25664 1278) (intervals 56 3552 721) (buffers 960 35)) -- jbm