From: David Mulder Date: Wed, 16 May 2018 14:04:20 +0000 (-0600) Subject: gpupdate: Remove the unnecessary url parameter X-Git-Tag: tdb-1.3.17~1419 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=f702ad943eb94d9d7964e8dec91a4708a43c81a3 gpupdate: Remove the unnecessary url parameter The samdb object isn't initialized here anymore, but in the gp_sec_ext, so this parameter to gpupdate does nothing. Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall Reviewed-by: Aurelien Aptel --- diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index dc25e1371f2..8a459ad71ab 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -641,7 +641,7 @@ sub provision_raw_step1($$) rndc command = true dns update command = $ctx->{samba_dnsupdate} spn update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba_spnupdate -s $ctx->{smb_conf} - gpo update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba-gpupdate -s $ctx->{smb_conf} -H $ctx->{privatedir}/sam.ldb --target=Computer + gpo update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba-gpupdate -s $ctx->{smb_conf} --target=Computer dreplsrv:periodic_startup_interval = 0 dsdb:schema update allowed = yes diff --git a/source4/scripting/bin/samba-gpupdate b/source4/scripting/bin/samba-gpupdate index e97c4b901f7..648d1886cda 100755 --- a/source4/scripting/bin/samba-gpupdate +++ b/source4/scripting/bin/samba-gpupdate @@ -29,11 +29,6 @@ sys.path.insert(0, "bin/python") import optparse from samba import getopt as options -from samba.auth import system_session -try: - from samba.samdb import SamDB -except: - SamDB = None from samba.gpclass import apply_gp, unapply_gp, GPOStorage from samba.gp_sec_ext import gp_sec_ext from samba.gp_ext_loader import get_gp_client_side_extensions @@ -47,7 +42,6 @@ if __name__ == "__main__": parser.add_option_group(sambaopts) parser.add_option_group(options.VersionOptions(parser)) credopts = options.CredentialsOptions(parser) - parser.add_option('-H', '--url', dest='url', help='URL for the samdb') parser.add_option('-X', '--unapply', help='Unapply Group Policy', action='store_true') parser.add_option('--target', default='Computer', help='{Computer | User}', @@ -59,14 +53,8 @@ if __name__ == "__main__": # Set the loadparm context lp = sambaopts.get_loadparm() - if not opts.url: - url = lp.samdb_url() - else: - url = opts.url - # Initialize the session creds = credopts.get_credentials(lp, fallback_machine=True) - session = system_session() # Set up logging logger = logging.getLogger('samba-gpupdate') @@ -89,22 +77,15 @@ if __name__ == "__main__": lp.configfile) gp_extensions = [] if opts.target == 'Computer': - if lp.get('server role') == 'active directory domain controller': - gp_extensions.append(gp_sec_ext(logger)) + gp_extensions.append(gp_sec_ext(logger)) for ext in machine_exts: gp_extensions.append(ext(logger)) elif opts.target == 'User': for ext in user_exts: gp_extensions.append(ext(logger)) - # Get a live instance of Samba - if SamDB: - test_ldb = SamDB(url, session_info=session, credentials=creds, lp=lp) - else: - test_ldb = None - if not opts.unapply: - apply_gp(lp, creds, test_ldb, logger, store, gp_extensions) + apply_gp(lp, creds, logger, store, gp_extensions) else: - unapply_gp(lp, creds, test_ldb, logger, store, gp_extensions) + unapply_gp(lp, creds, logger, store, gp_extensions)