The branch, master has been updated
       via  c4409ea perf: Add simple tests for the open/close a database case
       via  70b9f83 KCC: unconnected graph test
       via  1a5445c KCC: avoid infinite recursion when edgelist contains self
       via  6057c25 KCC: Graphnode.add_edge_from expects dn strings, not objects
       via  aa63600 ldb: new ldb version 1.1.29
       via  6ca5e9e ldb: Add test for behaviour of rdn_name
       via  4dfe84a ldb: Cope with a->name being *
       via  ea3c966 ldb:rdn_name: add support for 
LDB_CONTROL_RECALCULATE_RDN_OID on ldb_modify()
       via  25aa261 ldb:rdn_name: normalize rdn_name in rdn_rename_callback()
       via  f599a2d ldb: load @ATTRIBUTES faster by sorting once, not at each 
insertion
       via  393b8f3 ldb: Add helper function 
ldb_schema_attribute_fill_with_syntax()
       via  d8ee927 ldb: Reduce per-attribute memory allocation during 
@ATTRIBUTES load
       via  df2cc30 ldb: Reduce scope of allocation and de-allocation of 
@ATTRIBUTES
       via  604a4fd ldb: Add helper function 
ldb_schema_attribute_remove_flagged()
       via  4e1b965 ldb:controls: add LDB_CONTROL_RECALCULATE_RDN_OID
       via  2628aa5 ldb: Avoid individual memory allocations when searching for 
indexlist
       via  3739532 dsdb: specify attributes when loading schema
       via  c6c1463 pidl: Make static struct api_struct also const
       via  d368ee2 pidl: Change *_get_pipe_fns() to return const struct 
api_struct *
       via  d4990bc s4-rpc_server: Use an initialised static const struct in 
dcerpc_server_remote_init
       via  a6357d9 s4-rpc_server: Use a type-safe struct signature in 
dcerpc_register_ep_server
       via  778fc58 pidl: Use a static const initialised struct in 
dcerpc_server_$name_init(void)
       via  bf7342b torture: Remove access to LSARPC via \pipe
etlogon in rpc.netlogon for ManyGetDCName test
       via  5a1dcf2 s4/rpc_server: Show what RPC interfaces are listening on 
which TCP port
       via  5cb1882 talloc: Add tests for talloc_parent() after realloc() of 
the parent
       via  48c897f talloc: clarify that talloc_magic never includes the bits 
in TALLOC_FLAG_MASK
       via  032e25f talloc: add ASCII art to describe parent/child arrangement
       via  3c9d703 Fix typo
       via  a39c494 python: Add py3compat.h
       via  1e27111 python: samba.subunit.run: Fix Python 3 compatibility.
       via  8f8b0fd python: selftesthelpers: Add possibility for planning tests 
for 'extra_python' (Python 3).
       via  358eaf8 python: wscript_build: Prepare build environment for Python 
3 porting
       via  c503ca3 join.py: Attempt to allocate a RID Set during the join
       via  62e19e6 selftest: Ensure vampiredc has a full copy of localdc 
before we start
       via  07df896 selftest: Rework child process cleanup
       via  e952a12 selftest/gdb_*: make use of 'mktemp'
      from  446851c librpc: cab: Fix ndr_size_cab_file() to detect integer wrap.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c4409ea13074e0b01bcdd3020595e00bbd74225d
Author: Andrew Bartlett <abart...@samba.org>
Date:   Tue Oct 18 10:39:00 2016 +1300

    perf: Add simple tests for the open/close a database case
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abart...@samba.org>
    Autobuild-Date(master): Thu Dec  1 09:40:20 CET 2016 on sn-devel-144

commit 70b9f8308d244f76b9e87f4a1b319a7e4c4d3569
Author: Clive Ferreira <cliveferre...@catalyst.net.nz>
Date:   Fri Nov 4 12:31:09 2016 +1300

    KCC: unconnected graph test
    
    Uses a unconnected 5 DC single site database to test Douglas Bagnalls
    patch which corrected a mix up between a str and an object which caused
    infinite recursion and a method call on a None type.
    
    This test patch originally triggered an edge case bug. This bug is
    triggered by code to create additional edges which normally never ran.
    In normal cases, the leftover connections made during a join would
    prevent these additional edges from being created.
    
    Signed-off-by: Clive Ferreira <cliveferre...@catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 1a5445ca4e729389a7b5c226cf1d9b73429013a1
Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
Date:   Wed Nov 2 16:49:49 2016 +1300

    KCC: avoid infinite recursion when edgelist contains self
    
    Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 6057c2522c85e23899dc26be4537683e388d49f0
Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
Date:   Wed Nov 2 16:48:50 2016 +1300

    KCC: Graphnode.add_edge_from expects dn strings, not objects
    
    Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit aa63600afb925715f7a24a3af5c0df433541bc12
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 28 14:05:41 2016 +1300

    ldb: new ldb version 1.1.29
    
     - new OID LDB_CONTROL_RECALCULATE_RDN_OID
     - honour LDB_CONTROL_RECALCULATE_RDN_OID in rdn_modify
     - fix handling of @ATTRIBUTES containing * in rdn_modify
     - improve startup performance on AD DC databases
      - These have lots of index attributes and attributes specified
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 6ca5e9ee1c1afdab70689116d5d47d59e410314d
Author: Andrew Bartlett <abart...@samba.org>
Date:   Thu Dec 1 12:11:46 2016 +1300

    ldb: Add test for behaviour of rdn_name
    
    Cover a wildcard in @ATTRIBUTES and the normal case.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 4dfe84a98459d1e6a7de12a54295b0c92bcdde26
