[SCM] Samba Shared Repository - branch v4-7-test updated

Karolin Seeger kseeger at samba.org
Fri Jan 26 00:30:04 UTC 2018


The branch, v4-7-test has been updated
       via  a73a751 vfs_fruit: set delete-on-close for empty finderinfo
       via  f06e251 vfs_fruit: filter out AFP_AfpInfo streams with pending delete-on-close
       via  f597147 vfs_fruit: factor out delete_invalid_meta_stream() from fruit_streaminfo_meta_stream()
       via  b4864ac s4/torture/fruit: enhance zero AFP_AfpInfo stream test
       via  2a376b7 s4/torture/fruit: ensure AFP_AfpInfo blobs are 0-initialized
       via  aba3f9b dbcheck: disable fixing duplicate linked attributes until we can recover lost forward links
       via  5070224 repl_meta_data: fix linked attribute corruption on databases with unsorted links on expunge
       via  376298e testprogs:blackbox: add regression test for unsorted links in tombstones-expunge.sh
       via  46a212d samba: Only use async signal-safe functions in signal handler
       via  fafbd4e waf: Fix NFS quota support with libtirpc
       via  7ed0c06 wafsamba: Allow passing 'lib' to CHECK_STRUCTURE_MEMBER
       via  25e01d9 build: deal with recent glibc sunrpc header removal
       via  f3f5d50 include: Create system/nis.h in libreplace
       via  3bc0a57 s3:waf: Move HAVE_NETGROUP to wscript
      from  bde3d64 vfs_default: use VFS statvfs macro in fs_capabilities

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test


- Log -----------------------------------------------------------------
commit a73a7512390d71009feee0d0703730539da6fdf6
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 6 22:09:52 2017 +0100

    vfs_fruit: set delete-on-close for empty finderinfo
    
    We previously removed the stream from the underlying filesystem stream
    backing store when the client zeroes out FinderInfo in the AFP_AfpInfo
    stream, but this causes certain operations to fail (eg stat) when trying
    to access the stream over any file-handle open on that stream.
    
    So instead of deleting, set delete-on-close on the stream. The previous
    commit already implemented not to list list streams with delete-on-close
    set which is necessary to implemenent correct macOS semantics for this
    particular stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13181
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Tue Jan  9 17:09:12 CET 2018 on sn-devel-144
    
    (cherry picked from commit e61e9e98e9ff461055daae2fe78f0202f7ed8663)
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Fri Jan 26 01:29:54 CET 2018 on sn-devel-144

commit f06e2514748672fb5847629056357427b91ef44b
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 7 17:32:35 2017 +0100

    vfs_fruit: filter out AFP_AfpInfo streams with pending delete-on-close
    
    This is in preperation of fixing the implementation of removing the
    AFP_AfpInfo stream by zeroing the FinderInfo out.
    
    We currently remove the stream blob from the underyling filesystem
    backing store, but that results in certain operations to fail on any
    still open file-handle.
    
    The fix comes in the next commit which will convert to backing store
    delete operation to a set delete-on-close on the stream.
    
    This commit adds filtering on streams that have the delete-on-close
    set. It is only needed for the fruit:metadata=stream case, as with
    fruit:metadata=netatalk the filtering is already done in
    fruit_streaminfo_meta_netatalk().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13181
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 70d8f7c5d25f35b58620c2db8f57c7c0758267b3)

commit f59714752445bac37feb6ced394afe5a173f3c30
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 7 14:56:36 2017 +0100

    vfs_fruit: factor out delete_invalid_meta_stream() from fruit_streaminfo_meta_stream()
    
    No change in behaviour, just some refactoring before adding more code to
    fruit_streaminfo_meta_stream() in the next commit.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13181
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit c41e1ea9247611473d30184efd953c61955ead15)

