diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-08-14 10:46:38 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-08-14 18:48:19 +0200 |
commit | c335c5f54a2bb174b558f7edaced468e597c7ed6 (patch) | |
tree | 06f075ec29c525b8ffb1cc30a31830ab431f36ab /source4/dsdb/tests/python | |
parent | 4f6377043dc7a524a2afd05cd151c82350f06cfe (diff) | |
download | samba-c335c5f54a2bb174b558f7edaced468e597c7ed6.tar.gz samba-c335c5f54a2bb174b558f7edaced468e597c7ed6.tar.bz2 samba-c335c5f54a2bb174b558f7edaced468e597c7ed6.zip |
s4:passwords.py - perform testing of wrong old passwords on change operations
Diffstat (limited to 'source4/dsdb/tests/python')
-rwxr-xr-x | source4/dsdb/tests/python/passwords.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index de1889fbea..247ed1681b 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -155,6 +155,20 @@ add: unicodePwd unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """ """) + # Wrong old password + try: + self.ldb2.modify_ldif(""" +dn: cn=testuser,cn=users,""" + self.base_dn + """ +changetype: modify +delete: unicodePwd +unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')) + """ +add: unicodePwd +unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS4\"".encode('utf-16-le')) + """ +""") + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + # A change to the same password again will not work (password history) try: self.ldb2.modify_ldif(""" @@ -225,6 +239,20 @@ add: userPassword userPassword: thatsAcomplPASS2 """) + # Wrong old password + try: + self.ldb2.modify_ldif(""" +dn: cn=testuser,cn=users,""" + self.base_dn + """ +changetype: modify +delete: userPassword +userPassword: thatsAcomplPASS3 +add: userPassword +userPassword: thatsAcomplPASS4 +""") + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + # A change to the same password again will not work (password history) try: self.ldb2.modify_ldif(""" @@ -274,6 +302,22 @@ clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le' if num != ERR_NO_SUCH_ATTRIBUTE: raise LdbError(num, msg) + # Wrong old password + try: + self.ldb2.modify_ldif(""" +dn: cn=testuser,cn=users,""" + self.base_dn + """ +changetype: modify +delete: clearTextPassword +clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS3".encode('utf-16-le')) + """ +add: clearTextPassword +clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS4".encode('utf-16-le')) + """ +""") + self.fail() + except LdbError, (num, _): + # "NO_SUCH_ATTRIBUTE" is returned by Windows -> ignore it + if num != ERR_NO_SUCH_ATTRIBUTE: + self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + # A change to the same password again will not work (password history) try: self.ldb2.modify_ldif(""" |