Author: Andrew Bartlett <abart...@samba.org>
Date:   Tue Nov 29 16:20:07 2016 +1300

    ldb: Cope with a->name being *
    
    The default schema when loaded from the DB will have a name of *, not NULL.
    
    This feature is rarely used, and was incompatible with the rdn_name module
    until now.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit ea3c96647faef4911c6fe376f71e2b0dc63c7259
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Nov 10 18:03:26 2016 +0100

    ldb:rdn_name: add support for LDB_CONTROL_RECALCULATE_RDN_OID on 
ldb_modify()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12399
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 25aa26178faf87efc166ec0bad8d86fb1968d7c7
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Nov 10 14:01:21 2016 +0100

    ldb:rdn_name: normalize rdn_name in rdn_rename_callback()
    
    We already do that on 'add'.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12399
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit f599a2d244ac14fd804a4f08bdfdef6f48c862e9
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Oct 19 13:24:36 2016 +1300

    ldb: load @ATTRIBUTES faster by sorting once, not at each insertion
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 393b8f3c1d2552374bff1c5067bf5f86b09446b1
Author: Andrew Bartlett <abart...@samba.org>
Date:   Thu Oct 20 16:01:42 2016 +1300

    ldb: Add helper function ldb_schema_attribute_fill_with_syntax()
    
    This will allow us to avoid calling ldb_schema_attribute_add_with_syntax()
    in a tight loop.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit d8ee92734b0fdaee52734f4b22315a31d15388ab
Author: Andrew Bartlett <abart...@samba.org>
Date:   Fri Oct 14 15:42:53 2016 +1300

    ldb: Reduce per-attribute memory allocation during @ATTRIBUTES load
    
    This means we do just a few allocations, not multiple per configured 
attribute (there can be 1000s)
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit df2cc307e7993197a8793e6beadc967432168cc5
Author: Andrew Bartlett <abart...@samba.org>
Date:   Fri Oct 14 15:35:46 2016 +1300

    ldb: Reduce scope of allocation and de-allocation of @ATTRIBUTES
    
    This memory does not need to be around long-term
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 604a4fd438200d36c65aec089bdf43dba0b87e6f
Author: Andrew Bartlett <abart...@samba.org>
Date:   Thu Oct 20 16:04:04 2016 +1300

    ldb: Add helper function ldb_schema_attribute_remove_flagged()
    
    This helps us avoid keeping a list of attributes to later remove on 
@ATTRIBUTES reload
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 4e1b965005d76b3dc57cb7efbf21591a3cf80688
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Nov 10 18:01:47 2016 +0100

    ldb:controls: add LDB_CONTROL_RECALCULATE_RDN_OID
    
    This will be used by 'samba-tool dbcheck' to fix the rdn attribute name.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12399
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>
    
    (Patch reduced by Andrew Bartlett to only allocate the OID)

commit 2628aa5f7e3b055f0f96462a70d96f8e2221960d
Author: Andrew Bartlett <abart...@samba.org>
Date:   Tue Oct 25 10:56:43 2016 +1300

    ldb: Avoid individual memory allocations when searching for indexlist
    
    This reduces the talloc_free() cost when the ldb is terminated.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 37395322c5046e5b7714c0b4697d328f3352a375
Author: Andrew Bartlett <abart...@samba.org>
Date:   Fri Oct 14 15:43:46 2016 +1300

    dsdb: specify attributes when loading schema
    
    The LDB code performs better when the required attributes are listed, even 
when it is almost
    all the attributes
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit c6c1463852533ed8234911835b8b1fce29b2d3d8
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 21 11:58:07 2016 +1300

    pidl: Make static struct api_struct also const
    
    This moves the table to read-only memory
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit d368ee2298bc472caca940a3db7a4f855df6ca21
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 21 11:57:48 2016 +1300

    pidl: Change *_get_pipe_fns() to return const struct api_struct *
    
    This will allow the table to be made static const in the next commit
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit d4990bcf7f62ff243f148ec460feab7fad35b6c9
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 21 11:42:30 2016 +1300

    s4-rpc_server: Use an initialised static const struct in 
