Bugfix patch for offlineimap

Hello John,

i fixed some tiny bugs in offlineimap, mainly just for myself. They are
more dirty fixes than real bugfixes since I'm missing the deeper insight
into the code.
Especially the first one for Curses.py is very dirty and breaks the
scaling of the interface when the terminal size changes, but at least
the terminal is in proper state after exiting offlineimap.

In the order of appearance in the patchfile:
1. 'fixes' terminal breakage on quit of curses interface in python 2.6
to 2.6.5 (fixed since 2.6.6 http://bugs.python.org/issue7567)
2. fixes netrc password authentication
3. fixes user name querying from netrc

The patch is made for git revision 6b1cb5e036

Thanks a lot for the great application!

Best regards,
buergi
This commit is contained in:
buergi 2010-08-19 20:56:51 +02:00 committed by John Goerzen
parent 6b1cb5e036
commit 9239a2d326
3 changed files with 6 additions and 4 deletions

View File

@ -176,7 +176,7 @@ class IMAPServer:
challenge = response.strip() challenge = response.strip()
ui.debug('imap', 'md5handler: got challenge %s' % challenge) ui.debug('imap', 'md5handler: got challenge %s' % challenge)
passwd = self.getpassword() passwd = self.repos.getpassword()
retval = self.username + ' ' + hmac.new(passwd, challenge).hexdigest() retval = self.username + ' ' + hmac.new(passwd, challenge).hexdigest()
ui.debug('imap', 'md5handler: returning %s' % retval) ui.debug('imap', 'md5handler: returning %s' % retval)
return retval return retval
@ -184,7 +184,7 @@ class IMAPServer:
def plainauth(self, imapobj): def plainauth(self, imapobj):
UIBase.getglobalui().debug('imap', UIBase.getglobalui().debug('imap',
'Attempting plain authentication') 'Attempting plain authentication')
imapobj.login(self.username, self.getpassword()) imapobj.login(self.username, self.repos.getpassword())
def gssauth(self, response): def gssauth(self, response):
data = base64.b64encode(response) data = base64.b64encode(response)

View File

@ -109,7 +109,7 @@ class IMAPRepository(BaseRepository):
return user return user
try: try:
netrcentry = netrc.netrc().authentificator(self.gethost()) netrcentry = netrc.netrc().authenticators(self.gethost())
except IOError, inst: except IOError, inst:
if inst.errno != errno.ENOENT: if inst.errno != errno.ENOENT:
raise raise
@ -118,7 +118,7 @@ class IMAPRepository(BaseRepository):
return netrcentry[0] return netrcentry[0]
try: try:
netrcentry = netrc.netrc('/etc/netrc').authentificator(self.gethost()) netrcentry = netrc.netrc('/etc/netrc').authenticators(self.gethost())
except IOError, inst: except IOError, inst:
if inst.errno != errno.ENOENT: if inst.errno != errno.ENOENT:
raise raise

View File

@ -122,6 +122,8 @@ class CursesUtil:
del self.stdscr del self.stdscr
def reset(self): def reset(self):
# dirty walkaround for bug http://bugs.python.org/issue7567 in python 2.6 to 2.6.5 (fixed since #83743)
if (sys.version_info[0:3] >= (2,6) and sys.version_info[0:3] <= (2,6,5)): return
self.stop() self.stop()
self.start() self.start()