1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

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 <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
This commit is contained in:
David Mulder 2018-05-16 08:04:20 -06:00 committed by Aurélien Aptel
parent aa9b07ba0f
commit f702ad943e
2 changed files with 4 additions and 23 deletions

View File

@ -641,7 +641,7 @@ sub provision_raw_step1($$)
rndc command = true rndc command = true
dns update command = $ctx->{samba_dnsupdate} dns update command = $ctx->{samba_dnsupdate}
spn update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba_spnupdate -s $ctx->{smb_conf} 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 dreplsrv:periodic_startup_interval = 0
dsdb:schema update allowed = yes dsdb:schema update allowed = yes

View File

@ -29,11 +29,6 @@ sys.path.insert(0, "bin/python")
import optparse import optparse
from samba import getopt as options 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.gpclass import apply_gp, unapply_gp, GPOStorage
from samba.gp_sec_ext import gp_sec_ext from samba.gp_sec_ext import gp_sec_ext
from samba.gp_ext_loader import get_gp_client_side_extensions 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(sambaopts)
parser.add_option_group(options.VersionOptions(parser)) parser.add_option_group(options.VersionOptions(parser))
credopts = options.CredentialsOptions(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', parser.add_option('-X', '--unapply', help='Unapply Group Policy',
action='store_true') action='store_true')
parser.add_option('--target', default='Computer', help='{Computer | User}', parser.add_option('--target', default='Computer', help='{Computer | User}',
@ -59,14 +53,8 @@ if __name__ == "__main__":
# Set the loadparm context # Set the loadparm context
lp = sambaopts.get_loadparm() 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) creds = credopts.get_credentials(lp, fallback_machine=True)
session = system_session()
# Set up logging # Set up logging
logger = logging.getLogger('samba-gpupdate') logger = logging.getLogger('samba-gpupdate')
@ -89,22 +77,15 @@ if __name__ == "__main__":
lp.configfile) lp.configfile)
gp_extensions = [] gp_extensions = []
if opts.target == 'Computer': 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: for ext in machine_exts:
gp_extensions.append(ext(logger)) gp_extensions.append(ext(logger))
elif opts.target == 'User': elif opts.target == 'User':
for ext in user_exts: for ext in user_exts:
gp_extensions.append(ext(logger)) 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: if not opts.unapply:
apply_gp(lp, creds, test_ldb, logger, store, gp_extensions) apply_gp(lp, creds, logger, store, gp_extensions)
else: else:
unapply_gp(lp, creds, test_ldb, logger, store, gp_extensions) unapply_gp(lp, creds, logger, store, gp_extensions)