From: David Mulder Date: Thu, 2 Jul 2020 16:13:15 +0000 (-0600) Subject: gpo: Scripts gpo add warning about generated scripts X-Git-Tag: talloc-2.3.2~931 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e387aa937e576116d5487d18a829066ee75eb0b7;p=thirdparty%2Fsamba.git gpo: Scripts gpo add warning about generated scripts Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/gp_scripts_ext.py b/python/samba/gp_scripts_ext.py index d1657ae197c..51ed66cee20 100644 --- a/python/samba/gp_scripts_ext.py +++ b/python/samba/gp_scripts_ext.py @@ -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()