Bug 510036

Summary: offlineimap 6.1.0 can't login via Kerberos anymore
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: offlineimapAssignee: Christoph Höger <choeger>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: choeger
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-28 13:30:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
offlineimap log from 6.0.3 (working)
none
offlineimap log from 6.1.0 (broken)
none
new imaplib2 from upstream none

Description Michal Schmidt 2009-07-07 14:20:41 UTC
Created attachment 350804 [details]
offlineimap log from 6.0.3 (working)

Description of problem:
I've been using offlineimap-6.0.3-3.fc11 against a kerberized IMAP server with no problems. After upgrading to offlineimap-6.1.0-2.fc11, offlineimap is unable to login to the remote IMAP server via Kerberos and falls back to asking for a password (which works). Downgrading to 6.0.3 makes it work again.

Version-Release number of selected component (if applicable):
offlineimap-6.1.0-2.fc11

How reproducible:
always

Steps to Reproduce:
1. kinit
2. offlineimap
  
Actual results:
offlineimap prompts me to "Enter password:".

Expected results:
offlineimap should be able to login using my Kerberos ticket.

Additional info:
See the attached logs from 6.0.3 and 6.1.0 made using offlineimap -d imap -l /tmp/log.txt.

Comment 1 Michal Schmidt 2009-07-07 14:21:24 UTC
Created attachment 350805 [details]
offlineimap log from 6.1.0 (broken)

Comment 2 Christoph Höger 2009-07-07 18:27:00 UTC
Hi Michal,

honestly, I am not quite sure, what happens with your token. The bug is probably somewhere inside imaplib2.py which is new in that release. If you could have a talk with the server admin or add some debugging code to imaplib2.py (inside offlineimaps site-package dir) that may help.
The problem: That lib does not have a real upstream. Only one developer and no collaboration tools at all. 
I'll see what upstream says on that. Thanks for testing that before the push - I am going to delay the update while this bug hangs around since I guess kerberos is pretty important.

regards

Christoph

Comment 3 Michal Schmidt 2009-07-09 00:18:51 UTC
OK, here's what I found so far:
In imaplib2.py the function _command creates a Request object 'crqb' to expect an IMAP continuation, then waits for it. The Request object has a threading.Event object which gets signalled by the reader thread when the continuation arrives. The problems is _command then goes through its 'While True:' loop again and reuses the same 'crqb' object. This object has the Event already set even if no other response arrived from the server yet. So _command does not wait as it should and calls 'literator' too soon, without having meaningful data for it. The 'literator' (which is really the gssapi state machine) gets confused and aborts the authentication process.
Not sure what the proper fix is, but a slightly racy workaround could be:

diff --git a/offlineimap/imaplib2.py b/offlineimap/imaplib2.py
index 2426754..c17f3c3 100644
--- a/offlineimap/imaplib2.py
+++ b/offlineimap/imaplib2.py
@@ -142,6 +142,7 @@ class Request(object):
     def get_response(self, exc_fmt=None):
         self.callback = None
         self.ready.wait()
+        self.ready.clear()
 
         if self.aborted is not None:
             typ, val = self.aborted

Comment 4 Christoph Höger 2009-07-09 09:04:25 UTC
That looks correct. Did that fix your bug?

Comment 5 Michal Schmidt 2009-07-09 10:29:02 UTC
Yes, I'm using offlineimap 6.1.0 + this single line patch and it's working fine for me with Kerberos now.

Comment 6 Christoph Höger 2009-07-10 08:53:14 UTC
Created attachment 351222 [details]
new imaplib2 from upstream

Could you please check if this version of imaplib2 also fixes that bug?
Upstream asks for it.

Comment 7 Michal Schmidt 2009-07-10 12:01:11 UTC
Yes, this new version of imaplib2 fixes the bug.

Comment 8 Fedora Update System 2009-07-17 14:13:40 UTC
offlineimap-6.1.2-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/offlineimap-6.1.2-1.fc11

Comment 9 Fedora Update System 2009-07-22 21:48:05 UTC
offlineimap-6.1.2-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update offlineimap'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-7844

Comment 10 Bug Zapper 2010-04-27 15:31:50 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 11 Bug Zapper 2010-06-28 13:30:35 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.