From d7d19fdc84d73fda85e1794af7c7122ded6b24bb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 22 Aug 2010 14:51:12 +1000 Subject: s4-net: better error message on net setpassword --- source4/scripting/python/samba/netcmd/setpassword.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/netcmd/setpassword.py b/source4/scripting/python/samba/netcmd/setpassword.py index e01fa23ab9..047a95afae 100644 --- a/source4/scripting/python/samba/netcmd/setpassword.py +++ b/source4/scripting/python/samba/netcmd/setpassword.py @@ -26,6 +26,7 @@ from getpass import getpass from samba.auth import system_session from samba.samdb import SamDB from samba import gensec +import ldb class cmd_setpassword(Command): """(Re)sets the password on a user account""" @@ -74,6 +75,7 @@ class cmd_setpassword(Command): samdb.setpassword(filter, password, force_change_at_next_login=must_change_at_next_login, username=username) - except: - raise CommandError('Failed to set password for user "%s"' % - username) + except ldb.LdbError, (num, msg): + raise CommandError('Failed to set password for user "%s" - %s' % + (username, msg)) + print "Changed password OK" -- cgit