diff options
Diffstat (limited to 'source4/scripting/python/samba/netcmd/setpassword.py')
-rw-r--r-- | source4/scripting/python/samba/netcmd/setpassword.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/netcmd/setpassword.py b/source4/scripting/python/samba/netcmd/setpassword.py index c4a9b00698..a1fe75c029 100644 --- a/source4/scripting/python/samba/netcmd/setpassword.py +++ b/source4/scripting/python/samba/netcmd/setpassword.py @@ -22,7 +22,7 @@ import samba.getopt as options from samba.netcmd import Command, CommandError, Option - +import sys from getpass import getpass from samba.auth import system_session from samba.samdb import SamDB @@ -68,5 +68,11 @@ class cmd_setpassword(Command): samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) - samdb.setpassword(filter, password, - force_change_at_next_login=must_change_at_next_login) + try: + samdb.setpassword(filter, password, + force_change_at_next_login=must_change_at_next_login, + username=username) + except: + print('Failed to set password for user "%s"' % username) + sys.exit(1) + |