diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-04-15 17:15:25 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-04-16 14:12:44 +1000 |
commit | 75f5c3cd97e90ba19dde3d3d3b3679d5e14abe8c (patch) | |
tree | b420a46cccd6145269504f6b61fe85eeeeb3a600 /source4 | |
parent | 046c5824e4f28d07c96e5ad21bef415cfdcf090e (diff) | |
download | samba-75f5c3cd97e90ba19dde3d3d3b3679d5e14abe8c.tar.gz samba-75f5c3cd97e90ba19dde3d3d3b3679d5e14abe8c.tar.bz2 samba-75f5c3cd97e90ba19dde3d3d3b3679d5e14abe8c.zip |
s4-net: allow a username to be displayed in setpassword errors
the filter is a bit too cryptic
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 790cb2badc..d41b3ec637 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -153,7 +153,9 @@ pwdLastSet: 0 else: self.transaction_commit() - def setpassword(self, filter, password, force_change_at_next_login=False): + def setpassword(self, filter, password, + force_change_at_next_login=False, + username=None): """Sets the password for a user Note: This call uses the "userPassword" attribute to set the password. @@ -168,6 +170,9 @@ pwdLastSet: 0 try: res = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE, expression=filter, attrs=[]) + if len(res) == 0: + print('Unable to find user "%s"' % (username or filter)) + raise assert(len(res) == 1) user_dn = res[0].dn |