commit b4864ac384d23fdff60cc8212ad852a1aa71e6ee
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 7 13:43:02 2017 +0100

    s4/torture/fruit: enhance zero AFP_AfpInfo stream test
    
    This test more operations in the zeroed out FinderInfo test, ensuring
    after zeroing out FinderInfo, operations on the filehandle still work
    and that enumerating streams doesn't return the stream anymore.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13181
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit df31e94eb6241f5e5594f6fd0ec1ad7896e02e27)

commit 2a376b7a77c729cbf403260daa2b7e82677c8775
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 6 22:05:23 2017 +0100

    s4/torture/fruit: ensure AFP_AfpInfo blobs are 0-initialized
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13181
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a22833c2971dc7234b32741305f40ed62e232e0b)

commit aba3f9b8b587328176b5a42388f1e7ff806396d1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 19 11:50:55 2018 +0100

    dbcheck: disable fixing duplicate linked attributes until we can recover lost forward links
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 850a8027f32185e523614231cca76505134bb5e4)

commit 50702246f88a29eb7b6c2fd0e56e9fe87f658f3d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 17 08:07:03 2018 +0100

    repl_meta_data: fix linked attribute corruption on databases with unsorted links on expunge
    
    This is really critical bug, it removes valid linked attributes.
    
    When a DC was provisioned/joined with a Samba version older than 4.7
    is upgraded to 4.7 (or later), it can happen that the garbage collection
    (dsdb_garbage_collect_tombstones()), triggered periodically by the 'kcc' task
    of 'samba' or my 'samba-tool domain tombstones expunge' corrupt the linked attributes.
    
    This is similar to Bug #13095 - Broken linked attribute handling,
    but it's not triggered by an originating change.
    
    The bug happens in replmd_modify_la_delete()
    were get_parsed_dns_trusted() generates a sorted array of
    struct parsed_dn based on the values in old_el->values.
    
    If the database doesn't support the sortedLinks compatibleFeatures
    in the @SAMBA_DSDB record, it's very likely that
    the array of old_dns is sorted differently than the values
    in old_el->values.
    
    The problem is that struct parsed_dn has just a pointer
    'struct ldb_val *v' that points to the corresponding
    value in old_el->values.
    
    Now if vanish_links is true the damage happens here:
    
            if (vanish_links) {
                    unsigned j = 0;
                    for (i = 0; i < old_el->num_values; i++) {
                            if (old_dns[i].v != NULL) {
                                    old_el->values[j] = *old_dns[i].v;
                                    j++;
                            }
                    }
                    old_el->num_values = j;
            }
    
    old_el->values[0] = *old_dns[0].v;
    can change the value old_dns[1].v is pointing at!
    That means that some values can get lost while others
    are stored twice, because the LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK
    allows it to be stored.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit a25c99c9f1fd1814c56c21848c748cd0e038eed7)

commit 376298eccc4fb5fd85e4c4b938b1a8bd9a2132ac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 18 14:54:04 2018 +0100

    testprogs:blackbox: add regression test for unsorted links in tombstones-expunge.sh
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit c34c2dd55545b99fba46cf374a1653bad96cea9e)

commit 46a212dd41fb823d19efa4b6c5feaaa56536d492
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 4 21:06:02 2018 +0100

    samba: Only use async signal-safe functions in signal handler
    
    Otherwise shutdown can hang
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13240
    
    Signed-off-by: Björn Baumbach <bb at sernet.de>
    (similar to commit 361ea743576cf125d7957a97ed78a0446dab1a19)

commit fafbd4edee9888ceb734ef510cc62e461f1f6096
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jan 19 14:30:20 2018 +0100

    waf: Fix NFS quota support with libtirpc
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Mon Jan 22 17:26:52 CET 2018 on sn-devel-144
    
    (cherry picked from commit 39a6ea766dfe55d84ab2284b8d5ed01d66da11dd)

commit 7ed0c0663f378de90b4a0b5b8fe057929979a37f
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jan 19 15:34:32 2018 +0100

    wafsamba: Allow passing 'lib' to CHECK_STRUCTURE_MEMBER
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
    
    We need to be able to point it to the right header location, so we need
    to be able to pass the 'lib' that it gets set.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 87f105d76ce074bff08fd507d72568be88d48d00)

