Package: offlineimap
Version: 6.2.0+nmu2
Severity: normal
Tags: patch

When specifying maxconnections > 1, Kerberos authentication does not work. This
is due to self.gss_step and self.gss_vc not being cleaned up after successful
authentication. However, when specifying maxconnections > 2, the problem happens
despite the attached patch. I suspect the threads getting into each others way,
then again, I don’t know enough about offlineimap’s internals to fix it.

So, the attached patch works for maxconnections = 2 (at least every time I
tried) and should give you an idea where the problem is.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32.8-midna-2 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages offlineimap depends on:
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-support                1.0.4      automated rebuilding support for P

offlineimap recommends no packages.

Versions of packages offlineimap suggests:
ii  python-kerberos         1.1+svn4895-1+b1 A GSSAPI interface module for Pyth

-- no debconf information
--- /usr/share/pyshared/offlineimap/imapserver.py       2010-03-19 
16:08:03.043844214 +0100
+++ /tmp/imapserver.py  2010-03-19 16:07:52.763844519 +0100
@@ -187,8 +187,10 @@
         imapobj.login(self.username, self.getpassword())
 
     def gssauth(self, response):
+       UIBase.getglobalui().debug('imap', 'gssapi step = %d' % self.gss_step)
         data = base64.b64encode(response)
         try:
+            reset_state = False
             if self.gss_step == self.GSS_STATE_STEP:
                 if not self.gss_vc:
                     rc, self.gss_vc = kerberos.authGSSClientInit('imap@' + 
@@ -202,7 +204,15 @@
                 response = kerberos.authGSSClientResponse(self.gss_vc)
                 rc = kerberos.authGSSClientWrap(self.gss_vc, response,
                                                 self.username)
+                UIBase.getglobalui().debug('imap', 'rc = %d' % rc)
+                if rc == kerberos.AUTH_GSS_COMPLETE:
+                    reset_state = True
             response = kerberos.authGSSClientResponse(self.gss_vc)
+
+            if reset_state:
+                self.gss_step = self.GSS_STATE_STEP
+                self.gss_vc = None
+                UIBase.getglobalui().debug('imap', 'reset step')
         except kerberos.GSSError, err:
             # Kerberos errored out on us, respond with None to cancel the
             # authentication

Reply via email to