Skip to content

Commit

Permalink
gp: Fix user apply failure when droping privs
Browse files Browse the repository at this point in the history
When dropping privileges, gpupdate errored:
gpclass.py:1167: KeyError: "getpwnam(): name not found: <HOSTNAME>
apply_gp was incorrectly passing the hostname
instead of the username.

Signed-off-by: David Mulder <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>

Autobuild-User(master): Andrew Bartlett <[email protected]>
Autobuild-Date(master): Sat Jun 10 10:46:28 UTC 2023 on atb-devel-224
  • Loading branch information
dmulder authored and abartlet committed Jun 10, 2023
1 parent cd0f9fc commit e40c86e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/samba/gp/gpclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def apply_gp(lp, creds, store, gp_extensions, username, target, force=False):
if target == 'Computer':
ext.process_group_policy(del_gpos, changed_gpos)
else:
drop_privileges(creds.get_principal(), ext.process_group_policy,
drop_privileges(username, ext.process_group_policy,
del_gpos, changed_gpos)
except Exception as e:
log.error('Failed to apply extension %s' % str(ext))
Expand Down

0 comments on commit e40c86e

Please sign in to comment.