commit 25e01d97e7713e419f0910c803f32c282d10f8a2
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 16 17:48:10 2018 +0100

    build: deal with recent glibc sunrpc header removal
    
    We need to rely on libtirpc or libntirpc to be around in that case.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10976
    
    Guenther
    
    Pair-Programmed-With: Andreas Schneider <asn at samba.org>
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit ee0be7eb723be1420fd601ea1abe0af748562953)

commit f3f5d5000cd3d9466edad2fbbb6f44cbc473792d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jan 19 09:33:21 2018 +0100

    include: Create system/nis.h in libreplace
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
    
    Pair-Programmed-With: Guenther Deschner <gd at samba.org>
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit c29d087e1ea4c92717ef86e372fe80f410580fdc)

commit 3bc0a57a81407cd265780cd6ecb2f12e0d5afb1b
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jan 19 09:32:49 2018 +0100

    s3:waf: Move HAVE_NETGROUP to wscript
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13238
    
    Pair-Programmed-With: Guenther Deschner <gd at samba.org>
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit ca5eaf0cdcf8257ac52786aa7439c8f081a2fe0d)

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba_autoconf.py              |   4 +-
 ctdb/wscript                                       |   2 +-
 lib/replace/system/nis.h                           |  83 ++++++++++
 lib/replace/wscript                                |  38 ++++-
 lib/util/access.c                                  |  10 +-
 lib/util/wscript_build                             |   2 +-
 python/samba/dbchecker.py                          |  22 ++-
 selftest/knownfail.d/dbcheck_duplicate_member      |   5 +
 source3/auth/user_util.c                           |  13 ++
 source3/auth/wscript_build                         |   2 +-
 source3/include/includes.h                         |  49 ------
 source3/lib/sysquotas_nfs.c                        |  11 +-
 source3/lib/util.c                                 |  11 ++
 source3/modules/vfs_fruit.c                        | 173 ++++++++++++++++-----
 source3/wscript                                    |  33 ++--
 source3/wscript_build                              |   2 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |  18 ++-
 .../add-unsorted-links-step1.ldif                  |  72 +++++++++
 .../add-unsorted-links-step2.ldif                  |  12 ++
 .../release-4-5-0-pre1/expected-expunge-output.txt |   2 +-
 .../expected-unsorted-links-after-expunge.ldif     |  23 +++
 source4/smbd/server.c                              |   4 +-
 source4/torture/vfs/fruit.c                        |  89 ++++++++++-
 testprogs/blackbox/tombstones-expunge.sh           |  24 +++
 24 files changed, 574 insertions(+), 130 deletions(-)
 create mode 100644 lib/replace/system/nis.h
 create mode 100644 selftest/knownfail.d/dbcheck_duplicate_member
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/add-unsorted-links-step1.ldif
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/add-unsorted-links-step2.ldif
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/expected-unsorted-links-after-expunge.ldif


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 795d130..5305d9a 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -454,7 +454,8 @@ def CHECK_CODE(conf, code, define,
 
 @conf
 def CHECK_STRUCTURE_MEMBER(conf, structname, member,
-                           always=False, define=None, headers=None):
+                           always=False, define=None, headers=None,
+                           lib=None):
     '''check for a structure member'''
     if define is None:
         define = 'HAVE_%s' % member.upper()
