Complete.Org: Mailing Lists: Archives: offlineimap: December 2008:
Re: Patch: enable offlineimap to get password from /etc/netrc
Home

Re: Patch: enable offlineimap to get password from /etc/netrc

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: offlineimap@xxxxxxxxxxxx
Subject: Re: Patch: enable offlineimap to get password from /etc/netrc
From: Jim Pryor <lists+offlineimap@xxxxxxxxxxxx>
Date: Tue, 2 Dec 2008 10:45:25 -0500

On Mon, Dec 01, 2008 at 04:17:47PM -0600, John Goerzen wrote:
> Jim Pryor wrote:
> > Attached is a patch that enables offlineimap to get its password from a
> > system-wide /etc/netrc file if there's no user-specific ~/.netrc.
> > I wanted to use a system-wide /etc/netrc file because I have some
> > system daemons sometimes sending me email. I use msmtp, which doesn't do
> > local mail. It will only send mail through external smtp servers. I've
> > also patched msmtp to be capable or retrieving passwords from
> > /etc/netrc. So now I can just put my email address in that one file, and
> > all my daemons and cronjobs and everything can get the email credentials
> > they need from that one place.
> > 
> 
> I would be happy to apply this, if you would be willing to add a
> corresponding patch to offlineimap.conf documenting the new
> functionality, especially since this is a nonstandard behavior.
> 
> Actually, perhaps what we need is a configuration directive stating what
> netrc file to use?

That would give more flexibility, but it would be idiosyncratic
behavior. The pattern of "use ~/.CONFIG if it's available, else use
/etc/CONFIG if it's available, else used compiled-in defaults" is much
more familiar and widespread.

Here's a patch against the offlineimap.conf from v.6.0.3.


diff -ur offlineimap-orig4/offlineimap.conf offlineimap-base/offlineimap.conf
--- offlineimap-orig4/offlineimap.conf  2008-12-02 09:31:03.000000000 -0500
+++ offlineimap-base/offlineimap.conf   2008-12-02 10:40:57.000000000 -0500
@@ -250,10 +250,11 @@
 # There are five ways to give the password for the remote IMAP
 # server:
 #
-# 1. No password at all specified in the config file. If a matching
-#    entry is found in ~/.netrc (see netrc (5) for information) the
-#    password from the matching entry will be used. Otherwise you
-#    will be prompted for the password when OfflineIMAP starts.
+# 1. No password at all specified in the config file. If a matching entry is
+#    found in ~/.netrc (see netrc (5) for information) the password from the
+#    matching entry will be used. If there is no ~/.netrc file but there is an
+#    /etc/netrc file, the password will instead be taken from there. Otherwise 
+#    you will be prompted for the password when OfflineIMAP starts.
 #
 # 2. The remote password stored in this file with the remotepass
 #    option. Example:



-- 
Jim Pryor
jim@xxxxxxxxxxxx



[Prev in Thread] Current Thread [Next in Thread]