Pan Tsu | 21 Mar 11:12 2011
Picon

~/.netrc & multiple accounts with same <at> domain

offlineimap is unable to get password from ~/.netrc when it contains
more than one entry for `machine'

  machine imap.gmail.com login foo password blah
  machine imap.gmail.com login bar password blah

where the last one wins, i.e. `bar'. It'll ask password for `foo'
account when running in TTY.TTYUI.

OTOH, msmtp which I use to send mails picks the right password without issues.

--
$ offlineimap --version
6.3.2

_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap

David Soulayrol | 21 Mar 14:27 2011
Picon

Re: ~/.netrc & multiple accounts with same <at> domain

hello,

2011/3/21 Pan Tsu <inyaoo <at> gmail.com>:
> offlineimap is unable to get password from ~/.netrc when it contains
> more than one entry for `machine'
>
>  machine imap.gmail.com login foo password blah
>  machine imap.gmail.com login bar password blah
>

I'm really interested in a nice fix for this problem too. My current
workaround is to use two domain names which point to the same server
(at ovh.net), but that's a bit annoying.

--

-- 
David

_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap
Pan Tsu | 22 Mar 15:27 2011
Picon

Re: ~/.netrc & multiple accounts with same <at> domain

David Soulayrol <david.soulayrol <at> gmail.com> writes:

> 2011/3/21 Pan Tsu <inyaoo <at> gmail.com>:
>> offlineimap is unable to get password from ~/.netrc when it contains
>> more than one entry for `machine'
>>
>>   machine imap.gmail.com login foo password blah
>>   machine imap.gmail.com login bar password blah
>>
>
> I'm really interested in a nice fix for this problem too. My current
> workaround is to use two domain names which point to the same server
> (at ovh.net), but that's a bit annoying.

Here is another workaround using remotepasseval.

  [general]
  pythonfile = ~/.offlineimap.py

  [Repository foo|remote]
  type = Gmail
  remoteuser = foo
  remotepasseval = getnetrc(machine='imap.gmail.com', login='foo')['password']

-- crapcode begins --
import os

def getnetrc(authinfo=None, **match):
    '''A dumb filter for ~/.netrc. It understands oneline entries,
    comments and default entry. No macros or multiline entries.
(Continue reading)

Sebastian Spaeth | 21 Mar 17:21 2011
Picon

Re: ~/.netrc & multiple accounts with same <at> domain

On Mon, 21 Mar 2011 13:12:42 +0300, Pan Tsu <inyaoo <at> gmail.com> wrote:
> offlineimap is unable to get password from ~/.netrc when it contains
> more than one entry for `machine'
>   machine imap.gmail.com login foo password blah
>   machine imap.gmail.com login bar password blah
> 
> where the last one wins, i.e. `bar'. It'll ask password for `foo'
> account when running in TTY.TTYUI.
> 
> OTOH, msmtp which I use to send mails picks the right password without issues.

We are simply using the netrc library that python provides:

http://docs.python.org/library/netrc.html

Care to file a bug against them at bugs.python.org?

Sebastian
_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap
Sebastian Spaeth | 21 Mar 17:23 2011
Picon

Re: ~/.netrc & multiple accounts with same <at> domain

On Mon, 21 Mar 2011 13:12:42 +0300, Pan Tsu <inyaoo <at> gmail.com> wrote:
> offlineimap is unable to get password from ~/.netrc when it contains
> more than one entry for `machine'
> 
>   machine imap.gmail.com login foo password blah
>   machine imap.gmail.com login bar password blah
> 
> where the last one wins, i.e. `bar'. It'll ask password for `foo'
> account when running in TTY.TTYUI.

Actually looking at the netrc library doc in python, it should be
possible to tickle out different user names against the same host
name. I might have a look at it soon.

Sebastian
_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap

Gmane