From: Douglas Bagnall Date: Tue, 6 Nov 2018 22:43:26 +0000 (+1300) Subject: samba-tool gpo: do not use predictable temp directory X-Git-Tag: tdb-1.3.17~854 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3320b6d3df7a0c7b78e71cb5bc2d18f31839573;p=thirdparty%2Fsamba.git samba-tool gpo: do not use predictable temp directory Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 4d5fc883876..0e6e2626c25 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # - +from __future__ import print_function import os import samba.getopt as options import ldb @@ -939,7 +939,9 @@ class cmd_fetch(Command): # Copy GPT if tmpdir is None: - tmpdir = "/tmp" + tmpdir = tempfile.mkdtemp() + print("Using temporary directory %s (use --tmpdir to change)" % tmpdir, + file=self.outf) if not os.path.isdir(tmpdir): raise CommandError("Temoprary directory '%s' does not exist" % tmpdir) @@ -1017,7 +1019,9 @@ class cmd_backup(Command): # Copy GPT if tmpdir is None: - tmpdir = "/tmp" + tmpdir = tempfile.mkdtemp() + print("Using temporary directory %s (use --tmpdir to change)" % tmpdir, + file=self.outf) if not os.path.isdir(tmpdir): raise CommandError("Temoprary directory '%s' does not exist" % tmpdir) @@ -1168,7 +1172,9 @@ class cmd_create(Command): # Create GPT if tmpdir is None: - tmpdir = "/tmp" + tmpdir = tempfile.mkdtemp() + print("Using temporary directory %s (use --tmpdir to change)" % tmpdir, + file=self.outf) if not os.path.isdir(tmpdir): raise CommandError("Temporary directory '%s' does not exist" % tmpdir) self.tmpdir = tmpdir