@@ -463,6 +464,7 @@ def CHECK_STRUCTURE_MEMBER(conf, structname, member,
                       define,
                       execute=False,
                       link=False,
+                      lib=lib,
                       always=always,
                       headers=headers,
                       local_include=False,
diff --git a/ctdb/wscript b/ctdb/wscript
index c678228..ad53bb9 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -540,7 +540,7 @@ def build(bld):
     bld.SAMBA_BINARY('smnotify',
                      source=bld.SUBDIR('utils/smnotify',
                                        'smnotify.c gen_smnotify.c gen_xdr.c'),
-                     deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt',
+                     deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt tirpc',
                      includes='utils utils/smnotify',
                      install_path='${CTDB_HELPER_BINDIR}')
 
diff --git a/lib/replace/system/nis.h b/lib/replace/system/nis.h
new file mode 100644
index 0000000..068595a
--- /dev/null
+++ b/lib/replace/system/nis.h
@@ -0,0 +1,83 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   nis system include wrappers
+
+   Copyright (C) Andrew Tridgell 2004
+
+     ** NOTE! The following LGPL license applies to the replace
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _nis_passwd_h
+#define _nis_passwd_h
+
+#if defined(HAVE_RPC_RPC_H)
+/*
+ * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
+ */
+#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
+#undef AUTH_ERROR
+#endif /* HAVE_SYS_SECURITY_H && HAVE_RPC_AUTH_ERROR_CONFLICT */
+/*
+ * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
+ * was included above.  However <rpc/rpc.h> includes <sys/xti.h> which defines
+ * them again without checking if they already exsist.  This generates
+ * two "Redefinition of macro" warnings for every single .c file that is
+ * compiled.
+ */
+#if defined(HPUX) && defined(TCP_NODELAY)
+#undef TCP_NODELAY
+#endif /* HPUX && TCP_NODELAY */
+
+#if defined(HPUX) && defined(TCP_MAXSEG)
+#undef TCP_MAXSEG
+#endif /* HPUX && TCP_MAXSEG */
+
+#include <rpc/rpc.h>
+#endif /* HAVE_RPC_RPC_H */
+
+
+#if defined (HAVE_NETGROUP)
+
+#if defined(HAVE_RPCSVC_YP_PROT_H)
+/*
+ * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
+ * was included above.  However <rpc/rpc.h> includes <sys/xti.h> which defines
+ * them again without checking if they already exsist.  This generates
+ * two "Redefinition of macro" warnings for every single .c file that is
+ * compiled.
+ */
+#if defined(HPUX) && defined(TCP_NODELAY)
+#undef TCP_NODELAY
+#endif /* HPUX && TCP_MAXSEG */
+
+#if defined(HPUX) && defined(TCP_MAXSEG)
+#undef TCP_MAXSEG
+#endif /* HPUX && TCP_MAXSEG */
+
+#include <rpcsvc/yp_prot.h>
+
+#endif /* HAVE_RPCSVC_YP_PROT_H */
+
+#if defined(HAVE_RPCSVC_YPCLNT_H)
+#include <rpcsvc/ypclnt.h>
+#endif /* HAVE_RPCSVC_YPCLNT_H */
+
+#endif /* HAVE_NETGROUP */
+
+#endif /* _nis_passwd_h */
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 7357eea..edd7484 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -5,7 +5,7 @@ VERSION = '1.2.1'
 
 blddir = 'bin'
 
-import sys, os
+import Logs, sys, os
 
 # find the buildtools directory
 srcdir = '.'
@@ -65,14 +65,42 @@ def configure(conf):
                         headers='sys/inotify.h')
 
     conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h')
-    conf.CHECK_HEADERS('aio.h sys/unistd.h rpc/rpc.h rpc/nettype.h alloca.h float.h')
+    conf.CHECK_HEADERS('aio.h sys/unistd.h alloca.h float.h')
+
+    conf.SET_TARGET_TYPE('tirpc', 'EMPTY')
+    conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h')
+    if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+        if conf.CHECK_CFG(package='libtirpc', args='--cflags --libs',
+                       msg='Checking for libtirpc headers',
+                       uselib_store='TIRPC'):
+            conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h', lib='tirpc', together=True)
+            conf.SET_TARGET_TYPE('tirpc', 'SYSLIB')
+    if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+        if conf.CHECK_CFG(package='libntirpc', args='--cflags',
+                       msg='Checking for libntirpc headers',
+                       uselib_store='TIRPC'):
+            conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h', lib='tirpc', together=True)
+            conf.SET_TARGET_TYPE('tirpc', 'SYSLIB')
+    if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+            Logs.error('ERROR: No rpc/rpc.h header found, tirpc or libntirpc missing?')
+            sys.exit(1)
+
+    conf.SET_TARGET_TYPE('nsl', 'EMPTY')
+    conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc')
+    if not conf.CONFIG_SET('HAVE_RPCSVC_YP_PROT_H'):
+        if conf.CHECK_CFG(package='libnsl', args='--cflags --libs',
+                          msg='Checking for libnsl',
+                          uselib_store='NSL'):
+            conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
+            conf.CHECK_HEADERS('rpc/rpc.h rpcsvc/yp_prot.h', lib='tirpc nsl')
+        else:
+            conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
+    conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h', lib='tirpc nsl')
 
