Bug 15006 - samba-tool gpo create pollutes /tmp
Summary: samba-tool gpo create pollutes /tmp
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.15.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Douglas Bagnall
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-10 16:34 UTC by keesvanvloten
Modified: 2023-08-28 22:40 UTC (History)
1 user (show)

See Also:


Attachments
a patch for samba-tool gpo create (1.01 KB, patch)
2022-03-24 05:48 UTC, Douglas Bagnall
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description keesvanvloten 2022-03-10 16:34:10 UTC
After creating a lot of GPOs with 'samba-tool gpo create' I found a lot of files are left in /tmp


ls -l /tmp
total 252
drwx------ 3 root root 4096 Mar  7 23:57 tmp093akutw
drwx------ 3 root root 4096 Mar  7 22:47 tmp0d_rb0sz
drwx------ 3 root root 4096 Mar  8 00:21 tmp0j44evnc
drwx------ 3 root root 4096 Mar  9 10:12 tmp1fqxikin
drwx------ 3 root root 4096 Mar  9 10:19 tmp2iu01qhk
drwx------ 3 root root 4096 Mar  9 10:09 tmp35w5__n2
drwx------ 3 root root 4096 Mar  8 00:16 tmp3gqozqwj
drwx------ 3 root root 4096 Mar  8 17:49 tmp3nb2xv9t
drwx------ 3 root root 4096 Mar  8 15:51 tmp3pe5tdb9
drwx------ 3 root root 4096 Mar  8 21:54 tmp3rioz5j5
drwx------ 3 root root 4096 Mar  8 21:27 tmp45f3adxe
drwx------ 3 root root 4096 Mar  8 21:43 tmp4jbys7g5
drwx------ 3 root root 4096 Mar  8 21:34 tmp4liiqtzm
drwx------ 3 root root 4096 Mar  8 19:09 tmp4lqj1fpd
drwx------ 3 root root 4096 Mar  8 19:51 tmp4w0cayx9
drwx------ 3 root root 4096 Mar  8 00:12 tmp5t2sz5v5
drwx------ 3 root root 4096 Mar  8 21:45 tmp64s6pbsh
drwx------ 3 root root 4096 Mar  8 00:06 tmp6jrexuxc
drwx------ 3 root root 4096 Mar  8 22:07 tmp6m2gwr21
drwx------ 3 root root 4096 Mar  8 17:34 tmp766i0ztk
drwx------ 3 root root 4096 Mar  8 22:17 tmp900heo29
drwx------ 3 root root 4096 Mar  7 23:59 tmp99ddtrjd
drwx------ 3 root root 4096 Mar  8 20:54 tmpaihfefzn
drwx------ 3 root root 4096 Mar  8 22:27 tmpazyfdi6r
drwx------ 3 root root 4096 Mar  8 21:03 tmpcd18shr7
drwx------ 3 root root 4096 Mar  9 10:17 tmpcu1889dm
drwx------ 3 root root 4096 Mar  8 22:02 tmpe85d1hf8
drwx------ 3 root root 4096 Mar  8 20:42 tmpeqjfpwga
drwx------ 3 root root 4096 Mar  8 00:01 tmpf4dpdmt0
drwx------ 3 root root 4096 Mar  8 00:32 tmpfdxc2b5i
drwx------ 3 root root 4096 Mar  7 23:00 tmpg6yd3r1s
drwx------ 3 root root 4096 Mar  8 00:34 tmph87kq43o
drwx------ 3 root root 4096 Mar  8 00:27 tmphf7b7rym
drwx------ 3 root root 4096 Mar  8 17:58 tmphvaa3xo2
drwx------ 3 root root 4096 Mar  8 21:41 tmpjdvsr0zs
drwx------ 3 root root 4096 Mar  8 21:56 tmpjwgm9v56
drwx------ 3 root root 4096 Mar  8 21:37 tmpjyury1vr
drwx------ 3 root root 4096 Mar  8 22:12 tmpl_g0pada
drwx------ 3 root root 4096 Mar  8 19:22 tmpp3awscqg
drwx------ 3 root root 4096 Mar  8 22:21 tmpqxxp404d
drwx------ 3 root root 4096 Mar  8 00:31 tmpr55fj8a3
drwx------ 3 root root 4096 Mar  7 23:15 tmpri8oadgm
drwx------ 3 root root 4096 Mar  8 20:58 tmpsh9ugzr4
drwx------ 3 root root 4096 Mar  8 00:07 tmpu4c_1vrm
drwx------ 3 root root 4096 Mar  8 00:26 tmpuhsosa03
drwx------ 3 root root 4096 Mar  8 21:32 tmpuv5yxmue
drwx------ 3 root root 4096 Mar  8 00:14 tmpvh3b7q_k
drwx------ 3 root root 4096 Mar  8 23:18 tmpvqsiogb7
drwx------ 3 root root 4096 Mar  8 21:52 tmpwlygnjdm
drwx------ 3 root root 4096 Mar  8 20:47 tmpwz5l2wvd
drwx------ 3 root root 4096 Mar  9 10:22 tmp_x9cswgo
drwx------ 3 root root 4096 Mar  8 22:09 tmpxmrjlsrq
drwx------ 3 root root 4096 Mar  8 22:24 tmpy4zd5d32
drwx------ 3 root root 4096 Mar  8 17:13 tmpy796ji39
drwx------ 3 root root 4096 Mar  8 21:39 tmpyq71vw1v
drwx------ 3 root root 4096 Mar  8 17:24 tmpz5s1d3hg
drwx------ 3 root root 4096 Mar  8 00:13 tmpzq_p4_au

