Stefan Metzmacher
c5c99b5695
dbchecker: improve verbose output of do_modify()
...
This makes it easier to debug dbcheck problems.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13418
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-10-30 07:30:20 +01:00
Noel Power
557ff7b7ff
python/samba: samba4.blackbox.dbcheck.release-4-1-0rc3
...
* Various string related fixed py2/py3
* Fix strange double decode followed by encode code (see comments
in change)
* Added dump_attr_values, simply printing attribute values (from
sequence) doesn't work (when using string '%s' format codes in
existing string). We need to print out string from bytes in PY3
and fallback to repr(which will print b'blah') if we get a decode error
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-10-23 05:50:27 +02:00
Noel Power
e5cac2b843
python/samba: misc use of str for ldb.bytes
...
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-10-23 05:50:27 +02:00
Noel Power
17728c2f53
python/samba: ldb attribute string fix for wafsamba.tests
2018-10-23 05:50:27 +02:00
Noel Power
8db43696e7
python/samba: extra ndr_unpack needs bytes function
2018-09-15 15:18:26 +02:00
Noel Power
fc13a1268a
python/samba: PY3 port for ridalloc_exop test to work
...
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-09-15 15:18:26 +02:00
Noel Power
dcbdae15b2
python/samba: ndr_unpack has to take bytes not string
...
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-09-15 15:18:26 +02:00
Joe Guo
deb819913d
PEP8: fix E127: continuation line over-indented for visual indent
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-09-06 12:10:12 +02:00
Noel Power
27df0e81c2
python/samba: port changes to allow samba.tests.dsdb_lock to work with PY3/PY2
...
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-09-03 03:22:20 +02:00
Joe Guo
9f5bbcc10a
PEP8: fix E713: test for membership should be 'not in'
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:31 +02:00
Joe Guo
cabb299749
PEP8: fix E703: statement ends with a semicolon
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:30 +02:00
Joe Guo
7b031b01a1
PEP8: fix E502: the backslash is redundant between brackets
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:30 +02:00
Joe Guo
fd6b2086cb
PEP8: fix E303: too many blank lines (2)
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:30 +02:00
Joe Guo
542e91ef92
PEP8: fix E301: expected 1 blank line, found 0
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:29 +02:00
Joe Guo
1ccc36b401
PEP8: fix E251: unexpected spaces around keyword / parameter equals
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:29 +02:00
Joe Guo
87bbc2df97
PEP8: fix E226: missing whitespace around arithmetic operator
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:28 +02:00
Joe Guo
32266d2d48
PEP8: fix E225: missing whitespace around operator
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:28 +02:00
Joe Guo
562411bd95
PEP8: fix E202: whitespace before ')'
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:27 +02:00
Joe Guo
a9551edaee
PEP8: fix E201: whitespace after '('
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:27 +02:00
Joe Guo
5d532543ab
PEP8: fix E128: continuation line under-indented for visual indent
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:27 +02:00
Joe Guo
dba0c7ebe5
PEP8: fix E124: closing bracket does not match visual indentation
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:26 +02:00
Joe Guo
297faf3252
PEP8: fix E122: continuation line missing indentation or outdented
...
Signed-off-by: Joe Guo <joeg@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-08-24 07:49:26 +02:00
Tim Beale
22208f52e6
dbchecker: Fixing up incorrect DNs wasn't working
...
dbcheck would fail to fix up attributes where the extended DN's GUID is
correct, but the DN itself is incorrect. The code failed attempting to
remove the old/incorrect DN, e.g.
NOTE: old (due to rename or delete) DN string component for
objectCategory in object CN=alice,CN=Users,DC=samba,DC=example,DC=com -
<GUID=7bfdf9d8-62f9-420c-8a71-e3d3e931c91e>;
CN=Person,CN=Schema,CN=Configuration,DC=samba,DC=bad,DC=com
Change DN to <GUID=7bfdf9d8-62f9-420c-8a71-e3d3e931c91e>;
CN=Person,CN=Schema,CN=Configuration,DC=samba,DC=example,DC=com?
[y/N/all/none] y
Failed to fix old DN string on attribute objectCategory : (16,
"attribute 'objectCategory': no matching attribute value while deleting
attribute on 'CN=alice,CN=Users,DC=samba,DC=example,DC=com'")
The problem was the LDB message specified the value to delete with its
full DN, including the GUID. The LDB code then helpfully corrected this
value on the way through, so that the DN got updated to reflect the
correct DN (i.e. 'DC=example,DC=com') of the object matching that GUID,
rather than the incorrect DN (i.e. 'DC=bad,DC=com') that we were trying
to remove. Because the requested value and the existing DB value didn't
match, the operation failed.
We can avoid this problem by passing down just the DN (not the extended
DN) of the value we want to delete. Without the GUID portion of the DN,
the LDB code will no longer try to correct it on the way through, and
the dbcheck operation will succeed.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13495
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz >
Signed-off-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz >
Pair-programmed-with: Andrew Bartlett <abartlet@samba.org >
2018-07-03 05:24:13 +02:00
Andrew Bartlett
c7fd68088d
dbcheck: Use symbolic control name for DSDB_CONTROL_DBCHECK_FIX_DUPLICATE_LINKS
...
While we do not wish to encourage use of this control, manually typed OIDs are
even more trouble, so pass out via pydsdb.
Signed-off-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz >
2018-07-03 05:24:13 +02:00
Noel Power
b54472f868
python: Bulk conversion callers of ldb.Dn second param
...
Convert second param passed to ldb.Dn to be unicode so py2 & py3 code
will work
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Alexander Bokovoy <ab@samba.org >
2018-04-30 15:43:19 +02:00
Noel Power
13280d3db9
python/samba: bulk conversion of caller to dsdb_Dn 2nd param.
...
Convert second param to dsdb_Dn to be unicode so py2 & py3 code
will work
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Alexander Bokovoy <ab@samba.org >
2018-04-30 15:43:19 +02:00
Noel Power
9c251740b4
samba python libs: convert print func to be py2/py3 compatible
...
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
2018-03-23 07:28:23 +01:00
Noel Power
91a5941f17
samba python libs: convert 'except X, (tuple)' to 'except X as e'
...
In addition to converting the except line another line is also added
for each except to extract the tuple contents.
Signed-off-by: Noel Power <noel.power@suse.com >
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-02-28 23:01:40 +01:00
Douglas Bagnall
4885937bf8
samba python libs: convert 'except X, e' to 'except X as e'
...
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2018-02-15 00:18:30 +01:00
Stefan Metzmacher
0c3348feb0
dbcheck: skip find_missing_forward_links_from_backlinks() if the db has the sortedLinks feature
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
Autobuild-User(master): Stefan Metzmacher <metze@samba.org >
Autobuild-Date(master): Mon Feb 5 18:32:51 CET 2018 on sn-devel-144
2018-02-05 18:32:51 +01:00
Ralph Boehme
5bf823d68b
dbcheck: add support for restoring missing forward links
...
This recovers broken databases with duplicate and missing
forward links.
See commit a25c99c9f1 for
the fix that prevents to problem from happening.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:13 +01:00
Ralph Boehme
d59f201388
dbcheck: add find_missing_forward_links_from_backlinks()
...
find_missing_forward_links_from_backlinks() finds and returns missing forward-links by
searching all for all objects that link to the object in the backlink attribute.
This will be used in the next commit to restore forward links in a corrupted
forward link attribute by passing the missing backling objects to
err_recover_forward_links().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:13 +01:00
Stefan Metzmacher
182fb3c4c9
dbcheck: make sure we ask for replPropertyMetaData if we need to process any forward link attributes
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-02-05 13:49:13 +01:00
Stefan Metzmacher
2059803386
dbcheck: make sure we always ask for the objectGUID attribute explicitly
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-02-05 13:49:13 +01:00
Ralph Boehme
e258b4fb28
dbcheck: add a helper function that checks is a value has duplicate links
...
Will be used in a subsequent commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:13 +01:00
Ralph Boehme
e4cc062fa9
dbcheck: add a dict where we remember attributes with duplicate links
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:13 +01:00
Ralph Boehme
44a8782d71
dbcheck: split out check_duplicate_links from check_dn
...
Refactoring, no change in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Stefan Metzmacher
7df17c0a8d
dbcheck: store fixed forward link attributes with the correct sorting
...
The corruption we're trying to fix messed up the sorting,
so there's no point in keeping the current order.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-02-05 13:49:12 +01:00
Stefan Metzmacher
b0bc3f6008
dbcheck: remove ldb.FLAG_MOD_REPLACE when replacing search results for forward links
...
Search results don't have an ldb.FLAG_MOD_* flags set.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
ec433f8531
dbcheck: rename err_duplicate_links() to err_recover_forward_links() and adjust the output message
...
It's really a fatal error to have duplicate values as it's very likely that
some forward links got lost.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
dc43d31cd2
dbcheck: add link direction to error message for duplicate links
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
a651cc79d6
dbcheck: rename err_duplicate_links arguments
...
In preperation of adding more arguments.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Reviewed-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Stefan Metzmacher
9f47fe6c4a
dbcheck: only pass obj_dn to err_orphaned_backlink()
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
6f77503871
dbcheck: add forward_syntax argument to err_orphaned_backlink
...
Will be used in a subsequent commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
4a71394c6a
dbcheck: rename and reorder err_orphaned_backlink arguments
...
In preperation of adding more arguments.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org >
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Ralph Boehme
8c01acd562
Revert "dbcheck: disable fixing duplicate linked attributes until we can recover lost forward links"
...
This reverts commit 43e3f79d54c5aeaea820865d298d4249cf47af99.
The real fix will follow in the next commits.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Ralph Boehme <slow@samba.org >
Signed-off-by: Stefan Metzmacher <metze@samba.org >
2018-02-05 13:49:12 +01:00
Stefan Metzmacher
850a8027f3
dbcheck: disable fixing duplicate linked attributes until we can recover lost forward links
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Ralph Boehme <slow@samba.org >
2018-01-22 12:26:20 +01:00
Stefan Metzmacher
239fbeb163
dbcheck: detect and fix duplicate links
...
Check with git show -w
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2017-11-24 15:50:16 +01:00
Stefan Metzmacher
9a631560c9
dbcheck: only calculate linked attribute helper variables once in check_dn()
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2017-11-24 15:50:16 +01:00
Stefan Metzmacher
eb6bd6511a
dbcheck: remove indentation level
...
Check with git show -w
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095
Signed-off-by: Stefan Metzmacher <metze@samba.org >
Reviewed-by: Andrew Bartlett <abartlet@samba.org >
2017-11-24 15:50:16 +01:00