-    conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h sys/sysctl.h')
+    conf.CHECK_HEADERS('sys/sysctl.h')
     conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')
 
-    conf.CHECK_CODE('', headers='rpc/rpc.h rpcsvc/yp_prot.h', define='HAVE_RPCSVC_YP_PROT_H')
-
     conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
     conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h')
     conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h')
diff --git a/lib/util/access.c b/lib/util/access.c
index 6d04a5f..7da0573 100644
--- a/lib/util/access.c
+++ b/lib/util/access.c
@@ -22,6 +22,10 @@
 #include "lib/util/access.h"
 #include "lib/util/unix_match.h"
 
+#if defined(HAVE_NETGROUP)
+#include "system/nis.h"
+#endif
+
 #define NAME_INDEX 0
 #define ADDR_INDEX 1
 
@@ -143,11 +147,11 @@ static bool string_match(const char *tok,const char *s)
 
 		netgroup_ok = innetgr(tok + 1, hostname, (char *) 0, mydomain);
 
-		DEBUG(5,("looking for %s of domain %s in netgroup %s gave %s\n",
+		DBG_INFO("%s %s of domain %s in netgroup %s\n",
+			 netgroup_ok ? "Found" : "Could not find",
 			 hostname,
 			 mydomain?mydomain:"(ANY)",
-			 tok+1,
-			 BOOLSTR(netgroup_ok)));
+			 tok+1);
 
 		SAFE_FREE(hostname);
 
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 1d2f2ba..bfa5839 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -203,7 +203,7 @@ else:
 
     bld.SAMBA_SUBSYSTEM('access',
                         source='access.c',
-                        deps='interfaces samba-util',
+                        deps='interfaces samba-util tirpc nsl',
                         local_include=False)
 
     bld.SAMBA_SUBSYSTEM('util_str_escape',
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 1933740..6e4c440 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -708,9 +708,15 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                           "Failed to fix incorrect RMD_FLAGS %u" % rmd_flags):
             self.report("Fixed incorrect RMD_FLAGS %u" % (rmd_flags))
 
-    def err_orphaned_backlink(self, obj, attrname, val, link_name, target_dn):
+    def err_orphaned_backlink(self, obj, attrname, val, link_name, target_dn, duplicate_links):
         '''handle a orphaned backlink value'''
         self.report("ERROR: orphaned backlink attribute '%s' in %s for link %s in %s" % (attrname, obj.dn, link_name, target_dn))
+        if duplicate_links:
+            self.report("ERROR: FATAL! Most likely the corresponding forward link got lost!")
+            self.report("ERROR: FATAL! See https://bugzilla.samba.org/show_bug.cgi?id=13228")
+            self.report("Recovery handling will be implemented in a future version")
+            self.report("Not removing orphaned backlink %s" % attrname)
+            return
         if not self.confirm_all('Remove orphaned backlink %s' % attrname, 'fix_all_orphaned_backlinks'):
             self.report("Not removing orphaned backlink %s" % attrname)
             return
@@ -724,6 +730,11 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     def err_duplicate_links(self, obj, attrname, vals):
         '''handle a duplicate links value'''
 
