the filter is a bit too cryptic
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
else:
self.transaction_commit()
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.
"""Sets the password for a user
Note: This call uses the "userPassword" attribute to set the password.
try:
res = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
expression=filter, attrs=[])
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
assert(len(res) == 1)
user_dn = res[0].dn