Just listing one shows:

find /tmp/tmpwlygnjdm
/tmp/tmpwlygnjdm
/tmp/tmpwlygnjdm/policy
/tmp/tmpwlygnjdm/policy/{FEB7FDA5-F401-417E-9311-1221044B813E}
/tmp/tmpwlygnjdm/policy/{FEB7FDA5-F401-417E-9311-1221044B813E}/Machine
/tmp/tmpwlygnjdm/policy/{FEB7FDA5-F401-417E-9311-1221044B813E}/GPT.INI
/tmp/tmpwlygnjdm/policy/{FEB7FDA5-F401-417E-9311-1221044B813E}/User

Since the version in GPI.INI is set to 0, my suspision is that it can only "gpo create" that leaves this behind.

Please, add some code to remove the temp-file when the GPO is created.
Comment 1 David Mulder 2022-03-23 10:13:49 UTC
These are created by GPOCommand.construct_tmpdir() in samba-tool.
Comment 2 Douglas Bagnall 2022-03-24 05:48:34 UTC
Created attachment 17238 [details]
a patch for samba-tool gpo create

When I look at it, 'backup' and 'fetch' shouldn't really be using --tmpdir, should they? it is more like a --destination.

David is this patch right?
Comment 3 Samba QA Contact 2022-08-06 01:43:12 UTC
This bug was referenced in samba master:

0fdd7e16a1d2c68e3fa4262c8e7355b0889c5b66
Comment 4 Samba QA Contact 2022-08-08 14:32:29 UTC
This bug was referenced in samba v4-17-test:

0fdd7e16a1d2c68e3fa4262c8e7355b0889c5b66
Comment 5 Samba QA Contact 2022-08-08 14:36:25 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.0rc1):

0fdd7e16a1d2c68e3fa4262c8e7355b0889c5b66
Comment 6 Kacper 2023-08-28 11:27:16 UTC
0fdd7e16a1d2c68e3fa4262c8e7355b0889c5b66 broke 'samba-tool gpo restore" when used without the --tmpdir option. cmd_restore depended upon the tmpdir being there after cmd_create but now that directory is being clean up and no longer available for cmd_restore, resulting in a FileNotFoundError.
Comment 7 Douglas Bagnall 2023-08-28 22:40:16 UTC
I think we will call this one fixed, and open bug #15462 for the new thing we broke.