rda-python-setuid 3.0.2__py3-none-any.whl → 3.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -264,8 +264,22 @@ def main():
264
264
  cmd = ['gcc', '-DCMPROG="{}"'.format(args.cmlink), '-DCMEXEC="{}"'.format(script)]
265
265
  if args.simple: cmd.append('-DCMSIMPLE')
266
266
  prefix = [] if args.simple else ['sudo', '-u', args.username]
267
- run(prefix + cmd + ['-o', target, src_dest])
268
- run(prefix + ['chmod', '755' if args.simple else '4755', target])
267
+ mode = '755' if args.simple else '4755'
268
+ # Compile to a temporary file and copy it onto the target, rather than letting
269
+ # gcc write the target directly: gcc recreates the file, which hands ownership
270
+ # of a binary in a shared common area to whoever recompiled it last. 'cp'
271
+ # writes through the file already there, so its owner, group and mode survive,
272
+ # and the mode is only refreshed when it is ours to change.
273
+ tmpout = target + '.new'
274
+ run(prefix + cmd + ['-o', tmpout, src_dest])
275
+ run(prefix + ['chmod', mode, tmpout])
276
+ if os.path.exists(target):
277
+ owned = not args.simple or os.stat(target).st_uid == os.geteuid()
278
+ run(prefix + ['cp', tmpout, target])
279
+ run(prefix + ['rm', '-f', tmpout])
280
+ if owned: run(prefix + ['chmod', mode, target])
281
+ else:
282
+ run(prefix + ['mv', tmpout, target])
269
283
  if args.simple:
270
284
  print("Installed: {} (no setuid, execs {})".format(target, script))
271
285
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_setuid
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: RDA Python Package to setuid for program executions as an effective or common user
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-setuid
@@ -1,15 +1,15 @@
1
1
  rda_python_setuid/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
2
  rda_python_setuid/cmwrapper.c,sha256=reXWGJhGBSegHw9mFXHv9L8CQa-2O8jAl_FyaxPqQJU,4721
3
- rda_python_setuid/install.py,sha256=Y86vSRmxkRNLcBFM8Upz1atH9RCLGZBerWthUNQvCMc,15853
3
+ rda_python_setuid/install.py,sha256=SyVihB4-WYyP8rpJQIKk9iXZuEVjQwBtKrSDvO1ljZk,16617
4
4
  rda_python_setuid/install.usg,sha256=C8o3dNwAMHZo-zaJtPF-33wlnltnPG56qvKyrNR1GXs,10170
5
5
  rda_python_setuid/pgstart.py,sha256=tYCOTJedqE5Lc6hUD2tyQparsOK9VGJ2alHHLNWqF20,3968
6
6
  rda_python_setuid/pywrapper.c,sha256=Dp9EOFU9IShduQ4WMeFRiiIJLQvgZHsiQlc89vJgtII,4190
7
7
  rda_python_setuid/pywrapper.py,sha256=7RHpWeyHGLP_7Vx3KJ_yy-3qYObYg_ar6meuworA0MA,3023
8
8
  rda_python_setuid/setuid_setup.usg,sha256=nJaS08GtlCQmXiy-udp6cxCFgZZJuBaZ36DicUn5Q7I,2915
9
9
  rda_python_setuid/setup_guide.py,sha256=thdTlYJwhID63G7G9NWte0qeXwH6ytQPLFbjesWodNQ,2158
10
- rda_python_setuid-3.0.2.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
11
- rda_python_setuid-3.0.2.dist-info/METADATA,sha256=FsQOVUbq-3urP0OJf-dZwbjA4kIed7GbwgBTq7GNI2o,12014
12
- rda_python_setuid-3.0.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
13
- rda_python_setuid-3.0.2.dist-info/entry_points.txt,sha256=mWZUCa2KYzGsYVa33M7W03CY9SMsJYsywlIDF-4iMaQ,165
14
- rda_python_setuid-3.0.2.dist-info/top_level.txt,sha256=ONMhKLagyTBktuz5dTyipSnRC0YhomTMs8eFRjM9kHQ,18
15
- rda_python_setuid-3.0.2.dist-info/RECORD,,
10
+ rda_python_setuid-3.0.3.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
11
+ rda_python_setuid-3.0.3.dist-info/METADATA,sha256=QuS6lAVZE68h-9kZOce6eXRJVbVXS_YOELqXdcsDPVU,12014
12
+ rda_python_setuid-3.0.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
13
+ rda_python_setuid-3.0.3.dist-info/entry_points.txt,sha256=mWZUCa2KYzGsYVa33M7W03CY9SMsJYsywlIDF-4iMaQ,165
14
+ rda_python_setuid-3.0.3.dist-info/top_level.txt,sha256=ONMhKLagyTBktuz5dTyipSnRC0YhomTMs8eFRjM9kHQ,18
15
+ rda_python_setuid-3.0.3.dist-info/RECORD,,