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

Karolin Seeger kseeger at samba.org
Wed Nov 30 15:26:14 UTC 2016


The branch, v4-5-test has been updated
       via  cbf54e0 nss_wins: Fix errno values for HOST_NOT_FOUND
       via  ee07db3 samba_tool/fsmo: Allocate RID Set when seizing RID manager
       via  9f9e67e python-libnet: Use new NTSTATUSError, WERRORError and DsExtendedError exceptions
       via  ca5d700 python: Add DsExtendedError Exception
       via  31d24bf pyerrors: Add PyErr_Set{WERROR,HRESULT,NTSTATUS}_and_string()
       via  7396b5e python: create NTSTATUSError, HRESULTError and WERRORError
       via  81f50f0 dsdb: Catch errors in extended operations (like allocating a RID Set)
       via  26ccaf3 dsdb: Rework DSDB code to use WERROR
       via  da60caf dsdb: Create RID Set as SYSTEM
       via  da6d45a dbcheck: Correctly initialise keep_transaction in missing_parent test
       via  527eadd dbcheck: confirm RID Set presence and consistency
       via  b301f03 dsdb: Add python hooks to allocate a RID set and allocate a RID pool
       via  3a1396a tests/ridalloc_exop: Add a new suite of tests for RID allocation
       via  2be2529 objectclass_attrs: Only abort on a missing attribute when an attribute is both MUST and replicated
       via  0802e0a typo: supprise -> surprise
       via  0a62f6e tests/getnc_exop: Finish a comment in getnc_exop.py
       via  e089fb6 tests/getnc_exop: Improve the ridalloc test by performing an alloc against a new master
       via  fbd8e67 objectclass_attrs: correctly indent a comment
       via  7a23c89 selftest: Ensure we catch errors from samba-tool domain tombstones expunge
       via  b370238 dbcheck: Correct message for orphaned backlinks
       via  48d45ef dbcheck: Be more careful with link checks
       via  068f9fd selftest: Add test for link and deleted link behaviour in dbcheck
       via  dd5fb5b upgradeprovision: Remove objectCategory from constructed attrs
       via  6251b79 collect_tombstones: Allow links to recycled objects to be deleted
       via  b5d5d85 tombstones-expunge: Add a test for deleting links to recycled objects
       via  d83c6b3 s4:torture: Fix cleanup of the secrets object in session_key test
       via  3ff0d4a s4:torture: Normalizes names in session_key test
       via  0f1b2b8 s4:torture: Strip trailing whitespaces in session_key.c
       via  309a92b s4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY
       via  74c05505a lib:torture: Make variables const
       via  b07e2c8 s3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx
       via  30c400a doc: Add doxygen for functions in srv_keytab.c
       via  b37dcf0 s4-auth: Don't check for NULL saltPrincipal if it doesn't need it
      from  82053bf ctdb-recovery: Avoid NULL dereference in failure case

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


- Log -----------------------------------------------------------------
commit cbf54e0290992aeb36a2971741373cf2ee629af7
Author: Andreas Schneider <asn at samba.org>
Date:   Sun Nov 13 17:40:21 2016 +0100

    nss_wins: Fix errno values for HOST_NOT_FOUND
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 08d1ac0e36339e97e4464f6a6724464b0a568347)
    
    Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-5-test): Wed Nov 30 16:25:05 CET 2016 on sn-devel-144

commit ee07db353f619effa4cb3e789831ae8947aea028
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Tue Nov 1 16:29:53 2016 +1300

    samba_tool/fsmo: Allocate RID Set when seizing RID manager
    
    Seizing the role without allocating a RID set for itself is likely prone
    to cause issues.
    
    Pair-programmed-with: Clive Ferreira <cliveferreira at catalyst.net.nz>
    
    Signed-off-by: Clive Ferreira <cliveferreira at catalyst.net.nz>
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    
    Autobuild-User(master): Garming Sam <garming at samba.org>
    Autobuild-Date(master): Fri Nov  4 08:37:05 CET 2016 on sn-devel-144
    
    (cherry picked from commit 815658d2db46e4accdd35f5925585ec1f1c3d74f)

commit 9f9e67ecdeeeb33d233938b32658d7fdde29fd48
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 1 12:38:48 2016 +1300

    python-libnet: Use new NTSTATUSError, WERRORError and DsExtendedError exceptions
    
    This will allow callers to catch specific errors rather than RuntimeException
    
    As this slightly changes the exception, the timecmd test must be updated.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit 2a49c7451949d42e5a4d6fce3ce607f05f9e7b71)

commit ca5d70071fc4aec3ad1984f912eed9a28b8ae00f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 1 16:09:20 2016 +1300

    python: Add DsExtendedError Exception
    
    This will be used for checking errors during a GetNCChanges EXOP like
    RID Set allocation.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit e51256c7d58040eeee02fc189b55afbc58379f81)

commit 31d24bfb2a6954d43d179eeccd5070e64bc871fa
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 1 16:03:09 2016 +1300

    pyerrors: Add PyErr_Set{WERROR,HRESULT,NTSTATUS}_and_string()
    
    This varient allows control of the text explaination string
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit e737171f6ef172de559b41d54989eca0d7663b4e)

