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

Karolin Seeger kseeger at samba.org
Wed Sep 4 10:25:04 UTC 2019


The branch, v4-11-test has been updated
       via  bc0d16c9d8e ldb: Release ldb 2.0.7
       via  9392ee7d290 ldb: Extend the ldb_dn_explode test matrix
       via  e019f3a6aac ldb: Do not read beyond the end of the extended DN component when printing
       via  9b0c3051783 ldb: Add test with == true or false to boolean if statements in ldb_dn_explode()
       via  1bc9476be79 ldb: Rework all pointer NULL tests to use Samba's normal style
       via  0f993c094ea ldb: add some dn explode tests
       via  c71c51dda00 ldb: don't try to save a value that isn't there
       via  61a039cc21d ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure
       via  11427be15ed ldb: use TALLOC_FREE() over talloc_free() in ldb_filter_attrs()
       via  9c677a274d4 ldb: Correct Pigeonhole principle validation in ldb_filter_attrs()
       via  57f00784ffa ldb: Fix mem-leak if talloc_realloc fails
       via  7cf6afba656 ldb_dn: free dn components on explode failure
       via  0358b3f9bc1 ldb: do not allow adding a DN as a base to itself
       via  0e96b2cb506 vfs_glusterfs: Use pthreadpool for scheduling aio operations
       via  8b680d30979 ctdb-recoverd: Fix typo in previous fix
       via  20c4d212472 ctdb-tests: Clear deleted record via recovery instead of vacuuming
       via  9063f5dde3f ctdb-tests: Strengthen volatile DB traverse test
       via  a03443efef6 ctdb-recoverd: Only check for LMASTER nodes in the VNN map
       via  4a5c554508b ctdb-tests: Don't retrieve the VNN map from target node for notlmaster
       via  7e004230708 ctdb-tests: Handle special cases first and return
       via  e876b1e8562 ctdb-tests: Inline handling of recovered and notlmaster statuses
       via  6efb59affb2 ctdb-tests: Drop unused node statuses frozen/unfrozen
       via  a279b888346 ctdb-tests: Reformat node_has_status()
      from  96961348432 VERSION: Bump verison up to 4.11.0rc4...

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


- Log -----------------------------------------------------------------
commit bc0d16c9d8eacd254552ff28726a2ba5f2a1c8c0
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Aug 28 17:44:52 2019 +1200

    ldb: Release ldb 2.0.7
    
    * Robustness improvements against duplicate attributes in ldb_filter_attrs()
      (bug 13695)
    * Robustness improvements against invalid string DN values (bug 14049)
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-11-test): Wed Sep  4 10:24:56 UTC 2019 on sn-devel-184

commit 9392ee7d29081118afd2dfd531946cbdcaba729d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Aug 27 13:16:50 2019 +1200

    ldb: Extend the ldb_dn_explode test matrix
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 10058bcfa16d5029e61252d64d142a8aab9ec296)

commit e019f3a6aac62460ee9768fec4001e00f00f8096
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Aug 27 13:16:18 2019 +1200

    ldb: Do not read beyond the end of the extended DN component when printing
    
    The print functions used in Samba NULL terminate, but do not assume they will
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit a8a3cef3a768aaff01227dd7b229fb7b3aef926f)

commit 9b0c30517834da57a436ac6a0bad1fa2c6173849
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Aug 22 11:09:55 2019 +1200

    ldb: Add test with == true or false to boolean if statements in ldb_dn_explode()
    
    This is beyond the normal level of clarity we expect in Samba, and is of course
    rudundent, but this is a complex routine that has confusing tests, some of
    pointers and some of boolean state values.
    
    This tries to make the code as clear as possible pending a more comprehensive
    rewrite.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 52bd2dde5ae809ecc115f7087e367327f4771e73)

commit 1bc9476be79b994a3a9b0618f23f176e399c5aaa
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Aug 22 10:59:07 2019 +1200

    ldb: Rework all pointer NULL tests to use Samba's normal style
    
    Also avoid if () without braces
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 3f290e95c2c133eb2c983ecc984d3dff4809f3d3)

