change idmap in the same way as passdb

Stefan (metze) Metzmacher metze at samba.org
Thu Dec 18 12:27:52 MST 2014


Am 18.12.2014 um 10:38 schrieb Andrew Bartlett:
> On Thu, 2014-12-18 at 21:23 +1300, Andrew Bartlett wrote:
>> On Thu, 2014-12-18 at 09:13 +0100, Stefan (metze) Metzmacher wrote:
>>> Am 18.12.2014 um 08:52 schrieb Andrew Bartlett:
>>>> Metze,
>>>>
>>>> Now we have successfully changed the pdb library, I propose we do the
>>>> same with idmap.  On a solaris-like system a while back, I found our
>>>> internal and private idmap clashing with the system idmap (for NFSv4).
>>>> The same grouping library trick should be enough to avoid this issue as
>>>> well.  I'll try and prepare a patch tomorrow if I'm not totally swamped
>>>> in the rush before Christmas.
>>>
>>> Ok, do we already have a bug report for this?
>>>
>>> metze
>>
>> This looks like it:
>>
>> https://bugzilla.samba.org/show_bug.cgi?id=10112
> 
> Metze,
> 
> You suggested on private IRC that we find a generic solution in the
> PRIVATE_NAME wafsamba function.  I attach my attempt at that. 
> 
> Sadly at least on my test here, it didn't help.  Let me know if you
> figure it out, otherwise we may have to ad-hock idmap at least for now. 

This patch seems to work.

metze
-------------- next part --------------
From 2d0f205b1be01361348d5685382903a92d621f6b Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 18 Dec 2014 15:05:12 +0100
Subject: [PATCH] wafsamba: fill PRIVATE_NAME() logic again

We append bld.env.PRIVATE_EXTENSION to the name of private libraries
again, but only unless they have a abi_directory, vnum or soname defined.

This avoids naming conflicts with system libraries, e.g. libidmap.so
on Solaris

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10112

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 buildtools/wafsamba/samba_bundled.py | 16 +++++++++++++++-
 buildtools/wafsamba/wafsamba.py      |  9 ++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index 45946d5..515590f 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -7,11 +7,25 @@ from samba_utils import *
 def PRIVATE_NAME(bld, name, private_extension, private_library):
     '''possibly rename a library to include a bundled extension'''
 
+    if not private_library:
+        return name
+
     # we now use the same private name for libraries as the public name.
     # see http://git.samba.org/?p=tridge/junkcode.git;a=tree;f=shlib for a
     # demonstration that this is the right thing to do
     # also see http://lists.samba.org/archive/samba-technical/2011-January/075816.html
-    return name
+    if private_extension:
+        return name
+
+    extension = bld.env.PRIVATE_EXTENSION
+
+    if extension and name.startswith('%s' % extension):
+        return name
+
+    if extension and name.endswith('%s' % extension):
+        return name
+
+    return "%s-%s" % (name, extension)
 
 
 def target_in_list(target, lst, default):
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index bd2ca89..5fef9be 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -124,7 +124,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                   pyembed=False,
                   pyext=False,
                   target_type='LIBRARY',
-                  bundled_extension=True,
+                  bundled_extension=False,
                   link_name=None,
                   abi_directory=None,
                   abi_match=None,
@@ -218,8 +218,11 @@ def SAMBA_LIBRARY(bld, libname, source,
         else:
             bundled_name = libname.replace('_', '-')
     else:
-        bundled_name = PRIVATE_NAME(bld, libname, bundled_extension,
-            private_library)
+        assert (private_library == True and realname is None)
+        if abi_directory or vnum or soname:
+            bundled_extension=True
+        bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-'),
+                                    bundled_extension, private_library)
 
     ldflags = TO_LIST(ldflags)
 
-- 
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141218/884eee52/attachment.pgp>


More information about the samba-technical mailing list