MCPcopy
hub / github.com/OfflineIMAP/offlineimap / __plainhandler

Method __plainhandler

offlineimap/imapserver.py:201–221  ·  view source on GitHub ↗

Implements SASL PLAIN authentication, RFC 4616, http://tools.ietf.org/html/rfc4616

(self, response)

Source from the content-addressed store, hash-verified

199 imapobj.login(self.username, self.__getpassword())
200
201 def __plainhandler(self, response):
202 """Implements SASL PLAIN authentication, RFC 4616,
203 http://tools.ietf.org/html/rfc4616"""
204
205 authc = self.username
206 if not authc:
207 raise OfflineImapError("No username provided for '%s'"
208 % self.repos.getname(),
209 OfflineImapError.ERROR.REPO)
210
211 passwd = self.__getpassword()
212 authz = b''
213 if self.user_identity != None:
214 authz = self.user_identity
215 # At this point all authz, authc and passwd are expected bytes encoded
216 # in UTF-8.
217 NULL = b'\x00'
218 retval = NULL.join((authz, authc, passwd))
219 logsafe_retval = NULL.join((authz, authc, b'(passwd hidden for log)'))
220 self.ui.debug('imap', '__plainhandler: returning %s'% logsafe_retval)
221 return retval
222
223 def __xoauth2handler(self, response):
224 now = datetime.datetime.now()

Callers

nothing calls this directly

Calls 5

__getpasswordMethod · 0.95
OfflineImapErrorClass · 0.90
joinMethod · 0.80
getnameMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected