diff options
Diffstat (limited to 'source4/scripting/python')
8 files changed, 10 insertions, 49 deletions
diff --git a/source4/scripting/python/samba/netcmd/domainlevel.py b/source4/scripting/python/samba/netcmd/domainlevel.py index fb26dd09de..c97ed7bad6 100644 --- a/source4/scripting/python/samba/netcmd/domainlevel.py +++ b/source4/scripting/python/samba/netcmd/domainlevel.py @@ -73,12 +73,7 @@ class cmd_domainlevel(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) domain_dn = SamDB.domain_dn(samdb) diff --git a/source4/scripting/python/samba/netcmd/dsacl.py b/source4/scripting/python/samba/netcmd/dsacl.py index f846b26345..58fb9c611a 100644 --- a/source4/scripting/python/samba/netcmd/dsacl.py +++ b/source4/scripting/python/samba/netcmd/dsacl.py @@ -132,15 +132,11 @@ class cmd_ds_acl_set(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if car == None or action == None or objectdn == None or trusteedn == None: + if (car is None or action is None or objectdn is None or + trusteedn is None): return self.usage() - if host is not None: - url = host - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=host, session_info=system_session(), credentials=creds, lp=lp) cars = {'change-rid' : GUID_DRS_CHANGE_RID_MASTER, 'change-pdc' : GUID_DRS_CHANGE_PDC, diff --git a/source4/scripting/python/samba/netcmd/enableaccount.py b/source4/scripting/python/samba/netcmd/enableaccount.py index d4af0a84f1..0e57b5714c 100644 --- a/source4/scripting/python/samba/netcmd/enableaccount.py +++ b/source4/scripting/python/samba/netcmd/enableaccount.py @@ -55,11 +55,6 @@ class cmd_enableaccount(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.enable_account(filter) diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py index 171b89a2aa..bcf80ce290 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -135,12 +135,7 @@ all=all of the above"""), lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if host is not None: - url = host - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=host, session_info=system_session(), credentials=creds, lp=lp) domain_dn = SamDB.domain_dn(samdb) diff --git a/source4/scripting/python/samba/netcmd/newuser.py b/source4/scripting/python/samba/netcmd/newuser.py index 6f12de50e7..3815219460 100644 --- a/source4/scripting/python/samba/netcmd/newuser.py +++ b/source4/scripting/python/samba/netcmd/newuser.py @@ -59,12 +59,7 @@ class cmd_newuser(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), credentials=creds, + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.newuser(username, unixname, password, force_password_change_at_next_login_req=must_change_at_next_login) diff --git a/source4/scripting/python/samba/netcmd/pwsettings.py b/source4/scripting/python/samba/netcmd/pwsettings.py index 50525cc5ce..dda009ae06 100644 --- a/source4/scripting/python/samba/netcmd/pwsettings.py +++ b/source4/scripting/python/samba/netcmd/pwsettings.py @@ -69,12 +69,7 @@ class cmd_pwsettings(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) domain_dn = SamDB.domain_dn(samdb) diff --git a/source4/scripting/python/samba/netcmd/setexpiry.py b/source4/scripting/python/samba/netcmd/setexpiry.py index 0c5dc5afff..b95192aa9c 100644 --- a/source4/scripting/python/samba/netcmd/setexpiry.py +++ b/source4/scripting/python/samba/netcmd/setexpiry.py @@ -61,12 +61,7 @@ class cmd_setexpiry(Command): if days is None: days = 0 - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.setexpiry(filter, days*24*3600, no_expiry_req=noexpiry) diff --git a/source4/scripting/python/samba/netcmd/setpassword.py b/source4/scripting/python/samba/netcmd/setpassword.py index e86711d9ce..c4a9b00698 100644 --- a/source4/scripting/python/samba/netcmd/setpassword.py +++ b/source4/scripting/python/samba/netcmd/setpassword.py @@ -65,12 +65,7 @@ class cmd_setpassword(Command): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) - if H is not None: - url = H - else: - url = lp.get("sam database") - - samdb = SamDB(url=url, session_info=system_session(), + samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) samdb.setpassword(filter, password, |