Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ccc2e3d

Browse files
author
Moshe Zadka
committed
OK, checking in patch 103329.
Please check it against your nearest pop server -- mine doesn't support APOP (I checked I'm getting the same error message, though)
1 parent 2e9b396 commit ccc2e3d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/poplib.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Imports
1717

18-
import regex, socket, string
18+
import re, socket, string
1919

2020
# Exception raised when an error or invalid response is received:
2121

@@ -263,7 +263,7 @@ def rpop(self, user):
263263
return self._shortcmd('RPOP %s' % user)
264264

265265

266-
timestamp = regex.compile('\+OK.*\(<[^>]+>\)')
266+
timestamp = re.compile(r'\+OK.*(<[^>]+>)')
267267

268268
def apop(self, user, secret):
269269
"""Authorisation
@@ -276,10 +276,11 @@ def apop(self, user, secret):
276276
277277
NB: mailbox is locked by server from here to 'quit()'
278278
"""
279-
if self.timestamp.match(self.welcome) <= 0:
279+
m = self.timestamp.match(self.welcome)
280+
if not m:
280281
raise error_proto('-ERR APOP not supported by server')
281282
import md5
282-
digest = md5.new(self.timestamp.group(1)+secret).digest()
283+
digest = md5.new(m.group(1)+secret).digest()
283284
digest = string.join(map(lambda x:'%02x'%ord(x), digest), '')
284285
return self._shortcmd('APOP %s %s' % (user, digest))
285286

0 commit comments

Comments
 (0)