commit 7396b5efdda4efa6d9705f1e304a643afa3324f9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 1 15:23:58 2016 +1300

    python: create NTSTATUSError, HRESULTError and WERRORError
    
    The advantage of these over the previous use of just RuntimeError is that we can
    catch just the errors we want, without having to catch all possible RuntimeError
    cases and assume they decode to a tuple
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit c8505c53da3e21f31454f121efd5961d95349a38)

commit 81f50f02700c28fee27beab9b9b7a5946584a84c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Oct 31 16:25:51 2016 +1300

    dsdb: Catch errors in extended operations (like allocating a RID Set)
    
    There are cases where allocating a RID Set can reasonably fail.  Catch those nicely.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit f72da5ba51ae8bf9f3f54bed36b4572cd1b57adb)

commit 26ccaf38d9ce476260b7bfa603a9aaf34059c1f3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Oct 31 16:19:37 2016 +1300

    dsdb: Rework DSDB code to use WERROR
    
    The WERROR codes are more descriptive for DSDB issues, and almost all the code was
    converting from WERROR to NTSTATUS.  This will allow us to better catch specific
    errors like WERR_DS_DRA_MISSING_PARENT
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
    (cherry picked from commit 46fefb251f61b274cb687f6d1cb0a0a97fb36b44)

commit da60caf2c7bc3a1012862f39cc7aa669e24b3d16
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Oct 31 10:41:39 2016 +1300

    dsdb: Create RID Set as SYSTEM
    
    We do not want random users with add-user rights to own the new RID Set for this
    server, and the ridSet class is thankfully system-only.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    (cherry picked from commit fe90dadd2cd13c20484c06318724c592e5cf298e)

commit da6d45a59399e487b468fa8bb7a85c1032a26de5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Nov 3 13:30:56 2016 +1300

    dbcheck: Correctly initialise keep_transaction in missing_parent test
    
    Otherwise there is no point to this variable, we are trying to work out
    if the subsequent modify succeded
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    (cherry picked from commit 09537a67b0e761c834fb7c14d7e8d55e07fc5156)

commit 527eadd2461a5047f87e0a1eb9d075ca1b5e9f42
Author: Clive Ferreira <cliveferreira at catalyst.net.nz>
Date:   Thu Oct 27 17:28:01 2016 +1300

    dbcheck: confirm RID Set presence and consistency
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    (cherry picked from commit 7fd5be535ade5ed119d869c8f215aa605aba2125)

commit b301f03573d1ebc7c539730bf77f2bfbe80b4df5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Oct 28 16:08:57 2016 +1300

    dsdb: Add python hooks to allocate a RID set and allocate a RID pool
    
    This will help us to correct errors during dbcheck
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    (cherry picked from commit 035df7adbe9cc119324275275c2605433f6c4292)

commit 3a1396a039eaf6176b729a5ce4167e8ddc9dfa23
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Mon Oct 31 15:24:49 2016 +1300

    tests/ridalloc_exop: Add a new suite of tests for RID allocation
    
    This moves some tests from getnc_exop.py regarding RID sets as well as
    adding new tests for actions on join.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9954
    
    Pair-programmed-with: Clive Ferreira <cliveferreira at catalyst.net.nz>
    
    Signed-off-by: Andrew Bartlett <abartlet at samaba.org>
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Signed-off-by: Clive Ferreira <cliveferreira at catalyst.net.nz>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 1b40bb69d101b767ee453c96234cc6d573142ab3)

commit 2be252946f65c9c1edc5676aae90a4b9e4a7d390
Author: Clive Ferreira <cliveferreira at catalyst.net.nz>
Date:   Tue Oct 11 15:32:54 2016 +1300

    objectclass_attrs: Only abort on a missing attribute when an attribute is both MUST and replicated
    
    If an attribute is not replicated or constructed, it is quite normal for
    it to be missing. This is the case with both rIDNextRid and
    rIDPreviousAllocationPool. This currently prevents us switching the RID
    master. On Windows, missing this attribute does not cause any problems
    for the RID manager.
    
    We may now remove the knownfail entry added earlier.
    
    Signed-off-by: Clive Ferreira <cliveferreira at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
    Pair-programmed-with: Bob Campbell <bobcampbell at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394
    
    Autobuild-User(master): Garming Sam <garming at samba.org>
    Autobuild-Date(master): Wed Nov  2 01:28:44 CET 2016 on sn-devel-144
    
    (cherry picked from commit 79dd22aacb4c12bd008d9ad354ec5ec088560748)

commit 0802e0aed8f89d1eaf905b1769745cde56300df7
Author: Clive Ferreira <cliveferreira at catalyst.net.nz>
Date:   Thu Oct 20 16:20:49 2016 +1300

    typo: supprise -> surprise
    
    Signed-off-by: Clive Ferreira <cliveferreira at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394
    (cherry picked from commit e0aa05609556cf7bc93d585944542d630862ba0f)

commit 0a62f6e283f838cb70a47cbe466cd5347009e410
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Thu Oct 20 16:19:43 2016 +1300

    tests/getnc_exop: Finish a comment in getnc_exop.py
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394
    (cherry picked from commit 4c567932165229e7fa9c33b071e9fabe79d9eef0)

commit e089fb665d65f6d44f6c2e93aa5e18ee446516d0
Author: Bob Campbell <bobcampbell at catalyst.net.nz>
Date:   Mon Oct 10 16:58:57 2016 +1300

    tests/getnc_exop: Improve the ridalloc test by performing an alloc against a new master
    
    Currently we fail against ourselves due to rIDNextRid and
    rIDPreviousAllocationPool normally being unset, despite being mandatory
    attributes (being the only attributes in this situation).
    
    Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
    Pair-programmed-with: Clive Ferreira <cliveferreira at catalyst.net.nz>
    Signed-off-by: Bob Campbell <bobcampbell at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394
    (cherry picked from commit 37aa11ce5b2b91cd0d84f6c7370d64674fcf5479)