+        self.report("ERROR: FATAL! Most likely some forward link values for attribute '%s' in '%s' got lost!" % (attrname, obj.dn))
+        self.report("ERROR: FATAL! See https://bugzilla.samba.org/show_bug.cgi?id=13228")
+        self.report("Recovery handling will be implemented in a future version")
+        self.report("Not removing duplicate links in attribute '%s'" % attrname)
+        return
         if not self.confirm_all("Remove duplicate links in attribute '%s'" % attrname, 'fix_all_duplicate_links'):
             self.report("Not removing duplicate links in attribute '%s'" % attrname)
             return
@@ -896,6 +907,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         else:
             reverse_syntax_oid = None
 
+        duplicate_links = False
         duplicate_dict = dict()
         duplicate_list = list()
         unique_dict = dict()
@@ -950,6 +962,10 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             unique_dict[keystr] = dsdb_dn
 
         if len(duplicate_list) != 0:
+            duplicate_links = True
+            self.report("ERROR: FATAL! Most likely some forward link values for attribute '%s' in '%s' got lost!" % (attrname, obj.dn))
+            self.report("ERROR: FATAL! See https://bugzilla.samba.org/show_bug.cgi?id=13228")
+
             self.report("ERROR: Duplicate link values for attribute '%s' in '%s'" % (attrname, obj.dn))
             for keystr in duplicate_list:
                 d = duplicate_dict[keystr]
