Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: third_party/pyftpdlib/demo/md5_ftpd.py

Issue 16454: Add pyftpdlib for future ftp unit tests.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # md5_ftpd.py
3
4 """A basic ftpd storing passwords as hash digests (platform independent).
5 """
6
7 import md5
8 import os
9
10 from pyftpdlib import ftpserver
11
12
13 class DummyMD5Authorizer(ftpserver.DummyAuthorizer):
14
15 def validate_authentication(self, username, password):
16 hash = md5.new(password).hexdigest()
17 return self.user_table[username]['pwd'] == hash
18
19 if __name__ == "__main__":
20 # get a hash digest from a clear-text password
21 hash = md5.new('12345').hexdigest()
22 authorizer = DummyMD5Authorizer()
23 authorizer.add_user('user', hash, os.getcwd(), perm='elradfmw')
24 authorizer.add_anonymous(os.getcwd())
25 ftp_handler = ftpserver.FTPHandler
26 ftp_handler.authorizer = authorizer
27 address = ('', 21)
28 ftpd = ftpserver.FTPServer(address, ftp_handler)
29 ftpd.serve_forever()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698