Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; password - mailbox password. NB: mailbox is locked by server from here to 'quit()'
(self, user, password)
| 316 | timestamp = re.compile(br'\+OK.[^<]*(<.*>)') |
| 317 | |
| 318 | def apop(self, user, password): |
| 319 | """Authorisation |
| 320 | |
| 321 | - only possible if server has supplied a timestamp in initial greeting. |
| 322 | |
| 323 | Args: |
| 324 | user - mailbox user; |
| 325 | password - mailbox password. |
| 326 | |
| 327 | NB: mailbox is locked by server from here to 'quit()' |
| 328 | """ |
| 329 | secret = bytes(password, self.encoding) |
| 330 | m = self.timestamp.match(self.welcome) |
| 331 | if not m: |
| 332 | raise error_proto('-ERR APOP not supported by server') |
| 333 | import hashlib |
| 334 | digest = m.group(1)+secret |
| 335 | digest = hashlib.md5(digest).hexdigest() |
| 336 | return self._shortcmd('APOP %s %s' % (user, digest)) |
| 337 | |
| 338 | |
| 339 | def top(self, which, howmuch): |
nothing calls this directly
no test coverage detected