[PATCH] Fix failures on re-provision incorrectly blamed on posix acl support.

Jelmer Vernooij jelmer at samba.org
Tue Feb 4 16:19:37 MST 2014


On Wed, Feb 05, 2014 at 11:45:24AM +1300, Andrew Bartlett wrote:
> On Tue, 2014-02-04 at 15:42 -0700, BlackPenguin ADMIN wrote:
> > That works. I just tried it. Thank you!
> 
> Great.  
> 
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
> 
> Jelmer,
> 
> Can I get your review on this?

I realize you're just moving code, but this code could use some more
improvements. It's catching all Exceptions, making assumptions about the kind
of error that is occurring. Most of the lines are also too long.

Reviewed-By: Jelmer Vernooij <jelmer at samba.org>

Cheers,

Jelmer

> 
> > On 02/04/2014 03:41 PM, Garming Sam wrote:
> > 
> > > On 02/02/14 19:58, Andrew Bartlett wrote: 
> > > > On Sat, 2014-02-01 at 12:24 +0000, Ali Bendriss wrote: 
> > > > > On 02/01/2014 12:21 PM, Ali Bendriss wrote: 
> > > > > > Hi, 
> > > > > > 
> > > > > > Maybe you have missed this error message carefully 
> > > > > > 
> > > > > >     File 
> > > > > > "/usr/lib64/python2.6/site-packages/samba/provision/__init__.py", line 
> > > > > > 2052, in provision 
> > > > > >       raise ProvisioningError("Your filesystem or build does
> > > > > > not support 
> > > > > > posix ACLs, which s3fs requires.  Try the mounting the
> > > > > > filesystem with 
> > > > > > the 'acl' option.") 
> > > > > Sorry, I've missed that / was already having the acl enable. 
> > > > I do want to apologise.  This is a regression in Samba, since
> > > > early 4.0, 
> > > > one of those annoying cases where fixing other issues created this
> > > > one. 
> > > > 
> > > > I need to find the patch I did to have it remove the empty sam.ldb
> > > > that 
> > > > is created during our probe of ACL support.  In the meantime, the 
> > > > workaround is to wipe the private directory. 
> > > > 
> > > > Sorry, 
> > > > 
> > > > Andrew Bartlett 
> > > > 
> > > 
> > > Here is a patch to fix this failure. The test for posix acl support
> > > has now just been moved to a later point so the sam.ldb problems are
> > > avoided. 
> > > 
> > > 
> > > Cheers, 
> > > 
> > > Garming Sam 
> > 
> > -- 
> > BlackPenguin ADMIN | Linux administration 
> > admin at blackpenguin.org | http://www.blackpenguin.org 
> > h. 001.403.266.1513 | c. 001.403.919.5699 
> > 
> 
> -- 
> Andrew Bartlett
> http://samba.org/~abartlet/
> Authentication Developer, Samba Team  http://samba.org
> Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
> 
> 
> 

> >From 5dec61bc7a25b5da1c1ecd2142da5f184c7676ad Mon Sep 17 00:00:00 2001
> From: Garming Sam <garming at catalyst.net.nz>
> Date: Wed, 27 Nov 2013 15:26:14 +1300
> Subject: [PATCH] provision: Fix failures on re-provision incorrectly blamed on
>  posix acl support.
> 
> By doing the test later, there is an actual sam.ldb file that can be connected to.
> 
> Signed-off-by: Garming Sam <garming at catalyst.net.nz>
> ---
>  python/samba/provision/__init__.py | 48 +++++++++++++++++---------------------
>  1 file changed, 22 insertions(+), 26 deletions(-)
> 
> diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
> index 151444d..a7de573 100644
> --- a/python/samba/provision/__init__.py
> +++ b/python/samba/provision/__init__.py
> @@ -1527,6 +1527,28 @@ def setsysvolacl(samdb, netlogon, sysvol, uid, gid, domainsid, dnsdomain,
>      s4_passdb = None
>  
>      if not use_ntvfs:
> +        s3conf = s3param.get_context()
> +        s3conf.load(lp.configfile)
> +
> +        file = tempfile.NamedTemporaryFile(dir=os.path.abspath(sysvol))
> +        try:
> +            try:
> +                smbd.set_simple_acl(file.name, 0755, gid)
> +            except Exception:
> +                if not smbd.have_posix_acls():
> +                    # This clue is only strictly correct for RPM and
> +                    # Debian-like Linux systems, but hopefully other users
> +                    # will get enough clue from it.
> +                    raise ProvisioningError("Samba was compiled without the posix ACL support that s3fs requires.  Try installing libacl1-dev or libacl-devel, then re-run configure and make.")
> +
> +                raise ProvisioningError("Your filesystem or build does not support posix ACLs, which s3fs requires.  Try the mounting the filesystem with the 'acl' option.")
> +            try:
> +                smbd.chown(file.name, uid, gid)
> +            except Exception:
> +                raise ProvisioningError("Unable to chown a file on your filesystem.  You may not be running provision as root.")
> +        finally:
> +            file.close()
> +
>          # This will ensure that the smbd code we are running when setting ACLs
>          # is initialised with the smb.conf
>          s3conf = s3param.get_context()
> @@ -2032,32 +2054,6 @@ def provision(logger, session_info, smbconf=None,
>      if paths.sysvol and not os.path.exists(paths.sysvol):
>          os.makedirs(paths.sysvol, 0775)
>  
> -    if not use_ntvfs and serverrole == "active directory domain controller":
> -        s3conf = s3param.get_context()
> -        s3conf.load(lp.configfile)
> -
> -        if paths.sysvol is None:
> -            raise MissingShareError("sysvol", paths.smbconf)
> -
> -        file = tempfile.NamedTemporaryFile(dir=os.path.abspath(paths.sysvol))
> -        try:
> -            try:
> -                smbd.set_simple_acl(file.name, 0755, root_gid)
> -            except Exception:
> -                if not smbd.have_posix_acls():
> -                    # This clue is only strictly correct for RPM and
> -                    # Debian-like Linux systems, but hopefully other users
> -                    # will get enough clue from it.
> -                    raise ProvisioningError("Samba was compiled without the posix ACL support that s3fs requires.  Try installing libacl1-dev or libacl-devel, then re-run configure and make.")
> -
> -                raise ProvisioningError("Your filesystem or build does not support posix ACLs, which s3fs requires.  Try the mounting the filesystem with the 'acl' option.")
> -            try:
> -                smbd.chown(file.name, root_uid, root_gid)
> -            except Exception:
> -                raise ProvisioningError("Unable to chown a file on your filesystem.  You may not be running provision as root.")
> -        finally:
> -            file.close()
> -
>      ldapi_url = "ldapi://%s" % urllib.quote(paths.s4_ldapi_path, safe="")
>  
>      schema = Schema(domainsid, invocationid=invocationid,
> -- 
> 1.8.3.2
> 


-- 


More information about the samba-technical mailing list