4udak / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
1 stars 1 forks source link

UnixAuthorizer with require_valid_shell option is broken #199

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

from pyftpdlib.contrib.authorizers import UnixAuthorizer
auth = UnixAuthorizer(require_valid_shell=True)
auth.validate_authentication('?!foo', '?!foo')

What is the expected output? What do you see instead?

We get an exception:

Traceback (most recent call last):
  File "foo.py", line 3, in <module>
    auth = UnixAuthorizer(require_valid_shell=True)
  File "/home/giampaolo/svn/pyftpdlib/pyftpdlib/contrib/authorizers.py", line 289, in __init__
    BaseUnixAuthorizer.__init__(self, anonymous_user)
  File "/home/giampaolo/svn/pyftpdlib/pyftpdlib/contrib/authorizers.py", line 145, in __init__
    raise AuthorizerError("super user privileges are required")
pyftpdlib.ftpserver.AuthorizerError: super user privileges are required
giampaolo@ubuntu:~/svn/pyftpdlib$ sudo python foo.py
Traceback (most recent call last):
  File "foo.py", line 4, in <module>
    auth.validate_authentication('?!foo', '?!foo')
  File "/home/giampaolo/svn/pyftpdlib/pyftpdlib/contrib/authorizers.py", line 327, in validate_authentication
    if not self._has_valid_shell(username):
  File "/home/giampaolo/svn/pyftpdlib/pyftpdlib/contrib/authorizers.py", line 361, in _has_valid_shell
    shell = pwd.getpwnam(username).pw_shell
KeyError: 'getpwnam(): name not found: ?!foo'

Original issue reported on code.google.com by g.rodola on 17 Jan 2012 at 5:56

GoogleCodeExporter commented 9 years ago
Fixed in r971.

Original comment by g.rodola on 20 Jan 2012 at 8:57

GoogleCodeExporter commented 9 years ago
0.7.0 is out. Closing this out as definitively fixed.

Original comment by g.rodola on 25 Jan 2012 at 7:24