From dc0c89cf405e7cc1d66540c4f94b1b395da2439a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 29 Nov 2010 16:57:25 +1100 Subject: s4-samdb: give a better exception if multiple users match in password change --- source4/scripting/python/samba/samdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 67e77e303b..a7f474d134 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -372,7 +372,8 @@ member: %s expression=search_filter, attrs=[]) if len(res) == 0: raise Exception('Unable to find user "%s"' % (username or search_filter)) - assert(len(res) == 1) + if len(res) > 1: + raise Exception('Matched %u multiple users with filter "%s"' % (len(res), search_filter)) user_dn = res[0].dn setpw = """ dn: %s -- cgit