commit 0f993c094ea242934766761389cecd5ecfd14a37
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Jul 25 12:09:16 2019 +1200

    ldb: add some dn explode tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit a097ddf65ce56dcd2e0b072b6dd78f512a77a9da)

commit c71c51dda004a617eaeccb0819b70310de1ebd14
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Jul 26 09:49:13 2019 +1200

    ldb: don't try to save a value that isn't there
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 54f30f2fe3f03c9640664f9a11260b093fc57a5b)

commit 61a039cc21d845bb4b984929d878dd8cf68839fe
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 26 14:50:15 2019 +1200

    ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Aug 27 01:16:33 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 1521a22f4366c86ec955cb9d32b7a758315d8ce0)

commit 11427be15ed6701fb2a15830846b57fe5e62fb42
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 26 14:48:52 2019 +1200

    ldb: use TALLOC_FREE() over talloc_free() in ldb_filter_attrs()
    
    This is a macro that sets the pointer to NULL after the talloc_free()
    and is part of our standard coding practices.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 2117789c35fbf6d0ed02f391f17593e11727ec3e)

commit 9c677a274d49026105c72c5b4767b1d88eff77fa
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 26 13:04:07 2019 +1200

    ldb: Correct Pigeonhole principle validation in ldb_filter_attrs()
    
    Thankfully this only fails if the DB is corrupt and has a duplicate record.
    
    The test was at the wrong end of the loop, and was for the
    wrong boundary condition.  A write after the end of the array would
    occour before the condition was hit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13695
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit b1eec5b196e3d5a5716a5c74cf669ceaa5c0301f)

commit 57f00784ffac527a0f9b830339bba24784f2e294
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Wed Jul 31 10:27:37 2019 +0200

    ldb: Fix mem-leak if talloc_realloc fails
    
    In case of a failing talloc_realloc(), the only reference
    to the originally allocated memory is overwritten.
    Instead use a temp var until success is verified.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 99b4791cfe423b19f1f21d5f9fb42157336019f1)

commit 7cf6afba65641f48a5e2c326464fd97fd9f4173c
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Fri Mar 8 12:12:00 2019 +1300

    ldb_dn: free dn components on explode failure
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>
    (cherry picked from commit b136f153b83d80a91ec9d5350fdf08412d881964)

commit 0358b3f9bc1e557a639ec63670d8c29c135e54f5
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Sat Jul 6 23:24:43 2019 +1200

    ldb: do not allow adding a DN as a base to itself
    
    If you try to add a dn to itself, it expands as it goes. The resulting
    loop cannot end well.
    
    It looks like this in Python:
    
        dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x')
        dn.add_base(dn)
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit 19a13cbe0681b3996c33f7449f69b0fb0dc5d640)

commit 0e96b2cb506f278562fe21b0b8d47da276b939c6
Author: Poornima G <pgurusid at redhat.com>
Date:   Wed Jul 24 15:15:33 2019 +0530

    vfs_glusterfs: Use pthreadpool for scheduling aio operations
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14098
    
    Signed-off-by: Poornima G <pgurusid at redhat.com>
    Reviewed-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): Fri Aug 23 18:40:08 UTC 2019 on sn-devel-184
    
    (cherry picked from commit d8863dd8cb74bb0534457ca930a71e77c367d994)

commit 8b680d309798d91e4658a358831e957aaffa480b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 27 12:13:51 2019 +1000

    ctdb-recoverd: Fix typo in previous fix
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Tue Aug 27 15:29:11 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 8190993d99284162bd8699780248bb2edfec2673)

commit 20c4d212472e177739186e9ce675fa49a5ff0a64
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 13 14:45:33 2019 +1000

    ctdb-tests: Clear deleted record via recovery instead of vacuuming
    
    This test has been flapping because sometimes the record is not
    vacuumed within the expected time period, perhaps even because the
    check for the record can interfere with vacuuming.  However, instead
    of waiting for vacuuming the record can be cleared by doing a
    recovery.  This should be much more reliable.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    RN: Fix flapping CTDB tests
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Wed Aug 21 13:06:57 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 71ad473ba805abe23bbe6c1a1290612e448e73f3)

