all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19074: 24.4; Bug in auth-source.el's search of OS X Keychain
@ 2014-11-17  4:04 John Mastro
  2014-11-17  5:38 ` bug#19074: " John Mastro
  0 siblings, 1 reply; 63+ messages in thread
From: John Mastro @ 2014-11-17  4:04 UTC (permalink / raw)
  To: 19074

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 <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))))

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 <return> 
M-= M-= M-w C-x b C-g C-v C-v C-x b <return> 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 <backspace> <return> 
M-o C-x b <return> C-p C-p C-p M-f M-f M-f M-= M-= 
M-w C-x b <return> 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 <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
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 <backspace> 
v a l u e SPC o f A-H-s-÷µ¹¶ C-n <M-backspace> <M-backspace> 
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 <backspace> <backspace> <backspace> d r o <return> 
<return> e m <return> p a t C-n <return> C-h C-k q 
M-x r e p o r t - e m a c s - b u g <return>

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





^ permalink raw reply related	[flat|nested] 63+ messages in thread

end of thread, other threads:[~2014-11-29 22:28 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  4:04 bug#19074: 24.4; Bug in auth-source.el's search of OS X Keychain John Mastro
2014-11-17  5:38 ` bug#19074: " John Mastro
2014-11-26 14:17   ` Ted Zlatanov
2014-11-26 15:57     ` Stefan Monnier
     [not found]       ` <87wq6hap7v.fsf@lifelogs.com>
2014-11-26 18:59         ` merging emacs-24 (was: bug#19074: Bug in auth-source.el's search of OS X Keychain) Stefan Monnier
2014-11-26 19:02           ` merging emacs-24 David Engster
2014-11-26 20:01             ` Ted Zlatanov
2014-11-26 22:16             ` Stefan Monnier
2014-11-27 17:27               ` David Engster
2014-11-27 17:55                 ` Eli Zaretskii
2014-11-27 18:31                   ` Andreas Schwab
2014-11-27 18:42                     ` Eli Zaretskii
2014-11-27 18:46                       ` David Engster
2014-11-27 18:55                         ` Eli Zaretskii
2014-11-27 19:21                           ` David Engster
2014-11-27 21:05                         ` Stefan Monnier
2014-11-27 22:24                           ` David Engster
2014-11-28  0:28                             ` Ted Zlatanov
2014-11-28  8:20                               ` Eli Zaretskii
2014-11-28 14:20                                 ` Michael Welsh Duggan
2014-11-28 14:59                                   ` Eli Zaretskii
2014-11-28 15:06                                     ` Michael Welsh Duggan
2014-11-28 14:37                                 ` David Kastrup
2014-11-28 15:14                                   ` Eli Zaretskii
2014-11-29 12:55                             ` Eli Zaretskii
2014-11-29 20:01                               ` Glenn Morris
2014-11-29 20:33                                 ` Eli Zaretskii
2014-11-27  1:54           ` Ted Zlatanov
2014-11-27  2:01             ` Óscar Fuentes
2014-11-27  2:32               ` Ted Zlatanov
2014-11-27  3:48                 ` Glenn Morris
2014-11-27  3:59                   ` Glenn Morris
2014-11-27 10:45                     ` Andreas Schwab
2014-11-27 13:02                   ` Ted Zlatanov
2014-11-27 16:23                     ` Eli Zaretskii
2014-11-27 17:11                       ` Andreas Schwab
2014-11-27 17:44                         ` Eli Zaretskii
2014-11-27 17:56                           ` Andreas Schwab
2014-11-27 18:04                             ` Eli Zaretskii
2014-11-28  8:33                               ` Andreas Schwab
2014-11-28  8:54                                 ` Eli Zaretskii
2014-11-28 15:44                                   ` Sergey Organov
2014-11-28 15:56                                     ` David Kastrup
2014-11-27 17:17                     ` Stefan Monnier
2014-11-27 17:32                     ` David Engster
2014-11-27 17:59                       ` Andreas Schwab
2014-11-28  0:30                       ` Ted Zlatanov
2014-11-28  2:55                       ` Stephen J. Turnbull
2014-11-28  3:29                         ` Stephen J. Turnbull
2014-11-28  8:27                           ` Eli Zaretskii
2014-11-28  0:31                     ` Ted Zlatanov
2014-11-29  7:20                       ` Paul Eggert
2014-11-29 21:27                         ` Glenn Morris
2014-11-29 22:28                           ` generating Chan(was: merging emacs-24) Paul Eggert
2014-11-28  0:33                     ` merging emacs-24 Ted Zlatanov
2014-11-28  8:22                       ` Andreas Schwab
2014-11-28  8:31                       ` Eli Zaretskii
2014-11-28 14:29                         ` Stefan Monnier
2014-11-29 20:02                           ` Glenn Morris
2014-11-27 16:10                   ` Eli Zaretskii
2014-11-29 20:13                     ` Glenn Morris
2014-11-26 22:30     ` bug#19074: Bug in auth-source.el's search of OS X Keychain Katsumi Yamaoka
2014-11-27  1:24       ` Ted Zlatanov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.