0

In trying to debug auth failures from something that should be getting its auth info from auth-sources, I noticed an extremely weird thing: auth-source-search frequently returns nil for valid queries -- queries that in fact work elsewhere in the code.

For instance: I have these two lines in my .authinfo.gpg:

machine gmail.com login gastove password mypassword port xmpp
machine dev.urbanairship.com login gastove password myotherpassword

This:

(auth-source-search :host "dev.urbanairship.com")

Returns the very normal, expected:

((:host "dev.urbanairship.com" :user "gastove" :secret (lambda (&rest --cl-rest--) (apply ... ... ... --cl-rest--))))

But this:

(auth-source-search :host "gmail.com")

Returns the totally imponderable: nil. This makes even less sense because that line provide auth info to jabber.el, which is working normally. I've even confirmed jabber.el is reading my .authinfo.gpg by deleting that line. It's not like it's just the host -- a search for :user "gastove", for instance, only returns the second line, not the first.

So uh. What's going on? Any ideas?

Dan
  • 32,584
  • 6
  • 98
  • 168
Gastove
  • 1,511
  • 9
  • 15
  • How about trying: `(auth-source-search :max 1 :user "gastove" :host "gmail.com" :port "xmpp")` – lawlist Aug 07 '16 at 16:12
  • _Huh_. That works. It does *not* work if I omit the port. But, also I can query for the otherwise-unqueryable entries if I query only by `:port`. – Gastove Aug 08 '16 at 17:56
  • I pulled the formatting from the function `tramp-read-passwd` in `tramp.el`, but haven't spent any time dissecting the `auth-source.el` library to see what makes it tick. – lawlist Aug 08 '16 at 22:18
  • I see that there was a bug fix to `auth-source-ensure-strings` on 12/17/2015: https://github.com/jwiegley/emacs/commit/938495317a02b06a6c512832d0c6d9530fcd7f2b That may resolve your issue if you were using a version of Emacs that didn't contain that fix. – lawlist Mar 09 '17 at 18:56

0 Answers0