commit 9063f5dde3f9fc43037539e4424944400c00ddb5
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 17:22:50 2019 +1000

    ctdb-tests: Strengthen volatile DB traverse test
    
    Check the record count more often, from multiple nodes.  Add a case
    with multiple records.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit ca4df06080709adf0cbebc95b0a70b4090dad5ba)

commit a03443efef6488a5b2dc74962f77070c0c8ecb06
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 21 14:35:09 2019 +1000

    ctdb-recoverd: Only check for LMASTER nodes in the VNN map
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 5d655ac6f2ff82f8f1c89b06870d600a1a3c7a8a)

commit 4a5c554508b14be280bddb7c16688868c980abf0
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 16:45:07 2019 +1000

    ctdb-tests: Don't retrieve the VNN map from target node for notlmaster
    
    Use the VNN map from the node running node_has_status().
    
    This means that
    
      wait_until_node_has_status 1 notlmaster 10 0
    
    will run "ctdb status" on node 0 and check (for up to 10 seconds) if
    node 1 is in the VNN map.
    
    If the LMASTER capability has been dropped on node 1 then the above
    will wait for the VNN map to be updated on node 0.  This will happen
    as part of the recovery that is triggered by the change of LMASTER
    capability.  The next command will then only be able to attach to
    $TESTDB after the recovery is complete thus guaranteeing a sane state
    for the test to continue.
    
    This stops simple/79_volatile_db_traverse.sh from going into recovery
    during the traverse or at some other inconvenient time.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 53daeb2f878af1634a26e05cb86d87e2faf20173)

commit 7e004230708001878e6b278aab32b6854289dc6a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 16:43:09 2019 +1000

    ctdb-tests: Handle special cases first and return
    
    All the other cases involve matching bits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)

commit e876b1e85627db8be59bcbcede7154a55f640b00
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 15:45:41 2019 +1000

    ctdb-tests: Inline handling of recovered and notlmaster statuses
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit bb59073515ee5f7886b5d9a20d7b2805857c2708)

commit 6efb59affb25594828e4cc68a30ea41e71f0b124
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 15:40:16 2019 +1000

    ctdb-tests: Drop unused node statuses frozen/unfrozen
    
    Silently drop unused local variable mpat.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 9b09a87326af28877301ad27bcec5bb13744e2b6)

commit a279b8883469b524b18e61c30621fe0dd999e054
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 29 15:31:55 2019 +1000

    ctdb-tests: Reformat node_has_status()
    
    Re-indent and drop non-POSIX left-parenthesis from case labels.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)

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

Summary of changes:
 ctdb/server/ctdb_recoverd.c                        |  14 +-
 ctdb/tests/scripts/integration.bash                |  80 +-
 ctdb/tests/simple/69_recovery_resurrect_deleted.sh |  17 +-
 ctdb/tests/simple/79_volatile_db_traverse.sh       |  67 +-
 lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.0.7.sigs}     |   0
 ...yldb-util-1.1.10.sigs => pyldb-util-2.0.7.sigs} |   0
 lib/ldb/common/ldb_dn.c                            | 156 ++--
 lib/ldb/common/ldb_pack.c                          |  35 +-
 lib/ldb/tests/ldb_filter_attrs_test.c              | 988 +++++++++++++++++++++
 lib/ldb/tests/test_ldb_dn.c                        | 115 +++
 lib/ldb/wscript                                    |   7 +-
 source3/modules/vfs_glusterfs.c                    | 562 ++++++------
 12 files changed, 1626 insertions(+), 415 deletions(-)
 copy lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.0.7.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-2.0.7.sigs} (100%)
 create mode 100644 lib/ldb/tests/ldb_filter_attrs_test.c


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 652bf9ce4ea..3d5b727715a 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -2989,13 +2989,19 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 		return;
 	}
 
-	/* verify that all active nodes in the nodemap also exist in 
-	   the vnnmap.
+	/*
+	 * Verify that all active lmaster nodes in the nodemap also
+	 * exist in the vnnmap
 	 */
 	for (j=0; j<nodemap->num; j++) {
 		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
 			continue;
 		}
