#!/usr/bin/python
#
-# Add a new user to a Samba4 server
+# Sets a user password on a Samba4 server
# Copyright Jelmer Vernooij 2008
#
# Based on the original in EJS:
parser.add_option_group(credopts)
parser.add_option("--filter", help="LDAP Filter to set password on", type=str)
parser.add_option("--newpassword", help="Set password", type=str)
+parser.add_option("--must-change-at-next-login", help="Force password to be changed on next login", action="store_true")
opts, args = parser.parse_args()
samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
credentials=creds, lp=lp)
-samdb.setpassword(filter, password)
+samdb.setpassword(filter, password, force_password_change_at_next_login=opts.must_change_at_next_login)
+