Skip to content

Commit

Permalink
gpo: Add user policy extensions
Browse files Browse the repository at this point in the history
Signed-off-by: David Mulder <[email protected]>
Reviewed-by: Douglas Bagnall <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
dmulder authored and abartlet committed Jul 12, 2018
1 parent 126b789 commit de8b30a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion python/samba/gp_ext_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def get_gp_ext_from_module(name, mod):
return None

def get_gp_client_side_extensions(logger, smb_conf):
user_exts = []
machine_exts = []
gp_exts = list_gp_extensions(smb_conf)
for gp_ext in gp_exts.values():
Expand All @@ -47,5 +48,9 @@ def get_gp_client_side_extensions(logger, smb_conf):
machine_exts.append(ext)
logger.info('Loaded machine extension from %s: %s'
% (gp_ext['DllName'], ext.__name__))
return machine_exts
if ext and gp_ext['UserPolicy']:
user_exts.append(ext)
logger.info('Loaded user extension from %s: %s'
% (gp_ext['DllName'], ext.__name__))
return (machine_exts, user_exts)

6 changes: 4 additions & 2 deletions source4/scripting/bin/samba-gpupdate
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ if __name__ == "__main__":
cache_dir = lp.get('cache directory')
store = GPOStorage(os.path.join(cache_dir, 'gpo.tdb'))

machine_exts = get_gp_client_side_extensions(logger, lp.configfile)
machine_exts, user_exts = get_gp_client_side_extensions(logger,
lp.configfile)
gp_extensions = []
if opts.target == 'Computer':
if lp.get('server role') == 'active directory domain controller':
gp_extensions.append(gp_sec_ext(logger))
for ext in machine_exts:
gp_extensions.append(ext(logger))
elif opts.target == 'User':
pass # User extensions
for ext in user_exts:
gp_extensions.append(ext(logger))

# Get a live instance of Samba
if SamDB:
Expand Down

0 comments on commit de8b30a

Please sign in to comment.