+		if (! ctdb_node_has_capabilities(rec->caps,
+						 nodemap->nodes[j].pnn,
+						 CTDB_CAP_LMASTER)) {
+			continue;
+		}
 		if (nodemap->nodes[j].pnn == pnn) {
 			continue;
 		}
@@ -3006,8 +3012,8 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 			}
 		}
 		if (i == vnnmap->size) {
-			DEBUG(DEBUG_ERR, (__location__ " Node %u is active in the nodemap but did not exist in the vnnmap\n", 
-				  nodemap->nodes[j].pnn));
+			D_ERR("Active LMASTER node %u is not in the vnnmap\n",
+			      nodemap->nodes[j].pnn);
 			ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
 			do_recovery(rec, mem_ctx, pnn, nodemap, vnnmap);
 			return;
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 30725c48e53..a4d45fb9ac2 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -311,53 +311,53 @@ wait_until_ready ()
 # This function is becoming nicely overloaded.  Soon it will collapse!  :-)
 node_has_status ()
 {
-    local pnn="$1"
-    local status="$2"
-
-    local bits fpat mpat rpat
-    case "$status" in
-	(unhealthy)    bits="?|?|?|1|*" ;;
-	(healthy)      bits="?|?|?|0|*" ;;
-	(disconnected) bits="1|*" ;;
-	(connected)    bits="0|*" ;;
-	(banned)       bits="?|1|*" ;;
-	(unbanned)     bits="?|0|*" ;;
-	(disabled)     bits="?|?|1|*" ;;
-	(enabled)      bits="?|?|0|*" ;;
-	(stopped)      bits="?|?|?|?|1|*" ;;
-	(notstopped)   bits="?|?|?|?|0|*" ;;
-	(frozen)       fpat='^[[:space:]]+frozen[[:space:]]+1$' ;;
-	(unfrozen)     fpat='^[[:space:]]+frozen[[:space:]]+0$' ;;
-	(recovered)    rpat='^Recovery mode:RECOVERY \(1\)$' ;;
-	(notlmaster)   rpat="^hash:.* lmaster:${pnn}\$" ;;
+	local pnn="$1"
+	local status="$2"
+
+	case "$status" in
+	recovered)
+		! $CTDB status -n "$pnn" | \
+			grep -Eq '^Recovery mode:RECOVERY \(1\)$'
+		return
+		;;
+	notlmaster)
+		! $CTDB status | grep -Eq "^hash:.* lmaster:${pnn}\$"
+		return
+		;;
+	esac
+
+	local bits
+	case "$status" in
+	unhealthy)    bits="?|?|?|1|*" ;;
+	healthy)      bits="?|?|?|0|*" ;;
+	disconnected) bits="1|*" ;;
+	connected)    bits="0|*" ;;
+	banned)       bits="?|1|*" ;;
+	unbanned)     bits="?|0|*" ;;
+	disabled)     bits="?|?|1|*" ;;
+	enabled)      bits="?|?|0|*" ;;
+	stopped)      bits="?|?|?|?|1|*" ;;
+	notstopped)   bits="?|?|?|?|0|*" ;;
 	*)
-	    echo "node_has_status: unknown status \"$status\""
-	    return 1
-    esac
-
-    if [ -n "$bits" ] ; then
+		echo "node_has_status: unknown status \"$status\""
+		return 1
+	esac
 	local out x line
 
 	out=$($CTDB -X status 2>&1) || return 1
 
 	{
-            read x
-            while read line ; do
-		# This needs to be done in 2 steps to avoid false matches.
-		local line_bits="${line#|${pnn}|*|}"
-		[ "$line_bits" = "$line" ] && continue
-		[ "${line_bits#${bits}}" != "$line_bits" ] && return 0
-            done
-	    return 1
+		read x
+		while read line ; do
+			# This needs to be done in 2 steps to
+			# avoid false matches.
+			local line_bits="${line#|${pnn}|*|}"
+			[ "$line_bits" = "$line" ] && continue
+			[ "${line_bits#${bits}}" != "$line_bits" ] && \
+				return 0
+		done
+		return 1
 	} <<<"$out" # Yay bash!