commit fbd8e67394ab85c7840e5c57bc718978e249b773
Author: Clive Ferreira <cliveferreira at catalyst.net.nz>
Date:   Tue Oct 11 15:33:06 2016 +1300

    objectclass_attrs: correctly indent a comment
    
    Signed-off-by: Clive Ferreira <cliveferreira at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Pair-programmed-with: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12394
    (cherry picked from commit a3baf4b8049d222b8be71dce3bc1cd46b8391f73)

commit 7a23c894c4503d151522948100c7fd629e5ad6f9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 7 11:58:04 2016 +1300

    selftest: Ensure we catch errors from samba-tool domain tombstones expunge
    
    The previous code would overwrite $? before the return, so always returned 0
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297
    (cherry picked from commit 44d209c893d28030cb9928b974c8aa31348ac395)

commit b37023877b50031ad20153947c40c5e3c2d31837
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 7 11:04:03 2016 +1300

    dbcheck: Correct message for orphaned backlinks
    
    The backlink name is in attrname, not in link_name
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297
    (cherry picked from commit 04eb95a46b069f0238dbd232528fd1fadb745066)

commit 48d45ef07c369a5de400e83f256be96b2e75e54c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Oct 25 10:10:34 2016 +1300

    dbcheck: Be more careful with link checks
    
    Here we are more careful when checking links, flagging errors only
    when a non-deleted forward link appears incorrect.  In particular, we
    trust the GUID more than we trust the name, as otherwise we can get
    caught out if there is a swap of names, (the link should follow the
    swap, staying on the same target GUID).
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297
    (cherry picked from commit f051e5bf00d6df70048dd0cf901dd7b37be09669)

commit 068f9fd135390278151f41affb69c12697357b51
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Nov 7 11:39:53 2016 +1300

    selftest: Add test for link and deleted link behaviour in dbcheck
    
    The other dbcheck tests were getting over-complex, so we start a new test
    here based on tombestone-expunge.sh, as we are looking at very similar
    problems
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297
    (cherry picked from commit 8315d4d03ac77f1727ff01e87392f6e49ba40def)

commit dd5fb5b73e4cc96be5c4ab62201709aedc2e5b31
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Mon Nov 21 15:06:22 2016 +1300

    upgradeprovision: Remove objectCategory from constructed attrs
    
    The new dbcheck rules identify an error where the GUID of the
    objectCategory does not exist (pointing to a non-existent schema
    object). As objectClass was not copied over either, it makes sense not
    to copy over the objectCategory.
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12297
    (cherry picked from commit 5889f399daad54124e0bb2be1fe81da1df67c84e)

commit 6251b7938db4ce3b4214cd862ed5ff2a1e8e239b
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Oct 21 15:50:09 2016 +1300

    collect_tombstones: Allow links to recycled objects to be deleted
    
    The reason we choose to provide the string DN is because extended_dn_in
    will try to correct the <GUID=...> by searching on it (despite the fact
    it does not exist and then failing on a ldb_dn_validate in
    objectclass_attrs).
    
    We can now also remove the dangling link test from the knownfail.
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12385
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Nov  3 01:46:43 CET 2016 on sn-devel-144
    
    (cherry picked from commit ef7e46d68a6596be6e904caaa04e917c576dd9d3)

commit b5d5d85d5160ac82b24d73e7cd1e757c0bfd7835
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Fri Oct 21 11:40:51 2016 +1300

    tombstones-expunge: Add a test for deleting links to recycled objects
    
    Currently this fails because we rely on a GUID DN, which fails to
    resolve in the case that the GUID no longer exists in the database (i.e.
    when that object has been purged after 6 months).
    
    The tests use a made up extended DN built from fred where the GUID has
    been tweaked.
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12385
    (cherry picked from commit dba624364cde1c885640386c4e2bca17e9d5297c)

commit d83c6b3357d2230a4a8a315018e0b40560684392
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 16:15:54 2016 +0100

    s4:torture: Fix cleanup of the secrets object in session_key test
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    The test is known to be failing if sealing is turned on in some
    circumstances. In this case a secret is created and then the function
    dcerpc_fetch_session_key() fails. The secret is not removed!
    
    We use torturesecret-%08x with random() to fill in the number. Sometimes
    it happens that random() returns a number we already used. So we end up
    trying to create a secret for an entry which already exists and run
    into a collision
    
    This change makes sure we always cleanup behind us and do not leave
    secret objects we created.
    
    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: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Nov 17 22:30:36 CET 2016 on sn-devel-144
    
    (cherry picked from commit 9de04626c058563a6cf4c13e4f5399039e345ef5)

commit 3ff0d4aa9d287401206b001ba8619859eddb43ae
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 15:44:13 2016 +0100

    s4:torture: Normalizes names in session_key test
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 31d21de548d899f82fa7944767ad94e8aca8d96d)

commit 0f1b2b85407bf0066615d599d346234aee3243ca
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 17 15:35:47 2016 +0100

    s4:torture: Strip trailing whitespaces in session_key.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12433
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 80f7f568f8960c809756d5233c8f875db4ea07d6)