@@ -1148,7 +1164,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                     error_count += 1
                     self.err_orphaned_backlink(obj, attrname,
                                                val, reverse_link_name,
-                                               dsdb_dn.dn)
+                                               dsdb_dn.dn, duplicate_links)
                     continue
                 # Only warn here and let the forward link logic fix it.
                 self.report("WARNING: Link (back) mismatch for '%s' (%d) on '%s' to '%s' (%d) on '%s'" % (
@@ -1180,7 +1196,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                 else:
                     self.err_orphaned_backlink(res[0], reverse_link_name,
                                                obj.dn.extended_str(), attrname,
-                                               obj.dn)
+                                               obj.dn, duplicate_links)
                     diff_count += 1
 
 
diff --git a/selftest/knownfail.d/dbcheck_duplicate_member b/selftest/knownfail.d/dbcheck_duplicate_member
new file mode 100644
index 0000000..7ebb82b
--- /dev/null
+++ b/selftest/knownfail.d/dbcheck_duplicate_member
@@ -0,0 +1,5 @@
+^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_duplicate_member
+^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.check_expected_after_duplicate_links
+^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.duplicate_clean
+^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_clean2
+^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_clean3
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index 1ddb738..63841a1 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
@@ -23,6 +23,19 @@
 #include "system/filesys.h"
 #include "auth.h"
 
+#ifdef HAVE_NETGROUP
+/* rpc/xdr.h uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
+#include "system/nis.h"
+#endif
+
 /*******************************************************************
  Map a username from a dos name to a unix name by looking in the username
  map. Note that this modifies the name in place.
diff --git a/source3/auth/wscript_build b/source3/auth/wscript_build
index b95fb98..2f55dee 100644
--- a/source3/auth/wscript_build
+++ b/source3/auth/wscript_build
@@ -6,7 +6,7 @@ bld.SAMBA3_SUBSYSTEM('TOKEN_UTIL',
 
 bld.SAMBA3_SUBSYSTEM('USER_UTIL',
                      source='user_util.c',
-                     deps='TOKEN_UTIL')
+                     deps='TOKEN_UTIL tirpc nsl')
 
 bld.SAMBA3_SUBSYSTEM('AUTH_COMMON',
                     source='''auth_util.c
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 58bfaa7..1e1f14a 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -68,55 +68,6 @@
 #include "system/time.h"
 #include "system/wait.h"
 
-#if defined(HAVE_RPC_RPC_H)
-/*
- * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
- */
-#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
-#undef AUTH_ERROR
-#endif
-/*
- * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
- * was included above.  However <rpc/rpc.h> includes <sys/xti.h> which defines
- * them again without checking if they already exsist.  This generates
- * two "Redefinition of macro" warnings for every single .c file that is
- * compiled.
- */
-#if defined(HPUX) && defined(TCP_NODELAY)
-#undef TCP_NODELAY
-#endif
-#if defined(HPUX) && defined(TCP_MAXSEG)
-#undef TCP_MAXSEG
-#endif
-#include <rpc/rpc.h>
-#endif
-
-#if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
-#define HAVE_NETGROUP 1
-#endif
-
-#if defined (HAVE_NETGROUP)
-#if defined(HAVE_RPCSVC_YP_PROT_H)
-/*
- * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
- * was included above.  However <rpc/rpc.h> includes <sys/xti.h> which defines
- * them again without checking if they already exsist.  This generates
- * two "Redefinition of macro" warnings for every single .c file that is
- * compiled.
- */
-#if defined(HPUX) && defined(TCP_NODELAY)
-#undef TCP_NODELAY
-#endif
-#if defined(HPUX) && defined(TCP_MAXSEG)
-#undef TCP_MAXSEG
-#endif
-#include <rpcsvc/yp_prot.h>
-#endif
-#if defined(HAVE_RPCSVC_YPCLNT_H)
-#include <rpcsvc/ypclnt.h>
-#endif
-#endif /* HAVE_NETGROUP */
-
 #ifndef HAVE_KRB5_H
 #undef HAVE_KRB5
 #endif
diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c
index fe46d3f..dd2b12d 100644
--- a/source3/lib/sysquotas_nfs.c
+++ b/source3/lib/sysquotas_nfs.c
@@ -36,13 +36,22 @@
  * This is based on the FreeBSD / SUNOS5 section of quotas.c
  */
 
+/* <rpc/xdr.h> uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
 #include <rpc/rpc.h>
 #include <rpc/types.h>
+#include <rpc/xdr.h>
 #include <rpcsvc/rquota.h>
 #ifdef HAVE_RPC_NETTYPE_H
 #include <rpc/nettype.h>
 #endif
-#include <rpc/xdr.h>
 
 #ifndef RQ_PATHLEN
 #define RQ_PATHLEN 1024
diff --git a/source3/lib/util.c b/source3/lib/util.c
index fb50884..ae9fe71 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -45,6 +45,17 @@
 #define MAX_ALLOC_SIZE (1024*1024*256)
 
 #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
+/* rpc/xdr.h uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
+#include "system/nis.h"
+
 #ifdef WITH_NISPLUS_HOME
 #ifdef BROKEN_NISPLUS_INCLUDE_FILES
 /*
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 8c3870b..1e9ec58 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -4134,26 +4134,35 @@ static ssize_t fruit_pwrite_meta_stream(vfs_handle_struct *handle,
 					size_t n, off_t offset)
 {
 	AfpInfo *ai = NULL;
-	int ret;
+	size_t nwritten;
+	bool ok;
 
 	ai = afpinfo_unpack(talloc_tos(), data);
 	if (ai == NULL) {
 		return -1;
 	}
 
-	if (ai_empty_finderinfo(ai)) {
-		ret = SMB_VFS_NEXT_UNLINK(handle, fsp->fsp_name);
-		if (ret != 0 && errno != ENOENT && errno != ENOATTR) {
-			DBG_ERR("Can't delete metadata for %s: %s\n",
-				fsp_str_dbg(fsp), strerror(errno));
-			TALLOC_FREE(ai);
-			return -1;
-		}
+	nwritten = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+	if (nwritten != n) {
+		return -1;
+	}
 
+	if (!ai_empty_finderinfo(ai)) {
 		return n;
 	}
 
-	return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+	ok = set_delete_on_close(
+			fsp,
+			true,
+			handle->conn->session_info->security_token,
+			handle->conn->session_info->unix_token);
+	if (!ok) {
+		DBG_ERR("set_delete_on_close on [%s] failed\n",
+			fsp_str_dbg(fsp));
+		return -1;
+	}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list