-    elif [ -n "$fpat" ] ; then
-	$CTDB statistics -n "$pnn" | egrep -q "$fpat"
-    elif [ -n "$rpat" ] ; then
-        ! $CTDB status -n "$pnn" | egrep -q "$rpat"
-    else
-	echo 'node_has_status: unknown mode, neither $bits nor $fpat is set'
-	return 1
-    fi
 }
 
 wait_until_node_has_status ()
diff --git a/ctdb/tests/simple/69_recovery_resurrect_deleted.sh b/ctdb/tests/simple/69_recovery_resurrect_deleted.sh
index 8126c49b83c..f6c72c59f2a 100755
--- a/ctdb/tests/simple/69_recovery_resurrect_deleted.sh
+++ b/ctdb/tests/simple/69_recovery_resurrect_deleted.sh
@@ -54,18 +54,11 @@ database_has_zero_records ()
 	return 0
 }
 
-echo "Get vacuum interval"
-try_command_on_node -v $second $CTDB getvar VacuumInterval
-vacuum_interval="${out#* = }"
-
-echo "Wait until vacuuming deletes the record on active nodes"
-# Why 4?  Steps are:
-# 1. Original node processes delete queue, asks lmaster to fetch
-# 2. lmaster recoverd fetches
-# 3. lmaster processes delete queue
-# If vacuuming is just missed then need an extra interval
-t=$((vacuum_interval * 4))
-wait_until "${t}/10" database_has_zero_records
+echo "Trigger a recovery"
+try_command_on_node "$second" $CTDB recover
+
+echo "Checking that database has 0 records"
+database_has_zero_records
 
 echo "Continue node ${first}"
 try_command_on_node $first $CTDB continue
diff --git a/ctdb/tests/simple/79_volatile_db_traverse.sh b/ctdb/tests/simple/79_volatile_db_traverse.sh
index af7e962f579..7f3007d5105 100755
--- a/ctdb/tests/simple/79_volatile_db_traverse.sh
+++ b/ctdb/tests/simple/79_volatile_db_traverse.sh
@@ -42,11 +42,56 @@ try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
 echo "write foo=bar1 on node 1"
 try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
 
-echo "do traverse on node 0"
-try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+echo
 
-echo "do traverse on node 1"
-try_command_on_node -v 1 $CTDB catdb "$TESTDB"
+check_db_num_records ()
+{
+	local node="$1"
+	local db="$2"
+	local n="$3"
+
+	echo "Checking on node ${node} to ensure ${db} has ${n} records..."
+	try_command_on_node "$node" "${CTDB} catdb ${db}"
+
+	num=$(sed -n -e 's|^Dumped \(.*\) records$|\1|p' "$outfile")
+	if [ "$num" = "$n" ] ; then
+		echo "OK: Number of records=${num}"
+		echo
+	else
+		echo "BAD: There were ${num} (!= ${n}) records"
+		cat "$outfile"
+		exit 1
+	fi
+}
+
+check_db_num_records 0 "$TESTDB" 1
+check_db_num_records 1 "$TESTDB" 1
+
+cat <<EOF
+
+Again, this time with 10 records, rewriting 5 of them on the 2nd node
+
+EOF
+
+echo "wipe test database $TESTDB"
+try_command_on_node 0 $CTDB wipedb "$TESTDB"
+
+for i in $(seq 0 9) ; do
+	k="foo${i}"
+	v="bar${i}@0"
+	echo "write ${k}=${v} on node 0"
+	try_command_on_node 0 "${CTDB} writekey ${TESTDB} ${k} ${v}"
+done
+
+for i in $(seq 1 5) ; do
+	k="foo${i}"
+	v="bar${i}@1"
+	echo "write ${k}=${v} on node 1"
+	try_command_on_node 1 "${CTDB} writekey ${TESTDB} ${k} ${v}"
+done
+
+check_db_num_records 0 "$TESTDB" 10
+check_db_num_records 1 "$TESTDB" 10
 
 cat <<EOF
 