commit 309a92b62d27c34364f393116e9e0774d311ea53
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Nov 15 18:34:22 2016 +0100

    s4:torture: Add tortue test for AddPrinterDriverEx with COPY_FROM_DIRECTORY
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    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: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit b1ade58ffeb56a0238c820797905caa107b08265)

commit 74c05505a330e6f7790360ef25a3ca85f4087c74
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 18 10:51:57 2016 +0100

    lib:torture: Make variables const
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 9c0f2576d8aa3dd95be1c5ddda2b10d891add0bc)

commit b07e2c8fb4e15fd86e38ac087854d54b7dee3fa6
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Nov 15 14:29:29 2016 +0100

    s3:spoolss: Add support for COPY_FROM_DIRECTORY in AddPrinterDriverEx
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12415
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 4d9f4bfc69a5899bdf91406dfb7efb70a530446c)

commit 30c400a1ed52bedec2a71dc5f48e4a58dbb570bd
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Thu Sep 15 16:04:12 2016 +1200

    doc: Add doxygen for functions in srv_keytab.c
    
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10882
    (cherry picked from commit 683fcad3ca1617a07e9ade82ec7e44ac512ab415)

commit b37dcf075dc4506f11630d034d1ed6464eb9d13d
Author: Garming Sam <garming at catalyst.net.nz>
Date:   Wed Sep 7 12:18:29 2016 +1200

    s4-auth: Don't check for NULL saltPrincipal if it doesn't need it
    
    This check causes 4.1 domains to be unable to change their DNS backend
    correctly as they do not have the saltPrincipal value stored.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10882
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit b02da114980d46e9e251a5d3dfbf549ef348548a)

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

Summary of changes:
 lib/torture/torture.h                              |   8 +-
 nsswitch/wins.c                                    |   3 +-
 python/pyglue.c                                    |  28 +
 python/samba/__init__.py                           |   5 +
 python/samba/dbchecker.py                          | 172 ++++-
 python/samba/netcmd/fsmo.py                        |  29 +-
 python/samba/samdb.py                              |   8 +
 python/samba/tests/samba_tool/timecmd.py           |   2 +-
 selftest/knownfail                                 |   4 +
 selftest/tests.py                                  |   5 +
 source3/include/nt_printing.h                      |   7 +-
 source3/printing/nt_printing.c                     |  92 ++-
 source3/rpc_server/spoolss/srv_spoolss_nt.c        |  17 +-
 source4/auth/kerberos/srv_keytab.c                 |  59 +-
 source4/dsdb/kcc/garbage_collect_tombstones.c      |   5 +-
 source4/dsdb/pydsdb.c                              |  74 +++
 source4/dsdb/samdb/ldb_modules/objectclass_attrs.c |  36 +-
 source4/dsdb/samdb/ldb_modules/ridalloc.c          |  20 +-
 source4/dsdb/samdb/ldb_modules/rootdse.c           |   2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c            |  51 ++
 source4/dsdb/samdb/samdb.h                         |  10 +
 source4/libcli/util/pyerrors.h                     |  30 +-
 source4/libnet/libnet_become_dc.c                  |   8 +-
 source4/libnet/libnet_become_dc.h                  |  16 +-
 source4/libnet/libnet_vampire.c                    | 125 ++--
 source4/libnet/py_net.c                            | 143 ++++-
 source4/scripting/bin/samba_upgradeprovision       |   2 +-
 .../release-4-5-0-pre1/add-dangling-link.ldif      |   5 +
 .../expected-dbcheck-link-output.txt               |  42 ++
 ...expected-deleted-links-after-link-dbcheck.ldif} |   2 +-
 .../release-4-5-0-pre1/expected-expunge-output.txt |   2 +-
 ...ldif => expected-links-after-link-dbcheck.ldif} |   2 +-
 .../expected-match-rule-links.ldif                 |  18 +-
 .../expected-objects-after-link-dbcheck.ldif       |   5 +
 source4/selftest/tests.py                          |  11 +-
 source4/setup/schema_samba4.ldif                   |   2 +
 source4/torture/drs/python/getnc_exop.py           |  85 ---
 source4/torture/drs/python/ridalloc_exop.py        | 714 +++++++++++++++++++++
 source4/torture/rpc/session_key.c                  | 100 +--
 source4/torture/rpc/spoolss.c                      | 167 ++++-
 testprogs/blackbox/dbcheck-links.sh                | 188 ++++++
 testprogs/blackbox/tombstones-expunge.sh           |  11 +-
 42 files changed, 2013 insertions(+), 302 deletions(-)
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/add-dangling-link.ldif
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output.txt
 copy source4/selftest/provisions/release-4-5-0-pre1/{expected-deleted-links-after-expunge.ldif => expected-deleted-links-after-link-dbcheck.ldif} (89%)
 copy source4/selftest/provisions/release-4-5-0-pre1/{expected-links-after-expunge.ldif => expected-links-after-link-dbcheck.ldif} (88%)
 create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/expected-objects-after-link-dbcheck.ldif
 create mode 100644 source4/torture/drs/python/ridalloc_exop.py
 create mode 100755 testprogs/blackbox/dbcheck-links.sh


Changeset truncated at 500 lines:

diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 5b957fa..45332b2 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -547,7 +547,7 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 	} while(0)
 
 #define torture_assert_guid_equal(torture_ctx,got,expected,cmt)\
