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?

  • How about trying: (auth-source-search :max 1 :user "gastove" :host "gmail.com" :port "xmpp") – lawlist Aug 7 '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 8 '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 8 '16 at 22:18
  • I see that there was a bug fix to auth-source-ensure-strings on 12/17/2015: github.com/jwiegley/emacs/commit/… That may resolve your issue if you were using a version of Emacs that didn't contain that fix. – lawlist Mar 9 '17 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.