@@ -63,8 +108,6 @@ try_command_on_node 1 $CTDB setlmasterrole off
 try_command_on_node -v 1 $CTDB getcapabilities
 
 wait_until_node_has_status 1 notlmaster 10 0
-# Wait for recovery and new VNN map to be pushed
-#sleep_for 10
 
 echo "write foo=bar0 on node 0"
 try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
@@ -72,16 +115,10 @@ try_command_on_node 0 $CTDB writekey "$TESTDB" "foo" "bar0"
 echo "write foo=bar1 on node 1"
 try_command_on_node 1 $CTDB writekey "$TESTDB" "foo" "bar1"
 
-echo "do traverse on node 0"
-try_command_on_node -v 0 $CTDB catdb "$TESTDB"
+echo
 
-num=$(sed -n -e 's|^Dumped \(.*\) records$|\1|p' "$outfile")
-if [ "$num" = 1 ] ; then
-	echo "OK: There was 1 record"
-else
-	echo "BAD: There were ${num} (!= 1) records"
-	exit 1
-fi
+check_db_num_records 0 "$TESTDB" 1
+check_db_num_records 1 "$TESTDB" 1
 
 if grep -q "^data(4) = \"bar1\"\$" "$outfile" ; then
 	echo "OK: Data from node 1 was returned"
diff --git a/lib/ldb/ABI/ldb-2.0.5.sigs b/lib/ldb/ABI/ldb-2.0.7.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-2.0.5.sigs
copy to lib/ldb/ABI/ldb-2.0.7.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-2.0.7.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-2.0.7.sigs
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index 2e98f391467..83f94e3b913 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -298,19 +298,21 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 	char *parse_dn;
 	bool is_index;
 
-	if ( ! dn || dn->invalid) return false;
+	if (dn == NULL || dn->invalid == true) {
+		return false;
+	}
 
