]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gp: Fix user apply failure when droping privs
authorDavid Mulder <dmulder@samba.org>
Wed, 7 Jun 2023 14:29:31 +0000 (08:29 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 10 Jun 2023 10:46:28 +0000 (10:46 +0000)
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 <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Jun 10 10:46:28 UTC 2023 on atb-devel-224

python/samba/gp/gpclass.py

index 6083a0f8029dfb1dacdd2172b17c8ac5dc569aa8..11275f3f11700037fbdf28aecf7588c6b725cefa 100644 (file)
@@ -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))