unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs 29: Package netrc is deprecated
Date: Sun, 19 May 2024 13:58:03 +0200	[thread overview]
Message-ID: <8734qehv3o.fsf@dod.no> (raw)
In-Reply-To: <87frukluay.fsf@gmail.com> (Robert Pluim's message of "Tue, 14 May 2024 09:35:49 +0200")

>>>>> Robert Pluim <rpluim@gmail.com>:

> (auth-source-search :host "my.host.com" :port 993)

> (I guess the return format is different)

Yep! But getting that function name put me on the track to a solution! :-)

Thanks!

The function name landed me here: https://www.gnu.org/software/emacs/manual/html_mono/auth.html

From examples there I replaced 
  (setq blog (netrc-machine (netrc-parse netrc-file) "blog.mydomain.com" t))
with
  (setq blog (car (auth-source-search :host "blog.mydomain.com")))
and
         (list "my-blog"
               :url "http://blog.mydomain.com/xmlrpc.php"
               :username (netrc-get blog "login")
               :password (netrc-get blog "password")))))
with
         (list "my-blog"
               :url "http://blog.mydomain.com/xmlrpc.php"
               :username (plist-get blog :user)
               :password (auth-info-password blog)))))

plist-get can be used for all clear text entries in the return from auth-source-search

auth-info-password also unobfuscates the password.

Full config here: https://gist.github.com/steinarb/e844560f5850612361431b4cdc1ffbec
Diff here: https://gist.github.com/steinarb/258106dbce7052ec8cd6c831aedc17a1

Steinar> In the auth-source code there is lots of talk about backends, which I
Steinar> assume are Gnus backends, and little/nothing about using it as a netrc
Steinar> file parser.

> No, theyʼre auth source backends. .netrc, .authinfo, 'passʼ, oauth2
> etc.

Right! Since there is now no mention of netrc anywhere in the config, I
can presumably transparently search and use any auth source supported by
emacs?  At least: any auth source that can somehow return a clear text
password?

Thanks again!



  reply	other threads:[~2024-05-19 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 19:43 Emacs 29: Package netrc is deprecated Steinar Bang
2024-05-07  2:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-05-07 14:58   ` Steinar Bang
2024-05-07 15:12     ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-05-19 11:36       ` Steinar Bang
2024-05-14  7:35     ` Robert Pluim
2024-05-19 11:58       ` Steinar Bang [this message]
2024-05-20  9:10         ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734qehv3o.fsf@dod.no \
    --to=sb@dod.no \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).