-	if (dn->components) {
+	if (dn->components != NULL) {
 		return true;
 	}
 
-	if (dn->ext_linearized) {
+	if (dn->ext_linearized != NULL) {
 		parse_dn = dn->ext_linearized;
 	} else {
 		parse_dn = dn->linearized;
 	}
 
-	if ( ! parse_dn ) {
+	if (parse_dn == NULL) {
 		return false;
 	}
 
@@ -322,7 +324,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 	}
 
 	/* Special DNs case */
-	if (dn->special) {
+	if (dn->special == true) {
 		return true;
 	}
 
@@ -333,14 +335,14 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 	/* in the common case we have 3 or more components */
 	/* make sure all components are zeroed, other functions depend on it */
 	dn->components = talloc_zero_array(dn, struct ldb_dn_component, 3);
-	if ( ! dn->components) {
+	if (dn->components == NULL) {
 		return false;
 	}
 
 	/* Components data space is allocated here once */
 	data = talloc_array(dn->components, char, strlen(parse_dn) + 1);
-	if (!data) {
-		return false;
+	if (data == NULL) {
+		goto failed;
 	}
 
 	p = parse_dn;
@@ -348,7 +350,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 	d = dt = data;
 
 	while (*p) {
-		if (in_extended) {
+		if (in_extended == true) {
 
 			if (!in_ex_name && !in_ex_value) {
 
@@ -376,6 +378,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			}
 
 			if (in_ex_value && *p == '>') {
+				struct ldb_dn_ext_component *ext_comp = NULL;
 				const struct ldb_dn_extended_syntax *ext_syntax;
 				struct ldb_val ex_val = {
 					.data = (uint8_t *)ex_value,
@@ -388,17 +391,21 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 
 				/* Process name and ex_value */
 
-				dn->ext_components = talloc_realloc(dn,
-								    dn->ext_components,
-								    struct ldb_dn_ext_component,
-								    dn->ext_comp_num + 1);
-				if ( ! dn->ext_components) {
+				ext_comp = talloc_realloc(
+					dn,
+					dn->ext_components,
+					struct ldb_dn_ext_component,
+					dn->ext_comp_num + 1);
+
+				if (ext_comp == NULL) {
 					/* ouch ! */
 					goto failed;
 				}
 
+				dn->ext_components = ext_comp;
+
 				ext_syntax = ldb_dn_extended_syntax_by_name(dn->ldb, ex_name);
-				if (!ext_syntax) {
+				if (ext_syntax == NULL) {
 					/* We don't know about this type of extended DN */
 					goto failed;
 				}
@@ -430,8 +437,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			*d++ = *p++;
 			continue;
 		}
-		if (in_attr) {
-			if (trim) {
+		if (in_attr == true) {
+			if (trim == true) {
 				if (*p == ' ') {
 					p++;
 					continue;
@@ -481,7 +488,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				 *  with spaces trimmed) */
 				*d++ = '\0';
 				dn->components[dn->comp_num].name = talloc_strdup(dn->components, dt);
-				if ( ! dn->components[dn->comp_num].name) {
+				if (dn->components[dn->comp_num].name == NULL) {
 					/* ouch */
 					goto failed;
 				}
@@ -498,7 +505,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				goto failed;
 			}
 
-			if (is_oid && ( ! (isdigit(*p) || (*p == '.')))) {
+			if (is_oid == true && ( ! (isdigit(*p) || (*p == '.')))) {
 				/* not a digit nor a dot,
 				 * invalid attribute oid */
 				ldb_dn_mark_invalid(dn);
@@ -514,8 +521,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			continue;
 		}
 
-		if (in_value) {
-			if (in_quote) {
+		if (in_value == true) {
+			if (in_quote == true) {
 				if (*p == '\"') {
 					if (p[-1] != '\\') {
 						p++;
@@ -528,7 +535,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				continue;
 			}
 
-			if (trim) {
+			if (trim == true) {
 				if (*p == ' ') {
 					p++;
 					continue;
@@ -551,7 +558,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			*/
 
 			case ',':
-				if (escape) {
+				if (escape == true) {
 					*d++ = *p++;
 					l++;
 					escape = false;
@@ -559,7 +566,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				}
 				/* ok found value terminator */
 
-				if ( t ) {
+				if (t != NULL) {
 					/* trim back */
 					d -= (p - t);
 					l -= (p - t);
@@ -580,7 +587,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				dn->components[dn->comp_num].value.data = \
 					(uint8_t *)talloc_memdup(dn->components, dt, l + 1);
 				dn->components[dn->comp_num].value.length = l;
-				if ( ! dn->components[dn->comp_num].value.data) {
+				if (dn->components[dn->comp_num].value.data == NULL) {
 					/* ouch ! */
 					goto failed;
 				}
@@ -595,7 +602,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 									dn->components,
 									struct ldb_dn_component,
 									dn->comp_num + 1);
-					if ( ! dn->components) {
+					if (dn->components == NULL) {
 						/* ouch ! */
 						goto failed;
 					}
@@ -612,8 +619,10 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				accept the base64 encoded binary index
 				values, which contain a '+' or '='
 				which should normally be escaped */
-				if (is_index) {
-					if ( t ) t = NULL;
+				if (is_index == true) {
+					if (t != NULL) {
+						t = NULL;
+					}
 					*d++ = *p++;
 					l++;
 					break;
@@ -625,7 +634,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			case '>':
 			case ';':
 				/* a string with not escaped specials is invalid (tested) */
-				if ( ! escape) {
+				if (escape == false) {
 					ldb_dn_mark_invalid(dn);
 					goto failed;
 				}
@@ -634,11 +643,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				*d++ = *p++;
 				l++;
 
-				if ( t ) t = NULL;
+				if (t != NULL) {
+					t = NULL;
+				}
 				break;
 
 			case '\\':
-				if ( ! escape) {
+				if (escape == false) {
 					escape = true;
 					p++;
 					continue;
@@ -648,11 +659,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 				*d++ = *p++;
 				l++;
 
-				if ( t ) t = NULL;
+				if (t != NULL) {
+					t = NULL;
+				}
 				break;
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list