dcerpc_server_remote_init
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit a6357d9949c6e0baf7a85beb152bee7e778b633f
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 21 11:39:16 2016 +1300

    s4-rpc_server: Use a type-safe struct signature in dcerpc_register_ep_server
    
    This is much safer than void *, and the void * feature appears no longer
    to be needed after 31ded4901b4529ad2e49871502cab5ecba71483a
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 778fc58eb281e38eb1a3346b58cfdf9682f104c4
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 21 11:38:24 2016 +1300

    pidl: Use a static const initialised struct in 
dcerpc_server_$name_init(void)
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit bf7342bdf4fea9ce49915d88ab4bf5202cb1b64b
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Nov 9 14:22:33 2016 +1300

    torture: Remove access to LSARPC via \\pipe\netlogon in rpc.netlogon for 
ManyGetDCName test
    
    This exploited the fact that we had \\pipe\lsass in both netlogon.idl and 
lsarpc.idl
    
    To do this, we reset the binding to a new endpoint and reset the 
association group.
    
    We add a new test specifically for this "feature" that we can knownfail if 
we
    break it to add other new functionality.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 5a1dcf2385cc03c45c546522e38585b3092c35af
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Oct 19 12:45:05 2016 +1300

    s4/rpc_server: Show what RPC interfaces are listening on which TCP port
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 5cb1882dc6ae044acd5e8fda2a19aca5fc9bc2fa
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 28 11:47:41 2016 +1300

    talloc: Add tests for talloc_parent() after realloc() of the parent
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 48c897f126b68c1bc5b5b05e203e65fa1dc89390
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Nov 23 10:26:14 2016 +1300

    talloc: clarify that talloc_magic never includes the bits in 
TALLOC_FLAG_MASK
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 032e25fdc6f5f9c59ead471bc01ad62ae7383d81
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Nov 28 14:44:40 2016 +1300

    talloc: add ASCII art to describe parent/child arrangement
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 3c9d703d45a72cf10b4e9065e2071fff84dc67c8
Author: Alexis La Goutte <alexis.lagou...@gmail.com>
Date:   Wed Oct 26 22:18:09 2016 +0200

    Fix typo
    
    Fix (minor) typo found in wireshark with lintian tools
    https://code.wireshark.org/review/#/c/18485/
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit a39c4948a6bbda02a6b74b8e7e01dde290392e3d
Author: Petr Viktorin <pvikt...@redhat.com>
Date:   Tue Jun 28 17:58:04 2016 +0200

    python: Add py3compat.h
    
    This adds a shared header file with macros that enable compatibility
    between Python 2 and 3.
    The macros are the ones used in ldb/tdb, with some additions
    that make sense when the header is shared among several modules.
    See the module for a summary of contents.
    
    Signed-off-by: Petr Viktorin <pvikt...@redhat.com>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 1e27111955b4f4c038d037caa40c415313525fc7
Author: Lumir Balhar <lbal...@redhat.com>
Date:   Wed Oct 19 13:32:59 2016 +0200

    python: samba.subunit.run: Fix Python 3 compatibility.
    
    Usage of function _test_id() which generates test id in bytes breaks
    Python 3 compatibility. After fix, this function is not used any more.
    
    Signed-off-by: Lumir Balhar <lbal...@redhat.com>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 8f8b0fd12a72630d6340ad976eccb431d265e4d0
Author: Lumir Balhar <lbal...@redhat.com>
Date:   Wed Oct 19 20:51:47 2016 +0200

    python: selftesthelpers: Add possibility for planning tests for
    'extra_python' (Python 3).
    
    This change allows us to mark modules which are Python 3 compatible
    with the keyword argument `py3_compatible`. Then, if building with
    Python 3 is configured using --extra-python, `planpythontestsuite`
    will plan an extra Python test for each marked module.
    
    Signed-off-by: Lumir Balhar <lbal...@redhat.com>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 358eaf810edd59cb16e95d77967a7b37ecf6bb94
Author: Lumir Balhar <lbal...@redhat.com>
Date:   Wed Oct 19 20:26:22 2016 +0200

    python: wscript_build: Prepare build environment for Python 3 porting
    
    Signed-off-by: Lumir Balhar <lbal...@redhat.com>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit c503ca302d4f9dd0fc9c01344a25a917f6c3fafe
Author: Andrew Bartlett <abart...@samba.org>
Date:   Mon Oct 31 16:48:33 2016 +1300

    join.py: Attempt to allocate a RID Set during the join
    
    If we are joining the RID Manager, then we should get a RID Set, but
    otherwise we should accept failure with the right error code
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 62e19e6b4ac1d0d0325d18516082bc14ce2fa50c
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Nov 30 17:09:44 2016 +1300

    selftest: Ensure vampiredc has a full copy of localdc before we start
    
    Otherwise we may fail tests because we are still pulling in the full replica
    from localdc during the tests.  This may block RID allocation in particular.
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit 07df896a34bc0f776fe98ac16fc5dac38e494d92
Author: Andrew Bartlett <abart...@samba.org>
Date:   Wed Nov 30 14:18:46 2016 +1300

    selftest: Rework child process cleanup
    
    We now:
     - call gdb_backtrace on the stuck pid to determine why it is stuck
     - cleanup faster as we catch the process exit
       (by not waiting until 1 second after the exit for waitpid() to return -1)
    
    Signed-off-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

