doc ftp,webdav: fallback to passwd=login when using base_crypt

At the test scripts for these modules, we need to know the password for
the user that's making the tests. If we detect that passwords are hashed
by base_crypt, don't use them and attempt to assume that login=passwd.

bzr revid: p_christ@hol.gr-20101228165814-sfbyxy9ngryyfaea
This commit is contained in:
P. Christeas 2010-12-28 18:58:14 +02:00
parent 545f5421c3
commit d807742f50
2 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,12 @@ def get_plain_ftp(timeout=10.0):
def get_ftp_login(cr, uid, ormobj):
ftp = get_plain_ftp()
user = ormobj.pool.get('res.users').read(cr, uid, uid)
ftp.login(user.get('login',''), user.get('password',''))
passwd = user.get('password','')
if passwd.startswith("$1$"):
# md5 by base crypt. We cannot decode, wild guess
# that passwd = login
passwd = user.get('login', '')
ftp.login(user.get('login',''), passwd)
ftp.cwd("/" + cr.dbname)
return ftp

View File

@ -364,6 +364,10 @@ class DAVClient(object):
assert res, "uid %s not found" % uid
self.user = res[0]['login']
self.passwd = res[0]['password']
if self.passwd.startswith('$1$'):
# md5 by base crypt. We cannot decode, wild guess
# that passwd = login
self.passwd = self.user
return True
def set_useragent(self, uastr):