s4: check that the xattr are supported in the folder where we want to provision
authorMatthieu Patou <mat@matws.net>
Fri, 14 Oct 2011 09:22:20 +0000 (11:22 +0200)
committerMatthieu Patou <mat@matws.net>
Sat, 15 Oct 2011 22:01:36 +0000 (00:01 +0200)
By default we were checking this on the default folder for
tempfile.NamedTemporaryFile (usualy /tmp) but this folder can be mounted
on tmpfs (which didn't support xattr currently). Now we should check on
the filesystem where the provision will be done.

source4/scripting/python/samba/netcmd/domain.py
source4/setup/provision

index ce9d7d8682f0c988b6cb32063090d6aaeb83c507..3906d69a2d3e0f7e510f1d2e77103b6d61dacd42 100644 (file)
@@ -591,7 +591,10 @@ class cmd_domain_samba3upgrade(Command):
         if use_xattrs == "yes":
             eadb = False
         elif use_xattrs == "auto" and not s3conf.get("posix:eadb"):
-            tmpfile = tempfile.NamedTemporaryFile()
+            if targetdir:
+                tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(targetdir))
+            else:
+                tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(os.path.dirname(lp.get("private dir"))))
             try:
                 samba.ntacls.setntacl(lp, tmpfile.name,
                             "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
index d05af51fa326dd4cf8d3247819108124611f811f..94c5be3db83624935d956169fc0dae27683d88c0 100755 (executable)
@@ -32,6 +32,7 @@ sys.path.insert(0, "bin/python")
 
 import samba
 import samba.ntacls
+import os
 from samba.credentials import DONT_USE_KERBEROS
 from samba.auth import system_session
 import samba.getopt as options
@@ -226,7 +227,10 @@ eadb = True
 if opts.use_xattrs == "yes":
     eadb = False
 elif opts.use_xattrs == "auto" and not lp.get("posix:eadb"):
-    file = tempfile.NamedTemporaryFile()
+    if opts.targetdir:
+        file = tempfile.NamedTemporaryFile(prefix=os.path.abspath(opts.targetdir))
+    else:
+        file = tempfile.NamedTemporaryFile(prefix=os.path.abspath(os.path.dirname(lp.get("private dir"))))
     try:
         samba.ntacls.setntacl(lp, file.name,
             "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")