gpo: Scripts gpo add warning about generated scripts
authorDavid Mulder <dmulder@suse.com>
Thu, 2 Jul 2020 16:13:15 +0000 (10:13 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 6 Aug 2020 16:38:36 +0000 (16:38 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gp_scripts_ext.py

index d1657ae197c96e4cfb33b7d97cb6d8795becb444..51ed66cee20fa72c84a268419e6a23b03b6a17cc 100644 (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()