commit e952a127d676c308eab7b9dd356a36766749ac06
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Nov 23 12:26:18 2016 +0100

    selftest/gdb_*: make use of 'mktemp'
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Garming Sam <garm...@catalyst.net.nz>

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

Summary of changes:
 lib/ldb/ABI/{ldb-1.1.27.sigs => ldb-1.1.29.sigs}   |   2 +
 ...ldb-util-1.1.10.sigs => pyldb-util-1.1.29.sigs} |   0
 ...util-1.1.10.sigs => pyldb-util.py3-1.1.29.sigs} |   0
 lib/ldb/common/ldb_attributes.c                    |  68 +++
 lib/ldb/include/ldb.h                              |  12 +
 lib/ldb/include/ldb_private.h                      |  12 +
 lib/ldb/ldb_tdb/ldb_cache.c                        | 138 +++--
 lib/ldb/ldb_tdb/ldb_tdb.h                          |   1 -
 lib/ldb/modules/rdn_name.c                         | 155 +++++-
 lib/ldb/tests/test-tdb-features.sh                 |  13 +
 lib/ldb/wscript                                    |   2 +-
 lib/talloc/talloc.c                                |  32 +-
 lib/talloc/testsuite.c                             |  17 +-
 pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm            |   8 +-
 pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm           |  17 +-
 pidl/lib/Parse/Yapp/Driver.pm                      |   2 +-
 python/py3compat.h                                 | 167 ++++++
 python/samba/join.py                               |  20 +
 python/samba/kcc/__init__.py                       |   2 +-
 python/samba/kcc/kcc_utils.py                      |   6 +-
 python/samba/subunit/run.py                        |  10 +-
 python/samba/tests/kcc/ldif_import_export.py       |  24 +
 python/wscript_build                               |  12 +-
 selftest/gdb_backtrace                             |  12 +-
 selftest/gdb_run                                   |   9 +-
 selftest/knownfail                                 |   4 -
 selftest/perf_tests.py                             |  23 +
 selftest/selftesthelpers.py                        |   7 +-
 selftest/target/Samba4.pm                          |  73 ++-
 source3/winbindd/winbindd_dual_ndr.c               |   4 +-
 source4/dsdb/samdb/ldb_modules/schema_load.c       |  15 +-
 source4/dsdb/schema/schema.h                       |  51 ++
 source4/dsdb/tests/python/ad_dc_multi_bind.py      |  94 ++++
 source4/rpc_server/dcerpc_server.c                 |  12 +-
 source4/rpc_server/dcerpc_server.h                 |   2 +-
 source4/rpc_server/remote/dcesrv_remote.c          |  18 +-
 source4/setup/schema_samba4.ldif                   |   1 +
 source4/torture/rpc/netlogon.c                     |  70 ++-
 testdata/unconnected-intrasite.ldif                | 606 +++++++++++++++++++++
 39 files changed, 1593 insertions(+), 128 deletions(-)
 copy lib/ldb/ABI/{ldb-1.1.27.sigs => ldb-1.1.29.sigs} (98%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.1.29.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.1.29.sigs} (100%)
 create mode 100644 python/py3compat.h
 create mode 100644 source4/dsdb/tests/python/ad_dc_multi_bind.py
 create mode 100644 testdata/unconnected-intrasite.ldif


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ABI/ldb-1.1.27.sigs b/lib/ldb/ABI/ldb-1.1.29.sigs
similarity index 98%
copy from lib/ldb/ABI/ldb-1.1.27.sigs
copy to lib/ldb/ABI/ldb-1.1.29.sigs
index 4fa30d8..0ea968d 100644
--- a/lib/ldb/ABI/ldb-1.1.27.sigs
+++ b/lib/ldb/ABI/ldb-1.1.29.sigs
@@ -221,7 +221,9 @@ ldb_save_controls: int (struct ldb_control *, struct 
ldb_request *, struct ldb_c
 ldb_schema_attribute_add: int (struct ldb_context *, const char *, unsigned 
int, const char *)
 ldb_schema_attribute_add_with_syntax: int (struct ldb_context *, const char *, 
unsigned int, const struct ldb_schema_syntax *)
 ldb_schema_attribute_by_name: const struct ldb_schema_attribute *(struct 
ldb_context *, const char *)
+ldb_schema_attribute_fill_with_syntax: int (struct ldb_context *, TALLOC_CTX 
*, const char *, unsigned int, const struct ldb_schema_syntax *, struct 
ldb_schema_attribute *)
 ldb_schema_attribute_remove: void (struct ldb_context *, const char *)
+ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int)
 ldb_schema_attribute_set_override_handler: void (struct ldb_context *, 
ldb_attribute_handler_override_fn_t, void *)
 ldb_search: int (struct ldb_context *, TALLOC_CTX *, struct ldb_result **, 
struct ldb_dn *, enum ldb_scope, const char * const *, const char *, ...)
 ldb_search_default_callback: int (struct ldb_request *, struct ldb_reply *)
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs 
b/lib/ldb/ABI/pyldb-util-1.1.29.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.1.29.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs 
b/lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs
diff --git a/lib/ldb/common/ldb_attributes.c b/lib/ldb/common/ldb_attributes.c
index 767f69c..2021a0b 100644
--- a/lib/ldb/common/ldb_attributes.c
+++ b/lib/ldb/common/ldb_attributes.c
@@ -32,6 +32,41 @@
 #include "ldb_handlers.h"
 
 /*
+  fill in an attribute to the ldb_schema into the supplied buffer
+
+  if flags contains LDB_ATTR_FLAG_ALLOCATED
+  the attribute name string will be copied using
+  talloc_strdup(), otherwise it needs to be a static const
+  string at least with a lifetime longer than the ldb struct!
+
+  the ldb_schema_syntax structure should be a pointer
+  to a static const struct or at least it needs to be
+  a struct with a longer lifetime than the ldb context!
+
+*/
+int ldb_schema_attribute_fill_with_syntax(struct ldb_context *ldb,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *attribute,
+                                         unsigned flags,
+                                         const struct ldb_schema_syntax 
*syntax,
+                                         struct ldb_schema_attribute *a)
+{
+       a->name = attribute;
+       a->flags        = flags;
+       a->syntax       = syntax;
+
+       if (a->flags & LDB_ATTR_FLAG_ALLOCATED) {
+               a->name = talloc_strdup(mem_ctx, a->name);
+               if (a->name == NULL) {
+                       ldb_oom(ldb);
+                       return -1;
+               }
+       }
+
+       return 0;
+}
+
+/*
   add a attribute to the ldb_schema
 
   if flags contains LDB_ATTR_FLAG_ALLOCATED
@@ -216,6 +251,39 @@ void ldb_schema_attribute_remove(struct ldb_context *ldb, 
const char *name)
 }
 
 /*
+  remove attributes with a specified flag (eg LDB_ATTR_FLAG_FROM_DB) for this 
ldb context
+
+  This is to permit correct reloads
+*/
+void ldb_schema_attribute_remove_flagged(struct ldb_context *ldb, unsigned int 
flag)
+{
+       ptrdiff_t i;
+
+       for (i = 0; i < ldb->schema.num_attributes;) {
+               const struct ldb_schema_attribute *a
+                       = &ldb->schema.attributes[i];
+               /* FIXED attributes are never removed */
+               if (a->flags & LDB_ATTR_FLAG_FIXED) {
+                       i++;
+                       continue;
+               }
+               if ((a->flags & flag) == 0) {
+                       i++;
+                       continue;
+               }
+               if (a->flags & LDB_ATTR_FLAG_ALLOCATED) {
+                       talloc_free(discard_const_p(char, a->name));
+               }
+               if (i < ldb->schema.num_attributes - 1) {
+                       memmove(&ldb->schema.attributes[i],
+                               a+1, sizeof(*a) * 
(ldb->schema.num_attributes-(i+1)));
+               }
+
+               ldb->schema.num_attributes--;
+       }
+}
+
+/*
   setup a attribute handler using a standard syntax
 */
 int ldb_schema_attribute_add(struct ldb_context *ldb,
diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h
index 7422d46..397f994 100644
--- a/lib/ldb/include/ldb.h
+++ b/lib/ldb/include/ldb.h
@@ -427,6 +427,11 @@ const struct ldb_dn_extended_syntax 
*ldb_dn_extended_syntax_by_name(struct ldb_c
  */
 #define LDB_ATTR_FLAG_FORCE_BASE64_LDIF        (1<<5)
 
+/*
+ * The attribute was loaded from a DB, rather than via the C API
+ */
+#define LDB_ATTR_FLAG_FROM_DB      (1<<6)
+
 /**
   LDAP attribute syntax for a DN
 
@@ -499,6 +504,13 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, 
void *opaque);
 #define LDB_CONTROL_BYPASS_OPERATIONAL_NAME "bypassoperational"
 
 /**
+  OID for recalculate RDN (rdn attribute and 'name') control. This control 
forces
+  the rdn_name module to the recalculate the rdn and name attributes as if the
+  object was just created.
+*/
+#define LDB_CONTROL_RECALCULATE_RDN_OID "1.3.6.1.4.1.7165.4.3.30"
+
+/**
   OID for recalculate SD control. This control force the
   dsdb code to recalculate the SD of the object as if the
   object was just created.
diff --git a/lib/ldb/include/ldb_private.h b/lib/ldb/include/ldb_private.h
index 26a9d42..644d49c 100644
--- a/lib/ldb/include/ldb_private.h
+++ b/lib/ldb/include/ldb_private.h
@@ -163,6 +163,18 @@ extern const struct ldb_backend_ops ldb_ldapi_backend_ops;
 extern const struct ldb_backend_ops ldb_ldaps_backend_ops;
 
 int ldb_setup_wellknown_attributes(struct ldb_context *ldb);
+/*
+  remove attributes with a specified flag (eg LDB_ATTR_FLAG_FROM_DB) for this 
ldb context
+
+  This is to permit correct reloads
+*/
+void ldb_schema_attribute_remove_flagged(struct ldb_context *ldb, unsigned int 
flag);
+int ldb_schema_attribute_fill_with_syntax(struct ldb_context *ldb,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *attribute,
+                                         unsigned flags,
+                                         const struct ldb_schema_syntax 
*syntax,
+                                         struct ldb_schema_attribute *a);
 
 const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname);
 void ldb_subclass_remove(struct ldb_context *ldb, const char *classname);
diff --git a/lib/ldb/ldb_tdb/ldb_cache.c b/lib/ldb/ldb_tdb/ldb_cache.c
index 2f19d27..5ea09d6 100644
--- a/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/lib/ldb/ldb_tdb/ldb_cache.c
@@ -56,26 +56,10 @@ static const struct {
 */
 static void ltdb_attributes_unload(struct ldb_module *module)
 {
-       struct ldb_context *ldb;
-       void *data = ldb_module_get_private(module);
-       struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
-       struct ldb_message *msg;
-       unsigned int i;
-
-       ldb = ldb_module_get_ctx(module);
-
-       if (ltdb->cache->attributes == NULL) {
-               /* no previously loaded attributes */
-               return;
-       }
+       struct ldb_context *ldb = ldb_module_get_ctx(module);
 
-       msg = ltdb->cache->attributes;
-       for (i=0;i<msg->num_elements;i++) {
-               ldb_schema_attribute_remove(ldb, msg->elements[i].name);
-       }
+       ldb_schema_attribute_remove_flagged(ldb, LDB_ATTR_FLAG_FROM_DB);
 
-       talloc_free(ltdb->cache->attributes);
-       ltdb->cache->attributes = NULL;
 }
 
 /*
@@ -102,17 +86,24 @@ static int ltdb_attributes_flags(struct 
ldb_message_element *el, unsigned *v)
        return 0;
 }
 
+static int ldb_schema_attribute_compare(const void *p1, const void *p2)
+{
+       const struct ldb_schema_attribute *sa1 = (const struct 
ldb_schema_attribute *)p1;
+       const struct ldb_schema_attribute *sa2 = (const struct 
ldb_schema_attribute *)p2;
+       return ldb_attr_cmp(sa1->name, sa2->name);
+}
+
 /*
   register any special handlers from @ATTRIBUTES
 */
 static int ltdb_attributes_load(struct ldb_module *module)
 {
+       struct ldb_schema_attribute *attrs;
        struct ldb_context *ldb;
-       void *data = ldb_module_get_private(module);
-       struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
-       struct ldb_message *msg = ltdb->cache->attributes;
+       struct ldb_message *attrs_msg = NULL;
        struct ldb_dn *dn;
        unsigned int i;
+       unsigned int num_loaded_attrs = 0;
        int r;
 
        ldb = ldb_module_get_ctx(module);
@@ -123,26 +114,57 @@ static int ltdb_attributes_load(struct ldb_module *module)
                return 0;
        }
 
+       attrs_msg = ldb_msg_new(module);
+       if (attrs_msg == NULL) {
+               goto failed;
+       }
+
        dn = ldb_dn_new(module, ldb, LTDB_ATTRIBUTES);
        if (dn == NULL) goto failed;
 
-       r = ltdb_search_dn1(module, dn, msg, 0);
+       r = ltdb_search_dn1(module, dn, attrs_msg,
+                           LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_DN);
        talloc_free(dn);
        if (r != LDB_SUCCESS && r != LDB_ERR_NO_SUCH_OBJECT) {
                goto failed;
        }
-       if (r == LDB_ERR_NO_SUCH_OBJECT) {
+       if (r == LDB_ERR_NO_SUCH_OBJECT || attrs_msg->num_elements == 0) {
+               TALLOC_FREE(attrs_msg);
                return 0;
        }
+
+       attrs = talloc_array(attrs_msg,
+                            struct ldb_schema_attribute,
+                            attrs_msg->num_elements
+                            + ldb->schema.num_attributes);
+       if (attrs == NULL) {
+               goto failed;
+       }
+
+       memcpy(attrs,
+              ldb->schema.attributes,
+              sizeof(ldb->schema.attributes[0]) * ldb->schema.num_attributes);
+
        /* mapping these flags onto ldap 'syntaxes' isn't strictly correct,
           but its close enough for now */
-       for (i=0;i<msg->num_elements;i++) {
+       for (i=0;i<attrs_msg->num_elements;i++) {
                unsigned flags;
                const char *syntax;
                const struct ldb_schema_syntax *s;
+               const struct ldb_schema_attribute *a =
+                       ldb_schema_attribute_by_name(ldb,
+                                                    
attrs_msg->elements[i].name);
+               if (a != NULL && a->flags & LDB_ATTR_FLAG_FIXED) {
+                       /* Must already be set in the array, and kept */
+                       continue;
+               }
 
-               if (ltdb_attributes_flags(&msg->elements[i], &flags) != 0) {
-                       ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid @ATTRIBUTES 
element for '%s'", msg->elements[i].name);
+               if (ltdb_attributes_flags(&attrs_msg->elements[i], &flags) != 
0) {
+                       ldb_debug(ldb, LDB_DEBUG_ERROR,
+                                 "Invalid @ATTRIBUTES element for '%s'",
+                                 attrs_msg->elements[i].name);
                        goto failed;
                }
                switch (flags & ~LTDB_FLAG_HIDDEN) {
@@ -157,27 +179,50 @@ static int ltdb_attributes_load(struct ldb_module *module)
                        break;
                default:
                        ldb_debug(ldb, LDB_DEBUG_ERROR, 
-                                 "Invalid flag combination 0x%x for '%s' in 
@ATTRIBUTES",
-                                 flags, msg->elements[i].name);
+                                 "Invalid flag combination 0x%x for '%s' "
+                                 "in @ATTRIBUTES",
+                                 flags, attrs_msg->elements[i].name);
                        goto failed;
                }
 
                s = ldb_standard_syntax_by_name(ldb, syntax);
                if (s == NULL) {
                        ldb_debug(ldb, LDB_DEBUG_ERROR, 
-                                 "Invalid attribute syntax '%s' for '%s' in 
@ATTRIBUTES",
-                                 syntax, msg->elements[i].name);
+                                 "Invalid attribute syntax '%s' for '%s' "
+                                 "in @ATTRIBUTES",
+                                 syntax, attrs_msg->elements[i].name);
                        goto failed;
                }
 
-               flags |= LDB_ATTR_FLAG_ALLOCATED;
-               if (ldb_schema_attribute_add_with_syntax(ldb, 
msg->elements[i].name, flags, s) != 0) {
+               flags |= LDB_ATTR_FLAG_ALLOCATED | LDB_ATTR_FLAG_FROM_DB;
+
+               r = ldb_schema_attribute_fill_with_syntax(ldb,
+                                                         attrs,
+                                                         
attrs_msg->elements[i].name,
+                                                         flags, s,
+                                                         
&attrs[num_loaded_attrs + ldb->schema.num_attributes]);
+               if (r != 0) {
                        goto failed;
                }
+               num_loaded_attrs++;
        }
 
+       attrs = talloc_realloc(attrs_msg,
+                              attrs, struct ldb_schema_attribute,
+                              num_loaded_attrs + ldb->schema.num_attributes);
+       if (attrs == NULL) {
+               goto failed;
+       }
+       TYPESAFE_QSORT(attrs, num_loaded_attrs + ldb->schema.num_attributes,
+                      ldb_schema_attribute_compare);
+       talloc_unlink(ldb, ldb->schema.attributes);
+       ldb->schema.attributes = talloc_steal(ldb, attrs);
+       ldb->schema.num_attributes = num_loaded_attrs + 
ldb->schema.num_attributes;
+       TALLOC_FREE(attrs_msg);
+
        return 0;
 failed:
+       TALLOC_FREE(attrs_msg);
        return -1;
 }
 
@@ -288,9 +333,7 @@ int ltdb_cache_load(struct ldb_module *module)
                ltdb->cache = talloc_zero(ltdb, struct ltdb_cache);
                if (ltdb->cache == NULL) goto failed;
                ltdb->cache->indexlist = ldb_msg_new(ltdb->cache);
-               ltdb->cache->attributes = ldb_msg_new(ltdb->cache);
-               if (ltdb->cache->indexlist == NULL ||
-                   ltdb->cache->attributes == NULL) {
+               if (ltdb->cache->indexlist == NULL) {
                        goto failed;
                }
        }
@@ -360,12 +403,17 @@ int ltdb_cache_load(struct ldb_module *module)
        }
 
        talloc_free(ltdb->cache->indexlist);
-       ltdb_attributes_unload(module); /* calls internally "talloc_free" */
-
+       /*
+        * ltdb_attributes_unload() calls internally talloc_free() on
+        * any non-fixed elemnts in ldb->schema.attributes.
+        *
+        * NOTE WELL: This is per-ldb, not per module, so overwrites
+        * the handlers across all databases when used under Samba's
+        * partition module.
+        */
+       ltdb_attributes_unload(module);
        ltdb->cache->indexlist = ldb_msg_new(ltdb->cache);
-       ltdb->cache->attributes = ldb_msg_new(ltdb->cache);
-       if (ltdb->cache->indexlist == NULL ||
-           ltdb->cache->attributes == NULL) {
+       if (ltdb->cache->indexlist == NULL) {
                goto failed;
        }
        ltdb->cache->one_level_indexes = false;
@@ -374,7 +422,10 @@ int ltdb_cache_load(struct ldb_module *module)
        indexlist_dn = ldb_dn_new(module, ldb, LTDB_INDEXLIST);
        if (indexlist_dn == NULL) goto failed;
 
-       r = ltdb_search_dn1(module, indexlist_dn, ltdb->cache->indexlist, 0);
+       r = ltdb_search_dn1(module, indexlist_dn, ltdb->cache->indexlist,
+                           LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_DN);
        if (r != LDB_SUCCESS && r != LDB_ERR_NO_SUCH_OBJECT) {
                goto failed;
        }
@@ -386,6 +437,11 @@ int ltdb_cache_load(struct ldb_module *module)
                ltdb->cache->attribute_indexes = true;
        }
 
+       /*
+        * NOTE WELL: This is per-ldb, not per module, so overwrites
+        * the handlers across all databases when used under Samba's
+        * partition module.
+        */
        if (ltdb_attributes_load(module) == -1) {
                goto failed;
        }
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index b5b78a9..7caedeb 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -18,7 +18,6 @@ struct ltdb_private {
 
        struct ltdb_cache {
                struct ldb_message *indexlist;
-               struct ldb_message *attributes;
                bool one_level_indexes;
                bool attribute_indexes;
        } *cache;
diff --git a/lib/ldb/modules/rdn_name.c b/lib/ldb/modules/rdn_name.c
index f44ea71..e69ad93 100644
--- a/lib/ldb/modules/rdn_name.c
+++ b/lib/ldb/modules/rdn_name.c
@@ -144,7 +144,7 @@ static int rdn_name_add(struct ldb_module *module, struct 
ldb_request *req)
        attribute = ldb_msg_find_element(msg, rdn_name);
        if (!attribute) {
                /* add entry with normalised RDN information if possible */
-               if (a->name != NULL) {
+               if (a->name != NULL && strcmp(a->name, "*") != 0) {
                        ret = ldb_msg_add_value(msg, a->name, &rdn_val, NULL);
                } else {
                        ret = ldb_msg_add_value(msg, rdn_name, &rdn_val, NULL);
@@ -154,7 +154,7 @@ static int rdn_name_add(struct ldb_module *module, struct 
ldb_request *req)
                }
        } else {
                /* normalise attribute name if possible */
-               if (a->name != NULL) {
+               if (a->name != NULL && strcmp(a->name, "*") != 0) {
                        attribute->name = a->name;
                }
                /* normalise attribute value */
@@ -243,6 +243,7 @@ static int rdn_rename_callback(struct ldb_request *req, 
struct ldb_reply *ares)
        struct rename_context *ac;
        struct ldb_request *mod_req;
        const char *rdn_name;
+       const struct ldb_schema_attribute *a = NULL;
        const struct ldb_val *rdn_val_p;
        struct ldb_val rdn_val;
        struct ldb_message *msg;
@@ -286,6 +287,15 @@ static int rdn_rename_callback(struct ldb_request *req, 
struct ldb_reply *ares)
                goto error;
        }
 
+       a = ldb_schema_attribute_by_name(ldb, rdn_name);
+       if (a == NULL) {
+               goto error;
+       }
+
+       if (a->name != NULL && strcmp(a->name, "*") != 0) {
+               rdn_name = a->name;
+       }
+
        rdn_val_p = ldb_dn_get_rdn_val(msg->dn);
        if (rdn_val_p == NULL) {
                goto error;
@@ -367,11 +377,20 @@ static int rdn_name_rename(struct ldb_module *module, 
struct ldb_request *req)
        return ldb_next_request(module, down_req);
 }
 
+static int rdn_recalculate_callback(struct ldb_request *req, struct ldb_reply 
*ares)
+{
+       struct ldb_request *up_req = talloc_get_type(req->context, struct 
ldb_request);
+
+       talloc_steal(up_req, req);
+       return up_req->callback(up_req, ares);
+}
+
 static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req)
 {
        struct ldb_context *ldb;
        const struct ldb_val *rdn_val_p;
        struct ldb_message_element *e = NULL;
+       struct ldb_control *recalculate_rdn_control = NULL;
 
        ldb = ldb_module_get_ctx(module);
 
@@ -380,6 +399,138 @@ static int rdn_name_modify(struct ldb_module *module, 
struct ldb_request *req)
                return ldb_next_request(module, req);
        }
 
+       recalculate_rdn_control = ldb_request_get_control(req,
+                                       LDB_CONTROL_RECALCULATE_RDN_OID);
+       if (recalculate_rdn_control != NULL) {
+               struct ldb_message *msg = NULL;
+               const char *rdn_name = NULL;
+               struct ldb_val rdn_val;
+               const struct ldb_schema_attribute *a = NULL;
+               struct ldb_request *mod_req = NULL;
+               int ret;
+               struct ldb_message_element *rdn_del = NULL;
+               struct ldb_message_element *name_del = NULL;
+
+               recalculate_rdn_control->critical = false;
+


-- 
Samba Shared Repository

Reply via email to