On Mon, 2012-06-04 at 15:40 +0200, Marc Muehlfeld wrote:
> Hi,
> 
> I started with a fresh testing environment for s4 and when I do the 
> migration, 
> it breaks:
> 
> 
> # /usr/local/samba/bin/samba-tool domain samba3upgrade 
> --dbdir=/usr/var/locks/ 
> --use-xattrs=yes --realm=MUC.medizinische-genetik.de /etc/samba/smb3.conf
> no talloc stackframe around, leaking memory
> Reading smb.conf
> Provisioning
> Exporting account policy
> Exporting groups
> Exporting users
> Next rid = 17062
> ERROR(<type 'exceptions.AttributeError'>): uncaught exception - 'NoneType' 
> object has no attribute 'get'
>    File 
> "/usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/__init__.py", 
> line 160, in _run
>      return self.run(*args, **kwargs)
>    File 
> "/usr/local/samba/lib64/python2.6/site-packages/samba/netcmd/domain.py", line 
> 926, in run
>      useeadb=eadb)
>    File "/usr/local/samba/lib64/python2.6/site-packages/samba/upgrade.py", 
> line 675, in upgrade_from_samba3
>      useeadb=useeadb, dns_backend=dns_backend)
>    File 
> "/usr/local/samba/lib64/python2.6/site-packages/samba/provision/__init__.py", 
> line 1666, in provision
>      file = 
> tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private
>  dir"))))
> 
> 
> I used the latest git version (4.0.0alpha22-GIT-0110623).
> 
> Any idea what's wrong?

Try these patches, which should make it into beta1.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
>From f4ec3c1324cd4551776e9b22cb82083016193164 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abart...@samba.org>
Date: Tue, 5 Jun 2012 09:56:53 +1000
Subject: [PATCH 1/2] s4-provision: Place xattr.tdb in the actual state
 directory

This patch does two things: it fixes up the spelling of "state dir" to
"state directory" so that we actually find the smb.conf parameter, and
we move it to after we process the global settings in case this is
changed in the future.

Andrew Bartlett
---
 .../scripting/python/samba/provision/__init__.py   |   27 ++++++++++---------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index 1dc69a1..a84bb5b 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -627,19 +627,6 @@ def make_smbconf(smbconf, hostname, domain, realm, targetdir,
     #Load non-existant file
     if os.path.exists(smbconf):
         lp.load(smbconf)
-    if eadb:
-        if use_ntvfs and not lp.get("posix:eadb"):
-            if targetdir is not None:
-                privdir = os.path.join(targetdir, "private")
-            else:
-                privdir = lp.get("private dir")
-            lp.set("posix:eadb", os.path.abspath(os.path.join(privdir, "eadb.tdb")))
-        elif not use_ntvfs and not lp.get("xattr_tdb:file"):
-            if targetdir is not None:
-                statedir = os.path.join(targetdir, "state")
-            else:
-                statedir = lp.get("state dir")
-            lp.set("xattr_tdb:file", os.path.abspath(os.path.join(statedir, "xattr.tdb")))
 
     if global_param is not None:
         for ent in global_param:
@@ -656,6 +643,20 @@ def make_smbconf(smbconf, hostname, domain, realm, targetdir,
         lp.set("state directory",  global_settings["state directory"])
         lp.set("cache directory", global_settings["cache directory"])
 
+    if eadb:
+        if use_ntvfs and not lp.get("posix:eadb"):
+            if targetdir is not None:
+                privdir = os.path.join(targetdir, "private")
+            else:
+                privdir = lp.get("private dir")
+            lp.set("posix:eadb", os.path.abspath(os.path.join(privdir, "eadb.tdb")))
+        elif not use_ntvfs and not lp.get("xattr_tdb:file"):
+            if targetdir is not None:
+                statedir = os.path.join(targetdir, "state")
+            else:
+                statedir = lp.get("state directory")
+            lp.set("xattr_tdb:file", os.path.abspath(os.path.join(statedir, "xattr.tdb")))
+
     shares = {}
     if serverrole == "domain controller":
         shares["sysvol"] = os.path.join(lp.get("state directory"), "sysvol")
-- 
1.7.7.6

>From 5f01932ffdb6556949c4489992057db98c1f9c48 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abart...@samba.org>
Date: Tue, 5 Jun 2012 09:58:41 +1000
Subject: [PATCH 2/2] s4-provision: Test for posix ACLs in the actual sysvol
 path

This avoids issues in the previous location where lp may not be initialised at this point
and instead simply waits until we have a known sysvol path, and test for ACL support
there.

Andrew Bartlett
---
 .../scripting/python/samba/provision/__init__.py   |   24 ++++++++++----------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index a84bb5b..7faac70 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -1661,18 +1661,6 @@ def provision(logger, session_info, credentials, smbconf=None,
         server_services.append("+s3fs")
         global_param["dcerpc endpoint servers"] = ["-winreg", "-srvsvc"]
 
-        if targetdir is not None:
-            file = tempfile.NamedTemporaryFile(dir=os.path.abspath(targetdir))
-        else:
-            file = tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private dir"))))
-        try:
-            try:
-                smbd.set_simple_acl(file.name, root_uid, wheel_gid)
-            except Exception:
-                raise ProvisioningError("Your filesystem or build does not support posix ACLs, s3fs is unworkable in this mode")
-        finally:
-            file.close()
-
     if len(server_services) > 0:
         global_param["server services"] = server_services
 
@@ -1743,6 +1731,18 @@ def provision(logger, session_info, credentials, smbconf=None,
         os.mkdir(os.path.join(paths.private_dir, "tls"))
     if not os.path.exists(paths.state_dir):
         os.mkdir(paths.state_dir)
+    if not os.path.exists(paths.sysvol):
+        os.makedirs(paths.sysvol, 0775)
+
+    if not use_ntvfs:
+        file = tempfile.NamedTemporaryFile(dir=os.path.abspath(paths.sysvol))
+        try:
+            try:
+                smbd.set_simple_acl(file.name, root_uid, wheel_gid)
+            except Exception:
+                raise ProvisioningError("Your filesystem or build does not support posix ACLs, s3fs is unworkable in this mode")
+        finally:
+            file.close()
 
     ldapi_url = "ldapi://%s" % urllib.quote(paths.s4_ldapi_path, safe="")
 
-- 
1.7.7.6

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Reply via email to