Tres Seaver
2012-03-19 c272cee1fdae0ee51946bf1ad07ed468d63e2fb3
Suppress ResourceWarning spew under Py3k.
2 files modified
8 ■■■■ changed files
repoze/who/plugins/auth_tkt.py 3 ●●●● patch | view | raw | blame | history
repoze/who/plugins/htpasswd.py 5 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/auth_tkt.py
@@ -219,7 +219,8 @@
        secretfile = os.path.abspath(os.path.expanduser(secretfile))
        if not os.path.exists(secretfile):
            raise ValueError("No such 'secretfile': %s" % secretfile)
        secret = open(secretfile).read().strip()
        with open(secretfile) as f:
            secret = f.read().strip()
    if timeout:
        timeout = int(timeout)
    if reissue_time:
repoze/who/plugins/htpasswd.py
@@ -38,9 +38,11 @@
            # assumed to have a readline
            self.filename.seek(0)
            f = self.filename
            must_close = False
        else:
            try:
                f = open(self.filename, 'r')
                must_close = True
            except IOError:
                environ['repoze.who.logger'].warn('could not open htpasswd '
                                                  'file %s' % self.filename)
@@ -63,6 +65,9 @@
                maybe_user = username
                to_check = hashed
        if must_close:
            f.close()
        # Check *something* here, to mitigate a timing attack.
        password_ok = self.check(password, to_check)