Projects
Kolab:Winterfell
pykolab
0002-ID-directly-after-authentication-before-as...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-ID-directly-after-authentication-before-asking-for-a.patch of Package pykolab (Revision 15)
Currently displaying revision
15
,
Show latest
From 132ea08148dfb903af3bffa1a2f74c7145a6e504 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> Date: Mon, 4 Jul 2016 09:36:48 +0200 Subject: [PATCH 2/2] ID directly after authentication, before asking for admin or hierarchy separators --- cyruslib.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cyruslib.py b/cyruslib.py index 3802c00..9e42f39 100644 --- a/cyruslib.py +++ b/cyruslib.py @@ -130,7 +130,7 @@ class IMAP4(imaplib.IMAP4): def id(self): try: - typ, dat = self._simple_command('ID', 'NIL') + typ, dat = self._simple_command('ID', '("name" "PyKolab/Kolab")') res, dat = self._untagged_response(typ, dat, 'ID') except: return False, dat[0] @@ -211,7 +211,7 @@ class IMAP4_SSL(imaplib.IMAP4_SSL): def id(self): try: - typ, dat = self._simple_command('ID', 'NIL') + typ, dat = self._simple_command('ID', '("name" "PyKolab/Kolab")') res, dat = self._untagged_response(typ, dat, 'ID') except: return False, dat[0] @@ -275,6 +275,7 @@ class IMAP4_SSL(imaplib.IMAP4_SSL): encoded = b2a_base64("%s\0%s\0%s" % (admin, admin, password)).strip() res, data = self._simple_command('AUTHENTICATE', 'PLAIN', encoded) + self.AUTH = True if ok(res): self.state = 'AUTH' return res, data @@ -409,8 +410,11 @@ class CYRUS: self.__doexception("LOGIN", self.ERROR.get("AUTH")[1]) try: res, msg = self.m.login(username, password) + self.AUTH = True + self.id() admin = self.m.isadmin() except Exception, info: + self.AUTH = False error = str(info).split(':').pop().strip() self.__doexception("LOGIN", error) @@ -418,7 +422,6 @@ class CYRUS: self.ADMIN = username self.SEP = self.m.getsep() - self.AUTH = True self.__verbose( '[LOGIN %s] %s: %s' % (username, res, msg[0]) ) def login_plain(self, username, password, asUser = None): @@ -430,6 +433,8 @@ class CYRUS: self.__verbose( '[AUTHENTICATE PLAIN %s] %s: %s' % (username, res, msg[0]) ) if ok(res): + self.AUTH = True + self.id() if asUser is None: if self.m.isadmin(): self.ADMIN = admin @@ -437,7 +442,6 @@ class CYRUS: self.ADMIN = asUser self.AUSER = asUser self.SEP = self.m.getsep() - self.AUTH = True def logout(self): try: -- 2.5.5
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.