1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-22 16:59:09 +03:00

gpo: Scripts gpo add warning about generated scripts

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
David Mulder
2020-07-02 10:13:15 -06:00
committed by David Mulder
parent edf4b6eb12
commit e387aa937e

View File

@ -19,6 +19,17 @@ from samba.gpclass import gp_pol_ext
from base64 import b64encode
from tempfile import NamedTemporaryFile
intro = '''
### autogenerated by samba
#
# This file is generated by the gp_scripts_ext Group Policy
# Client Side Extension. To modify the contents of this file,
# modify the appropriate Group Policy objects which apply
# to this machine. DO NOT MODIFY THIS FILE DIRECTLY.
#
'''
class gp_scripts_ext(gp_pol_ext):
def __str__(self):
return 'Unix Settings/Scripts'
@ -54,7 +65,9 @@ class gp_scripts_ext(gp_pol_ext):
if not old_val:
with NamedTemporaryFile(prefix='gp_', mode="w+",
delete=False, dir=cron_dir) as f:
f.write('#!/bin/sh\n%s' % e.data)
contents = '#!/bin/sh\n%s' % intro
contents += '%s\n' % e.data
f.write(contents)
os.chmod(f.name, 0o700)
self.gp_db.store(str(self), attribute, f.name)
self.gp_db.commit()