summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-22 14:51:12 +1000
committerAndrew Tridgell <tridge@samba.org>2010-08-22 14:57:34 +1000
commitd7d19fdc84d73fda85e1794af7c7122ded6b24bb (patch)
treee009c7a9260161eac9ae98aa42b81e9c5fb2ad82
parenta2012dfc6b73f74fb9e9e3d815f3b8ede340f552 (diff)
downloadsamba-d7d19fdc84d73fda85e1794af7c7122ded6b24bb.tar.gz
samba-d7d19fdc84d73fda85e1794af7c7122ded6b24bb.tar.bz2
samba-d7d19fdc84d73fda85e1794af7c7122ded6b24bb.zip
s4-net: better error message on net setpassword
-rw-r--r--source4/scripting/python/samba/netcmd/setpassword.py8
1 files changed, 5 insertions, 3 deletions
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"