[Piers Lauder] Re: imaplib2 support for starttls

Piers Lauder piers at janeelix.com
Tue Apr 12 23:02:27 BST 2011


On Tue, 12 Apr 2011 19:15:03 +0200, Nicolas Sebrecht wrote:
  > 
  > [ I'm a bit tied by this 2-side discussion. Let's cc everybody.
  >   And please, keep cc'ing... ]
  > 
  > Hi Piers,
  > 
  > here is the reply of the OP at the OfflineIMAP mailing list for the test
  > against last sent imaplib2 file.
  > 
  > Please, do keep everybody in cc (including the mailing list) to get this
  > resolved efficiently.
  > 
  > Thanks.
  > 
  > On Tue, Apr 12, 2011 at 05:43:03PM +0200, dtk wrote:
  > > 
  > > Hi Sebastian,
  > > 
  > > Excerpts from Sebastian Spaeth's message of Tue Apr 12 17:16:14 +0200 2011:
  > > > And here is a patch. Could someone who can test STARTTLS see if it works?
  > > weeeeell. It changes *something* ;P
  > > 
  > > [bash]
  > >     $ ./offlineimap.py -c ../../configs/starttls.rc
  > >      OfflineIMAP 6.3.2
  > >     Copyright (C) 2002 - 2010 John Goerzen <john at complete.org>
  > > 
  > >     This software comes with ABSOLUTELY NO WARRANTY; see the file
  > >     COPYING for details.  This is free software, and you are welcome
  > >     to distribute it under the conditions laid out in COPYING.
  > >     Account sync Test:
  > >      ***** Processing account Test
  > >      Copying folder structure from IMAP to Maildir
  > >      Establishing connection to mail.jade-hamburg.de:143.
  > >      WARNING: Error occured attempting to sync account Test: Traceback (most recent call last):
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/accounts.py", line 191, in syncrunner
  > >         self.sync(siglistener)
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/accounts.py", line 246, in sync
  > >         remoterepos.syncfoldersto(localrepos, [statusrepos])
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/repository/Base.py", line 121, in syncfoldersto
  > >         srcfolders = src.getfolders()
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/repository/IMAP.py", line 242, in getfolders
  > >         imapobj = self.imapserver.acquireconnection()
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/imapserver.py", line 256, in acquireconnection
  > >         listres = imapobj.list(self.reference, '""')[1]
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplib2.py", line 772, in list
  > >         return self._simple_command(name, directory, pattern, **kw)
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplib2.py", line 1514, in _simple_command
  > >         return self._command_complete(self._command(name, *args), kw)
  > >       File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplib2.py", line 1210, in _command
  > >         % (name, self.state))
  > >     error: command LIST illegal in state NONAUTH
  > > 
  > >      ***** Finished processing account Test
  > > $
  > > [/bash]

"state NONAUTH" means that the imaplib login() function has not been
called for the connection. A starttls() call does not affect the state.

Anyway, I'm assuming that the starttls() terminated correctly, so the
fix I posted worked. Excellent!


  > > 
  > > So auth seems to break. But at least it's not hanging anymore. Cannot think
  > > about whether that is another error in imaplib2 or in offlineimap right now,
  > > *really* should be working -.-
  > > 
  > > l8r
  > > dtk
  > 
  > -- 
  > Nicolas Sebrecht

Piers Lauder.






More information about the OfflineIMAP-project mailing list