-	do { struct GUID __got = (got), __expected = (expected); \
+	do {const struct GUID __got = (got), __expected = (expected); \
 	if (!GUID_equal(&__got, &__expected)) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was %s, expected %s: %s", \
@@ -565,7 +565,7 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 	} while(0)
 
 #define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
-	do { struct dom_sid *__got = (got), *__expected = (expected); \
+	do {const struct dom_sid *__got = (got), *__expected = (expected); \
 	if (!dom_sid_equal(__got, __expected)) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 					   __location__": "#got" was %s, expected %s: %s", \
@@ -575,7 +575,7 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 	} while(0)
 
 #define torture_assert_not_null(torture_ctx,got,cmt)\
-	do { void *__got = (got); \
+	do {const void *__got = (got); \
 	if (__got == NULL) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was NULL, expected != NULL: %s", \
@@ -585,7 +585,7 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 	} while(0)
 
 #define torture_assert_not_null_goto(torture_ctx,got,ret,label,cmt)\
-	do { void *__got = (got); \
+	do {const void *__got = (got); \
 	if (__got == NULL) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
 			__location__": "#got" was NULL, expected != NULL: %s", \
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index dccb6dd..19d3c5b 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -260,8 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
 	ip = lookup_byname_backend(name);
 	if (ip == NULL) {
-		*errnop = EINVAL;
-		*h_errnop = NETDB_INTERNAL;
+		*h_errnop = HOST_NOT_FOUND;
 		nss_status = NSS_STATUS_NOTFOUND;
 		goto out;
 	}
diff --git a/python/pyglue.c b/python/pyglue.c
index 81244a2..dbe7eb4 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -24,6 +24,10 @@
 #include "lib/socket/netif.h"
 
 void init_glue(void);
+static PyObject *PyExc_NTSTATUSError;
+static PyObject *PyExc_WERRORError;
+static PyObject *PyExc_HRESULTError;
+static PyObject *PyExc_DsExtendedError;
 
 static PyObject *py_generate_random_str(PyObject *self, PyObject *args)
 {
@@ -294,5 +298,29 @@ void init_glue(void)
 
 	PyModule_AddObject(m, "version",
 					   PyString_FromString(SAMBA_VERSION_STRING));
+	PyExc_NTSTATUSError = PyErr_NewException(discard_const_p(char, "samba.NTSTATUSError"), PyExc_RuntimeError, NULL);
+	if (PyExc_NTSTATUSError != NULL) {
+		Py_INCREF(PyExc_NTSTATUSError);
+		PyModule_AddObject(m, "NTSTATUSError", PyExc_NTSTATUSError);
+	}
+
+	PyExc_WERRORError = PyErr_NewException(discard_const_p(char, "samba.WERRORError"), PyExc_RuntimeError, NULL);
+	if (PyExc_WERRORError != NULL) {
+		Py_INCREF(PyExc_WERRORError);
+		PyModule_AddObject(m, "WERRORError", PyExc_WERRORError);
+	}
+
+	PyExc_HRESULTError = PyErr_NewException(discard_const_p(char, "samba.HRESULTError"), PyExc_RuntimeError, NULL);
+	if (PyExc_HRESULTError != NULL) {
+		Py_INCREF(PyExc_HRESULTError);
+		PyModule_AddObject(m, "HRESULTError", PyExc_HRESULTError);
+	}
+
+	PyExc_DsExtendedError = PyErr_NewException(discard_const_p(char, "samba.DsExtendedError"), PyExc_RuntimeError, NULL);
+	if (PyExc_DsExtendedError != NULL) {
+		Py_INCREF(PyExc_DsExtendedError);
+		PyModule_AddObject(m, "DsExtendedError", PyExc_DsExtendedError);
+	}
+
 }
 
diff --git a/python/samba/__init__.py b/python/samba/__init__.py
index 7cfbc4c..5f91531 100644
--- a/python/samba/__init__.py
+++ b/python/samba/__init__.py
@@ -399,3 +399,8 @@ generate_random_password = _glue.generate_random_password
 strcasecmp_m = _glue.strcasecmp_m
 strstr_m = _glue.strstr_m
 is_ntvfs_fileserver_built = _glue.is_ntvfs_fileserver_built
+
+NTSTATUSError = _glue.NTSTATUSError
+HRESULTError = _glue.HRESULTError
+WERRORError = _glue.WERRORError
+DsExtendedError = _glue.DsExtendedError
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 9b0784b..3fcfbc0 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -32,6 +32,7 @@ from samba.dcerpc import security
 from samba.descriptor import get_wellknown_sds, get_diff_sds
 from samba.auth import system_session, admin_session
 from samba.netcmd import CommandError
+from samba.netcmd.fsmo import get_fsmo_roleowner
 
 
 class dbcheck(object):
@@ -79,6 +80,7 @@ class dbcheck(object):
         self.fix_base64_userparameters = False
         self.fix_utf8_userparameters = False
         self.fix_doubled_userparameters = False
+        self.fix_sid_rid_set_conflict = False
         self.reset_well_known_acls = reset_well_known_acls
         self.reset_all_well_known_acls = False
         self.in_transaction = in_transaction
@@ -92,6 +94,7 @@ class dbcheck(object):
         self.fix_all_missing_objectclass = False
         self.fix_missing_deleted_objects = False
         self.fix_replica_locations = False
+        self.fix_missing_rid_set_master = False
 
         self.dn_set = set()
         self.link_id_cache = {}
@@ -157,6 +160,27 @@ class dbcheck(object):
         if len(forest) == 1:
             self.dns_partitions.append((ldb.Dn(self.samdb, domaindns_zone), forest[0]))
 
+        fsmo_dn = ldb.Dn(self.samdb, "CN=RID Manager$,CN=System," + self.samdb.domain_dn())
+        rid_master = get_fsmo_roleowner(self.samdb, fsmo_dn, "rid")
+        if ldb.Dn(self.samdb, self.samdb.get_dsServiceName()) == rid_master:
+            self.is_rid_master = True
+        else:
+            self.is_rid_master = False
+
+        # To get your rid set
+        # 1. Get server name
+        res = self.samdb.search(base=ldb.Dn(self.samdb, self.samdb.get_serverName()),
+                                scope=ldb.SCOPE_BASE, attrs=["serverReference"])
+        # 2. Get server reference
+        self.server_ref_dn = ldb.Dn(self.samdb, res[0]['serverReference'][0])
+
+        # 3. Get RID Set
+        res = self.samdb.search(base=self.server_ref_dn,
+                                scope=ldb.SCOPE_BASE, attrs=['rIDSetReferences'])
+        if "rIDSetReferences" in res[0]:
+            self.rid_set_dn = ldb.Dn(self.samdb, res[0]['rIDSetReferences'][0])
+        else:
+            self.rid_set_dn = None
 
     def check_database(self, DN=None, scope=ldb.SCOPE_SUBTREE, controls=[], attrs=['*']):
         '''perform a database check, returning the number of errors found'''
@@ -492,8 +516,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                           "Failed to remove deleted DN attribute %s" % attrname):
             self.report("Removed deleted DN on attribute %s" % attrname)
 
-    def err_missing_dn_GUID(self, dn, attrname, val, dsdb_dn):
-        """handle a missing target DN (both GUID and DN string form are missing)"""
+    def err_missing_target_dn_or_GUID(self, dn, attrname, val, dsdb_dn):
+        """handle a missing target DN (if specified, GUID form can't be found,
+        and otherwise DN string form can't be found)"""
         # check if its a backlink
         linkID, _ = self.get_attr_linkID_and_reverse_name(attrname)
         if (linkID & 1 == 0) and str(dsdb_dn).find('\\0ADEL') == -1:
@@ -501,7 +526,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             return
         self.err_deleted_dn(dn, attrname, val, dsdb_dn, dsdb_dn, False)
 
-    def err_incorrect_dn_GUID(self, dn, attrname, val, dsdb_dn, errstr):
+    def err_missing_dn_GUID_component(self, dn, attrname, val, dsdb_dn, errstr):
         """handle a missing GUID extended DN component"""
         self.report("ERROR: %s component for %s in object %s - %s" % (errstr, attrname, dn, val))
         controls=["extended_dn:1:1", "show_recycled:1"]
@@ -510,11 +535,13 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                                     attrs=[], controls=controls)
         except ldb.LdbError, (enum, estr):
             self.report("unable to find object for DN %s - (%s)" % (dsdb_dn.dn, estr))
-            self.err_missing_dn_GUID(dn, attrname, val, dsdb_dn)
+            if enum != ldb.ERR_NO_SUCH_OBJECT:
+                raise
+            self.err_missing_target_dn_or_GUID(dn, attrname, val, dsdb_dn)
             return
         if len(res) == 0:
             self.report("unable to find object for DN %s" % dsdb_dn.dn)
-            self.err_missing_dn_GUID(dn, attrname, val, dsdb_dn)
+            self.err_missing_target_dn_or_GUID(dn, attrname, val, dsdb_dn)
             return
         dsdb_dn.dn = res[0].dn
 
@@ -624,15 +651,15 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
     def err_orphaned_backlink(self, obj, attrname, val, link_name, target_dn):
         '''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 not self.confirm_all('Remove orphaned backlink %s' % link_name, 'fix_all_orphaned_backlinks'):
-            self.report("Not removing orphaned backlink %s" % link_name)
+        if not self.confirm_all('Remove orphaned backlink %s' % attrname, 'fix_all_orphaned_backlinks'):
+            self.report("Not removing orphaned backlink %s" % attrname)
             return
         m = ldb.Message()
         m.dn = obj.dn
         m['value'] = ldb.MessageElement(val, ldb.FLAG_MOD_DELETE, attrname)
         if self.do_modify(m, ["show_recycled:1", "relax:0"],
-                          "Failed to fix orphaned backlink %s" % link_name):
-            self.report("Fixed orphaned backlink %s" % (link_name))
+                          "Failed to fix orphaned backlink %s" % attrname):
+            self.report("Fixed orphaned backlink %s" % (attrname))
 
     def err_no_fsmoRoleOwner(self, obj):
         '''handle a missing fSMORoleOwner'''
@@ -658,7 +685,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report('Not moving object %s into LostAndFound' % (obj.dn))
             return
 
-        keep_transaction = True
+        keep_transaction = False
         self.samdb.transaction_start()
         try:
             nc_root = self.samdb.get_nc_root(obj.dn);
@@ -797,7 +824,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             guid = dsdb_dn.dn.get_extended_component("GUID")
             if guid is None:
                 error_count += 1
-                self.err_incorrect_dn_GUID(obj.dn, attrname, val, dsdb_dn,
+                self.err_missing_dn_GUID_component(obj.dn, attrname, val, dsdb_dn,
                     "missing GUID")
                 continue
 
@@ -822,7 +849,11 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                                         ])
             except ldb.LdbError, (enum, estr):
                 error_count += 1
-                self.err_incorrect_dn_GUID(obj.dn, attrname, val, dsdb_dn, "incorrect GUID")
+                self.report("ERROR: no target object found for GUID component for %s in object %s - %s" % (attrname, obj.dn, val))
+                if enum != ldb.ERR_NO_SUCH_OBJECT:
+                    raise
+
+                self.err_missing_target_dn_or_GUID(obj.dn, attrname, val, dsdb_dn)
                 continue
 
             if fixing_msDS_HasInstantiatedNCs:
@@ -874,6 +905,15 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                 self.err_deleted_dn(obj.dn, attrname, val, dsdb_dn, res[0].dn, False)
                 continue
 
+            # We should not check for incorrect
+            # components on deleted links, as these are allowed to
+            # go stale (we just need the GUID, not the name)
+            rmd_blob = dsdb_dn.dn.get_extended_component("RMD_FLAGS")
+            if rmd_blob is not None:
+                rmd_flags = int(rmd_blob)
+                if rmd_flags & 1:
+                    continue
+
             # check the DN matches in string form
             if str(res[0].dn) != str(dsdb_dn.dn):
                 error_count += 1
@@ -1847,6 +1887,114 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                     self.err_replica_locations(obj, msg.dn, location)
                     error_count += 1
 
+        if dn == self.server_ref_dn:
+            # Check we have a valid RID Set
+            if "*" in attrs or "rIDSetReferences" in attrs:
+                if "rIDSetReferences" not in obj:
+                    # NO RID SET reference
+                    # We are RID master, allocate it.
+                    error_count += 1
+
+                    if self.is_rid_master:
+                        # Allocate a RID Set
+                        if self.confirm_all('Allocate the missing RID set for RID master?',
+                                            'fix_missing_rid_set_master'):
+
+                            # We don't have auto-transaction logic on
+                            # extended operations, so we have to do it
+                            # here.
+
+                            self.samdb.transaction_start()
+
+                            try:
+                                self.samdb.create_own_rid_set()
+
+                            except:
+                                self.samdb.transaction_cancel()
+                                raise
+
+                            self.samdb.transaction_commit()
+
+
+                    elif not self.samdb.am_rodc():
+                        self.report("No RID Set found for this server: %s, and we are not the RID Master (so can not self-allocate)" % dn)
+
+
+        # Check some details of our own RID Set
+        if dn == self.rid_set_dn:
+            res = self.samdb.search(base=self.rid_set_dn, scope=ldb.SCOPE_BASE,
+                                    attrs=["rIDAllocationPool",
+                                           "rIDPreviousAllocationPool",
+                                           "rIDUsedPool",
+                                           "rIDNextRID"])
+            if "rIDAllocationPool" not in res[0]:
+                self.report("No rIDAllocationPool found in %s" % dn)
+                error_count += 1
+            else:
+                next_pool = int(res[0]["rIDAllocationPool"][0])
+
+                high = (0xFFFFFFFF00000000 & next_pool) >> 32
+                low = 0x00000000FFFFFFFF & next_pool
+
+                if high <= low:
+                    self.report("Invalid RID set %d-%s, %d > %d!" % (low, high, low, high))
+                    error_count += 1
+
+                if "rIDNextRID" in res[0]:
+                    next_free_rid = int(res[0]["rIDNextRID"][0])
+                else:
+                    next_free_rid = 0
+
+                if next_free_rid == 0:
+                    next_free_rid = low
+                else:
+                    next_free_rid += 1
+
+                # Check the remainder of this pool for conflicts.  If
+                # ridalloc_allocate_rid() moves to a new pool, this
+                # will be above high, so we will stop.
+                while next_free_rid <= high:
+                    sid = "%s-%d" % (self.samdb.get_domain_sid(), next_free_rid)
+                    try:
+                        res = self.samdb.search(base="<SID=%s>" % sid, scope=ldb.SCOPE_BASE,
+                                                attrs=[])
+                    except ldb.LdbError, (enum, estr):
+                        if enum != ldb.ERR_NO_SUCH_OBJECT:
+                            raise
+                        res = None
+                    if res is not None:
+                        self.report("SID %s for %s conflicts with our current RID set in %s" % (sid, res[0].dn, dn))
+                        error_count += 1
+
+                        if self.confirm_all('Fix conflict between SID %s and RID pool in %s by allocating a new RID?'
+                                            % (sid, dn),
+                                            'fix_sid_rid_set_conflict'):
+                            self.samdb.transaction_start()
+
+                            # This will burn RIDs, which will move
+                            # past the conflict.  We then check again
+                            # to see if the new RID conflicts, until
+                            # the end of the current pool.  We don't
+                            # look at the next pool to avoid burning
+                            # all RIDs in one go in some strange
+                            # failure case.
+                            try:
+                                while True:
+                                    allocated_rid = self.samdb.allocate_rid()
+                                    if allocated_rid >= next_free_rid:
+                                        next_free_rid = allocated_rid + 1
+                                        break
+                            except:
+                                self.samdb.transaction_cancel()
+                                raise
+
+                            self.samdb.transaction_commit()
+                        else:
+                            break
+                    else:
+                        next_free_rid += 1
+
+
         return error_count
 
     ################################################################
diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py
index 1351654..62b3e43 100644
--- a/python/samba/netcmd/fsmo.py
+++ b/python/samba/netcmd/fsmo.py
@@ -295,12 +295,37 @@ You must provide an Admin user and password."""),
             m["fSMORoleOwner"]= ldb.MessageElement(
                 serviceName, ldb.FLAG_MOD_REPLACE,
                 "fSMORoleOwner")
+
+            samdb.transaction_start()
             try:
                 samdb.modify(m)
+                if role == "rid":
+                    # We may need to allocate the initial RID Set
+                    samdb.create_own_rid_set()
+
             except LdbError, (num, msg):
-                raise CommandError("Failed to seize '%s' role: %s" %
-                                   (role, msg))
+                if role == "rid" and num == ldb.ERR_ENTRY_ALREADY_EXISTS:
+
+                    # Try again without the RID Set allocation
+                    # (normal).  We have to manage the transaction as
+                    # we do not have nested transactions and creating
+                    # a RID set touches multiple objects. :-(
+                    samdb.transaction_cancel()
+                    samdb.transaction_start()
+                    try:
+                        samdb.modify(m)
+                    except LdbError, (num, msg):
+                        samdb.transaction_cancel()
+                        raise CommandError("Failed to seize '%s' role: %s" %
+                                           (role, msg))
+
+                else:
+                    samdb.transaction_cancel()
+                    raise CommandError("Failed to seize '%s' role: %s" %
+                                       (role, msg))
+            samdb.transaction_commit()
             self.outf.write("FSMO seize of '%s' role successful\n" % role)
+
             return True
 
     def seize_dns_role(self, role, samdb, credopts, sambaopts,
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index 3d7ea3e..eabe363 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -963,3 +963,11 @@ accountExpires: %u
             return dsdb._dsdb_garbage_collect_tombstones(self, dn,
                                                          current_time,
                                                          tombstone_lifetime)
+
+    def create_own_rid_set(self):
+        '''create a RID set for this DSA'''
+        return dsdb._dsdb_create_own_rid_set(self)
+
+    def allocate_rid(self):
+        '''return a new RID from the RID Pool on this DSA'''
+        return dsdb._dsdb_allocate_rid(self)
diff --git a/python/samba/tests/samba_tool/timecmd.py b/python/samba/tests/samba_tool/timecmd.py
index 310f861..68dcb06 100644
--- a/python/samba/tests/samba_tool/timecmd.py
+++ b/python/samba/tests/samba_tool/timecmd.py
@@ -39,5 +39,5 @@ class TimeCmdTestCase(SambaToolCmdTest):
         """Run time against a non-existent server, and make sure it fails"""
         (result, out, err) = self.runcmd("time", "notaserver")
         self.assertEquals(result, -1, "check for result code")
-        self.assertTrue(err.strip().endswith("NT_STATUS_OBJECT_NAME_NOT_FOUND"), "ensure right error string")
+        self.assertNotEqual(err.strip().find("NT_STATUS_OBJECT_NAME_NOT_FOUND"), -1, "ensure right error string")
         self.assertEquals(out, "", "ensure no output returned")
diff --git a/selftest/knownfail b/selftest/knownfail
index c1899da..7c42777 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -292,3 +292,7 @@
 #ntvfs server blocks copychunk with execute access on read handle
 ^samba4.smb2.ioctl.copy_chunk_bad_access
 ^samba4.drs.getnc_exop.python.*getnc_exop.DrsReplicaPrefixMapTestCase.test_regular_prefix_map_ex_attid.*
+^samba4.drs.ridalloc_exop.python.*ridalloc_exop.DrsReplicaSyncTestCase.test_offline_ridalloc
+^samba4.drs.ridalloc_exop.python.*ridalloc_exop.DrsReplicaSyncTestCase.test_join_time_ridalloc
+^samba4.drs.ridalloc_exop.python.*ridalloc_exop.DrsReplicaSyncTestCase.test_rid_set_dbcheck_after_seize
+^samba4.drs.ridalloc_exop.python.*ridalloc_exop.DrsReplicaSyncTestCase.test_rid_set_dbcheck
diff --git a/selftest/tests.py b/selftest/tests.py
index 019784c..46ca88c 100644
--- a/selftest/tests.py
+++ b/selftest/tests.py
@@ -109,6 +109,11 @@ plantestsuite(
     ["PYTHON=%s" % python,
      os.path.join(bbdir, "tombstones-expunge.sh"),
      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
+plantestsuite(
+    "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
+    ["PYTHON=%s" % python,
+     os.path.join(bbdir, "dbcheck-links.sh"),
+     '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
 planpythontestsuite("none", "samba.tests.upgradeprovision")
 planpythontestsuite("none", "samba.tests.xattr")
 planpythontestsuite("none", "samba.tests.ntacls")
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index e253658..e0003f9 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -170,11 +170,14 @@ bool delete_driver_files(const struct auth_session_info *server_info,
 			 const struct spoolss_DriverInfo8 *r);
 
 WERROR move_driver_to_download_area(struct auth_session_info *session_info,
-				    struct spoolss_AddDriverInfoCtr *r);
+				    struct spoolss_AddDriverInfoCtr *r,
+				    const char *driver_directory);
 
 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
 			      struct auth_session_info *session_info,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list