From b4d7540bb4798e6801accf34a26fc0f2636bdd1f Mon Sep 17 00:00:00 2001 From: David Mulder Date: Mon, 18 Jul 2022 09:19:24 -0600 Subject: [PATCH] gpo: samba-gpupdate use s3 param for registry conf Cause samba-gpupdate to use an s3 param so that it can load settings from registry configuration. Signed-off-by: David Mulder Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Jul 22 20:40:51 UTC 2022 on sn-devel-184 --- python/samba/getopt.py | 9 +++++++++ python/samba/gp/gpclass.py | 7 +------ source4/scripting/bin/samba-gpupdate | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/python/samba/getopt.py b/python/samba/getopt.py index 7b8d2ef46c5..a271cd8a736 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -93,6 +93,15 @@ class SambaOptions(optparse.OptionGroup): return self._lp +class Samba3Options(SambaOptions): + """General Samba-related command line options with an s3 param.""" + + def __init__(self, parser): + SambaOptions.__init__(self, parser) + from samba.samba3 import param as s3param + self._lp = s3param.get_context() + + class VersionOptions(optparse.OptionGroup): """Command line option for printing Samba version.""" def __init__(self, parser): diff --git a/python/samba/gp/gpclass.py b/python/samba/gp/gpclass.py index 0c95cdb66c0..39a34a75cf0 100644 --- a/python/samba/gp/gpclass.py +++ b/python/samba/gp/gpclass.py @@ -32,7 +32,6 @@ import re from samba.net import Net from samba.dcerpc import nbt from samba.samba3 import libsmb_samba_internal as libsmb -from samba.samba3 import param as s3param import samba.gpo as gpo from samba.param import LoadParm from uuid import UUID @@ -406,14 +405,10 @@ def check_safe_path(path): def check_refresh_gpo_list(dc_hostname, lp, creds, gpos): - # the SMB bindings rely on having a s3 loadparm - s3_lp = s3param.get_context() - s3_lp.load(lp.configfile) - # Force signing for the connection saved_signing_state = creds.get_smb_signing() creds.set_smb_signing(SMB_SIGNING_REQUIRED) - conn = libsmb.Conn(dc_hostname, 'sysvol', lp=s3_lp, creds=creds) + conn = libsmb.Conn(dc_hostname, 'sysvol', lp=lp, creds=creds) # Reset signing state creds.set_smb_signing(saved_signing_state) cache_path = lp.cache_path('gpo_cache') diff --git a/source4/scripting/bin/samba-gpupdate b/source4/scripting/bin/samba-gpupdate index 8c4923aa68f..4b3f057f534 100755 --- a/source4/scripting/bin/samba-gpupdate +++ b/source4/scripting/bin/samba-gpupdate @@ -57,7 +57,7 @@ from samba.gp.util.logging import logger_init if __name__ == "__main__": parser = optparse.OptionParser('samba-gpupdate [options]') - sambaopts = options.SambaOptions(parser) + sambaopts = options.Samba3Options(parser) # Get the command line options parser.add_option_group(sambaopts) -- 2.34.1