<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.network.samba.cvs">
    <title>gmane.network.samba.cvs</title>
    <link>http://blog.gmane.org/gmane.network.samba.cvs</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77885"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77884"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77883"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77882"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77881"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77880"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77879"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77878"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77877"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77876"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77875"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77874"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77873"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77872"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77871"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77870"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77869"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77868"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77867"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.network.samba.cvs/77866"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77885">
    <title>autobuild: intermittent test failure detected</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77885</link>
    <description>&lt;pre&gt;The autobuild test system has detected an intermittent failing test in 
the current master tree.

The autobuild log of the failure is available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1742/flakey.log

The samba3 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1742/samba3.stderr
   http://git.samba.org/autobuild.flakey/2013-05-24-1742/samba3.stdout

The source4 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1742/samba.stderr
   http://git.samba.org/autobuild.flakey/2013-05-24-1742/samba.stdout
  
The top commit at the time of the failure was:

commit e24fe5705e3c4d33705ebb584ea2009bb4a1a82c
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 23:18:55 2013 +0200

    libnet-vampire: make use of dsdb_repl_resolve_working_schema()
    
    Pair-Programmed-With: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Thu May 23 14:18:03 CEST 2013 on sn-devel-104

&lt;/pre&gt;</description>
    <dc:creator>autobuild</dc:creator>
    <dc:date>2013-05-24T15:42:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77884">
    <title>autobuild: intermittent test failure detected</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77884</link>
    <description>&lt;pre&gt;The autobuild test system has detected an intermittent failing test in 
the current master tree.

The autobuild log of the failure is available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1542/flakey.log

The samba3 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1542/samba3.stderr
   http://git.samba.org/autobuild.flakey/2013-05-24-1542/samba3.stdout

The source4 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-24-1542/samba.stderr
   http://git.samba.org/autobuild.flakey/2013-05-24-1542/samba.stdout
  
The top commit at the time of the failure was:

commit e24fe5705e3c4d33705ebb584ea2009bb4a1a82c
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 23:18:55 2013 +0200

    libnet-vampire: make use of dsdb_repl_resolve_working_schema()
    
    Pair-Programmed-With: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Thu May 23 14:18:03 CEST 2013 on sn-devel-104

&lt;/pre&gt;</description>
    <dc:creator>autobuild</dc:creator>
    <dc:date>2013-05-24T13:42:33</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77883">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-206-g75a620c</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77883</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  75a620c516e384f042b5d675183b3a1b48fd6115 (commit)
       via  cfd1371d3a1f78a0ed86485d83bd4d311727c3d4 (commit)
       via  ef35c8889d90220929e48e66eb62da9ea2025ede (commit)
       via  954ae6f84cb06a8dcbc12456d4752280072be5bf (commit)
      from  32723c9efdad1c6ca4aa53f308ccd9bef1aadfff (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 75a620c516e384f042b5d675183b3a1b48fd6115
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Apr 5 20:47:47 2013 +1100

    tests/takeover: New test with 900 IPs

commit cfd1371d3a1f78a0ed86485d83bd4d311727c3d4
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Apr 5 20:45:08 2013 +1100

    tests/takeover: Takeover tests can use up to 1024 and checks limits
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit ef35c8889d90220929e48e66eb62da9ea2025ede
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon Apr 8 14:37:44 2013 +1000

    tests/takeover: LCP2 tests for weird, unbalanced corner-cases
    
    2 tests to show a bad result and a 3rd test for the fix.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 954ae6f84cb06a8dcbc12456d4752280072be5bf
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon Apr 8 14:37:08 2013 +1000

    tests/takeover: Allow takeover runs with differing IP allocations per node
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

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

Summary of changes:
 tests/src/ctdb_takeover_tests.c |   71 ++-
 tests/takeover/lcp2.027.sh      |   45 +
 tests/takeover/lcp2.028.sh      |   45 +
 tests/takeover/lcp2.029.sh      |  111 +++
 tests/takeover/lcp2.030.sh      | 1813 +++++++++++++++++++++++++++++++++++++++
 tests/takeover/scripts/local.sh |    3 +-
 6 files changed, 2075 insertions(+), 13 deletions(-)
 create mode 100755 tests/takeover/lcp2.027.sh
 create mode 100755 tests/takeover/lcp2.028.sh
 create mode 100755 tests/takeover/lcp2.029.sh
 create mode 100755 tests/takeover/lcp2.030.sh


Changeset truncated at 500 lines:

diff --git a/tests/src/ctdb_takeover_tests.c b/tests/src/ctdb_takeover_tests.c
index 196f90d..1aa0620 100644
--- a/tests/src/ctdb_takeover_tests.c
+++ b/tests/src/ctdb_takeover_tests.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -21,7 +21,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 /* This is lazy... but it is test code! */
 #define CTDB_TEST_MAX_NODES 256
-#define CTDB_TEST_MAX_IPS 256
+#define CTDB_TEST_MAX_IPS 1024
 
 /* Format of each line is "IP pnn" - the separator has to be at least
  * 1 space (not a tab or whatever - a space!).
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -127,6 +127,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; read_ctdb_public_ip_info(TALLOC_CTX *ctx,
 *t = '\0';
 }
 
+/* Exit on an empty line */
+if (line[0] == '\0') {
+break;
+}
+
 /* Get the IP address */
 tok = strtok(line, " \t");
 if (tok == NULL) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -140,6 +145,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; read_ctdb_public_ip_info(TALLOC_CTX *ctx,
 }
 
 numips++;
+if (numips &amp;gt; CTDB_TEST_MAX_IPS) {
+DEBUG(DEBUG_ERR, ("ERROR: Exceeding CTDB_TEST_MAX_IPS: %d\n", CTDB_TEST_MAX_IPS));
+exit(1);
+}
 
 /* Get the PNN */
 pnn = -1;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -236,6 +245,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
 tok = strtok(ns, ",");
 while (tok != NULL) {
 numnodes++;
+if (numnodes &amp;gt; CTDB_TEST_MAX_NODES) {
+DEBUG(DEBUG_ERR, ("ERROR: Exceeding CTDB_TEST_MAX_NODES: %d\n", CTDB_TEST_MAX_NODES));
+exit(1);
+}
 tok = strtok(NULL, ",");
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -377,10 +390,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
 return runstate;
 }
 
+/* Fake up enough CTDB state to be able to run the IP allocation
+ * algorithm.  Usually this sets up some standard state, sets the node
+ * states from the command-line and reads the current IP layout from
+ * stdin.
+ *
+ * However, if read_ips_for_multiple_nodes is true then each node's
+ * idea of the IP layout is read separately from stdin.  In this mode
+ * is doesn't make much sense to use read_ctdb_public_ip_info's
+ * optional ALLOWED_PNN,... list in the input, since each node is
+ * being handled separately anyway.  IPs for each node are separated
+ * by a blank line.  This mode is for testing weird behaviours where
+ * the IP layouts differs across nodes and we want to improve
+ * create_merged_ip_list(), so should only be used in tests of
+ * ctdb_takeover_run_core().  Yes, it is a hack...  :-)
+ */
 void ctdb_test_init(const char nodestates[],
     struct ctdb_context **ctdb,
     struct ctdb_public_ip_list **all_ips,
-    struct ctdb_ipflags **ipflags)
+    struct ctdb_ipflags **ipflags,
+    bool read_ips_for_multiple_nodes)
 {
 struct ctdb_all_public_ips **avail;
 int i, numnodes;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -401,6 +430,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_init(const char nodestates[],
 while (tok != NULL) {
 nodeflags[numnodes] = (uint32_t) strtol(tok, NULL, 0);
 numnodes++;
+if (numnodes &amp;gt; CTDB_TEST_MAX_NODES) {
+DEBUG(DEBUG_ERR, ("ERROR: Exceeding CTDB_TEST_MAX_NODES: %d\n", CTDB_TEST_MAX_NODES));
+exit(1);
+}
 tok = strtok(NULL, ",");
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -438,7 +471,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_init(const char nodestates[],
 nodemap =  talloc_array(*ctdb, struct ctdb_node_map, numnodes);
 nodemap-&amp;gt;num = numnodes;
 
-read_ctdb_public_ip_info(*ctdb, numnodes, all_ips, &amp;amp;avail);
+if (!read_ips_for_multiple_nodes) {
+read_ctdb_public_ip_info(*ctdb, numnodes, all_ips, &amp;amp;avail);
+}
 
 (*ctdb)-&amp;gt;nodes = talloc_array(*ctdb, struct ctdb_node *, numnodes); // FIXME: bogus size, overkill
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -447,6 +482,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_init(const char nodestates[],
 nodemap-&amp;gt;nodes[i].flags = nodeflags[i];
 /* nodemap-&amp;gt;nodes[i].sockaddr is uninitialised */
 
+if (read_ips_for_multiple_nodes) {
+read_ctdb_public_ip_info(*ctdb, numnodes,
+ all_ips, &amp;amp;avail);
+}
+
 (*ctdb)-&amp;gt;nodes[i] = talloc(*ctdb, struct ctdb_node);
 (*ctdb)-&amp;gt;nodes[i]-&amp;gt;pnn = i;
 (*ctdb)-&amp;gt;nodes[i]-&amp;gt;flags = nodeflags[i];
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -470,7 +510,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
 uint32_t *lcp2_imbalances;
 bool *newly_healthy;
 
-ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags);
+ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags, false);
 
 lcp2_init(ctdb, ipflags, all_ips, &amp;amp;lcp2_imbalances, &amp;amp;newly_healthy);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -492,7 +532,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_lcp2_failback(const char nodestates[])
 uint32_t *lcp2_imbalances;
 bool *newly_healthy;
 
-ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags);
+ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags, false);
 
 lcp2_init(ctdb, ipflags, all_ips, &amp;amp;lcp2_imbalances, &amp;amp;newly_healthy);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -514,7 +554,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_lcp2_failback_loop(const char nodestates[])
 uint32_t *lcp2_imbalances;
 bool *newly_healthy;
 
-ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags);
+ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags, false);
 
 lcp2_init(ctdb, ipflags, all_ips, &amp;amp;lcp2_imbalances, &amp;amp;newly_healthy);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -526,14 +566,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_lcp2_failback_loop(const char nodestates[])
 talloc_free(ctdb);
 }
 
-/* IP layout is read from stdin. */
-void ctdb_test_ctdb_takeover_run_core(const char nodestates[])
+/* IP layout is read from stdin.  See comment for ctdb_test_init() for
+ * explanation of read_ips_for_multiple_nodes.
+ */
+void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
+      bool read_ips_for_multiple_nodes)
 {
 struct ctdb_context *ctdb;
 struct ctdb_public_ip_list *all_ips;
 struct ctdb_ipflags *ipflags;
 
-ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags);
+ctdb_test_init(nodestates, &amp;amp;ctdb, &amp;amp;all_ips, &amp;amp;ipflags,
+       read_ips_for_multiple_nodes);
 
 ctdb_takeover_run_core(ctdb, ipflags, &amp;amp;all_ips);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -575,8 +619,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int main(int argc, const char *argv[])
 ctdb_test_lcp2_failback(argv[2]);
 } else if (argc == 3 &amp;amp;&amp;amp; strcmp(argv[1], "lcp2_failback_loop") == 0) {
 ctdb_test_lcp2_failback_loop(argv[2]);
-} else if (argc == 3 &amp;amp;&amp;amp; strcmp(argv[1], "ctdb_takeover_run_core") == 0) {
-ctdb_test_ctdb_takeover_run_core(argv[2]);
+} else if (argc == 3 &amp;amp;&amp;amp;
+   strcmp(argv[1], "ctdb_takeover_run_core") == 0) {
+ctdb_test_ctdb_takeover_run_core(argv[2], false);
+} else if (argc == 4 &amp;amp;&amp;amp;
+   strcmp(argv[1], "ctdb_takeover_run_core") == 0 &amp;amp;&amp;amp;
+   strcmp(argv[3], "multi") == 0) {
+ctdb_test_ctdb_takeover_run_core(argv[2], true);
 } else {
 usage();
 }
diff --git a/tests/takeover/lcp2.027.sh b/tests/takeover/lcp2.027.sh
new file mode 100755
index 0000000..20e0f28
--- /dev/null
+++ b/tests/takeover/lcp2.027.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,45 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "4 nodes, all IPs assigned, 3-&amp;gt;4 unhealthy"
+
+export CTDB_TEST_LOGLEVEL=0
+
+required_result &amp;lt;&amp;lt;EOF
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 3
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+EOF
+
+simple_test 0,0,2,0 &amp;lt;&amp;lt;EOF
+130.216.30.170 3
+130.216.30.171 2
+130.216.30.172 3
+130.216.30.173 2
+130.216.30.174 1
+130.216.30.175 0
+130.216.30.176 1
+130.216.30.177 0
+130.216.30.178 3
+130.216.30.179 2
+130.216.30.180 1
+130.216.30.181 0
+10.19.99.250 3
+10.19.99.251 2
+10.19.99.252 1
+10.19.99.253 0
+EOF
diff --git a/tests/takeover/lcp2.028.sh b/tests/takeover/lcp2.028.sh
new file mode 100755
index 0000000..60d22d9
--- /dev/null
+++ b/tests/takeover/lcp2.028.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,45 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "4 nodes, all healthy/assigned, stays unbalanced"
+
+export CTDB_TEST_LOGLEVEL=3
+
+required_result &amp;lt;&amp;lt;EOF
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 2
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+EOF
+
+simple_test 0,0,0,0 &amp;lt;&amp;lt;EOF
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 2
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+EOF
diff --git a/tests/takeover/lcp2.029.sh b/tests/takeover/lcp2.029.sh
new file mode 100755
index 0000000..d3c817f
--- /dev/null
+++ b/tests/takeover/lcp2.029.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,111 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "4 nodes, some IPs unassigned on target nodes"
+
+export CTDB_TEST_LOGLEVEL=3
+
+required_result &amp;lt;&amp;lt;EOF
+DATE TIME [PID]:  10.19.99.251 -&amp;gt; 2 [+9216]
+DATE TIME [PID]:  130.216.30.173 -&amp;gt; 2 [+24345]
+DATE TIME [PID]:  130.216.30.171 -&amp;gt; 2 [+39970]
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 2
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 2
+130.216.30.172 3
+130.216.30.171 2
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 2
+10.19.99.250 3
+EOF
+
+# In this example were 4 releases from node 2 in a previous iteration
+#
+#   Release of IP 130.216.30.179/27 on interface ethX1  node:3
+#   Release of IP 130.216.30.173/27 on interface ethX1  node:0
+#   Release of IP 130.216.30.171/27 on interface ethX1  node:1
+#   Release of IP 10.19.99.251/22 on interface ethX2  node:0
+#
+# However, one release failed so no takeovers were done.  This means
+# that the target node for each IP still thinks that the IPs are held
+# by node 2.  The release of 130.216.30.179 was so late that node 2
+# still thought that it held that address.
+
+simple_test 0,0,0,0 multi &amp;lt;&amp;lt;EOF
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 3
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 2
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 2
+10.19.99.250 3
+
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 3
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 2
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 2
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+
+130.216.30.181 0
+130.216.30.180 1
+130.216.30.179 2
+130.216.30.178 3
+130.216.30.177 0
+130.216.30.176 1
+130.216.30.175 0
+130.216.30.174 1
+130.216.30.173 0
+130.216.30.172 3
+130.216.30.171 1
+130.216.30.170 3
+10.19.99.253 0
+10.19.99.252 1
+10.19.99.251 0
+10.19.99.250 3
+EOF
diff --git a/tests/takeover/lcp2.030.sh b/tests/takeover/lcp2.030.sh
new file mode 100755
index 0000000..739757b
--- /dev/null
+++ b/tests/takeover/lcp2.030.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,1813 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "900 IPs, 5 nodes, 0 -&amp;gt; 5 healthy"
+
+export CTDB_TEST_LOGLEVEL=0
+
+required_result &amp;lt;&amp;lt;EOF
+192.168.10.90 0
+192.168.10.89 1
+192.168.10.88 2
+192.168.10.87 3
+192.168.10.86 4
+192.168.10.85 0
+192.168.10.84 1
+192.168.10.83 2
+192.168.10.82 3
+192.168.10.81 4
+192.168.10.80 0
+192.168.10.79 0
+192.168.10.78 1
+192.168.10.77 2
+192.168.10.76 3
+192.168.10.75 4
+192.168.10.74 1
+192.168.10.73 2
+192.168.10.72 3
+192.168.10.71 3
+192.168.10.70 4
+192.168.10.69 0
+192.168.10.68 1
+192.168.10.67 2
+192.168.10.66 4
+192.168.10.65 0
+192.168.10.64 1
+192.168.10.63 0
+192.168.10.62 1
+192.168.10.61 2
+192.168.10.60 3
+192.168.10.59 4
+192.168.10.58 2
+192.168.10.57 3
+192.168.10.56 0
+192.168.10.55 0
+192.168.10.54 1
+192.168.10.53 2
+192.168.10.52 3
+192.168.10.51 4
+192.168.10.50 1
+192.168.10.49 4
+192.168.10.48 2
+192.168.10.47 0
+192.168.10.46 1
+192.168.10.45 2
+192.168.10.44 3
+192.168.10.43 4
+192.168.10.42 2
+192.168.10.41 3
+192.168.10.40 1
+192.168.10.39 3
+192.168.10.38 4
+192.168.10.37 0
+192.168.10.36 1
+192.168.10.35 2
+192.168.10.34 4
+192.168.10.33 0
+192.168.10.32 3
+192.168.10.31 0
+192.168.10.30 1
+192.168.10.29 2
+192.168.10.28 3
+192.168.10.27 4
+192.168.10.26 3
+192.168.10.25 2
+192.168.10.24 0
+192.168.10.23 3
+192.168.10.22 4
+192.168.10.21 0
+192.168.10.20 1
+192.168.10.19 2
+192.168.10.18 4
+192.168.10.17 1
+192.168.10.16 4
+192.168.10.15 0
+192.168.10.14 1
+192.168.10.13 2
+192.168.10.12 3
+192.168.10.11 4
+192.168.10.10 2
+192.168.10.9 3
+192.168.10.8 4
+192.168.10.7 0
+192.168.10.6 1
+192.168.10.5 2
+192.168.10.4 3
+192.168.10.3 4
+192.168.10.2 0
+192.168.10.1 1
+192.168.9.90 0
+192.168.9.89 1


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-24T13:42:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77882">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-202-g32723c9</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77882</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  32723c9efdad1c6ca4aa53f308ccd9bef1aadfff (commit)
      from  b697625b184227dad1be31a41b7a3fd9bd312e29 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 32723c9efdad1c6ca4aa53f308ccd9bef1aadfff
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Fri May 24 18:07:39 2013 +1000

    vacuum: Reduce the priority of non-critical error
    
    Since the complete database is not locked when the receive_records
    control is received, it's possible that we may not be able to obtain
    lock on a chain.  We will try again to store this record.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
    Reviewed-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 server/ctdb_recover.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 6506f8b..7a8b0bb 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1138,7 +1138,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int store_tdb_record(struct ctdb_context *ctdb,
 
 /* use a non-blocking lock */
 if (tdb_chainlock_nonblock(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb, key) != 0) {
-DEBUG(DEBUG_ERR, (__location__ " Failed to lock chain\n"));
+DEBUG(DEBUG_INFO, (__location__ " Failed to lock chain in non-blocking mode\n"));
 return -1;
 }
 


&lt;/pre&gt;</description>
    <dc:creator>Michael Adam</dc:creator>
    <dc:date>2013-05-24T12:22:51</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77881">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-201-gb697625</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77881</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  b697625b184227dad1be31a41b7a3fd9bd312e29 (commit)
       via  d9e24782a90d9ce29c0e6584b75d2b186142174d (commit)
       via  9a21d417c51fb9cad8f2e87e00ca54d379aef860 (commit)
      from  c57430998a3bdedc8a904eb3a9cdfde1421aff50 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b697625b184227dad1be31a41b7a3fd9bd312e29
Author: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 11:05:44 2013 +0200

    ctdbd: fix comment explaining redirection of CTDB_REQ_CALL redirection.
    
    Signed-off-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

commit d9e24782a90d9ce29c0e6584b75d2b186142174d
Author: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 11:01:31 2013 +0200

    ctdbd: remove a nonempty blank line
    
    Signed-off-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 9a21d417c51fb9cad8f2e87e00ca54d379aef860
Author: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 11:00:32 2013 +0200

    ctdbd: update comment describing ctdb_call_send_redirect()
    
    Signed-off-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 server/ctdb_call.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index dbbebec..a98903d 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -113,20 +113,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_send_error(struct ctdb_context *ctdb,
  * to its local ctdb (ctdb_request_call). If the node is not itself
  * the record's DMASTER, it first redirects the packet to  the
  * record's LMASTER. The LMASTER then redirects the call packet to
- * the current DMASTER. But there is a race: The record may have
- * been migrated off the DMASTER while the redirected packet is
- * on the wire (or in the local queue). So in case the record has
- * migrated off the new destinaton of the call packet, instead of
- * going back to the LMASTER to get the new DMASTER, we try to
- * reduce round-trips by first chasing the record a couple of times
- * before giving up the direct chase and finally going back to the
- * LMASTER (again). Note that this works because of this: When
+ * the current DMASTER. Note that this works because of this: When
  * a record is migrated off a node, then the new DMASTER is stored
  * in the record's copy on the former DMASTER.
- *
- * The maximum number of attempts for direct chase to make before
- * going back to the LMASTER is configurable by the tunable
- * "MaxRedirectCount".
  */
 static void ctdb_call_send_redirect(struct ctdb_context *ctdb,
     struct ctdb_db_context *ctdb_db,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -134,7 +123,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_call_send_redirect(struct ctdb_context *ctdb,
     struct ctdb_req_call *c, 
     struct ctdb_ltdb_header *header)
 {
-
 uint32_t lmaster = ctdb_lmaster(ctdb, &amp;amp;key);
 
 c-&amp;gt;hdr.destnode = lmaster;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -813,8 +801,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 return;
 }
 
-/* if we are not the dmaster and are not hosting any delegations,
-   then send a redirect to the requesting node */
+/*
+ * If we are not the dmaster and are not hosting any delegations,
+ * then we redirect the request to the node than can answer it
+ * (the lmaster or the dmaster).
+ */
 if ((header.dmaster != ctdb-&amp;gt;pnn) 
     &amp;amp;&amp;amp; (!(header.flags &amp;amp; CTDB_REC_RO_HAVE_DELEGATIONS)) ) {
 talloc_free(data.dptr);


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-24T12:07:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77880">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-198-gc574309</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77880</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  c57430998a3bdedc8a904eb3a9cdfde1421aff50 (commit)
       via  f15dd562fd8c08cafd957ce9509102db7eb49668 (commit)
       via  c0c27762ea728ed86405b29c642ba9e43200f4ae (commit)
       via  1190bb0d9c14dc5889c2df56f6c8986db23d81a1 (commit)
       via  40e34773b8063196457746ffe7a048eb87d96d61 (commit)
       via  03fd90d41f9cd9b8c42dc6b8b8d46ae19101a544 (commit)
       via  473cfcb019f0cb4a094bf10397f7414f7923ee57 (commit)
       via  f6792f478197774d2f3b2258c969b67c83e017ab (commit)
      from  c50eca6fbf49a6c7bf50905334704f8d2d3237d7 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c57430998a3bdedc8a904eb3a9cdfde1421aff50
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon May 6 20:31:08 2013 +1000

    tests/takeover: New tests to check runstate handling
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit f15dd562fd8c08cafd957ce9509102db7eb49668
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon May 6 15:36:29 2013 +1000

    recoverd: Nodes can only takeover IPs if they are in runstate RUNNING
    
    Currently the order of the first IP allocation, including the first
    "ipreallocated" event, and the "startup" event is undefined.  Both of
    these events can (re)start services.
    
    This stops IPs being hosted before the "startup" event has completed.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit c0c27762ea728ed86405b29c642ba9e43200f4ae
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu May 23 19:03:11 2013 +1000

    recoverd: Handle errors carefully when fetching tunables
    
    If a tunable is not implemented on a remote node then this should not
    be fatal.  In this case the takeover run can continue using benign
    defaults for the tunables.
    
    However, timeouts and any unexpected errors should be fatal.  These
    should abort the takeover run because they can lead to unexpected IP
    movements.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 1190bb0d9c14dc5889c2df56f6c8986db23d81a1
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu May 23 19:01:01 2013 +1000

    recoverd: Set explicit default value when getting tunable from nodes
    
    Both of the current defaults are implicitly 0.  It is better to make
    the defaults obvious.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 40e34773b8063196457746ffe7a048eb87d96d61
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu May 23 16:09:38 2013 +1000

    client: async_callback() sets result to -ETIME if a control times out
    
    Otherwise there is no way of treating a timeout differently to a
    general failure.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 03fd90d41f9cd9b8c42dc6b8b8d46ae19101a544
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 21 15:41:56 2013 +1000

    ctdbd: Update the get_tunable code to return -EINVAL for unknown tunable
    
    Otherwise callers can't tell the difference between some other failure
    (e.g. memory allocation failure) and an unknown tunable.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 473cfcb019f0cb4a094bf10397f7414f7923ee57
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Wed May 22 17:19:34 2013 +1000

    recoverd: Whitespace improvements
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit f6792f478197774d2f3b2258c969b67c83e017ab
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Wed May 22 20:56:03 2013 +1000

    recoverd: Use talloc_array_length() for simpler code
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

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

Summary of changes:
 client/ctdb_client.c                        |    7 +-
 server/ctdb_takeover.c                      |  211 +++++++++++++++++++++++----
 server/ctdb_tunables.c                      |    2 +-
 tests/src/ctdb_takeover_tests.c             |   30 ++++-
 tests/takeover/lcp2.024.sh                  |   42 ++++++
 tests/takeover/{lcp2.007.sh =&amp;gt; lcp2.025.sh} |   24 ++--
 tests/takeover/{lcp2.007.sh =&amp;gt; lcp2.026.sh} |   24 ++--
 tools/ctdb.c                                |    2 +-
 8 files changed, 287 insertions(+), 55 deletions(-)
 create mode 100755 tests/takeover/lcp2.024.sh
 copy tests/takeover/{lcp2.007.sh =&amp;gt; lcp2.025.sh} (71%)
 copy tests/takeover/{lcp2.007.sh =&amp;gt; lcp2.026.sh} (70%)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index e930bff..334d830 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2502,7 +2502,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
 talloc_free(data.dptr);
 if (ret != 0 || res != 0) {
 DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_tunable failed\n"));
-return -1;
+return ret != 0 ? ret : res;
 }
 
 if (outdata.dsize != sizeof(uint32_t)) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3329,6 +3329,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void async_callback(struct ctdb_client_control_state *state)
 DEBUG(DEBUG_ERR,("Async operation failed with state %d, opcode:%u\n", state-&amp;gt;state, data-&amp;gt;opcode));
 }
 data-&amp;gt;fail_count++;
+if (state-&amp;gt;state == CTDB_CONTROL_TIMEOUT) {
+res = -ETIME;
+} else {
+res = -1;
+}
 if (data-&amp;gt;fail_callback) {
 data-&amp;gt;fail_callback(ctdb, destnode, res, outdata,
 data-&amp;gt;callback_data);
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index d8e77df..b5e7f87 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1324,7 +1324,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
 return false;
 }
 
-for (i=0;i&amp;lt;public_ips-&amp;gt;num;i++) {
+for (i=0; i&amp;lt;public_ips-&amp;gt;num; i++) {
 if (ctdb_same_ip(&amp;amp;ip-&amp;gt;addr, &amp;amp;public_ips-&amp;gt;ips[i].addr)) {
 /* yes, this node can serve this public ip */
 return true;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1357,9 +1357,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int find_takeover_node(struct ctdb_context *ctdb,
 int pnn, min=0, num;
 int i, numnodes;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 pnn    = -1;
-for (i=0;i&amp;lt;numnodes;i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 /* verify that this node can serve this ip */
 if (!can_node_takeover_ip(ctdb, i, ipflags[i], ip)) {
 /* no it couldnt   so skip to the next node */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1626,7 +1626,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void basic_failback(struct ctdb_context *ctdb,
 int maxnode, maxnum, minnode, minnum, num, retries;
 struct ctdb_public_ip_list *tmp_ip;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 retries = 0;
 
 try_again:
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1648,7 +1648,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; try_again:
 */
 maxnode = -1;
 minnode = -1;
-for (i=0;i&amp;lt;numnodes;i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 /* only check nodes that can actually serve this ip */
 if (!can_node_takeover_ip(ctdb, i, ipflags[i], tmp_ip)) {
 /* no it couldnt   so skip to the next node */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1742,14 +1742,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void lcp2_init(struct ctdb_context *tmp_ctx,
 int i, numnodes;
 struct ctdb_public_ip_list *tmp_ip;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 
 *rebalance_candidates = talloc_array(tmp_ctx, bool, numnodes);
 CTDB_NO_MEMORY_FATAL(tmp_ctx, *rebalance_candidates);
 *lcp2_imbalances = talloc_array(tmp_ctx, uint32_t, numnodes);
 CTDB_NO_MEMORY_FATAL(tmp_ctx, *lcp2_imbalances);
 
-for (i=0;i&amp;lt;numnodes;i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 (*lcp2_imbalances)[i] = lcp2_imbalance(all_ips, i);
 /* First step: assume all nodes are candidates */
 (*rebalance_candidates)[i] = true;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1801,7 +1801,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
 bool should_loop = true;
 bool have_unassigned = true;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 
 while (have_unassigned &amp;amp;&amp;amp; should_loop) {
 should_loop = false;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1819,7 +1819,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
 continue;
 }
 
-for (dstnode=0; dstnode &amp;lt; numnodes; dstnode++) {
+for (dstnode=0; dstnode&amp;lt;numnodes; dstnode++) {
 /* only check nodes that can actually takeover this ip */
 if (!can_node_takeover_ip(ctdb, dstnode,
   ipflags[dstnode],
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1904,7 +1904,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
 mindstnode = -1;
 mindstimbl = 0;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 
 DEBUG(DEBUG_DEBUG,(" ----------------------------------------\n"));
 DEBUG(DEBUG_DEBUG,(" CONSIDERING MOVES FROM %d [%d]\n", srcnode, candimbl));
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1925,7 +1925,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
  * to do gratuitous failover of IPs just to make minor
  * balance improvements.
  */
-for (dstnode=0; dstnode &amp;lt; numnodes; dstnode++) {
+for (dstnode=0; dstnode&amp;lt;numnodes; dstnode++) {
 if (!rebalance_candidates[dstnode]) {
 continue;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2009,7 +2009,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void lcp2_failback(struct ctdb_context *ctdb,
 struct lcp2_imbalance_pnn * lips;
 bool again;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 
 try_again:
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2018,7 +2018,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; try_again:
  * continuing on...
  */
 num_rebalance_candidates = 0;
-for (i = 0; i &amp;lt; numnodes; i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 if (rebalance_candidates[i]) {
 num_rebalance_candidates++;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2032,7 +2032,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; try_again:
  * used, so this doesn't cost much...
  */
 lips = talloc_array(ctdb, struct lcp2_imbalance_pnn, numnodes);
-for (i = 0; i &amp;lt; numnodes; i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 lips[i].imbalance = lcp2_imbalances[i];
 lips[i].pnn = i;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2040,7 +2040,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; try_again:
       lcp2_cmp_imbalance_pnn);
 
 again = false;
-for (i = 0; i &amp;lt; numnodes; i++) {
+for (i=0; i&amp;lt;numnodes; i++) {
 /* This means that all nodes had 0 or 1 addresses, so
  * can't be imbalanced.
  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2097,7 +2097,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
 struct ctdb_public_ip_list *tmp_ip;
 int i, numnodes;
 
-numnodes = talloc_get_size(ipflags) / sizeof(struct ctdb_ipflags);
+numnodes = talloc_array_length(ipflags);
 
 DEBUG(DEBUG_NOTICE,("Deterministic IPs enabled. Resetting all ip allocations\n"));
        /* Allocate IPs to nodes in a modulo fashion so that IPs will
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2106,7 +2106,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
 */
 
 for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip-&amp;gt;next,i++) {
-tmp_ip-&amp;gt;pnn = i%numnodes;
+tmp_ip-&amp;gt;pnn = i % numnodes;
 }
 
 /* IP failback doesn't make sense with deterministic
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2229,6 +2229,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_takeover_run_core(struct ctdb_context *ctdb,
 struct get_tunable_callback_data {
 const char *tunable;
 uint32_t *out;
+bool fatal;
 };
 
 static void get_tunable_callback(struct ctdb_context *ctdb, uint32_t pnn,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2240,9 +2241,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void get_tunable_callback(struct ctdb_context *ctdb, uint32_t pnn,
 int size;
 
 if (res != 0) {
-DEBUG(DEBUG_ERR,
-      ("Failure to read \"%s\" tunable from remote node %d\n",
-       cd-&amp;gt;tunable, pnn));
+/* Already handled in fail callback */
 return;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2250,10 +2249,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void get_tunable_callback(struct ctdb_context *ctdb, uint32_t pnn,
 DEBUG(DEBUG_ERR,("Wrong size of returned data when reading \"%s\" tunable from node %d. Expected %d bytes but received %d bytes\n",
  cd-&amp;gt;tunable, pnn, (int)sizeof(uint32_t),
  (int)outdata.dsize));
+cd-&amp;gt;fatal = true;
 return;
 }
 
-size = talloc_get_size(cd-&amp;gt;out) / sizeof(uint32_t);
+size = talloc_array_length(cd-&amp;gt;out);
 if (pnn &amp;gt;= size) {
 DEBUG(DEBUG_ERR,("Got %s reply from node %d but nodemap only has %d entries\n",
  cd-&amp;gt;tunable, pnn, size));
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2264,21 +2264,56 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void get_tunable_callback(struct ctdb_context *ctdb, uint32_t pnn,
 cd-&amp;gt;out[pnn] = *(uint32_t *)outdata.dptr;
 }
 
+static void get_tunable_fail_callback(struct ctdb_context *ctdb, uint32_t pnn,
+       int32_t res, TDB_DATA outdata,
+       void *callback)
+{
+struct get_tunable_callback_data *cd =
+(struct get_tunable_callback_data *)callback;
+
+switch (res) {
+case -ETIME:
+DEBUG(DEBUG_ERR,
+      ("Timed out getting tunable \"%s\" from node %d\n",
+       cd-&amp;gt;tunable, pnn));
+cd-&amp;gt;fatal = true;
+break;
+case -EINVAL:
+case -1:
+DEBUG(DEBUG_WARNING,
+      ("Tunable \"%s\" not implemented on node %d\n",
+       cd-&amp;gt;tunable, pnn));
+break;
+default:
+DEBUG(DEBUG_ERR,
+      ("Unexpected error getting tunable \"%s\" from node %d\n",
+       cd-&amp;gt;tunable, pnn));
+cd-&amp;gt;fatal = true;
+}
+}
+
 static uint32_t *get_tunable_from_nodes(struct ctdb_context *ctdb,
 TALLOC_CTX *tmp_ctx,
 struct ctdb_node_map *nodemap,
-const char *tunable)
+const char *tunable,
+uint32_t default_value)
 {
 TDB_DATA data;
 struct ctdb_control_get_tunable *t;
 uint32_t *nodes;
 uint32_t *tvals;
 struct get_tunable_callback_data callback_data;
+int i;
 
-tvals = talloc_zero_array(tmp_ctx, uint32_t, nodemap-&amp;gt;num);
+tvals = talloc_array(tmp_ctx, uint32_t, nodemap-&amp;gt;num);
 CTDB_NO_MEMORY_NULL(ctdb, tvals);
+for (i=0; i&amp;lt;nodemap-&amp;gt;num; i++) {
+tvals[i] = default_value;
+}
+
 callback_data.out = tvals;
 callback_data.tunable = tunable;
+callback_data.fatal = false;
 
 data.dsize = offsetof(struct ctdb_control_get_tunable, name) + strlen(tunable) + 1;
 data.dptr  = talloc_size(tmp_ctx, data.dsize);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2289,9 +2324,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static uint32_t *get_tunable_from_nodes(struct ctdb_context *ctdb,
 if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_TUNABLE,
       nodes, 0, TAKEOVER_TIMEOUT(),
       false, data,
-      get_tunable_callback, NULL,
+      get_tunable_callback,
+      get_tunable_fail_callback,
       &amp;amp;callback_data) != 0) {
-DEBUG(DEBUG_ERR, (__location__ " ctdb_control to get %s tunable failed\n", tunable));
+if (callback_data.fatal) {
+talloc_free(tvals);
+tvals = NULL;
+}
 }
 talloc_free(nodes);
 talloc_free(data.dptr);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2299,6 +2338,98 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static uint32_t *get_tunable_from_nodes(struct ctdb_context *ctdb,
 return tvals;
 }
 
+struct get_runstate_callback_data {
+enum ctdb_runstate *out;
+bool fatal;
+};
+
+static void get_runstate_callback(struct ctdb_context *ctdb, uint32_t pnn,
+  int32_t res, TDB_DATA outdata,
+  void *callback_data)
+{
+struct get_runstate_callback_data *cd =
+(struct get_runstate_callback_data *)callback_data;
+int size;
+
+if (res != 0) {
+/* Already handled in fail callback */
+return;
+}
+
+if (outdata.dsize != sizeof(uint32_t)) {
+DEBUG(DEBUG_ERR,("Wrong size of returned data when getting runstate from node %d. Expected %d bytes but received %d bytes\n",
+ pnn, (int)sizeof(uint32_t),
+ (int)outdata.dsize));
+cd-&amp;gt;fatal = true;
+return;
+}
+
+size = talloc_array_length(cd-&amp;gt;out);
+if (pnn &amp;gt;= size) {
+DEBUG(DEBUG_ERR,("Got reply from node %d but nodemap only has %d entries\n",
+ pnn, size));
+return;
+}
+
+cd-&amp;gt;out[pnn] = (enum ctdb_runstate)*(uint32_t *)outdata.dptr;
+}
+
+static void get_runstate_fail_callback(struct ctdb_context *ctdb, uint32_t pnn,
+       int32_t res, TDB_DATA outdata,
+       void *callback)
+{
+struct get_runstate_callback_data *cd =
+(struct get_runstate_callback_data *)callback;
+
+switch (res) {
+case -ETIME:
+DEBUG(DEBUG_ERR,
+      ("Timed out getting runstate from node %d\n", pnn));
+cd-&amp;gt;fatal = true;
+break;
+default:
+DEBUG(DEBUG_WARNING,
+      ("Error getting runstate from node %d - assuming runstates not supported\n",
+       pnn));
+}
+}
+
+static enum ctdb_runstate * get_runstate_from_nodes(struct ctdb_context *ctdb,
+    TALLOC_CTX *tmp_ctx,
+    struct ctdb_node_map *nodemap,
+    enum ctdb_runstate default_value)
+{
+uint32_t *nodes;
+enum ctdb_runstate *rs;
+struct get_runstate_callback_data callback_data;
+int i;
+
+rs = talloc_array(tmp_ctx, enum ctdb_runstate, nodemap-&amp;gt;num);
+CTDB_NO_MEMORY_NULL(ctdb, rs);
+for (i=0; i&amp;lt;nodemap-&amp;gt;num; i++) {
+rs[i] = default_value;
+}
+
+callback_data.out = rs;
+callback_data.fatal = false;
+
+nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_RUNSTATE,
+      nodes, 0, TAKEOVER_TIMEOUT(),
+      true, tdb_null,
+      get_runstate_callback,
+      get_runstate_fail_callback,
+      &amp;amp;callback_data) != 0) {
+if (callback_data.fatal) {
+free(rs);
+rs = NULL;
+}
+}
+talloc_free(nodes);
+
+return rs;
+}
+
 /* Set internal flags for IP allocation:
  *   Clear ip flags
  *   Set NOIPTAKOVER ip flags from per-node NoIPTakeover tunable
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2313,7 +2444,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; set_ipflags_internal(struct ctdb_context *ctdb,
      TALLOC_CTX *tmp_ctx,
      struct ctdb_node_map *nodemap,
      uint32_t *tval_noiptakeover,
-     uint32_t *tval_noiphostonalldisabled)
+     uint32_t *tval_noiphostonalldisabled,
+     enum ctdb_runstate *runstate)
 {
 int i;
 struct ctdb_ipflags *ipflags;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2328,6 +2460,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; set_ipflags_internal(struct ctdb_context *ctdb,
 ipflags[i].noiptakeover = true;
 }
 
+/* Can not host IPs on node not in RUNNING state */
+if (runstate[i] != CTDB_RUNSTATE_RUNNING) {
+ipflags[i].noiphost = true;
+continue;
+}
 /* Can not host IPs on INACTIVE node */
 if (nodemap-&amp;gt;nodes[i].flags &amp;amp; NODE_FLAGS_INACTIVE) {
 ipflags[i].noiphost = true;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2364,26 +2501,42 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct ctdb_ipflags *set_ipflags(struct ctdb_context *ctdb,
 uint32_t *tval_noiptakeover;
 uint32_t *tval_noiphostonalldisabled;
 struct ctdb_ipflags *ipflags;
+enum ctdb_runstate *runstate;
+
 
 tval_noiptakeover = get_tunable_from_nodes(ctdb, tmp_ctx, nodemap,
-   "NoIPTakeover");
+   "NoIPTakeover", 0);
 if (tval_noiptakeover == NULL) {
 return NULL;
 }
 
 tval_noiphostonalldisabled =
 get_tunable_from_nodes(ctdb, tmp_ctx, nodemap,
-       "NoIPHostOnAllDisabled");
+       "NoIPHostOnAllDisabled", 0);
 if (tval_noiphostonalldisabled == NULL) {
+/* Caller frees tmp_ctx */
+return NULL;
+}
+
+/* Any nodes where CTDB_CONTROL_GET_RUNSTATE is not supported
+ * will default to CTDB_RUNSTATE_RUNNING.  This ensures
+ * reasonable behaviour on a mixed cluster during upgrade.
+ */
+runstate = get_runstate_from_nodes(ctdb, tmp_ctx, nodemap,
+   CTDB_RUNSTATE_RUNNING);
+if (runstate == NULL) {
+/* Caller frees tmp_ctx */
 return NULL;
 }
 
 ipflags = set_ipflags_internal(ctdb, tmp_ctx, nodemap,
        tval_noiptakeover,
-       tval_noiphostonalldisabled);
+       tval_noiphostonalldisabled,
+       runstate);
 
 talloc_free(tval_noiptakeover);
 talloc_free(tval_noiphostonalldisabled);
+talloc_free(runstate);
 
 return ipflags;
 }
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 84fb949..365c6ba 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -128,7 +128,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_get_tunable(struct ctdb_context *ctdb, TDB_DATA indata,
 talloc_free(name);
 
 if (i == ARRAY_SIZE(tunable_map)) {
-return -1;
+return -EINVAL;
 }
 
 val = *(uint32_t *)(tunable_map[i].offset + (uint8_t*)&amp;amp;ctdb-&amp;gt;tunable);
diff --git a/tests/src/ctdb_takeover_tests.c b/tests/src/ctdb_takeover_tests.c
index e804c9a..196f90d 100644
--- a/tests/src/ctdb_takeover_tests.c
+++ b/tests/src/ctdb_takeover_tests.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -353,6 +353,30 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static uint32_t *get_tunable_values(TALLOC_CTX *tmp_ctx,
 return tvals;
 }
 
+static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
+int numnodes)
+{
+int i;
+uint32_t *tvals;
+enum ctdb_runstate *runstate =
+talloc_zero_array(tmp_ctx, enum ctdb_runstate, numnodes);
+char *t = getenv("CTDB_TEST_RUNSTATE");
+
+if (t == NULL) {
+for (i=0; i&amp;lt;numnodes; i++) {
+runstate[i] = CTDB_RUNSTATE_RUNNING;
+}
+} else {
+tvals = get_tunable_values(tmp_ctx, numnodes, "CTDB_TEST_RUNSTATE");
+for (i=0; i&amp;lt;numnodes; i++) {
+runstate[i] = (enum ctdb_runstate) tvals[i];
+}
+talloc_free(tvals);
+}
+
+return runstate;
+}
+
 void ctdb_test_init(const char nodestates[],
     struct ctdb_context **ctdb,
     struct ctdb_public_ip_list **all_ips,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -365,6 +389,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_test_init(const char nodestates[],
 struct ctdb_node_map *nodemap;
 uint32_t *tval_noiptakeover;


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-24T11:47:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77879">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-190-gc50eca6</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77879</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  c50eca6fbf49a6c7bf50905334704f8d2d3237d7 (commit)
       via  39a43feae7c7de07ddaf2d6cb962f923d47d0c19 (commit)
       via  ed6814ff0a59ddbb1c1b3128b505380f60d7aeb7 (commit)
       via  4a2effcc455be67ff4a779a59ca81ba584312cd6 (commit)
       via  bf20c3ab090f75f59097b36186347cedb1c445d4 (commit)
       via  dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1 (commit)
       via  f43fe3a560d5915c1a9893256f4e7bfe3d7e290a (commit)
       via  c31feb27dcdb748b5333321c85fe54852dfa1bcf (commit)
       via  8076773a9924dcf8aff16f7d96b2b9ac383ecc28 (commit)
       via  9e7b7cd04adc5e66e2ffa4edf463a682aaea379b (commit)
      from  dbb7c550133c92292a7212bdcaaa79f399b0919b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c50eca6fbf49a6c7bf50905334704f8d2d3237d7
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Jan 11 18:02:51 2013 +1100

    ctdbd: When the "setup" event fails log an error and exit, don't abort
    
    The "setup" event can fail when one of the eventscripts fails to run
    its "setup" event.  If this occurs then the eventscript should log an
    error.  The stack trace and core file generated when we abort provides
    no useful information.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 39a43feae7c7de07ddaf2d6cb962f923d47d0c19
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Jan 11 16:02:31 2013 +1100

    eventscripts: 11.natgw should not call ctdb tool in "init" event
    
    The current code calls "ctdb setnatgwstate ..." on every event.
    However, calling the ctdb tool in the "init" event is not permitted.
    
    Instead, update the capability when it is needed and at regular
    intervals via the "monitor" event.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit ed6814ff0a59ddbb1c1b3128b505380f60d7aeb7
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu Apr 18 20:30:14 2013 +1000

    ctdbd: Add new runstate CTDB_RUNSTATE_FIRST_RECOVERY
    
    This adds more serialisation to the startup, ensuring that the
    "startup" event runs after everything to do with the first recovery
    (including the "recovered" event).
    
    Given that it now takes longer to get to the "startup" state, the
    initscript needs to wait until ctdbd gets to "first_recovery".
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 4a2effcc455be67ff4a779a59ca81ba584312cd6
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Jan 11 14:09:14 2013 +1100

    tools/ctdb: "ctdb runstate" now accepts optional expected run state arguments
    
    If one or more run states are specified then "ctdb runstate" succeeds
    only if ctdbd is in one of those run states.
    
    At the moment, if the "setup" event fails then the initscript succeeds
    but ctdbd exits almost immediately.  This behaviour isn't very
    friendly.
    
    The initscript now waits until ctdbd is in "startup" or "running" run
    state via the use of "ctdb runstate startup running", meaning that ctdbd
    has successfully passed the "setup" event.
    
    The "setup" event code in 00.ctdb now waits until ctdbd is in the
    "setup" run state before proceeding via the use of "ctdb runstate setup".
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit bf20c3ab090f75f59097b36186347cedb1c445d4
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri Jan 11 14:07:12 2013 +1100

    tools/ctdb: New command runstate to print current runstate
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 21 16:18:28 2013 +1000

    ctdbd: New control CTDB_CONTROL_GET_RUNSTATE
    
    Also new client function ctdb_ctrl_get_runstate().
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit f43fe3a560d5915c1a9893256f4e7bfe3d7e290a
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu Jan 10 16:48:39 2013 +1100

    ctdbd: Start logging process earlier
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit c31feb27dcdb748b5333321c85fe54852dfa1bcf
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu Jan 10 16:33:36 2013 +1100

    ctdbd: Only start recovery daemon and timed events after setup event
    
    This deconstructs ctdb_start_transport(), which did much more than
    starting the transport.
    
    This removes a very unlikely race and adds some clarity.  The setup
    event is supposed to set the tunables before the first recovery.
    However, there was nothing stopping the first recovery from starting
    before the setup event had completed.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 8076773a9924dcf8aff16f7d96b2b9ac383ecc28
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu Jan 10 16:06:25 2013 +1100

    ctdbd: Replace ctdb-&amp;gt;done_startup with ctdb-&amp;gt;runstate
    
    This allows states, including startup and shutdown states, to be
    clearly tracked.  This doesn't include regular runtime "states", which
    are handled by node flags.
    
    Introduce new functions ctdb_set_runstate(), runstate_to_string() and
    runstate_from_string().
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 9e7b7cd04adc5e66e2ffa4edf463a682aaea379b
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu May 23 16:06:47 2013 +1000

    tools/ctdb: Remove duplicate command definition for "sync"
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-programmed-with: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

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

Summary of changes:
 client/ctdb_client.c      |   30 +++++++++++++++++++++
 common/ctdb_util.c        |   50 +++++++++++++++++++++++++++++++++++
 config/ctdb.init          |    2 +-
 config/events.d/00.ctdb   |    2 +-
 config/events.d/11.natgw  |   17 +++++++++---
 doc/ctdb.1.xml            |   22 +++++++++++++++
 include/ctdb_client.h     |    5 +++
 include/ctdb_private.h    |   16 ++++++++++-
 include/ctdb_protocol.h   |    1 +
 server/ctdb_control.c     |    8 +++++
 server/ctdb_daemon.c      |   63 ++++++++++++++++++++++++--------------------
 server/ctdb_ltdb_server.c |   10 +++---
 server/ctdb_monitor.c     |   19 ++++++++++---
 server/ctdb_recover.c     |    4 +++
 server/ctdb_takeover.c    |    2 +-
 tools/ctdb.c              |   47 ++++++++++++++++++++++++++++++++-
 16 files changed, 249 insertions(+), 49 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 2ae8958..e930bff 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1654,6 +1654,36 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode)
 return res;
 }
 
+int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb, 
+   struct timeval timeout, 
+   uint32_t destnode,
+   uint32_t *runstate)
+{
+TDB_DATA outdata;
+int32_t res;
+int ret;
+
+ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_RUNSTATE, 0,
+   tdb_null, ctdb, &amp;amp;outdata, &amp;amp;res, &amp;amp;timeout, NULL);
+if (ret != 0 || res != 0) {
+DEBUG(DEBUG_ERR,("ctdb_control for get_runstate failed\n"));
+return ret != 0 ? ret : res;
+}
+
+if (outdata.dsize != sizeof(uint32_t)) {
+DEBUG(DEBUG_ERR,("Invalid return data in get_runstate\n"));
+talloc_free(outdata.dptr);
+return -1;
+}
+
+if (runstate != NULL) {
+*runstate = *(uint32_t *)outdata.dptr;
+}
+talloc_free(outdata.dptr);
+
+return 0;
+}
+
 /*
   find the real path to a ltdb 
  */
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index 71dee2b..a910a0c 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -702,3 +702,53 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; const char *ctdb_eventscript_call_names[] = {
 "updateip",
 "ipreallocated"
 };
+
+/* Runstate handling */
+static struct {
+enum ctdb_runstate runstate;
+const char * label;
+} runstate_map[] = {
+{ CTDB_RUNSTATE_UNKNOWN, "UNKNOWN" },
+{ CTDB_RUNSTATE_INIT, "INIT" },
+{ CTDB_RUNSTATE_SETUP, "SETUP" },
+{ CTDB_RUNSTATE_FIRST_RECOVERY, "FIRST_RECOVERY" },
+{ CTDB_RUNSTATE_STARTUP, "STARTUP" },
+{ CTDB_RUNSTATE_RUNNING, "RUNNING" },
+{ CTDB_RUNSTATE_SHUTDOWN, "SHUTDOWN" },
+{ -1, NULL },
+};
+
+const char *runstate_to_string(enum ctdb_runstate runstate)
+{
+int i;
+for (i=0; runstate_map[i].label != NULL ; i++) {
+if (runstate_map[i].runstate == runstate) {
+return runstate_map[i].label;
+}
+}
+
+return runstate_map[0].label;
+}
+
+enum ctdb_runstate runstate_from_string(const char *label)
+{
+int i;
+for (i=0; runstate_map[i].label != NULL; i++) {
+if (strcasecmp(runstate_map[i].label, label) == 0) {
+return runstate_map[i].runstate;
+}
+}
+
+return CTDB_RUNSTATE_UNKNOWN;
+}
+
+void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate)
+{
+if (runstate &amp;lt;= ctdb-&amp;gt;runstate) {
+ctdb_fatal(ctdb, "runstate must always increase");
+}
+
+DEBUG(DEBUG_NOTICE,("Set runstate to %s (%d)\n",
+    runstate_to_string(runstate), runstate));
+ctdb-&amp;gt;runstate = runstate;
+}
diff --git a/config/ctdb.init b/config/ctdb.init
index 6c4e16d..2ceb45f 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -220,7 +220,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; wait_until_ready () {
     _timeout="${1:-10}" # default is 10 seconds
 
     _count=0
-    while ! ctdb ping &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; do
+    while ! ctdb runstate first_recovery startup running &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; do
 if [ $_count -ge $_timeout ] ; then
     return 1
 fi
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index c1ac11a..02d1569 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -53,7 +53,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; wait_until_ready () {
     _timeout="${1:-10}" # default is 10 seconds
 
     _count=0
-    while ! ctdb ping &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; do
+    while ! ctdb runstate setup &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; do
 if [ $_count -ge $_timeout ] ; then
     return 1
 fi
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index a6e0523..c6c45ca 100755
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -13,12 +13,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; loadconfig
 
 [ -z "$CTDB_NATGW_NODES" ] &amp;amp;&amp;amp; exit 0
 
-# Update capabilities to show whether we support teh NATGW capability or not
-if [ "$CTDB_NATGW_SLAVE_ONLY" = "yes" ] ; then
+set_natgw_capability ()
+{
+    # Set NATGW capability depending on configuration
+    if [ "$CTDB_NATGW_SLAVE_ONLY" = "yes" ] ; then
 ctdb setnatgwstate off
-else
+    else
 ctdb setnatgwstate on
-fi
+    fi
+}
 
 delete_all() {
 _ip="${CTDB_NATGW_PUBLIC_IP%/*}"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -58,6 +61,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ensure_natgwmaster ()
 }
 
 case "$1" in 
+    setup)
+set_natgw_capability
+;;
+
     startup)
 # Error if CTDB_NATGW_PUBLIC_IP is listed in public addresses
 grep -q "^$CTDB_NATGW_PUBLIC_IP[[:space:]]" "${CTDB_PUBLIC_ADDRESSES:-/etc/ctdb/public_addresses}" &amp;amp;&amp;amp; \
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -70,6 +77,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; case "$1" in
     recovered|updatenatgw|ipreallocated)
 mypnn=$(ctdb pnn | cut -d: -f2)
 
+set_natgw_capability
 ensure_natgwmaster "$1"
 
 delete_all
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -103,6 +111,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; case "$1" in
 ;;
 
     monitor)
+set_natgw_capability
 ensure_natgwmaster "$1"
 ;;
 
diff --git a/doc/ctdb.1.xml b/doc/ctdb.1.xml
index 83d0ac0..ce83a3e 100644
--- a/doc/ctdb.1.xml
+++ b/doc/ctdb.1.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -382,6 +382,28 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; response from 3 time=0.000114 sec  (2 clients)
       &amp;lt;/screen&amp;gt;
     &amp;lt;/refsect2&amp;gt;
 
+    &amp;lt;refsect2&amp;gt;&amp;lt;title&amp;gt;runstate [setup|first_recovery|startup|running]&amp;lt;/title&amp;gt;
+      &amp;lt;para&amp;gt;
+        Print the runstate of the specified node.  Runstates are used
+        to serialise important state transitions in CTDB, particularly
+        during startup.
+      &amp;lt;/para&amp;gt;
+      &amp;lt;para&amp;gt;
+        If one or more optional runstate arguments are specified then
+        the node must be in one of these runstates for the command to
+        succeed.
+      &amp;lt;/para&amp;gt;
+      &amp;lt;para&amp;gt;
+Example: ctdb runstate
+      &amp;lt;/para&amp;gt;
+      &amp;lt;para&amp;gt;
+Example output:
+      &amp;lt;/para&amp;gt;
+      &amp;lt;screen format="linespecific"&amp;gt;
+RUNNING
+      &amp;lt;/screen&amp;gt;
+    &amp;lt;/refsect2&amp;gt;
+
     &amp;lt;refsect2&amp;gt;&amp;lt;title&amp;gt;ifaces&amp;lt;/title&amp;gt;
       &amp;lt;para&amp;gt;
 This command will display the list of network interfaces, which could
diff --git a/include/ctdb_client.h b/include/ctdb_client.h
index 564c563..8739923 100644
--- a/include/ctdb_client.h
+++ b/include/ctdb_client.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -295,6 +295,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t
 
 int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
 
+int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb, 
+   struct timeval timeout, 
+   uint32_t destnode,
+   uint32_t *runstate);
+
 int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
 
 int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index c47210e..eadd963 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -436,6 +436,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct ctdb_write_record {
 
 enum ctdb_freeze_mode {CTDB_FREEZE_NONE, CTDB_FREEZE_PENDING, CTDB_FREEZE_FROZEN};
 
+enum ctdb_runstate {
+CTDB_RUNSTATE_UNKNOWN,
+CTDB_RUNSTATE_INIT,
+CTDB_RUNSTATE_SETUP,
+CTDB_RUNSTATE_FIRST_RECOVERY,
+CTDB_RUNSTATE_STARTUP,
+CTDB_RUNSTATE_RUNNING,
+CTDB_RUNSTATE_SHUTDOWN,
+};
+
+const char *runstate_to_string(enum ctdb_runstate runstate);
+enum ctdb_runstate runstate_from_string(const char *label);
+void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate);
+
 #define CTDB_MONITORING_ACTIVE0
 #define CTDB_MONITORING_DISABLED1
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -505,7 +519,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct ctdb_context {
 pid_t ctdbd_pid;
 pid_t recoverd_pid;
 pid_t syslogd_pid;
-bool done_startup;
+enum ctdb_runstate runstate;
 struct ctdb_monitor_state *monitor;
 struct ctdb_log_state *log;
 int start_as_disabled;
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 09ce01a..10f643b 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -405,6 +405,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
     CTDB_CONTROL_TRAVERSE_ALL_EXT = 135,
     CTDB_CONTROL_RECEIVE_RECORDS = 136,
     CTDB_CONTROL_IPREALLOCATED = 137,
+    CTDB_CONTROL_GET_RUNSTATE = 138,
 };
 
 /*
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 72a602d..bf4a20d 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -207,6 +207,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 CHECK_CONTROL_DATA_SIZE(0);
 return ctdb-&amp;gt;num_clients;
 
+case CTDB_CONTROL_GET_RUNSTATE:
+CHECK_CONTROL_DATA_SIZE(0);
+outdata-&amp;gt;dptr = (uint8_t *)&amp;amp;ctdb-&amp;gt;runstate;
+outdata-&amp;gt;dsize = sizeof(uint32_t);
+return 0;
+
+
 case CTDB_CONTROL_SET_DB_READONLY: {
 uint32_t db_id;
 struct ctdb_db_context *ctdb_db;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -325,6 +332,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 
 case CTDB_CONTROL_SHUTDOWN:
 DEBUG(DEBUG_NOTICE,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
+ctdb_set_runstate(ctdb, CTDB_RUNSTATE_SHUTDOWN);
 ctdb_stop_recoverd(ctdb);
 ctdb_stop_keepalive(ctdb);
 ctdb_stop_monitoring(ctdb);
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index d2df115..cedee09 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -76,25 +76,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_start_time_tickd(struct ctdb_context *ctdb)
 ctdb_time_tick, ctdb);
 }
 
-
-/* called when CTDB is ready to process requests */
-static void ctdb_start_transport(struct ctdb_context *ctdb)
+static void ctdb_start_periodic_events(struct ctdb_context *ctdb)
 {
-/* start the transport running */
-if (ctdb-&amp;gt;methods-&amp;gt;start(ctdb) != 0) {
-DEBUG(DEBUG_ALERT,("transport failed to start!\n"));
-ctdb_fatal(ctdb, "transport failed to start");
-}
-
-/* start the recovery daemon process */
-if (ctdb_start_recoverd(ctdb) != 0) {
-DEBUG(DEBUG_ALERT,("Failed to start recovery daemon\n"));
-exit(11);
-}
-
-/* Make sure we log something when the daemon terminates */
-atexit(print_exit_message);
-
 /* start monitoring for connected/disconnected nodes */
 ctdb_start_keepalive(ctdb);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1049,16 +1032,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_setup_event_callback(struct ctdb_context *ctdb, int status,
       void *private_data)
 {
 if (status != 0) {
-ctdb_fatal(ctdb, "Failed to run setup event\n");
-return;
+DEBUG(DEBUG_ALERT,("Failed to run setup event - exiting\n"));
+exit(1);
 }
 ctdb_run_notification_script(ctdb, "setup");
 
+ctdb_set_runstate(ctdb, CTDB_RUNSTATE_FIRST_RECOVERY);
+
 /* tell all other nodes we've just started up */
 ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL,
  0, CTDB_CONTROL_STARTUP, 0,
  CTDB_CTRL_FLAG_NOREPLY,
  tdb_null, NULL, NULL);
+
+/* Start the recovery daemon */
+if (ctdb_start_recoverd(ctdb) != 0) {
+DEBUG(DEBUG_ALERT,("Failed to start recovery daemon\n"));
+exit(11);
+}
+
+ctdb_start_periodic_events(ctdb);
 }
 
 static struct timeval tevent_before_wait_ts;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1207,6 +1200,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 }
 
 ctdb_set_child_logging(ctdb);
+if (use_syslog) {
+if (start_syslog_daemon(ctdb)) {
+DEBUG(DEBUG_CRIT, ("Failed to start syslog daemon\n"));
+exit(10);
+}
+}
 
 /* initialize statistics collection */
 ctdb_statistics_init(ctdb);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1259,6 +1258,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 ctdb_fatal(ctdb, "Failed to attach to databases\n");
 }
 
+ctdb_set_runstate(ctdb, CTDB_RUNSTATE_INIT);
 ret = ctdb_event_script(ctdb, CTDB_EVENT_INIT);
 if (ret != 0) {
 ctdb_fatal(ctdb, "Failed to run init event\n");
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1281,9 +1281,21 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 ctdb_release_all_ips(ctdb);
 }
 
-/* start the transport going */
-ctdb_start_transport(ctdb);
 
+/* Make sure we log something when the daemon terminates */
+atexit(print_exit_message);
+
+/* Start the transport */
+if (ctdb-&amp;gt;methods-&amp;gt;start(ctdb) != 0) {
+DEBUG(DEBUG_ALERT,("transport failed to start!\n"));
+ctdb_fatal(ctdb, "transport failed to start");
+}
+
+/* Recovery daemon and timed events are started from the
+ * callback, only after the setup event completes
+ * successfully.
+ */
+ctdb_set_runstate(ctdb, CTDB_RUNSTATE_SETUP);
 ret = ctdb_event_script_callback(ctdb,
  ctdb,
  ctdb_setup_event_callback,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1297,13 +1309,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 exit(1);
 }
 
-if (use_syslog) {
-if (start_syslog_daemon(ctdb)) {
-DEBUG(DEBUG_CRIT, ("Failed to start syslog daemon\n"));
-exit(10);
-}
-}
-
 ctdb_lockdown_memory(ctdb);
   
 /* go into a wait loop to allow other nodes to complete */
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index 8b06703..0426d96 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -656,7 +656,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_db_set_healthy(struct ctdb_context *ctdb, TDB_DATA indata)
 return -1;
 }
 
-if (may_recover &amp;amp;&amp;amp; !ctdb-&amp;gt;done_startup) {
+if (may_recover &amp;amp;&amp;amp; ctdb-&amp;gt;runstate == CTDB_RUNSTATE_STARTUP) {
 DEBUG(DEBUG_ERR, (__location__ " db %s become healthy  - force recovery for startup\n",
   ctdb_db-&amp;gt;db_name));
 ctdb-&amp;gt;recovery_mode = CTDB_RECOVERY_ACTIVE;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -794,7 +794,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name,
 if (ctdb-&amp;gt;max_persistent_check_errors &amp;gt; 0) {
 remaining_tries = 1;
 }
-if (ctdb-&amp;gt;done_startup) {
+if (ctdb-&amp;gt;runstate == CTDB_RUNSTATE_RUNNING) {
 remaining_tries = 0;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1086,9 +1086,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
 return -1;
 }
 
-if (ctdb-&amp;gt;recovery_mode == CTDB_RECOVERY_ACTIVE
- &amp;amp;&amp;amp; client-&amp;gt;pid != ctdb-&amp;gt;recoverd_pid
- &amp;amp;&amp;amp; !ctdb-&amp;gt;done_startup) {
+if (ctdb-&amp;gt;recovery_mode == CTDB_RECOVERY_ACTIVE &amp;amp;&amp;amp;
+    client-&amp;gt;pid != ctdb-&amp;gt;recoverd_pid &amp;amp;&amp;amp;
+    ctdb-&amp;gt;runstate &amp;lt; CTDB_RUNSTATE_RUNNING) {
 struct ctdb_deferred_attach_context *da_ctx = talloc(client, struct ctdb_deferred_attach_context);
 
 if (da_ctx == NULL) {
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index 984f947..1608804 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -204,7 +204,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p
 DEBUG(DEBUG_ERR,("startup event failed\n"));
 } else if (status == 0) {
 DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
-ctdb-&amp;gt;done_startup = true;
+ctdb_set_runstate(ctdb, CTDB_RUNSTATE_RUNNING);
 ctdb-&amp;gt;monitor-&amp;gt;next_interval = 2;
 ctdb_run_notification_script(ctdb, "startup");
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -307,7 +307,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
 }
 ctdb-&amp;gt;db_persistent_check_errors = 0;
 
-DEBUG(DEBUG_NOTICE,(__location__ " Recoveries finished. Running the \"startup\" event.\n"));
 event_add_timed(ctdb-&amp;gt;ev, ctdb-&amp;gt;monitor-&amp;gt;monitor_context,
      timeval_current(),
      ctdb_check_health, ctdb);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -323,15 +322,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
 struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
 int ret = 0;
 
+if (ctdb-&amp;gt;runstate &amp;lt; CTDB_RUNSTATE_STARTUP) {
+DEBUG(DEBUG_NOTICE,("Not yet in startup runstate. Wait one more second\n"));
+event_add_timed(ctdb-&amp;gt;ev, ctdb-&amp;gt;monitor-&amp;gt;monitor_context,
+timeval_current_ofs(1, 0), 
+ctdb_check_health, ctdb);
+return;
+}
+
 if (ctdb-&amp;gt;recovery_mode != CTDB_RECOVERY_NORMAL ||
-    (ctdb-&amp;gt;monitor-&amp;gt;monitoring_mode == CTDB_MONITORING_DISABLED &amp;amp;&amp;amp; ctdb-&amp;gt;done_startup)) {
+    (ctdb-&amp;gt;monitor-&amp;gt;monitoring_mode == CTDB_MONITORING_DISABLED &amp;amp;&amp;amp;
+     ctdb-&amp;gt;runstate == CTDB_RUNSTATE_RUNNING)) {
 event_add_timed(ctdb-&amp;gt;ev, ctdb-&amp;gt;monitor-&amp;gt;monitor_context,
 timeval_current_ofs(ctdb-&amp;gt;monitor-&amp;gt;next_interval, 0), 
 ctdb_check_health, ctdb);
 return;
 }
 
-if (!ctdb-&amp;gt;done_startup) {
+if (ctdb-&amp;gt;runstate == CTDB_RUNSTATE_STARTUP) {
+DEBUG(DEBUG_NOTICE,("Recoveries finished. Running the \"startup\" event.\n"));
 ret = ctdb_event_script_callback(ctdb, 
  ctdb-&amp;gt;monitor-&amp;gt;monitor_context, ctdb_startup_callback, 
  ctdb, false,


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-24T05:49:03</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77878">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-180-gdbb7c55</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77878</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  dbb7c550133c92292a7212bdcaaa79f399b0919b (commit)
       via  29911fa44a480c17c701528ef46919b2a962a366 (commit)
       via  80fbe9364350d42658f7f8af250ac87eb1afbc21 (commit)
       via  c660f33c3eaa1b4a2c4e951c1982979e57374ed4 (commit)
       via  6ea3212a7b177c6c06b1484cf9e8b2f4036653d9 (commit)
       via  7cde53a6cbe74b1e46f7e1bca298df82c08de866 (commit)
       via  f665e3d540c90579952e590caa5828acb581ae61 (commit)
       via  a08b6ac19506160f3fb5925ea025027dce07781d (commit)
       via  7630ca4116b476636c27407748088ea335f1a06c (commit)
       via  adc113055de98fae276f9b501aff5c03cd25ddc8 (commit)
       via  e8ea65b2713417db4a618a9f4633991cfaa93fe6 (commit)
       via  f120e40533780e02ff1cdc41cc6d3af1c4c83258 (commit)
       via  187ed83f9701c7fa8d3cc476d47c5d2a87d5c308 (commit)
       via  725239535f40ca2cca445bb5bf2e181351b330e9 (commit)
       via  d2634d72d9ca0ceeb72cbb1adc95017a234480fd (commit)
       via  2a1c933ef7c78ee071e2a640ea10941f1c12e32a (commit)
       via  a3275854812aca86032704134fdf6a129069c86a (commit)
       via  d98a861716d5f8c1f4387d21666396d3164551b3 (commit)
      from  0577ce3c68e4febf49a1ef5093e918db9d5ec636 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit dbb7c550133c92292a7212bdcaaa79f399b0919b
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 8 23:29:55 2013 +1000

    logging: Make sure ringbuffer messages are terminated with a newline
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 29911fa44a480c17c701528ef46919b2a962a366
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 8 16:25:30 2013 +1000

    tests: Fix output of run_tests usage

commit 80fbe9364350d42658f7f8af250ac87eb1afbc21
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 8 13:45:55 2013 +1000

    locking: Set lock helper path once
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit c660f33c3eaa1b4a2c4e951c1982979e57374ed4
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 8 10:42:08 2013 +1000

    locking: Remove functions that are not used anymore
    
    These functions were used in locking child process to do the locking.  With
    locking helper, these are not required.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 6ea3212a7b177c6c06b1484cf9e8b2f4036653d9
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 15:13:44 2013 +1000

    locking: Remove functions that are not used anymore
    
    These functions were used in locking child process to do the locking.  With
    locking helper, these are not required.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 7cde53a6cbe74b1e46f7e1bca298df82c08de866
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 15:07:49 2013 +1000

    locking: Use separate locking helper binary for locking
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit f665e3d540c90579952e590caa5828acb581ae61
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:32:46 2013 +1000

    locking: Create commandline arguments for locking helper
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit a08b6ac19506160f3fb5925ea025027dce07781d
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Mon Apr 22 15:36:27 2013 +1000

    locking: Add a standalone helper to lock record/db
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 7630ca4116b476636c27407748088ea335f1a06c
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:14:16 2013 +1000

    locking: Use database iterator for unmarking databases
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit adc113055de98fae276f9b501aff5c03cd25ddc8
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:16:07 2013 +1000

    locking: Add handler function for unmarking a database
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit e8ea65b2713417db4a618a9f4633991cfaa93fe6
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:12:40 2013 +1000

    locking: Use database iterator for marking databases
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit f120e40533780e02ff1cdc41cc6d3af1c4c83258
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:07:11 2013 +1000

    locking: Add handler function for marking a database
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 187ed83f9701c7fa8d3cc476d47c5d2a87d5c308
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:10:06 2013 +1000

    locking: Use database iterator for unlocking databases
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 725239535f40ca2cca445bb5bf2e181351b330e9
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:06:46 2013 +1000

    locking: Add handler function for unlocking a database
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit d2634d72d9ca0ceeb72cbb1adc95017a234480fd
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:08:51 2013 +1000

    locking: Use database iterator for locking databases
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 2a1c933ef7c78ee071e2a640ea10941f1c12e32a
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 14:06:27 2013 +1000

    locking: Add handler function for locking a database
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit a3275854812aca86032704134fdf6a129069c86a
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Tue Apr 30 13:23:59 2013 +1000

    locking: Refactor code to iterate over databases based on priority
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit d98a861716d5f8c1f4387d21666396d3164551b3
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 1 12:55:22 2013 +1000

    locking: Add newline to debug logs
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

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

Summary of changes:
 Makefile.in                    |   10 +-
 common/ctdb_logging.c          |    6 +
 include/ctdb_private.h         |    2 -
 packaging/RPM/ctdb.spec.in     |    1 +
 server/ctdb_lock.c             |  396 ++++++++++++++++++++--------------------
 server/ctdb_lock_helper.c      |  148 +++++++++++++++
 tests/scripts/integration.bash |    1 +
 tests/scripts/run_tests        |    4 +-
 8 files changed, 361 insertions(+), 207 deletions(-)
 create mode 100644 server/ctdb_lock_helper.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 9f94aee..1bbec6f 100755
--- a/Makefile.in
+++ b/Makefile.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -51,7 +51,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; PMDA_DEST_DIR = /var/lib/pcp/pmdas
 CFLAGS=&amp;lt; at &amp;gt;CPPFLAGS&amp;lt; at &amp;gt; -g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
        $(TALLOC_CFLAGS) $(TEVENT_CFLAGS) $(TDB_CFLAGS) -I&amp;lt; at &amp;gt;libreplacedir&amp;lt; at &amp;gt; \
 -DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
--DLOGDIR=\"$(logdir)\" \
+-DLOGDIR=\"$(logdir)\" -DBINDIR=\"$(bindir)\" \
 -DSOCKPATH=\"$(sockpath)\" \
 -DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 &amp;lt; at &amp;gt;CFLAGS&amp;lt; at &amp;gt; -Wno-format-zero-length $(POPT_CFLAGS) \
 -fPIC
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -107,7 +107,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
 tests/bin/ctdb_porting_tests \
 &amp;lt; at &amp;gt;INFINIBAND_BINS&amp;lt; at &amp;gt;
 
-BINS = bin/ctdb &amp;lt; at &amp;gt;CTDB_SCSI_IO&amp;lt; at &amp;gt; bin/smnotify bin/ping_pong bin/ltdbtool &amp;lt; at &amp;gt;CTDB_PMDA&amp;lt; at &amp;gt;
+BINS = bin/ctdb &amp;lt; at &amp;gt;CTDB_SCSI_IO&amp;lt; at &amp;gt; bin/smnotify bin/ping_pong bin/ltdbtool \
+       bin/ctdb_lock_helper &amp;lt; at &amp;gt;CTDB_PMDA&amp;lt; at &amp;gt;
 
 SBINS = bin/ctdbd
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -176,6 +177,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; bin/ltdbtool: tools/ltdbtool.o $(TDB_OBJ)
 &amp;lt; at &amp;gt;echo Linking $&amp;lt; at &amp;gt;
 &amp;lt; at &amp;gt;$(CC) $(CFLAGS) -o $&amp;lt; at &amp;gt; $+ $(TDB_LIBS) $(LIB_FLAGS)
 
+bin/ctdb_lock_helper: server/ctdb_lock_helper.o lib/util/util_file.o $(TALLOC_OBJ) $(TDB_OBJ)
+&amp;lt; at &amp;gt;echo Linking $&amp;lt; at &amp;gt;
+&amp;lt; at &amp;gt;$(CC) $(CFLAGS) -o $&amp;lt; at &amp;gt; $+ $(TDB_LIBS) $(LIB_FLAGS)
+
 bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ)
 &amp;lt; at &amp;gt;echo Linking $&amp;lt; at &amp;gt;
 &amp;lt; at &amp;gt;$(CC) $(CFLAGS) -o $&amp;lt; at &amp;gt; utils/smnotify/smnotify.o utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o $(POPT_OBJ) $(LIB_FLAGS)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -327,6 +332,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; install: all manpages $(PMDA_INSTALL)
 ${INSTALLCMD} -m 755 bin/smnotify $(DESTDIR)$(bindir)
 $(INSTALLCMD) -m 755 bin/ping_pong $(DESTDIR)$(bindir)
 $(INSTALLCMD) -m 755 bin/ltdbtool $(DESTDIR)$(bindir)
+$(INSTALLCMD) -m 755 bin/ctdb_lock_helper $(DESTDIR)$(bindir)
 $(INSTALLCMD) -m 755 libctdb/libctdb.a $(DESTDIR)$(libdir)
 ${INSTALLCMD} -m 644 include/ctdb.h $(DESTDIR)$(includedir)
 ${INSTALLCMD} -m 644 include/ctdb_client.h $(DESTDIR)$(includedir)
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index 339198b..408fda8 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -67,6 +67,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void log_ringbuffer_v(const char *format, va_list ap)
 if (ret == -1) {
 return;
 }
+/* Log messages longer than MAX_LOG_SIZE are truncated to MAX_LOG_SIZE-1
+ * bytes.  In that case, add a newline.
+ */
+if (ret &amp;gt;= MAX_LOG_SIZE) {
+log_entries[next_entry].message[MAX_LOG_SIZE-2] = '\n';
+}
 
 log_entries[next_entry].level = this_log_level;
 log_entries[next_entry].t = timeval_current();
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 813a5a6..c47210e 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1564,8 +1564,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_monitoring_interfaces(struct ctdb_context *ctdb);
 /* from server/ctdb_lock.c */
 struct lock_request;
 
-int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority);
-int ctdb_unlockall_prio(struct ctdb_context *ctdb, uint32_t priority);
 int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority);
 int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority);
 
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 910b59a..9872427 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -166,6 +166,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; rm -rf $RPM_BUILD_ROOT
 %{_sysconfdir}/ctdb/notify.d/README
 %{_sbindir}/ctdbd
 %{_bindir}/ctdb
+%{_bindir}/ctdb_lock_helper
 %{_bindir}/smnotify
 %{_bindir}/ping_pong
 %{_bindir}/ltdbtool
diff --git a/server/ctdb_lock.c b/server/ctdb_lock.c
index 8a2ba5c..77b4da8 100644
--- a/server/ctdb_lock.c
+++ b/server/ctdb_lock.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -113,12 +113,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool later_db(struct ctdb_context *ctdb, const char *name)
 return false;
 }
 
-/*
- * lock all databases
- */
-int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority)
+typedef int (*db_handler_t)(struct ctdb_db_context *ctdb_db,
+    uint32_t priority,
+    void *private_data);
+
+static int ctdb_db_iterator(struct ctdb_context *ctdb, uint32_t priority,
+    db_handler_t handler, void *private_data)
 {
 struct ctdb_db_context *ctdb_db;
+int ret;
 
 for (ctdb_db = ctdb-&amp;gt;db_list; ctdb_db; ctdb_db = ctdb_db-&amp;gt;next) {
 if (ctdb_db-&amp;gt;priority != priority) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -127,11 +130,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority)
 if (later_db(ctdb, ctdb_db-&amp;gt;db_name)) {
 continue;
 }
-DEBUG(DEBUG_INFO, ("locking database %s, priority:%u\n",
-   ctdb_db-&amp;gt;db_name, priority));
-if (tdb_lockall(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-DEBUG(DEBUG_ERR, ("Failed to lock database %s\n",
-  ctdb_db-&amp;gt;db_name));
+ret = handler(ctdb_db, priority, private_data);
+if (ret != 0) {
 return -1;
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -145,24 +145,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t priority)
 if (!later_db(ctdb, ctdb_db-&amp;gt;db_name)) {
 continue;
 }
-DEBUG(DEBUG_INFO, ("locking database %s, priority:%u\n",
-   ctdb_db-&amp;gt;db_name, priority));
-if (tdb_lockall(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-DEBUG(DEBUG_ERR, ("Failed to lock database %s\n",
-  ctdb_db-&amp;gt;db_name));
-return -1;
-}
-}
-
-return 0;
-}
-
-static int ctdb_lockall(struct ctdb_context *ctdb)
-{
-uint32_t priority;
-
-for (priority=1; priority&amp;lt;=NUM_DB_PRIORITIES; priority++) {
-if (ctdb_lockall_prio(ctdb, priority) != 0) {
+ret = handler(ctdb_db, priority, private_data);
+if (ret != 0) {
 return -1;
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -172,50 +156,33 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_lockall(struct ctdb_context *ctdb)
 
 
 /*
- * unlock all databases
+ * lock all databases - mark only
  */
-int ctdb_unlockall_prio(struct ctdb_context *ctdb, uint32_t priority)
+static int db_lock_mark_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+void *private_data)
 {
-struct ctdb_db_context *ctdb_db;
-
-for (ctdb_db = ctdb-&amp;gt;db_list; ctdb_db; ctdb_db = ctdb_db-&amp;gt;next) {
-if (ctdb_db-&amp;gt;priority != priority) {
-continue;
-}
-DEBUG(DEBUG_INFO, ("unlocking database %s, priority:%u\n",
-   ctdb_db-&amp;gt;db_name, priority));
-if (tdb_unlockall(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-DEBUG(DEBUG_ERR, ("Failed to unlock database %s\n",
-  ctdb_db-&amp;gt;db_name));
-return -1;
-}
-}
+int tdb_transaction_write_lock_mark(struct tdb_context *);
 
-return 0;
-}
+DEBUG(DEBUG_INFO, ("marking locked database %s, priority:%u\n",
+   ctdb_db-&amp;gt;db_name, priority));
 
-static int ctdb_unlockall(struct ctdb_context *ctdb)
-{
-uint32_t priority;
+if (tdb_transaction_write_lock_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
+DEBUG(DEBUG_ERR, ("Failed to mark (transaction lock) database %s\n",
+  ctdb_db-&amp;gt;db_name));
+return -1;
+}
 
-for (priority=NUM_DB_PRIORITIES; priority&amp;gt;=0; priority--) {
-if (ctdb_unlockall_prio(ctdb, priority) != 0) {
-return -1;
-}
+if (tdb_lockall_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
+DEBUG(DEBUG_ERR, ("Failed to mark (all lock) database %s\n",
+  ctdb_db-&amp;gt;db_name));
+return -1;
 }
 
 return 0;
 }
 
-
-/*
- * lock all databases - mark only
- */
 int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority)
 {
-struct ctdb_db_context *ctdb_db;
-int tdb_transaction_write_lock_mark(struct tdb_context *);
-
 /*
  * This function is only used by the main dameon during recovery.
  * At this stage, the databases have already been locked, by a
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -228,41 +195,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority)
 return -1;
 }
 
-for (ctdb_db = ctdb-&amp;gt;db_list; ctdb_db; ctdb_db = ctdb_db-&amp;gt;next) {
-if (ctdb_db-&amp;gt;priority != priority) {
-continue;
-}
-if (later_db(ctdb, ctdb_db-&amp;gt;db_name)) {
-continue;
-}
-if (tdb_transaction_write_lock_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-return -1;
-}
-if (tdb_lockall_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-/* FIXME: Shouldn't we unmark here? */
-return -1;
-}
-}
-
-/* If priority != 1, later_db check is not required and can return */
-if (priority != 1) {
-return 0;
-}
-
-for (ctdb_db = ctdb-&amp;gt;db_list; ctdb_db; ctdb_db = ctdb_db-&amp;gt;next) {
-if (!later_db(ctdb, ctdb_db-&amp;gt;db_name)) {
-continue;
-}
-if (tdb_transaction_write_lock_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-return -1;
-}
-if (tdb_lockall_mark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-/* FIXME: Shouldn't we unmark here? */
-return -1;
-}
-}
-
-return 0;
+return ctdb_db_iterator(ctdb, priority, db_lock_mark_handler, NULL);
 }
 
 static int ctdb_lockall_mark(struct ctdb_context *ctdb)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -270,7 +203,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_lockall_mark(struct ctdb_context *ctdb)
 uint32_t priority;
 
 for (priority=1; priority&amp;lt;=NUM_DB_PRIORITIES; priority++) {
-if (ctdb_lockall_mark_prio(ctdb, priority) != 0) {
+if (ctdb_db_iterator(ctdb, priority, db_lock_mark_handler, NULL) != 0) {
 return -1;
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -282,11 +215,31 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_lockall_mark(struct ctdb_context *ctdb)
 /*
  * lock all databases - unmark only
  */
-int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority)
+static int db_lock_unmark_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+  void *private_data)
 {
-struct ctdb_db_context *ctdb_db;
 int tdb_transaction_write_lock_unmark(struct tdb_context *);
 
+DEBUG(DEBUG_INFO, ("unmarking locked database %s, priority:%u\n",
+   ctdb_db-&amp;gt;db_name, priority));
+
+if (tdb_transaction_write_lock_unmark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
+DEBUG(DEBUG_ERR, ("Failed to unmark (transaction lock) database %s\n",
+  ctdb_db-&amp;gt;db_name));
+return -1;
+}
+
+if (tdb_lockall_unmark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
+DEBUG(DEBUG_ERR, ("Failed to unmark (all lock) database %s\n",
+  ctdb_db-&amp;gt;db_name));
+return -1;
+}
+
+return 0;
+}
+
+int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority)
+{
 /*
  * This function is only used by the main dameon during recovery.
  * At this stage, the databases have already been locked, by a
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -299,19 +252,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority)
 return -1;
 }
 
-for (ctdb_db = ctdb-&amp;gt;db_list; ctdb_db; ctdb_db = ctdb_db-&amp;gt;next) {
-if (ctdb_db-&amp;gt;priority != priority) {
-continue;
-}
-if (tdb_transaction_write_lock_unmark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-return -1;
-}
-if (tdb_lockall_unmark(ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) != 0) {
-return -1;
-}
-}
-
-return 0;
+return ctdb_db_iterator(ctdb, priority, db_lock_unmark_handler, NULL);
 }
 
 static int ctdb_lockall_unmark(struct ctdb_context *ctdb)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -319,7 +260,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_lockall_unmark(struct ctdb_context *ctdb)
 uint32_t priority;
 
 for (priority=NUM_DB_PRIORITIES; priority&amp;gt;=0; priority--) {
-if (ctdb_lockall_unmark_prio(ctdb, priority) != 0) {
+if (ctdb_db_iterator(ctdb, priority, db_lock_unmark_handler, NULL) != 0) {
 return -1;
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -328,68 +269,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int ctdb_lockall_unmark(struct ctdb_context *ctdb)
 }
 
 
-/*
- * Lock record / db depending on lock_ctx-&amp;gt;type
- * Called from child context.
- */
-static bool ctdb_lock_item(struct lock_context *lock_ctx)
-{
-bool status = false;
-
-switch (lock_ctx-&amp;gt;type) {
-case LOCK_RECORD:
-if (tdb_chainlock(lock_ctx-&amp;gt;ctdb_db-&amp;gt;ltdb-&amp;gt;tdb, lock_ctx-&amp;gt;key) == 0) {
-status = true;
-}
-break;
-
-case LOCK_DB:
-if (tdb_lockall(lock_ctx-&amp;gt;ctdb_db-&amp;gt;ltdb-&amp;gt;tdb) == 0) {
-status = true;
-}
-break;
-
-case LOCK_ALLDB_PRIO:
-if (ctdb_lockall_prio(lock_ctx-&amp;gt;ctdb, lock_ctx-&amp;gt;priority) == 0) {
-status = true;
-}
-break;
-
-case LOCK_ALLDB:
-if (ctdb_lockall(lock_ctx-&amp;gt;ctdb) == 0) {
-status = true;
-}
-break;
-}
-
-return status;
-}
-
-
-/*
- * Unlock record / db depending on lock_ctx-&amp;gt;type
- */
-void ctdb_unlock_item(struct lock_context *lock_ctx)
-{
-switch (lock_ctx-&amp;gt;type) {
-case LOCK_RECORD:
-tdb_chainunlock(lock_ctx-&amp;gt;ctdb_db-&amp;gt;ltdb-&amp;gt;tdb, lock_ctx-&amp;gt;key);
-break;
-
-case LOCK_DB:
-tdb_unlockall(lock_ctx-&amp;gt;ctdb_db-&amp;gt;ltdb-&amp;gt;tdb);
-break;
-
-case LOCK_ALLDB_PRIO:
-ctdb_unlockall_prio(lock_ctx-&amp;gt;ctdb, lock_ctx-&amp;gt;priority);
-break;
-
-case LOCK_ALLDB:
-ctdb_unlockall(lock_ctx-&amp;gt;ctdb);
-break;
-}
-}
-
 static void ctdb_lock_schedule(struct ctdb_context *ctdb);
 
 /*
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -631,32 +510,118 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void ctdb_lock_timeout_handler(struct tevent_context *ev,
 }
 
 
-static char *lock_child_log_prefix(struct lock_context *lock_ctx)
+static int db_count_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+    void *private_data)
 {
-char *prefix;
-pid_t pid;
+int *count = (int *)private_data;
+
+(*count)++;
+
+return 0;
+}
+
+struct db_namelist {
+char **names;
+int n;
+};
+
+static int db_name_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+   void *private_data)
+{
+struct db_namelist *list = (struct db_namelist *)private_data;
+
+list-&amp;gt;names[list-&amp;gt;n] = talloc_strdup(list-&amp;gt;names, ctdb_db-&amp;gt;db_path);
+list-&amp;gt;n++;
+
+return 0;
+}
+
+static char **lock_helper_args(TALLOC_CTX *mem_ctx, struct lock_context *lock_ctx, int fd)
+{
+struct ctdb_context *ctdb = lock_ctx-&amp;gt;ctdb;
+char **args = NULL;
+int nargs, i;
+int priority;
+struct db_namelist list;
+
+switch (lock_ctx-&amp;gt;type) {
+case LOCK_RECORD:
+nargs = 6;
+break;
+
+case LOCK_DB:
+nargs = 5;
+break;
+
+case LOCK_ALLDB_PRIO:
+nargs = 4;
+ctdb_db_iterator(ctdb, lock_ctx-&amp;gt;priority, db_count_handler, &amp;amp;nargs);
+break;
+
+case LOCK_ALLDB:
+nargs = 4;
+for (priority=1; priority&amp;lt;NUM_DB_PRIORITIES; priority++) {
+ctdb_db_iterator(ctdb, priority, db_count_handler, &amp;amp;nargs);
+}
+break;
+}
+
+/* Add extra argument for null termination */
+nargs++;
+
+args = talloc_array(mem_ctx, char *, nargs);
+if (args == NULL) {
+return NULL;
+}
 
-pid = getpid();
+args[0] = talloc_strdup(args, "ctdb_lock_helper");
+args[1] = talloc_asprintf(args, "%d", getpid());
+args[2] = talloc_asprintf(args, "%d", fd);
 
 switch (lock_ctx-&amp;gt;type) {
 case LOCK_RECORD:
-prefix = talloc_asprintf(NULL, "lockR(%d): ", pid);
+args[3] = talloc_strdup(args, "RECORD");
+args[4] = talloc_strdup(args, lock_ctx-&amp;gt;ctdb_db-&amp;gt;db_path);
+if (lock_ctx-&amp;gt;key.dsize == 0) {
+args[5] = talloc_strdup(args, "NULL");
+} else {
+args[5] = hex_encode_talloc(args, lock_ctx-&amp;gt;key.dptr, lock_ctx-&amp;gt;key.dsize);
+}
 break;
 
 case LOCK_DB:
-prefix = talloc_asprintf(NULL, "lockD(%d): ", pid);
+args[3] = talloc_strdup(args, "DB");
+args[4] = talloc_strdup(args, lock_ctx-&amp;gt;ctdb_db-&amp;gt;db_path);
 break;
 
 case LOCK_ALLDB_PRIO:
-prefix = talloc_asprintf(NULL, "lockP(%d): ", pid);
+args[3] = talloc_strdup(args, "DB");
+list.names = args;
+list.n = 4;
+ctdb_db_iterator(ctdb, lock_ctx-&amp;gt;priority, db_name_handler, &amp;amp;list);


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-24T03:56:53</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77877">
    <title>[SCM] Samba Shared Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77877</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  e24fe57 libnet-vampire: make use of dsdb_repl_resolve_working_schema()
       via  24fb281 dsdb-repl: merge the logic from libnet_vampire_cb_apply_schema()
       via  9af430e dsdb-repl: split out dsdb_repl_resolve_working_schema
       via  d36e911 selftest: Improve test coverage of DRS (bug #8680)
       via  640c2ff dsdb-drs: when replicating schema object checks ask for removal of previous version if exists (bug #8680)
       via  c7d4b87 libnet-vampire: add attributes and classes from the replicated schema to the bootstrap schema (bug #8680)
       via  fe85bc1 dsdb-schema: make deduplication of class and schema possible (bug #8680)
       via  c524be1 dsdb-schema: schema_fill_possible_inferiors() should rebuild everthing
      from  bea2af9 Revert my accidental commit.

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


- Log -----------------------------------------------------------------
commit e24fe5705e3c4d33705ebb584ea2009bb4a1a82c
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 23:18:55 2013 +0200

    libnet-vampire: make use of dsdb_repl_resolve_working_schema()
    
    Pair-Programmed-With: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Thu May 23 14:18:03 CEST 2013 on sn-devel-104

commit 24fb281ea7983a42ba94b664530170e2401523f7
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 23:18:41 2013 +0200

    dsdb-repl: merge the logic from libnet_vampire_cb_apply_schema()
    
    This way libnet_vampire_cb_apply_schema() is able to use
    dsdb_repl_resolve_working_schema().
    
    Pair-Programmed-With: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 9af430ec0be46d0a616faee3552600219bc57097
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 23:02:03 2013 +0200

    dsdb-repl: split out dsdb_repl_resolve_working_schema
    
    This can be reused later in other places.
    
    Pair-Programmed-With: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit d36e9118cbf9deb01c6ee9af6790ce35bb3b936a
Author: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
Date:   Thu Apr 18 22:03:23 2013 -0700

    selftest: Improve test coverage of DRS (bug #8680)
    
    Pair-Programmed-With: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Signed-off-by: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    Reviewed-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 640c2ff57518a5711e795e6cc9f48ae29d379a01
Author: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
Date:   Sun Jan 27 15:43:07 2013 -0800

    dsdb-drs: when replicating schema object checks ask for removal of previous version if exists (bug #8680)
    
    Signed-off-by: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    Reviewed-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit c7d4b87512eabbff5172716a755a3cd61fe5476b
Author: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
Date:   Sun Oct 7 21:46:38 2012 -0700

    libnet-vampire: add attributes and classes from the replicated schema to the bootstrap schema (bug #8680)
    
    Replicated schema might have attributes and auxilary classes  on some
    critical classes (ie.  top, user, computer ) that are not in the bootstrap
    schema. Without those new attributes and classes, bootstrap schema is
    unable to translate those critical classes in the schema constructed
    from the replicated data. Without thoses classes new schema is useless
    and can't be indexed properly.
    
    In order to overcome this problem, we put all new attributes and classes
    definitions into the bootstrap schema so that foundations classes can be
    translated.
    
    Pair-Programmed-With: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Signed-off-by: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit fe85bc1fb9ab2f891a9fd46bd8e00325622d39cf
Author: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
Date:   Sat Jan 26 23:42:10 2013 -0800

    dsdb-schema: make deduplication of class and schema possible (bug #8680)
    
    When a class or an attribute is replicated it might already exists in
    the existing schema, so while replicating the new version of this object
    we want to get rid of the old version of the object is the current
    validating schema so that we don't end up having duplicates.
    
    Pair-Programmed-With: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Signed-off-by: Matthieu Patou &amp;lt;mat&amp;lt; at &amp;gt;matws.net&amp;gt;
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

commit c524be17815e92ce9fcdd0565e76b026e483cc9d
Author: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Thu May 23 08:46:31 2013 +0200

    dsdb-schema: schema_fill_possible_inferiors() should rebuild everthing
    
    commit cd7f3fd07215a7b8372b6b623faed02ae1310cb1 reverted the change
    of commit c2853f55fc603d4875bb1e50a1cbf409df0421ea.
    
    Signed-off-by: Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 selftest/skip                          |    2 -
 source4/dsdb/repl/replicated_objects.c |  271 ++++++++++++++++++++++++-------
 source4/dsdb/schema/schema.h           |    5 +
 source4/dsdb/schema/schema_inferiors.c |    4 +-
 source4/dsdb/schema/schema_init.c      |   72 ++++++++-
 source4/dsdb/schema/schema_set.c       |   46 +++++-
 source4/libnet/libnet_vampire.c        |  125 +++------------
 source4/selftest/tests.py              |   51 +++---
 8 files changed, 373 insertions(+), 203 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/skip b/selftest/skip
index 6ea9b25..0b8468d 100644
--- a/selftest/skip
+++ b/selftest/skip
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -103,8 +103,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; bench # don't run benchmarks in our selftest
 # ktutil might not be installed or from mit...
 # we should build a samba4ktutil and use that instead
 ^samba4.blackbox.ktpass # this test isn't portable ...
-^samba4.drs.repl_schema.python # flakey test
-^samba4.drs.delete_object.python # flakey test
 ^samba4.rpc.unixinfo # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
 ^samba.tests.dcerpc.unix  # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
 base.dir2 # This test spins on modern ext4, so we have to skip it
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 29b494b..b0abc1a 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -31,35 +31,95 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "libcli/auth/libcli_auth.h"
 #include "param/param.h"
 
-/**
- * Multi-pass working schema creation
- * Function will:
- *  - shallow copy initial schema supplied
- *  - create a working schema in multiple passes
- *    until all objects are resolved
- * Working schema is a schema with Attributes, Classes
- * and indexes, but w/o subClassOf, possibleSupperiors etc.
- * It is to be used just us cache for converting attribute values.
- */
-WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
-     const struct dsdb_schema *initial_schema,
-     const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,
-     uint32_t object_count,
-     const struct drsuapi_DsReplicaObjectListItemEx *first_object,
-     const DATA_BLOB *gensec_skey,
-     TALLOC_CTX *mem_ctx,
-     struct dsdb_schema **_schema_out)
+static WERROR dsdb_repl_merge_working_schema(struct ldb_context *ldb,
+     struct dsdb_schema *dest_schema,
+     const struct dsdb_schema *ref_schema)
+{
+const struct dsdb_class *cur_class = NULL;
+const struct dsdb_attribute *cur_attr = NULL;
+int ret;
+
+for (cur_class = ref_schema-&amp;gt;classes;
+     cur_class;
+     cur_class = cur_class-&amp;gt;next)
+{
+const struct dsdb_class *tmp1;
+struct dsdb_class *tmp2;
+
+tmp1 = dsdb_class_by_governsID_id(dest_schema,
+  cur_class-&amp;gt;governsID_id);
+if (tmp1 != NULL) {
+continue;
+}
+
+/*
+ * Do a shallow copy so that original next and prev are
+ * not modified, we don't need to do a deep copy
+ * as the rest won't be modified and this is for
+ * a short lived object.
+ */
+tmp2 = talloc(dest_schema-&amp;gt;classes, struct dsdb_class);
+if (tmp2 == NULL) {
+return WERR_NOMEM;
+}
+*tmp2 = *cur_class;
+DLIST_ADD(dest_schema-&amp;gt;classes, tmp2);
+}
+
+for (cur_attr = ref_schema-&amp;gt;attributes;
+     cur_attr;
+     cur_attr = cur_attr-&amp;gt;next)
+{
+const struct dsdb_attribute *tmp1;
+struct dsdb_attribute *tmp2;
+
+tmp1 = dsdb_attribute_by_attributeID_id(dest_schema,
+cur_attr-&amp;gt;attributeID_id);
+if (tmp1 != NULL) {
+continue;
+}
+
+/*
+ * Do a shallow copy so that original next and prev are
+ * not modified, we don't need to do a deep copy
+ * as the rest won't be modified and this is for
+ * a short lived object.
+ */
+tmp2 = talloc(dest_schema-&amp;gt;attributes, struct dsdb_attribute);
+if (tmp2 == NULL) {
+return WERR_NOMEM;
+}
+*tmp2 = *cur_attr;
+DLIST_ADD(dest_schema-&amp;gt;attributes, tmp2);
+}
+
+ret = dsdb_setup_sorted_accessors(ldb, dest_schema);
+if (LDB_SUCCESS != ret) {
+DEBUG(0,("Failed to add new attribute to reference schema!\n"));
+return WERR_INTERNAL_ERROR;
+}
+
+return WERR_OK;
+}
+
+WERROR dsdb_repl_resolve_working_schema(struct ldb_context *ldb,
+TALLOC_CTX *mem_ctx,
+struct dsdb_schema_prefixmap *pfm_remote,
+uint32_t cycle_before_switching,
+struct dsdb_schema *initial_schema,
+struct dsdb_schema *resulting_schema,
+uint32_t object_count,
+const struct drsuapi_DsReplicaObjectListItemEx *first_object)
 {
 struct schema_list {
 struct schema_list *next, *prev;
 const struct drsuapi_DsReplicaObjectListItemEx *obj;
 };
-
-WERROR werr;
-struct dsdb_schema_prefixmap *pfm_remote;
 struct schema_list *schema_list = NULL, *schema_list_item, *schema_list_next_item;
+WERROR werr;
 struct dsdb_schema *working_schema;
 const struct drsuapi_DsReplicaObjectListItemEx *cur;
+DATA_BLOB empty_key = data_blob_null;
 int ret, pass_no;
 uint32_t ignore_attids[] = {
 DRSUAPI_ATTID_auxiliaryClass,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -70,46 +130,56 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
 DRSUAPI_ATTID_INVALID
 };
 
-/* make a copy of the iniatial_scheam so we don't mess with it */
-working_schema = dsdb_schema_copy_shallow(mem_ctx, ldb, initial_schema);
-if (!working_schema) {
-DEBUG(0,(__location__ ": schema copy failed!\n"));
-return WERR_NOMEM;
-}
-
-/* we are going to need remote prefixMap for decoding */
-werr = dsdb_schema_pfm_from_drsuapi_pfm(mapping_ctr, true,
-mem_ctx, &amp;amp;pfm_remote, NULL);
-if (!W_ERROR_IS_OK(werr)) {
-DEBUG(0,(__location__ ": Failed to decode remote prefixMap: %s",
- win_errstr(werr)));
-return werr;
-}
-
 /* create a list of objects yet to be converted */
 for (cur = first_object; cur; cur = cur-&amp;gt;next_object) {
 schema_list_item = talloc(mem_ctx, struct schema_list);
+if (schema_list_item == NULL) {
+return WERR_NOMEM;
+}
+
 schema_list_item-&amp;gt;obj = cur;
 DLIST_ADD_END(schema_list, schema_list_item, struct schema_list);
 }
 
 /* resolve objects until all are resolved and in local schema */
 pass_no = 1;
+working_schema = initial_schema;
 
 while (schema_list) {
 uint32_t converted_obj_count = 0;
 uint32_t failed_obj_count = 0;
-TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
-W_ERROR_HAVE_NO_MEMORY(tmp_ctx);
 
-for (schema_list_item = schema_list; schema_list_item; schema_list_item=schema_list_next_item) {
+if (resulting_schema != working_schema) {
+/*
+ * If the selfmade schema is not the schema used to
+ * translate and validate replicated object,
+ * Which means that we are using the bootstrap schema
+ * Then we add attributes and classes that were already
+ * translated to the working schema, the idea is that
+ * we might need to add new attributes and classes
+ * to be able to translate critical replicated objects
+ * and without that we wouldn't be able to translate them
+ */
+werr = dsdb_repl_merge_working_schema(ldb,
+working_schema,
+resulting_schema);
+if (!W_ERROR_IS_OK(werr)) {
+return werr;
+}
+}
+
+for (schema_list_item = schema_list;
+     schema_list_item;
+     schema_list_item=schema_list_next_item) {
 struct dsdb_extended_replicated_object object;
 
 cur = schema_list_item-&amp;gt;obj;
 
-/* Save the next item, now we have saved out
+/*
+ * Save the next item, now we have saved out
  * the current one, so we can DLIST_REMOVE it
- * safely */
+ * safely
+ */
 schema_list_next_item = schema_list_item-&amp;gt;next;
 
 /*
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -117,14 +187,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
  * schema we have so far. It's ok if we fail to convert
  * an object. We should convert more objects on next pass.
  */
-werr = dsdb_convert_object_ex(ldb, working_schema, pfm_remote,
-      cur, gensec_skey,
+werr = dsdb_convert_object_ex(ldb, working_schema,
+      pfm_remote,
+      cur, &amp;amp;empty_key,
       ignore_attids,
       0,
-      tmp_ctx, &amp;amp;object);
+      schema_list_item, &amp;amp;object);
 if (!W_ERROR_IS_OK(werr)) {
-DEBUG(4,("debug: Failed to convert schema object %s into ldb msg, will try during next loop\n",
-  cur-&amp;gt;object.identifier-&amp;gt;dn));
+DEBUG(4,("debug: Failed to convert schema "
+ "object %s into ldb msg, "
+ "will try during next loop\n",
+ cur-&amp;gt;object.identifier-&amp;gt;dn));
 
 failed_obj_count++;
 } else {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -132,41 +205,117 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
  * Convert the schema from ldb_message format
  * (OIDs as OID strings) into schema, using
  * the remote prefixMap
+ *
+ * It's not likely, but possible to get the
+ * same object twice and we should keep
+ * the last instance.
  */
-werr = dsdb_schema_set_el_from_ldb_msg(ldb,
-       working_schema,
-       object.msg);
+werr = dsdb_schema_set_el_from_ldb_msg_dups(ldb,
+resulting_schema,
+object.msg,
+true);
 if (!W_ERROR_IS_OK(werr)) {
-DEBUG(4,("debug: failed to convert object %s into a schema element, will try during next loop: %s\n",
+DEBUG(4,("debug: failed to convert "
+ "object %s into a schema element, "
+ "will try during next loop: %s\n",
  ldb_dn_get_linearized(object.msg-&amp;gt;dn),
  win_errstr(werr)));
 failed_obj_count++;
 } else {
+DEBUG(8,("Converted object %s into a schema element\n",
+ ldb_dn_get_linearized(object.msg-&amp;gt;dn)));
 DLIST_REMOVE(schema_list, schema_list_item);
-talloc_free(schema_list_item);
+TALLOC_FREE(schema_list_item);
 converted_obj_count++;
 }
 }
 }
-talloc_free(tmp_ctx);
 
 DEBUG(4,("Schema load pass %d: converted %d, %d of %d objects left to be converted.\n",
  pass_no, converted_obj_count, failed_obj_count, object_count));
-pass_no++;
 
 /* check if we converted any objects in this pass */
 if (converted_obj_count == 0) {
-DEBUG(0,("Can't continue Schema load: didn't manage to convert any objects: all %d remaining of %d objects failed to convert\n", failed_obj_count, object_count));
+DEBUG(0,("Can't continue Schema load: "
+ "didn't manage to convert any objects: "
+ "all %d remaining of %d objects "
+ "failed to convert\n",
+ failed_obj_count, object_count));
 return WERR_INTERNAL_ERROR;
 }
 
-/* rebuild indexes */
-ret = dsdb_setup_sorted_accessors(ldb, working_schema);
-if (LDB_SUCCESS != ret) {
-DEBUG(0,("Failed to create schema-cache indexes!\n"));
-return WERR_INTERNAL_ERROR;
+/*
+ * Don't try to load the schema if there is missing object
+ * _and_ we are on the first pass as some critical objects
+ * might be missing.
+ */
+if (failed_obj_count == 0 || pass_no &amp;gt; cycle_before_switching) {
+/* prepare for another cycle */
+working_schema = resulting_schema;
+
+ret = dsdb_setup_sorted_accessors(ldb, working_schema);
+if (LDB_SUCCESS != ret) {
+DEBUG(0,("Failed to create schema-cache indexes!\n"));
+return WERR_INTERNAL_ERROR;
+}
 }
-};
+pass_no++;
+}
+
+return WERR_OK;
+}
+
+/**
+ * Multi-pass working schema creation
+ * Function will:
+ *  - shallow copy initial schema supplied
+ *  - create a working schema in multiple passes
+ *    until all objects are resolved
+ * Working schema is a schema with Attributes, Classes
+ * and indexes, but w/o subClassOf, possibleSupperiors etc.
+ * It is to be used just us cache for converting attribute values.
+ */
+WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
+     const struct dsdb_schema *initial_schema,
+     const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,
+     uint32_t object_count,
+     const struct drsuapi_DsReplicaObjectListItemEx *first_object,
+     const DATA_BLOB *gensec_skey,
+     TALLOC_CTX *mem_ctx,
+     struct dsdb_schema **_schema_out)
+{
+WERROR werr;
+struct dsdb_schema_prefixmap *pfm_remote;
+struct dsdb_schema *working_schema;
+
+/* make a copy of the iniatial_scheam so we don't mess with it */
+working_schema = dsdb_schema_copy_shallow(mem_ctx, ldb, initial_schema);
+if (!working_schema) {
+DEBUG(0,(__location__ ": schema copy failed!\n"));
+return WERR_NOMEM;
+}
+
+/* we are going to need remote prefixMap for decoding */
+werr = dsdb_schema_pfm_from_drsuapi_pfm(mapping_ctr, true,
+mem_ctx, &amp;amp;pfm_remote, NULL);
+if (!W_ERROR_IS_OK(werr)) {
+DEBUG(0,(__location__ ": Failed to decode remote prefixMap: %s",
+ win_errstr(werr)));
+return werr;
+}
+
+werr = dsdb_repl_resolve_working_schema(ldb, mem_ctx,
+pfm_remote,
+0, /* cycle_before_switching */
+working_schema,
+working_schema,
+object_count,
+first_object);
+if (!W_ERROR_IS_OK(werr)) {
+DEBUG(0, ("%s: dsdb_repl_resolve_working_schema() failed: %s",
+  __location__, win_errstr(werr)));
+return werr;
+}
 
 *_schema_out = working_schema;
 
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 66df1c5..538b858 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -221,6 +221,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct dsdb_schema {
 struct dsdb_attribute *attributes;
 struct dsdb_class *classes;
 
+struct dsdb_attribute **attributes_to_remove;
+uint32_t attributes_to_remove_size;
+struct dsdb_class **classes_to_remove;
+uint32_t classes_to_remove_size;
+
 /* lists of classes sorted by various attributes, for faster
    access */
 uint32_t num_classes;
diff --git a/source4/dsdb/schema/schema_inferiors.c b/source4/dsdb/schema/schema_inferiors.c
index 4d09521..56f5733 100644
--- a/source4/dsdb/schema/schema_inferiors.c
+++ b/source4/dsdb/schema/schema_inferiors.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -201,8 +201,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void schema_fill_possible_inferiors(const struct dsdb_schema *schema,
    struct dsdb_class *schema_class)
 {
 struct dsdb_class *c2;
-const char** poss_inf = schema_class-&amp;gt;possibleInferiors;
-const char** sys_poss_inf = schema_class-&amp;gt;systemPossibleInferiors;
+const char **poss_inf = NULL;
+const char **sys_poss_inf = NULL;
 
 for (c2 = schema-&amp;gt;classes; c2; c2 = c2-&amp;gt;next) {
 const char **superiors = schema_posssuperiors(schema, c2);
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 752d4f5..efbd38a 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -699,9 +699,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
 return WERR_OK;
 }
 
-WERROR dsdb_set_attribute_from_ldb(struct ldb_context *ldb,
-       struct dsdb_schema *schema,
-       struct ldb_message *msg)
+WERROR dsdb_set_attribute_from_ldb_dups(struct ldb_context *ldb,
+struct dsdb_schema *schema,
+struct ldb_message *msg,
+bool checkdups)
 {
 WERROR status;
 struct dsdb_attribute *attr = talloc_zero(schema, struct dsdb_attribute);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -729,12 +730,44 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_set_attribute_from_ldb(struct ldb_context *ldb,
 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
 }
 
+if (checkdups) {
+const struct dsdb_attribute *a2;
+struct dsdb_attribute **a;
+uint32_t i;
+
+a2 = dsdb_attribute_by_attributeID_id(schema,
+      attr-&amp;gt;attributeID_id);
+if (a2 == NULL) {
+goto done;
+}
+
+i = schema-&amp;gt;attributes_to_remove_size;
+a = talloc_realloc(schema, schema-&amp;gt;attributes_to_remove,
+   struct dsdb_attribute *, i + 1);
+if (a == NULL) {
+return WERR_NOMEM;
+}
+/* Mark the old attribute as to be removed */
+a[i] = discard_const_p(struct dsdb_attribute, a2);
+schema-&amp;gt;attributes_to_remove = a;
+schema-&amp;gt;attributes_to_remove_size++;
+}
+
+done:
 DLIST_ADD(schema-&amp;gt;attributes, attr);
 return WERR_OK;
 }
 
-WERROR dsdb_set_class_from_ldb(struct dsdb_schema *schema,
-   struct ldb_message *msg)
+WERROR dsdb_set_attribute_from_ldb(struct ldb_context *ldb,
+   struct dsdb_schema *schema,
+   struct ldb_message *msg)
+{
+return dsdb_set_attribute_from_ldb_dups(ldb, schema, msg, false);
+}
+
+WERROR dsdb_set_class_from_ldb_dups(struct dsdb_schema *schema,
+    struct ldb_message *msg,
+    bool checkdups)
 {
 WERROR status;
 struct dsdb_class *obj = talloc_zero(schema, struct dsdb_class);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -792,10 +825,39 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR dsdb_set_class_from_ldb(struct dsdb_schema *schema,
 GET_BOOL_LDB(msg, "isDefunct", obj, isDefunct, false);
 GET_BOOL_LDB(msg, "systemOnly", obj, systemOnly, false);
 
+if (checkdups) {
+const struct dsdb_class *c2;
+struct dsdb_class **c;
+uint32_t i;
+
+c2 = dsdb_class_by_governsID_id(schema, obj-&amp;gt;governsID_id);
+if (c2 == NULL) {
+goto done;
+}
+
+i = schema-&amp;gt;classes_to_remove_size;
+c = talloc_realloc(schema, schema-&amp;gt;classes_to_remove,
+   struct dsdb_class *, i + 1);
+if (c == NULL) {
+return WERR_NOMEM;
+}
+/* Mark the old class to be removed */
+c[i] = discard_const_p(struct dsdb_class, c2);
+schema-&amp;gt;classes_to_remove = c;
+schema-&amp;gt;classes_to_remove_size++;
+}
+
+done:
 DLIST_ADD(schema-&amp;gt;classes, obj);
 return WERR_OK;
 }
 
+WERROR dsdb_set_class_from_ldb(struct dsdb_schema *schema,
+       struct ldb_message *msg)
+{
+return dsdb_set_class_from_ldb_dups(schema, msg, false);
+}
+


&lt;/pre&gt;</description>
    <dc:creator>Andrew Bartlett</dc:creator>
    <dc:date>2013-05-23T12:19:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77876">
    <title>[SCM] CTDB repository - branch master updated - ctdb-2.1-162-g0577ce3</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77876</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  0577ce3c68e4febf49a1ef5093e918db9d5ec636 (commit)
       via  9d4524d13cbba21bfaf61bd35667984359b379b3 (commit)
       via  d18fcfff674e876abde8d51afec92d9c4a090d2f (commit)
       via  939d12b96a0cbebbe6269fa2b14f584058dd6174 (commit)
       via  14bd0b6961ef1294e9cba74ce875386b7dfbf446 (commit)
       via  a8605f7e06076e7edf84e0cc160fd3d9ab5c4b64 (commit)
       via  3105f9e291d0792199ac9e689f6d0e0a47ee4b0d (commit)
       via  d29e9a420b133088bf23a847c8d1dbce56c25eb0 (commit)
       via  1f96ea08f9a39dfe537c9b957ac512c84dc76f91 (commit)
       via  3c3df1d6afec7e3e721f9bcd4e8b8e008fd6e50b (commit)
       via  4a8d90d0812a3242f58a2a0e2aa0f528f60f7013 (commit)
       via  f1619a36c1beba11533052dc5728fa3adaa08870 (commit)
       via  e6b6b793f61556c21e8daf34abf89ee7b388ecfb (commit)
      from  0c0752515b66661ffae24be5f138bd2fab4dec5c (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0577ce3c68e4febf49a1ef5093e918db9d5ec636
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Thu May 23 13:04:06 2013 +1000

    tools/ctdb: Fix racy ipreallocate code
    
    This code tried to find the recovery master and send an ipreallocate
    request to that node.  When a node is stopped, this code asked the
    stopped node for recovery master.  Stopped node does not have up-to-date
    information on the current recovery master.  So ipreallocate requests
    were sent to the wrong node and ignored by that node which is not the
    recovery master.
    
    Send ipreallocate request to all active nodes.  That way we guarantee
    that the current recovery master will see it and respond to it.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
    Pair-Programmed-With: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 9d4524d13cbba21bfaf61bd35667984359b379b3
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 22 15:37:46 2013 +1000

    ctdbd: Print version string in the daemon startup
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit d18fcfff674e876abde8d51afec92d9c4a090d2f
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 22 14:23:17 2013 +1000

    build: Rename version.h to ctdb_version.h
    
    This avoids clash with version.h from Samba tree.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 939d12b96a0cbebbe6269fa2b14f584058dd6174
Author: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Thu May 9 15:43:10 2013 +1000

    logging: Fix a bug in ringbuffer
    
    When ringbuffer is full, it does not return any entries.  Simplify
    ringbuffer logic by keeping track of number of log entries rather than
    last entry.
    
    Signed-off-by: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;
    Pair-Programmed-With: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 14bd0b6961ef1294e9cba74ce875386b7dfbf446
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon May 13 15:27:04 2013 +1000

    recoverd: takeover_run_core() should not use modified node flags
    
    Modifying the node flags with IP-allocation-only flags is not
    necessary.  It causes breakage if the flags are not cleared after use.
    ctdb_takeover_run() no longer needs the general node flags - it only
    needs the IP flags.
    
    Instead of modifying the node flags in nodemap, construct a custom IP
    flags list and have takeover_run_core() use that instead of node
    flags.  As well as being safer, this makes the IP allocation code more
    self contained and a little bit clearer.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit a8605f7e06076e7edf84e0cc160fd3d9ab5c4b64
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Mon May 20 10:47:07 2013 +1000

    ctdbd: Update confusing log message
    
    Inactive can also mean stopped.  To add information, just print the
    flags instead.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 3105f9e291d0792199ac9e689f6d0e0a47ee4b0d
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri May 17 16:46:41 2013 +1000

    Packaging: maketarball.sh should be a bash script due to pushd use
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit d29e9a420b133088bf23a847c8d1dbce56c25eb0
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Fri May 17 16:42:25 2013 +1000

    scripts: Rework notify.sh to use notify.d/ directory
    
    This makes it easier to add notification handlers.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 1f96ea08f9a39dfe537c9b957ac512c84dc76f91
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 14 16:20:32 2013 +1000

    ctdbd: Log a message when recovery master changes
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
    Pair-Programmed-With: Amitay Isaacs &amp;lt;amitay&amp;lt; at &amp;gt;gmail.com&amp;gt;

commit 3c3df1d6afec7e3e721f9bcd4e8b8e008fd6e50b
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 14 15:38:08 2013 +1000

    ctdbd: Log add and delete of IPs
    
    At the moment, when someone deletes all the IPs on a node, all we see
    are the release IP messages and we have to guess why.
    
    Some would argue that add/release are more significant than
    take/release so they should be logged.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit 4a8d90d0812a3242f58a2a0e2aa0f528f60f7013
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 14 15:30:53 2013 +1000

    ctdbd: Removed bogus comment in ctdb_find_iface()
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit f1619a36c1beba11533052dc5728fa3adaa08870
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Tue May 14 14:56:26 2013 +1000

    eventscripts: Fix regression in _loadconfig()
    
    fff88940f71058e4eefd65f50a6701389c005c17 introduced a regression.
    Without $service_name set by default, the CTDB configuration is no
    longer loaded when loadconfig() is called without any arguments.
    That's bad.
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

commit e6b6b793f61556c21e8daf34abf89ee7b388ecfb
Author: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;
Date:   Thu May 9 20:44:11 2013 +1000

    initscript: If CTDB doesn't become ready, print a message before killing
    
    Signed-off-by: Martin Schwenke &amp;lt;martin&amp;lt; at &amp;gt;meltin.net&amp;gt;

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

Summary of changes:
 Makefile.in                     |    4 +-
 common/ctdb_logging.c           |   62 +++++-------
 config/ctdb.init                |    1 +
 config/functions                |    9 ++-
 config/notify.d.README          |   44 ++++++++
 config/notify.sh                |   66 ++++--------
 packaging/RPM/ctdb.spec.in      |    2 +
 packaging/RPM/makerpms.sh       |    2 +-
 packaging/maketarball.sh        |    4 +-
 packaging/mkversion.sh          |    2 +-
 server/ctdb_daemon.c            |    4 +-
 server/ctdb_ltdb_server.c       |    2 +-
 server/ctdb_recover.c           |   15 +++-
 server/ctdb_takeover.c          |  215 +++++++++++++++++++++------------------
 tests/src/ctdb_takeover_tests.c |   45 +++++----
 tools/ctdb.c                    |   87 ++++------------
 16 files changed, 291 insertions(+), 273 deletions(-)
 create mode 100755 config/notify.d.README


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 86b4870..9f94aee 100755
--- a/Makefile.in
+++ b/Makefile.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -63,7 +63,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; SHLD=${CC} ${CFLAGS} ${LDSHFLAGS} -o $&amp;lt; at &amp;gt;
 LIB_FLAGS=&amp;lt; at &amp;gt;LDFLAGS&amp;lt; at &amp;gt; -Llib &amp;lt; at &amp;gt;LIBS&amp;lt; at &amp;gt; $(POPT_LIBS) $(TALLOC_LIBS) $(TEVENT_LIBS) $(TDB_LIBS) \
   &amp;lt; at &amp;gt;INFINIBAND_LIBS&amp;lt; at &amp;gt; &amp;lt; at &amp;gt;CTDB_PCAP_LDFLAGS&amp;lt; at &amp;gt;
 
-CTDB_VERSION_H = include/version.h
+CTDB_VERSION_H = include/ctdb_version.h
 
 UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util.o \
 lib/util/util_time.o lib/util/util_file.o lib/util/fault.o lib/util/substitute.o \
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -319,6 +319,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; install: all manpages $(PMDA_INSTALL)
 mkdir -p $(DESTDIR)$(etcdir)/ctdb/events.d
 mkdir -p $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d
 mkdir -p $(DESTDIR)$(etcdir)/sudoers.d/
+mkdir -p $(DESTDIR)$(etcdir)/ctdb/notify.d
 mkdir -p $(DESTDIR)$(docdir)/ctdb
 ${INSTALLCMD} -m 644 ctdb.pc $(DESTDIR)$(libdir)/pkgconfig
 ${INSTALLCMD} -m 755 bin/ctdb $(DESTDIR)$(bindir)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -376,6 +377,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; install: all manpages $(PMDA_INSTALL)
 if [ -f doc/ltdbtool.1.html ];then ${INSTALLCMD} -m 644 doc/ltdbtool.1.html $(DESTDIR)$(docdir)/ctdb; fi
 if [ -f doc/ping_pong.1.html ];then ${INSTALLCMD} -m 644 doc/ping_pong.1.html $(DESTDIR)$(docdir)/ctdb; fi
 if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
+if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.d/README ];then ${INSTALLCMD} -m 755 config/notify.d.README $(DESTDIR)$(etcdir)/ctdb/notify.d/README ; fi
 ${INSTALLCMD} -m 755 config/debug-hung-script.sh $(DESTDIR)$(etcdir)/ctdb
 if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
 if [ ! -f $(DESTDIR)$(etcdir)/ctdb/gcore_trace.sh ];then ${INSTALLCMD} -m 755 config/gcore_trace.sh $(DESTDIR)$(etcdir)/ctdb; fi
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index de5ca6e..339198b 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -27,8 +27,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int log_ringbuf_size;
 
 #define MAX_LOG_SIZE 128
 
-static int first_entry;
-static int last_entry;
+static int first_entry = 0;
+static int ringbuf_count = 0;
 
 struct ctdb_log_entry {
 int32_t level;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -45,6 +45,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct ctdb_log_entry *log_entries;
 static void log_ringbuffer_v(const char *format, va_list ap)
 {
 int ret;
+int next_entry;
 
 if (log_entries == NULL &amp;amp;&amp;amp; log_ringbuf_size != 0) {
 /* Hope this works. We cant log anything if it doesnt anyway */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -54,25 +55,24 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void log_ringbuffer_v(const char *format, va_list ap)
 return;
 }
 
-log_entries[last_entry].message[0] = '\0';
+next_entry = (first_entry + ringbuf_count) % log_ringbuf_size;
 
-ret = vsnprintf(&amp;amp;log_entries[last_entry].message[0], MAX_LOG_SIZE, format, ap);
+if (ringbuf_count &amp;gt; 0 &amp;amp;&amp;amp; first_entry == next_entry) {
+first_entry = (first_entry + 1) % log_ringbuf_size;
+}
+
+log_entries[next_entry].message[0] = '\0';
+
+ret = vsnprintf(&amp;amp;log_entries[next_entry].message[0], MAX_LOG_SIZE, format, ap);
 if (ret == -1) {
 return;
 }
 
-log_entries[last_entry].level = this_log_level;
-log_entries[last_entry].t = timeval_current();
+log_entries[next_entry].level = this_log_level;
+log_entries[next_entry].t = timeval_current();
 
-last_entry++;
-if (last_entry &amp;gt;= log_ringbuf_size) {
-last_entry = 0;
-}
-if (first_entry == last_entry) {
-first_entry++;
-}
-if (first_entry &amp;gt;= log_ringbuf_size) {
-first_entry = 0;
+if (ringbuf_count &amp;lt; log_ringbuf_size) {
+ringbuf_count++;
 }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -100,8 +100,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr *log_a
 FILE *f;
 long fsize;
 int tmp_entry;
-int count = 0;
-DEBUG(DEBUG_ERR,("Marshalling log entries  first:%d last:%d\n", first_entry, last_entry));
+struct tm *tm;
+char tbuf[100];
+int i;
+
+DEBUG(DEBUG_ERR,("Marshalling %d log entries\n", ringbuf_count));
 
 /* dump to a file, then send the file as a blob */
 f = tmpfile();
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -110,20 +113,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr *log_a
 return;
 }
 
-tmp_entry = first_entry;
-while (tmp_entry != last_entry) {
-struct tm *tm;
-char tbuf[100];
-
-if (log_entries == NULL) {
-break;
-}
+for (i=0; i&amp;lt;ringbuf_count; i++) {
+tmp_entry = (first_entry + i) % log_ringbuf_size;
 
 if (log_entries[tmp_entry].level &amp;gt; log_addr-&amp;gt;level) {
-tmp_entry++;
-if (tmp_entry &amp;gt;= log_ringbuf_size) {
-tmp_entry = 0;
-}
  continue;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -131,12 +124,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr *log_a
 strftime(tbuf, sizeof(tbuf)-1,"%Y/%m/%d %H:%M:%S", tm);
 
 if (log_entries[tmp_entry].message) {
-count += fprintf(f, "%s:%s %s", tbuf, get_debug_by_level(log_entries[tmp_entry].level), log_entries[tmp_entry].message);
-}
-
-tmp_entry++;
-if (tmp_entry &amp;gt;= log_ringbuf_size) {
-tmp_entry = 0;
+fprintf(f, "%s:%s %s", tbuf,
+get_debug_by_level(log_entries[tmp_entry].level),
+log_entries[tmp_entry].message);
 }
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -184,7 +174,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_get_log(struct ctdb_context *ctdb, TDB_DATA addr)
 void ctdb_clear_log(struct ctdb_context *ctdb)
 {
 first_entry = 0;
-last_entry  = 0;
+ringbuf_count  = 0;
 }
 
 int32_t ctdb_control_clear_log(struct ctdb_context *ctdb)
diff --git a/config/ctdb.init b/config/ctdb.init
index 013e1ae..6c4e16d 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -288,6 +288,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; start() {
     if [ $RETVAL -eq 0 ] ; then
 if ! wait_until_ready ; then
     RETVAL=1
+    echo "Timed out waiting for initialisation - killing CTDB"
     pkill -9 -f $ctdbd &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
 fi
     fi
diff --git a/config/functions b/config/functions
index 4f31d84..5778420 100755
--- a/config/functions
+++ b/config/functions
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -23,11 +23,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; _loadconfig() {
 foo="${service_config:-${service_name}}"
 if [ -n "$foo" ] ; then
     loadconfig "$foo"
+    return
 fi
-    elif [ "$1" != "ctdb" ] ; then
+    fi
+
+    if [ "$1" != "ctdb" ] ; then
 loadconfig "ctdb"
     fi
 
+    if [ -z "$1" ] ; then
+return
+    fi
+
     if [ -f $CTDB_ETCDIR/sysconfig/$1 ]; then
 . $CTDB_ETCDIR/sysconfig/$1
     elif [ -f $CTDB_ETCDIR/default/$1 ]; then
diff --git a/config/notify.d.README b/config/notify.d.README
new file mode 100755
index 0000000..ffce7fa
--- /dev/null
+++ b/config/notify.d.README
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,44 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+This directory should contain executable programs to handle CTDB event
+notifications.  The first and only argument passed to each program is
+the event, which is one of:
+
+  init, setup, startup, unhealthy, healthy
+
+To use notifications with this directory then you need to set:
+
+  CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
+
+in your CTDB configuration file.
+
+An example script that sends SNMP traps for unhealthy/healthy might
+look like this:
+
+  #!/bin/sh
+
+  case "$1" in
+      unhealthy)
+          # Send an SNMP trap saying that the node is unhealthy:
+          snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
+              $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 1
+          ;;
+      healthy)
+          # Send an SNMP trap saying that the node is healthy again:
+          snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb \
+      $(hostname) 0 0 $(date +"%s") ctdb.nodeHealth.0 i 0
+  ;;
+  esac
+
+Alternatively, email could be sent:
+
+  #!/bin/sh
+
+  case "$1" in
+      unhealthy)
+          mail -s "$(hostname) is UNHEALTHY" foo&amp;lt; at &amp;gt;example.com &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
+          ;;
+      healthy)
+          mail -s "$(hostname) is HEALTHY" foo&amp;lt; at &amp;gt;example.com &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
+          ;;
+  esac
+
+When adding programs please note the exclusion patterns in notify.sh.
diff --git a/config/notify.sh b/config/notify.sh
index 8d3eb87..dfcb81a 100755
--- a/config/notify.sh
+++ b/config/notify.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3,47 +3,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 # This script is activated by setting CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
 # in /etc/sysconfig/ctdb
 
-# This is script is invoked from ctdb when node UNHEALTHY flag changes.
-# and can be used to send SNMPtraps, email, etc
-# when the status of a node changes
-
-
-event="$1"
-shift
-
-case $event in
-unhealthy)
-#
-#               Send an snmptrap that the node is unhealthy :
-#snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb `hostname` 0 0 `date +"%s"` ctdb.nodeHealth.0 i 1
-#
-#               or send an email :
-#               mail foo&amp;lt; at &amp;gt;bar -s "`hostname` is UNHEALTHY"   ...
-#
-#               or do something else ...
-;;
-healthy)
-#
-#               Send an snmptrap that the node is healthy again :
-#snmptrap -m ALL -v 1 -c public 10.1.1.105 ctdb `hostname` 0 0 `date +"%s"` ctdb.nodeHealth.0 i 0
-#
-#               or send an email :
-#               mail foo&amp;lt; at &amp;gt;bar -s "`hostname` is HEALTHY"   ...
-#
-#               or do something else ...
-;;
-startup)
-#do some extra magic when ctdb has finished the initial
-#recovery?
-;;
-
-setup)
-#do some extra magic when ctdb has setup itself?
-;;
-
-init)
-#do some extra magic when ctdb has started?
-;;
-esac
-
-exit 0
+# This is script is invoked from ctdb when certain events happen.  See
+# /etc/ctdb/notify.d/README for more details.
+
+d=$(dirname $0)
+nd="${d}/notify.d"
+
+ok=true
+
+for i in "${nd}/"* ; do
+    # Don't run files matching basename
+    case "${i##*/}" in
+*~|*,|*.rpm*|*.swp|README) continue ;;
+    esac
+
+    # Files must be executable
+    [ -x "$i" ] || continue
+
+    # Flag failures
+    "$i" "$1" || ok=false
+done
+
+$ok
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 83261c5..910b59a 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -127,6 +127,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/ctdb/gcore_trace.sh
 %config(noreplace) %{_sysconfdir}/ctdb/functions
 %attr(755,root,root) %{initdir}/ctdb
+%attr(755,root,root) %{_sysconfdir}/ctdb/notify.d
 
 %{_docdir}/ctdb/README
 %{_docdir}/ctdb/COPYING
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -162,6 +163,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/40.mountd.check
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/50.rquotad.check
 %{_sysconfdir}/ctdb/statd-callout
+%{_sysconfdir}/ctdb/notify.d/README
 %{_sbindir}/ctdbd
 %{_bindir}/ctdb
 %{_bindir}/smnotify
diff --git a/packaging/RPM/makerpms.sh b/packaging/RPM/makerpms.sh
index c216185..d3bda52 100755
--- a/packaging/RPM/makerpms.sh
+++ b/packaging/RPM/makerpms.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -52,7 +52,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; mkdir -p `rpm --eval %_rpmdir`/noarch
 mkdir -p `rpm --eval %_rpmdir`/i386
 mkdir -p `rpm --eval %_rpmdir`/x86_64
 
-VERSION=$(${TOPDIR}/packaging/mkversion.sh ${TOPDIR}/include/version.h)
+VERSION=$(${TOPDIR}/packaging/mkversion.sh ${TOPDIR}/include/ctdb_version.h)
 if [ -z "$VERSION" ]; then
     exit 1
 fi
diff --git a/packaging/maketarball.sh b/packaging/maketarball.sh
index 221fede..be19869 100755
--- a/packaging/maketarball.sh
+++ b/packaging/maketarball.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,4 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
-#!/bin/sh
+#!/bin/bash
 #
 # maketarball.sh - create a tarball from the git branch HEAD
 #
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -35,7 +35,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; fi
 TAR_PREFIX_TMP="ctdb-tmp"
 SPECFILE=/tmp/${TAR_PREFIX_TMP}/packaging/RPM/ctdb.spec
 SPECFILE_IN=${SPECFILE}.in
-VERSION_H=/tmp/${TAR_PREFIX_TMP}/include/version.h
+VERSION_H=/tmp/${TAR_PREFIX_TMP}/include/ctdb_version.h
 
 if echo | gzip -c --rsyncable - &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 ; then
 GZIP="gzip -9 --rsyncable"
diff --git a/packaging/mkversion.sh b/packaging/mkversion.sh
index 18b432a..4a80b25 100755
--- a/packaging/mkversion.sh
+++ b/packaging/mkversion.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,7 +25,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 OUTPUT=$1
 
 if [ -z "$OUTPUT" ]; then
-    OUTPUT="include/version.h"
+    OUTPUT="include/ctdb_version.h"
 fi
 
 # We use tags and determine the version, as follows:
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index d8edcee..d2df115 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -24,6 +24,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "system/network.h"
 #include "system/filesys.h"
 #include "system/wait.h"
+#include "../include/ctdb_version.h"
 #include "../include/ctdb_client.h"
 #include "../include/ctdb_private.h"
 #include "../common/rb_tree.h"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1174,7 +1175,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 
 ctdbd_pid = getpid();
 ctdb-&amp;gt;ctdbd_pid = ctdbd_pid;
-DEBUG(DEBUG_ERR, ("Starting CTDBD as PID: %u\n", ctdbd_pid));
+DEBUG(DEBUG_ERR, ("Starting CTDBD (Version %s) as PID: %u\n",
+  CTDB_VERSION_STRING, ctdbd_pid));
 ctdb_create_pidfile(ctdb-&amp;gt;ctdbd_pid);
 
 if (ctdb-&amp;gt;do_setsched) {
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index 4f77934..8b06703 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1082,7 +1082,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
    databases
 */
 if (node-&amp;gt;flags &amp;amp; NODE_FLAGS_INACTIVE) {
-DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
+DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (flags=0x%x)\n", db_name, node-&amp;gt;flags));
 return -1;
 }
 
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 2e9408f..7fd0ac3 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1350,9 +1350,22 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb)
 
 int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata)
 {
+uint32_t new_recmaster;
+
 CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
+new_recmaster = ((uint32_t *)(&amp;amp;indata.dptr[0]))[0];
+
+if (ctdb-&amp;gt;pnn != new_recmaster &amp;amp;&amp;amp; ctdb-&amp;gt;recovery_master == ctdb-&amp;gt;pnn) {
+DEBUG(DEBUG_NOTICE,
+      ("This node (%u) is no longer the recovery master\n", ctdb-&amp;gt;pnn));
+}
+
+if (ctdb-&amp;gt;pnn == new_recmaster &amp;amp;&amp;amp; ctdb-&amp;gt;recovery_master != new_recmaster) {
+DEBUG(DEBUG_NOTICE,
+      ("This node (%u) is now the recovery master\n", ctdb-&amp;gt;pnn));
+}
 
-ctdb-&amp;gt;recovery_master = ((uint32_t *)(&amp;amp;indata.dptr[0]))[0];
+ctdb-&amp;gt;recovery_master = new_recmaster;
 return 0;
 }
 
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 24c6298..3d78205 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -33,11 +33,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #define CTDB_ARP_INTERVAL 1
 #define CTDB_ARP_REPEAT   3
 
-/* These flags are ONLY valid within IP allocation code and must be
- * cleared to avoid confusing other recovery daemon functions
- */
-#define NODE_FLAGS_NOIPTAKEOVER0x01000000 /* can not takeover additional IPs */
-#define NODE_FLAGS_NOIPHOST0x02000000 /* can not host IPs */
+/* Flags used in IP allocation algorithms. */
+struct ctdb_ipflags {
+bool noiptakeover;
+bool noiphost;
+};
 
 struct ctdb_iface {
 struct ctdb_iface *prev, *next;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -164,7 +164,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct ctdb_iface *ctdb_find_iface(struct ctdb_context *ctdb,
 {
 struct ctdb_iface *i;
 
-/* Verify that we dont have an entry for this ip yet */
 for (i=ctdb-&amp;gt;ifaces;i;i=i-&amp;gt;next) {
 if (strcmp(i-&amp;gt;name, iface) == 0) {
 return i;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1309,13 +1308,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int node_ip_coverage(struct ctdb_context *ctdb,
  * node and is NOIPHOST unset?
 */
 static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn, 
-     struct ctdb_node_map *nodemap,
+     struct ctdb_ipflags ipflags,
      struct ctdb_public_ip_list *ip)
 {
 struct ctdb_all_public_ips *public_ips;
 int i;
 
-if (nodemap-&amp;gt;nodes[pnn].flags &amp;amp; NODE_FLAGS_NOIPHOST) {
+if (ipflags.noiphost) {
 return false;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1336,14 +1335,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
 }
 
 static bool can_node_takeover_ip(struct ctdb_context *ctdb, int32_t pnn, 
- struct ctdb_node_map *nodemap,
+ struct ctdb_ipflags ipflags,
  struct ctdb_public_ip_list *ip)
 {
-if (nodemap-&amp;gt;nodes[pnn].flags &amp;amp; NODE_FLAGS_NOIPTAKEOVER) {
+if (ipflags.noiptakeover) {
 return false;
 }
 
-return can_node_host_ip(ctdb, pnn, nodemap, ip);
+return can_node_host_ip(ctdb, pnn, ipflags, ip);


&lt;/pre&gt;</description>
    <dc:creator>Amitay Isaacs</dc:creator>
    <dc:date>2013-05-23T09:11:11</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77875">
    <title>[SCM] Samba Shared Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77875</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  bea2af9 Revert my accidental commit.
      from  9ddfd7d lib/replace: Set BROKEN_STRNLEN and BROKEN_STRNDUP on all AIX

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


- Log -----------------------------------------------------------------
commit bea2af9369d596d513ae3909f9c6a1f356f7c827
Author: Richard Sharpe &amp;lt;realrichardsharpe&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Wed May 22 20:05:17 2013 -0700

    Revert my accidental commit.
    
    Signed-off-by: Richard Sharpe &amp;lt;rsharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Richard Sharpe &amp;lt;sharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Thu May 23 06:53:17 CEST 2013 on sn-devel-104

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

Summary of changes:
 source3/smbd/smb2_server.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 73df368..b031c6d 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -997,7 +997,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn,
  const char *reason,
  const char *location)
 {
-DEBUG(0,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
+DEBUG(10,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
   reason, location));
 exit_server_cleanly(reason);
 }


&lt;/pre&gt;</description>
    <dc:creator>Richard Sharpe</dc:creator>
    <dc:date>2013-05-23T04:54:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77874">
    <title>[SCM] Samba Shared Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77874</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  9ddfd7d lib/replace: Set BROKEN_STRNLEN and BROKEN_STRNDUP on all AIX
       via  e896f3c docs: Fix small errors in TOSHARG-Compiling
       via  f632150 docs: Remove TOSHARG-HighAvailability which is made obsolete by CTDB
       via  fa8e760 docs: Remove out of date and unmaintained Speed page from the HOWTO
       via  7174b2e When message-type is drvupgrade, MSG_DEBUG should be replaced with MSG_PRINTER_DRVUPGRADE.
       via  9a9949f When '--policies-reset' is success, the exit code should be 0.
      from  30a2243 build: Update md5.h detection in waf and autoconf to use sys/md5.h and -lmd

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


- Log -----------------------------------------------------------------
commit 9ddfd7d8784e6f546628f48990b69ee2850be52d
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Wed May 22 17:23:30 2013 +1000

    lib/replace: Set BROKEN_STRNLEN and BROKEN_STRNDUP on all AIX
    
    The background is in https://bugzilla.samba.org/show_bug.cgi?id=1097
    and wider reports are at
    http://stackoverflow.com/questions/2091460/strndup-call-is-currupting-stack-frames
    
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Thu May 23 03:52:10 CEST 2013 on sn-devel-104

commit e896f3c5bf5dee3c771985cd9dd2eb376481c22b
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue May 21 20:44:26 2013 +1000

    docs: Fix small errors in TOSHARG-Compiling
    
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;

commit f632150e1b5a8d8a32753f43f7433b392f3a2136
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue May 21 20:50:30 2013 +1000

    docs: Remove TOSHARG-HighAvailability which is made obsolete by CTDB
    
    This is mostly a lament on why this is hard, and while CTDB is still
    hard, this document tries to imply it is almost impossible, and makes
    no mention of the solution.
    
    Andrew Bartlett
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;

commit fa8e760882ea389f8c94d6dfdc7386b0295974d1
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue May 21 17:49:55 2013 +1000

    docs: Remove out of date and unmaintained Speed page from the HOWTO
    
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 7174b2e18ece47b6c662020b38b279dfdf88a929
Author: Peng Haitao &amp;lt;penght&amp;lt; at &amp;gt;cn.fujitsu.com&amp;gt;
Date:   Wed May 22 14:03:13 2013 -0700

    When message-type is drvupgrade, MSG_DEBUG should be replaced with MSG_PRINTER_DRVUPGRADE.
    
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;
    Reviewed-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 9a9949f92f90bd4305607350dea2672473397752
Author: Peng Haitao &amp;lt;penght&amp;lt; at &amp;gt;cn.fujitsu.com&amp;gt;
Date:   Wed May 22 14:02:29 2013 -0700

    When '--policies-reset' is success, the exit code should be 0.
    
    Reviewed-by: Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;
    Reviewed-by: Michael Adam &amp;lt;obnox&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 docs-xml/Samba3-HOWTO/TOSHARG-Compiling.xml        |    6 +-
 docs-xml/Samba3-HOWTO/TOSHARG-HighAvailability.xml |  500 --------------------
 docs-xml/Samba3-HOWTO/TOSHARG-Speed.xml            |  327 -------------
 docs-xml/Samba3-HOWTO/index.xml                    |    4 -
 lib/replace/wscript                                |   13 +
 source3/utils/pdbedit.c                            |    2 +-
 source3/utils/smbcontrol.c                         |    2 +-
 7 files changed, 18 insertions(+), 836 deletions(-)
 delete mode 100644 docs-xml/Samba3-HOWTO/TOSHARG-HighAvailability.xml
 delete mode 100644 docs-xml/Samba3-HOWTO/TOSHARG-Speed.xml


Changeset truncated at 500 lines:

diff --git a/docs-xml/Samba3-HOWTO/TOSHARG-Compiling.xml b/docs-xml/Samba3-HOWTO/TOSHARG-Compiling.xml
index ac866a8..3a2b729 100644
--- a/docs-xml/Samba3-HOWTO/TOSHARG-Compiling.xml
+++ b/docs-xml/Samba3-HOWTO/TOSHARG-Compiling.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -119,7 +119,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; gpg: BAD signature from &amp;lt;quote&amp;gt;Samba Distribution Verification Key&amp;lt;/quote&amp;gt;
 &amp;lt;para&amp;gt;
 &amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;configure&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
 To build the binaries, run the program &amp;lt;userinput&amp;gt;./configure
-&amp;lt;/userinput&amp;gt; in the top level director of the source tree. This should automatically 
+&amp;lt;/userinput&amp;gt; in the top level directory of the source tree. This should automatically
 configure Samba for your operating system. If you have unusual 
 needs, then you may wish to first run:
 &amp;lt;screen&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -177,7 +177,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; gpg: BAD signature from &amp;lt;quote&amp;gt;Samba Distribution Verification Key&amp;lt;/quote&amp;gt;
 
 &amp;lt;para&amp;gt;
 After you run configure, make sure that the 
-&amp;lt;filename&amp;gt;bin/include/config.h&amp;lt;/filename&amp;gt; it generates contain lines like this:
+&amp;lt;filename&amp;gt;bin/default/include/config.h&amp;lt;/filename&amp;gt; it generates contain lines like this:
 &amp;lt;programlisting&amp;gt;
 #define HAVE_KRB5 1
 #define HAVE_LDAP 1
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -186,7 +186,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; gpg: BAD signature from &amp;lt;quote&amp;gt;Samba Distribution Verification Key&amp;lt;/quote&amp;gt;
 
 &amp;lt;para&amp;gt;
 If it does not, configure did not find your KRB5 libraries or
-your LDAP libraries. Look in &amp;lt;filename&amp;gt;config.log&amp;lt;/filename&amp;gt; to figure
+your LDAP libraries. Look in &amp;lt;filename&amp;gt;bin/config.log&amp;lt;/filename&amp;gt; to figure
 out why and fix it.
 &amp;lt;/para&amp;gt;
 
diff --git a/docs-xml/Samba3-HOWTO/TOSHARG-HighAvailability.xml b/docs-xml/Samba3-HOWTO/TOSHARG-HighAvailability.xml
deleted file mode 100644
index 1ce81d4..0000000
--- a/docs-xml/Samba3-HOWTO/TOSHARG-HighAvailability.xml
+++ /dev/null
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,500 +0,0 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
-&amp;lt;?xml version="1.0" encoding="iso-8859-1"?&amp;gt;
-&amp;lt;!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc"&amp;gt;
-&amp;lt;chapter id="SambaHA"&amp;gt;
-&amp;lt;chapterinfo&amp;gt;
-&amp;amp;author.jht;
-&amp;amp;author.jeremy;
-&amp;lt;/chapterinfo&amp;gt;
-
-&amp;lt;title&amp;gt;High Availability&amp;lt;/title&amp;gt;
-
-&amp;lt;sect1&amp;gt;
-&amp;lt;title&amp;gt;Features and Benefits&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;availability&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;intolerance&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;vital task&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Network administrators are often concerned about the availability of file and print
-services. Network users are inclined toward intolerance of the services they depend
-on to perform vital task responsibilities.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-A sign in a computer room served to remind staff of their responsibilities. It read:
-&amp;lt;/para&amp;gt;
-
-&amp;lt;blockquote&amp;gt;
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;fail&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;managed by humans&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;economically wise&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;anticipate failure&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-All humans fail, in both great and small ways we fail continually. Machines fail too.
-Computers are machines that are managed by humans, the fallout from failure
-can be spectacular. Your responsibility is to deal with failure, to anticipate it
-and to eliminate it as far as is humanly and economically wise to achieve.
-Are your actions part of the problem or part of the solution?
-&amp;lt;/para&amp;gt;
-&amp;lt;/blockquote&amp;gt;
-
-&amp;lt;para&amp;gt;
-If we are to deal with failure in a planned and productive manner, then first we must
-understand the problem. That is the purpose of this chapter.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;high availability&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;CIFS/SMB&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;state of knowledge&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Parenthetically, in the following discussion there are seeds of information on how to
-provision a network infrastructure against failure. Our purpose here is not to provide
-a lengthy dissertation on the subject of high availability. Additionally, we have made
-a conscious decision to not provide detailed working examples of high availability
-solutions; instead we present an overview of the issues in the hope that someone will
-rise to the challenge of providing a detailed document that is focused purely on
-presentation of the current state of knowledge and practice in high availability as it
-applies to the deployment of Samba and other CIFS/SMB technologies.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect1&amp;gt;
-
-&amp;lt;sect1&amp;gt;
-&amp;lt;title&amp;gt;Technical Discussion&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SambaXP conference&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Germany&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;inspired structure&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-The following summary was part of a presentation by Jeremy Allison at the SambaXP 2003
-conference that was held at Goettingen, Germany, in April 2003. Material has been added
-from other sources, but it was Jeremy who inspired the structure that follows.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;sect2&amp;gt;
-&amp;lt;title&amp;gt;The Ultimate Goal&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;clustering technologies&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;affordable power&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;unstoppable services&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-All clustering technologies aim to achieve one or more of the following:
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Obtain the maximum affordable computational power.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Obtain faster program execution.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Deliver unstoppable services.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Avert points of failure.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Exact most effective utilization of resources.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;para&amp;gt;
-A clustered file server ideally has the following properties:
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;clustered file server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;connect transparently&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;transparently reconnected&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;distributed file system&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;All clients can connect transparently to any server.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;A server can fail and clients are transparently reconnected to another server.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;All servers serve out the same set of files.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;All file changes are immediately seen on all servers.&amp;lt;/para&amp;gt;
-&amp;lt;itemizedlist&amp;gt;&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Requires a distributed file system.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;&amp;lt;/itemizedlist&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Infinite ability to scale by adding more servers or disks.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;/sect2&amp;gt;
-
-&amp;lt;sect2&amp;gt;
-&amp;lt;title&amp;gt;Why Is This So Hard?&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-In short, the problem is one of &amp;lt;emphasis&amp;gt;state&amp;lt;/emphasis&amp;gt;.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;state information&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-All TCP/IP connections are dependent on state information.
-&amp;lt;/para&amp;gt;
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;TCP failover&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-The TCP connection involves a packet sequence number. This
-sequence number would need to be dynamically updated on all
-machines in the cluster to effect seamless TCP failover.
-&amp;lt;/para&amp;gt;
-&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;CIFS/SMB&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;TCP&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-CIFS/SMB (the Windows networking protocols) uses TCP connections.
-&amp;lt;/para&amp;gt;
-&amp;lt;para&amp;gt;
-This means that from a basic design perspective, failover is not
-seriously considered.
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-All current SMB clusters are failover solutions
-&amp;amp;smbmdash; they rely on the clients to reconnect. They provide server
-failover, but clients can lose information due to a server failure.
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;server failure&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-&amp;lt;/para&amp;gt;
-&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;
-&amp;lt;para&amp;gt;
-Servers keep state information about client connections.
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;state&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;CIFS/SMB involves a lot of state.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Every file open must be compared with other open files
-to check share modes.&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-&amp;lt;/para&amp;gt;
-&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;The Front-End Challenge&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;cluster servers&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;single server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;TCP data streams&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;front-end virtual server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;virtual server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;de-multiplex&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-To make it possible for a cluster of file servers to appear as a single server that has one
-name and one IP address, the incoming TCP data streams from clients must be processed by the
-front-end virtual server. This server must de-multiplex the incoming packets at the SMB protocol
-layer level and then feed the SMB packet to different servers in the cluster.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;IPC$ connections&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;RPC calls&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-One could split all IPC$ connections and RPC calls to one server to handle printing and user
-lookup requirements. RPC printing handles are shared between different IPC4 sessions &amp;amp;smbmdash; it is
-hard to split this across clustered servers!
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-Conceptually speaking, all other servers would then provide only file services. This is a simpler
-problem to concentrate on.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;Demultiplexing SMB Requests&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB requests&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB state information&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;front-end virtual server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;complicated problem&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-De-multiplexing of SMB requests requires knowledge of SMB state information,
-all of which must be held by the front-end &amp;lt;emphasis&amp;gt;virtual&amp;lt;/emphasis&amp;gt; server.
-This is a perplexing and complicated problem to solve.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;vuid&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;tid&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;fid&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Windows XP and later have changed semantics so state information (vuid, tid, fid)
-must match for a successful operation. This makes things simpler than before and is a
-positive step forward.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB requests&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Terminal Server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-SMB requests are sent by vuid to their associated server. No code exists today to
-effect this solution. This problem is conceptually similar to the problem of
-correctly handling requests from multiple requests from Windows 2000
-Terminal Server in Samba.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;de-multiplexing&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-One possibility is to start by exposing the server pool to clients directly.
-This could eliminate the de-multiplexing step.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;The Distributed File System Challenge&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Distributed File Systems&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-There exists many distributed file systems for UNIX and Linux.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;backend&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB semantics&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;share modes&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;locking&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;oplock&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;distributed file systems&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Many could be adopted to backend our cluster, so long as awareness of SMB
-semantics is kept in mind (share modes, locking, and oplock issues in particular).
-Common free distributed file systems include:
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;NFS&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;AFS&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;OpenGFS&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Lustre&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;NFS&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;AFS&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;OpenGFS&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;Lustre&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;server pool&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-The server pool (cluster) can use any distributed file system backend if all SMB
-semantics are performed within this pool.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;Restrictive Constraints on Distributed File Systems&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB services&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;oplock handling&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;server pool&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;backend file system pool&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Where a clustered server provides purely SMB services, oplock handling
-may be done within the server pool without imposing a need for this to
-be passed to the backend file system pool.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;NFS&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;interoperability&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-On the other hand, where the server pool also provides NFS or other file services,
-it will be essential that the implementation be oplock-aware so it can
-interoperate with SMB services. This is a significant challenge today. A failure
-to provide this interoperability will result in a significant loss of performance that will be
-sorely noted by users of Microsoft Windows clients.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-Last, all state information must be shared across the server pool.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;Server Pool Communications&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;POSIX semantics&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;POSIX locks&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SMB locks&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Most backend file systems support POSIX file semantics. This makes it difficult
-to push SMB semantics back into the file system. POSIX locks have different properties
-and semantics from SMB locks.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;smbd&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;tdb&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Clustered smbds&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-All &amp;lt;command&amp;gt;smbd&amp;lt;/command&amp;gt; processes in the server pool must of necessity communicate
-very quickly. For this, the current &amp;lt;parameter&amp;gt;tdb&amp;lt;/parameter&amp;gt; file structure that Samba
-uses is not suitable for use across a network. Clustered &amp;lt;command&amp;gt;smbd&amp;lt;/command&amp;gt;s must use something else.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;Server Pool Communications Demands&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-High-speed interserver communications in the server pool is a design prerequisite
-for a fully functional system. Possibilities for this include:
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Myrinet&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;scalable coherent interface&amp;lt;/primary&amp;gt;&amp;lt;see&amp;gt;SCI&amp;lt;/see&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-Proprietary shared memory bus (example: Myrinet or SCI [scalable coherent interface]).
-These are high-cost items.
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-Gigabit Ethernet (now quite affordable).
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-Raw Ethernet framing (to bypass TCP and UDP overheads).
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;para&amp;gt;
-We have yet to identify metrics for  performance demands to enable this to happen
-effectively.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-
-&amp;lt;sect3&amp;gt;
-&amp;lt;title&amp;gt;Required Modifications to Samba&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-Samba needs to be significantly modified to work with a high-speed server interconnect
-system to permit transparent failover clustering.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-Particular functions inside Samba that will be affected include:
-&amp;lt;/para&amp;gt;
-
-&amp;lt;itemizedlist&amp;gt;
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-The locking database, oplock notifications,
-and the share mode database.
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;failure semantics&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;oplock messages&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Failure semantics need to be defined. Samba behaves the same way as Windows.
-When oplock messages fail, a file open request is allowed, but this is 
-potentially dangerous in a clustered environment. So how should interserver
-pool failure semantics function, and how should such functionality be implemented?
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;&amp;lt;para&amp;gt;
-Should this be implemented using a point-to-point lock manager, or can this
-be done using multicast techniques?
-&amp;lt;/para&amp;gt;&amp;lt;/listitem&amp;gt;
-
-&amp;lt;/itemizedlist&amp;gt;
-
-&amp;lt;/sect3&amp;gt;
-&amp;lt;/sect2&amp;gt;
-
-&amp;lt;sect2&amp;gt;
-&amp;lt;title&amp;gt;A Simple Solution&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;failover servers&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;exported file system&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;distributed locking protocol&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Allowing failover servers to handle different functions within the exported file system
-removes the problem of requiring a distributed locking protocol.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;high-speed server interconnect&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;complex file name space&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-If only one server is active in a pair, the need for high-speed server interconnect is avoided.
-This allows the use of existing high-availability solutions, instead of inventing a new one.
-This simpler solution comes at a price &amp;amp;smbmdash; the cost of which is the need to manage a more
-complex file name space. Since there is now not a single file system, administrators
-must remember where all services are located &amp;amp;smbmdash; a complexity not easily dealt with.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;virtual server&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-The &amp;lt;emphasis&amp;gt;virtual server&amp;lt;/emphasis&amp;gt; is still needed to redirect requests to backend
-servers. Backend file space integrity is the responsibility of the administrator.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;/sect2&amp;gt;
-
-&amp;lt;sect2&amp;gt;
-&amp;lt;title&amp;gt;High-Availability Server Products&amp;lt;/title&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;resource failover&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;high-availability services&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;dedicated heartbeat&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;LAN&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;failover process&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Failover servers must communicate in order to handle resource failover. This is essential
-for high-availability services. The use of a dedicated heartbeat is a common technique to
-introduce some intelligence into the failover process. This is often done over a dedicated
-link (LAN or serial).
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;SCSI&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Red Hat Cluster Manager&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Microsoft Wolfpack&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Fiber Channel&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;failover communication&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Many failover solutions (like Red Hat Cluster Manager and Microsoft Wolfpack)
-can use a shared SCSI of Fiber Channel disk storage array for failover communication.
-Information regarding Red Hat high availability solutions for Samba may be obtained from
-&amp;lt;ulink url="http://www.redhat.com/docs/manuals/enterprise/RHEL-AS-2.1-Manual/cluster-manager/s1-service-samba.html"&amp;gt;www.redhat.com&amp;lt;/ulink&amp;gt;.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;Linux High Availability project&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-The Linux High Availability project is a resource worthy of consultation if your desire is
-to build a highly available Samba file server solution. Please consult the home page at
-&amp;lt;ulink url="http://www.linux-ha.org/"&amp;gt;www.linux-ha.org/&amp;lt;/ulink&amp;gt;.
-&amp;lt;/para&amp;gt;
-
-&amp;lt;para&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;backend failures&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-&amp;lt;indexterm&amp;gt;&amp;lt;primary&amp;gt;continuity of service&amp;lt;/primary&amp;gt;&amp;lt;/indexterm&amp;gt;
-Front-end server complexity remains a challenge for high availability because it must deal
-gracefully with backend failures, while at the same time providing continuity of service
-to all network clients.


&lt;/pre&gt;</description>
    <dc:creator>Jeremy Allison</dc:creator>
    <dc:date>2013-05-23T01:53:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77873">
    <title>autobuild: intermittent test failure detected</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77873</link>
    <description>&lt;pre&gt;The autobuild test system has detected an intermittent failing test in 
the current master tree.

The autobuild log of the failure is available here:

   http://git.samba.org/autobuild.flakey/2013-05-23-0045/flakey.log

The samba3 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-23-0045/samba3.stderr
   http://git.samba.org/autobuild.flakey/2013-05-23-0045/samba3.stdout

The source4 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-23-0045/samba.stderr
   http://git.samba.org/autobuild.flakey/2013-05-23-0045/samba.stdout
  
The top commit at the time of the failure was:

commit 30a224367595f9e2506e41053fc9c7cb96a90928
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Wed May 22 00:14:19 2013 +1000

    build: Update md5.h detection in waf and autoconf to use sys/md5.h and -lmd
    
    This brings the two build systems in sync, without using md5.h (which is a problem name)
    
    Tested on FreeBSD
    
    Andrew Bartlett
    
    Reviewed-by: Richard Sharpe &amp;lt;rsharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Richard Sharpe &amp;lt;sharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Wed May 22 10:06:40 CEST 2013 on sn-devel-104

&lt;/pre&gt;</description>
    <dc:creator>autobuild</dc:creator>
    <dc:date>2013-05-22T22:45:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77872">
    <title>[SCM] Samba Shared Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77872</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  30a2243 build: Update md5.h detection in waf and autoconf to use sys/md5.h and -lmd
       via  27df444 Make sure that if an smbd is exiting because of an error we let the user know.
      from  f80d56a s4-torture: No need to disable rpc.spoolss.win test when compiled with MIT kerberos.

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


- Log -----------------------------------------------------------------
commit 30a224367595f9e2506e41053fc9c7cb96a90928
Author: Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Wed May 22 00:14:19 2013 +1000

    build: Update md5.h detection in waf and autoconf to use sys/md5.h and -lmd
    
    This brings the two build systems in sync, without using md5.h (which is a problem name)
    
    Tested on FreeBSD
    
    Andrew Bartlett
    
    Reviewed-by: Richard Sharpe &amp;lt;rsharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): Richard Sharpe &amp;lt;sharpe&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Wed May 22 10:06:40 CEST 2013 on sn-devel-104

commit 27df444d0b92a8acb4d830b3b62f04835b57f0e8
Author: Richard Sharpe &amp;lt;realrichardsharpe&amp;lt; at &amp;gt;gmail.com&amp;gt;
Date:   Sat May 11 09:47:23 2013 -0700

    Make sure that if an smbd is exiting because of an error we let the user know.
    
    Signed-off-by: Richard Sharpe &amp;lt;realrichardsharpe&amp;lt; at &amp;gt;gmail.com&amp;gt;

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

Summary of changes:
 lib/crypto/md5.h             |   16 +++++++++-------
 lib/crypto/wscript_build     |    4 ++++
 lib/crypto/wscript_configure |    8 ++++++--
 source3/configure.in         |    4 ++--
 source3/smbd/smb2_server.c   |    2 +-
 5 files changed, 22 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/crypto/md5.h b/lib/crypto/md5.h
index 388cdf8..edae27f 100644
--- a/lib/crypto/md5.h
+++ b/lib/crypto/md5.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -6,12 +6,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #define HEADER_MD5_H 
 #endif
 
-#ifdef HAVE_BSD_MD5_H
-/* Try to avoid clashes with BSD MD5 implementation */
+#if defined(HAVE_BSD_MD5_H)
+/* Try to avoid clashes with BSD MD5 implementation (on linux) */
 #include &amp;lt;bsd/md5.h&amp;gt;
-#else
+
+#elif defined(HAVE_SYS_MD5_H)
+/* Try to avoid clashes with BSD MD5 implementation (on BSD) */
+#include &amp;lt;sys/md5.h&amp;gt;
+
 /* Try to use CommonCrypto on Mac as otherwise we can get MD5Final twice */
-#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
+#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
 #include &amp;lt;CommonCrypto/CommonDigest.h&amp;gt;
 
 #define MD5Init(c)CC_MD5_Init(c)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -32,8 +36,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void MD5Init(MD5_CTX *context);
 void MD5Update(MD5_CTX *context, const uint8_t *buf,
        size_t len);
 void MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context);
-#endif /* HAVE_COMMONCRYPTO_COMMONDIGEST_H */
-
-#endif /* HAVE_BSD_MD5_H */
+#endif /* HAVE_*MD5_H */
 
 #endif /* !MD5_H */
diff --git a/lib/crypto/wscript_build b/lib/crypto/wscript_build
index cd7a466..e056f65 100644
--- a/lib/crypto/wscript_build
+++ b/lib/crypto/wscript_build
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -4,6 +4,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; extra_source = ''
 extra_deps = ''
 if bld.CONFIG_SET('HAVE_BSD_MD5_H'):
 extra_deps += ' bsd'
+elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD5'):
+extra_deps += ' md5'
+elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD'):
+extra_deps += ' md'
 elif not bld.CONFIG_SET('HAVE_COMMONCRYPTO_COMMONDIGEST_H'):
 extra_source += ' md5.c'
 
diff --git a/lib/crypto/wscript_configure b/lib/crypto/wscript_configure
index 5fc00fb..21ec566 100644
--- a/lib/crypto/wscript_configure
+++ b/lib/crypto/wscript_configure
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
-conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
-    checklibc=True)
+if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
+    checklibc=True):
+    conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
+                        checklibc=True)
+    conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
+                        checklibc=True)
 conf.CHECK_FUNCS_IN('CC_MD5_Init', '', headers='CommonCrypto/CommonDigest.h',
     checklibc=True)
diff --git a/source3/configure.in b/source3/configure.in
index 822c5f4..0e2f126 100644
--- a/source3/configure.in
+++ b/source3/configure.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -620,11 +620,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; if test x"$samba_cv_md5lib" = x"none" ; then
 fi
 
 if test x"$samba_cv_md5lib" != x"none" ; then
-AC_CHECK_HEADERS(md5.h)
+AC_CHECK_HEADERS(sys/md5.h)
 fi
 
 CRYPTO_MD5_OBJ="../lib/crypto/md5.o"
-if test x"$ac_cv_header_md5_h" = x"yes" -a \
+if test x"$ac_cv_header_sys_md5_h" = x"yes" -a \
         x"$samba_cv_md5lib" != x"none" ; then
 if test x"$samba_cv_md5lib" != x ; then
 LIBS="${LIBS} -l${samba_cv_md5lib}"
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index b031c6d..73df368 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -997,7 +997,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn,
  const char *reason,
  const char *location)
 {
-DEBUG(10,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
+DEBUG(0,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
   reason, location));
 exit_server_cleanly(reason);
 }


&lt;/pre&gt;</description>
    <dc:creator>Richard Sharpe</dc:creator>
    <dc:date>2013-05-22T08:07:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77871">
    <title>[SCM] Samba Website Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77871</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  5e16f0b Bump latest stable release up to 4.0.6.
      from  60a9a38 Announce Samba 4.0.6.

http://gitweb.samba.org/?p=samba-web.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5e16f0bbe5798c9e3d9587ec1b0baea6eb56516d
Author: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue May 21 09:21:04 2013 +0200

    Bump latest stable release up to 4.0.6.
    
    Signed-off-by: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 latest_stable_release.html |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/latest_stable_release.html b/latest_stable_release.html
index 70df517..0a924e9 100644
--- a/latest_stable_release.html
+++ b/latest_stable_release.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;p&amp;gt;
-&amp;lt;a href="/samba/ftp/stable/samba-4.0.5.tar.gz"&amp;gt;Samba 4.0.5 (gzipped)&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;
-&amp;lt;a href="/samba/history/samba-4.0.5.html"&amp;gt;Release Notes&amp;lt;/a&amp;gt; &amp;amp;middot;
-&amp;lt;a href="/samba/ftp/stable/samba-4.0.5.tar.asc"&amp;gt;Signature&amp;lt;/a&amp;gt;
+&amp;lt;a href="/samba/ftp/stable/samba-4.0.6.tar.gz"&amp;gt;Samba 4.0.6 (gzipped)&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;
+&amp;lt;a href="/samba/history/samba-4.0.6.html"&amp;gt;Release Notes&amp;lt;/a&amp;gt; &amp;amp;middot;
+&amp;lt;a href="/samba/ftp/stable/samba-4.0.6.tar.asc"&amp;gt;Signature&amp;lt;/a&amp;gt;
 &amp;lt;/p&amp;gt;


&lt;/pre&gt;</description>
    <dc:creator>Karolin Seeger</dc:creator>
    <dc:date>2013-05-21T07:21:10</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77870">
    <title>[SCM] Samba Website Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77870</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  60a9a38 Announce Samba 4.0.6.
      from  9c68d03 Fix link to HTML man pages.

http://gitweb.samba.org/?p=samba-web.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 60a9a38b71f4df223d9921f7bae9162272d7b96b
Author: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue May 21 09:12:49 2013 +0200

    Announce Samba 4.0.6.
    
    Signed-off-by: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 generated_news/latest_10_bodies.html    |   23 ++++---
 generated_news/latest_10_headlines.html |    4 +-
 generated_news/latest_2_bodies.html     |   24 ++++----
 history/header_history.html             |    1 +
 history/samba-4.0.6.html                |   94 +++++++++++++++++++++++++++++++
 5 files changed, 122 insertions(+), 24 deletions(-)
 create mode 100755 history/samba-4.0.6.html


Changeset truncated at 500 lines:

diff --git a/generated_news/latest_10_bodies.html b/generated_news/latest_10_bodies.html
index 8c0ce82..985be1a 100644
--- a/generated_news/latest_10_bodies.html
+++ b/generated_news/latest_10_bodies.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+&amp;lt;h5&amp;gt;&amp;lt;a name="4.0.6"&amp;gt;21 May 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
+&amp;lt;p class="headline"&amp;gt;Samba 4.0.6 Available for Download&amp;lt;/p&amp;gt;
+&amp;lt;p&amp;gt;This is the latest stable release of the Samba 4.0 series.&amp;lt;/p&amp;gt;
+
+&amp;lt;p&amp;gt;The uncompressed tarballs and patch files have been signed
+using GnuPG (ID 6568B7EA).  The source code can be
+&amp;lt;a href="http://samba.org/samba/ftp/stable/samba-4.0.6.tar.gz"&amp;gt;downloaded
+now&amp;lt;/a&amp;gt;. A &amp;lt;a href="http://samba.org/samba/ftp/patches/patch-4.0.5-4.0.6.diffs.gz"&amp;gt;
+patch against Samba 4.0.5&amp;lt;/a&amp;gt; is also available. See
+&amp;lt;a href="http://samba.org/samba/history/samba-4.0.6.html"&amp;gt; the release notes
+ for more info&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
+
+
 &amp;lt;h5&amp;gt;&amp;lt;a name="3.6.15"&amp;gt;08 May 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
 &amp;lt;p class="headline"&amp;gt;Samba 3.6.15 Available for Download&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;This is the latest stable release of the Samba 3.6 series.&amp;lt;/p&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -140,13 +153,3 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; now&amp;lt;/a&amp;gt;. A &amp;lt;a href="http://samba.org/samba/ftp/patches/patch-3.6.10-3.6.11.diffs
 patch against Samba 3.6.10&amp;lt;/a&amp;gt; is also available.
 See &amp;lt;a href="http://samba.org/samba/history/samba-3.6.11.html"&amp;gt;
 the release notes for more info&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
-
-&amp;lt;h5&amp;gt;&amp;lt;a name="CfP"&amp;gt;15 January 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
-        &amp;lt;p class="headline"&amp;gt;Call for Papers SambaXP 2013&amp;lt;/p&amp;gt;
-
-&amp;lt;p&amp;gt;From May 14th to 17th 2013 developers and users will meet again in
-Goettingen, Germany at the 12th international SAMBA conference, the
-"samba eXPerience 2013".&amp;lt;/p&amp;gt;
-&amp;lt;p&amp;gt;The call for papers and early bird registration are open until February
-28th 2013. Please find all necessary information at the &amp;lt;a
-href="http://sambaXP.org"&amp;gt;conference site&amp;lt;/a&amp;gt;.
diff --git a/generated_news/latest_10_headlines.html b/generated_news/latest_10_headlines.html
index f46c483..5cdb071 100644
--- a/generated_news/latest_10_headlines.html
+++ b/generated_news/latest_10_headlines.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;ul&amp;gt;
+&amp;lt;li&amp;gt; 21 May 2013 &amp;lt;a href="#4.0.6"&amp;gt;Samba 4.0.6 Available for Download&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+
 &amp;lt;li&amp;gt; 08 April 2013 &amp;lt;a href="#3.6.15"&amp;gt;Samba 3.6.15 Available for Download&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 
 &amp;lt;li&amp;gt; 29 April 2013 &amp;lt;a href="#3.6.14"&amp;gt;Samba 3.6.14 Available for Download&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -16,6 +18,4 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;li&amp;gt; 30 January 2013 &amp;lt;a href="#4.0.2"&amp;gt;Samba 4.0.2, 3.6.12 and 3.5.21 Security Releases Available for Download&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 
 &amp;lt;li&amp;gt; 21 January 2013 &amp;lt;a href="#3.6.11"&amp;gt;Samba 3.6.11 Available for Download&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
-
-&amp;lt;li&amp;gt; 15 January 2013 &amp;lt;a href="#CfP"&amp;gt;Call for Papers SambaXP 2013&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;/ul&amp;gt;
diff --git a/generated_news/latest_2_bodies.html b/generated_news/latest_2_bodies.html
index fcf4218..e533db7 100644
--- a/generated_news/latest_2_bodies.html
+++ b/generated_news/latest_2_bodies.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+&amp;lt;h5&amp;gt;&amp;lt;a name="4.0.6"&amp;gt;21 May 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
+&amp;lt;p class="headline"&amp;gt;Samba 4.0.6 Available for Download&amp;lt;/p&amp;gt;
+&amp;lt;p&amp;gt;This is the latest stable release of the Samba 4.0 series.&amp;lt;/p&amp;gt;
+
+&amp;lt;p&amp;gt;The uncompressed tarballs and patch files have been signed
+using GnuPG (ID 6568B7EA).  The source code can be
+&amp;lt;a href="http://samba.org/samba/ftp/stable/samba-4.0.6.tar.gz"&amp;gt;downloaded
+now&amp;lt;/a&amp;gt;. A &amp;lt;a href="http://samba.org/samba/ftp/patches/patch-4.0.5-4.0.6.diffs.gz"&amp;gt;
+patch against Samba 4.0.5&amp;lt;/a&amp;gt; is also available. See
+&amp;lt;a href="http://samba.org/samba/history/samba-4.0.6.html"&amp;gt; the release notes
+ for more info&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
+
 &amp;lt;h5&amp;gt;&amp;lt;a name="3.6.15"&amp;gt;08 May 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
 &amp;lt;p class="headline"&amp;gt;Samba 3.6.15 Available for Download&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;This is the latest stable release of the Samba 3.6 series.&amp;lt;/p&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -9,15 +21,3 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; now&amp;lt;/a&amp;gt;. A &amp;lt;a href="http://samba.org/samba/ftp/patches/patch-3.6.14-3.6.15.diffs
 patch against Samba 3.6.14&amp;lt;/a&amp;gt; is also available.
 See &amp;lt;a href="http://samba.org/samba/history/samba-3.6.15.html"&amp;gt;
 the release notes for more info&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
-
-&amp;lt;h5&amp;gt;&amp;lt;a name="3.6.14"&amp;gt;29 April 2013&amp;lt;/a&amp;gt;&amp;lt;/h5&amp;gt;
-&amp;lt;p class="headline"&amp;gt;Samba 3.6.14 Available for Download&amp;lt;/p&amp;gt;
-&amp;lt;p&amp;gt;This is the latest stable release of the Samba 3.6 series.&amp;lt;/p&amp;gt;
-
-&amp;lt;p&amp;gt;The uncompressed tarballs and patch files have been signed
-using GnuPG (ID 6568B7EA).  The source code can be
-&amp;lt;a href="http://samba.org/samba/ftp/stable/samba-3.6.14.tar.gz"&amp;gt;downloaded
-now&amp;lt;/a&amp;gt;. A &amp;lt;a href="http://samba.org/samba/ftp/patches/patch-3.6.13-3.6.14.diffs.gz"&amp;gt;
-patch against Samba 3.6.13&amp;lt;/a&amp;gt; is also available.
-See &amp;lt;a href="http://samba.org/samba/history/samba-3.6.14.html"&amp;gt;
-the release notes for more info&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
diff --git a/history/header_history.html b/history/header_history.html
index d692c3a..a3c8f17 100755
--- a/history/header_history.html
+++ b/history/header_history.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -10,6 +10,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;li class="navSub"&amp;gt;
 &amp;lt;ul&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;a href="/samba/security/CVE-2013-0454.html"&amp;gt;CVE-2013-0454&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+&amp;lt;li&amp;gt;&amp;lt;a href="samba-4.0.6.html"&amp;gt;samba-4.0.6&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;a href="samba-4.0.5.html"&amp;gt;samba-4.0.5&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;a href="samba-4.0.4.html"&amp;gt;samba-4.0.4&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;a href="samba-4.0.3.html"&amp;gt;samba-4.0.3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
diff --git a/history/samba-4.0.6.html b/history/samba-4.0.6.html
new file mode 100755
index 0000000..e1d8964
--- /dev/null
+++ b/history/samba-4.0.6.html
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,94 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
+&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
+
+&amp;lt;head&amp;gt;
+&amp;lt;title&amp;gt;Samba - Release Notes Archive&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+
+&amp;lt;body&amp;gt;
+
+   &amp;lt;H2&amp;gt;Samba 4.0.6 Available for Download&amp;lt;/H2&amp;gt;
+
+&amp;lt;p&amp;gt;
+&amp;lt;pre&amp;gt;
+                   =============================
+                   Release Notes for Samba 4.0.6
+                           May 21, 2013
+                   =============================
+
+
+This is is the latest stable release of Samba 4.0.
+
+Major enhancements in Samba 4.0.6 include:
+
+o  Fix crash during Win8 sync (bug #9822).
+o  Fix segfault when loging in with wrong password from w2k8r2 (bug #9834).
+
+
+Changes since 4.0.5:
+--------------------
+
+o   Jeremy Allison &amp;amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9412: SMB2 server doesn't support recvfile.
+    * BUG 9722: Properly handle oplock breaks in compound requests.
+    * BUG 9777: vfs_dirsort uses non-stackable calls, dirfd(), malloc instead
+      of talloc and doesn't cope with directories being modified whilst reading.
+    * BUG 9811: Old DOS SMB CTEMP request uses a non-VFS function to access the
+      filesystem.
+    * BUG 9822: Fix crash during Win8 sync.
+
+
+o   Anand Avati &amp;amp;lt;avati&amp;lt; at &amp;gt;redhat.com&amp;amp;gt;
+    * BUG 9833: Function called in unix_convert() path can overwrite errno.
+
+
+o   Andrew Bartlett &amp;amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9785: Use specified python for runtime installation of Samba.
+    * BUG 9834: Fix segfault when loging in with wrong password from w2k8r2.
+
+
+o   Alexander Bokovoy &amp;amp;lt;ab&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9767: Fix 'net ads join' when called via stdin.
+
+
+o   David Disseldorp &amp;amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9807: wbinfo: Fix segfault in wbinfo_pam_logon.
+    * BUG 9830: Fix panic in nt_printer_publish_ads.
+
+
+o   Volker Lendecke &amp;amp;lt;vl&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9775: Fix segfault for "artificial" conn_structs in vfs_fake_perms.
+    * BUG 9809: Package new dbwrap_tool man page.
+    * BUG 9824: SMB signing and the async echo responder don't work together.
+    * BUG 9832: talloc use after free in winbind4.
+    * BUG 9854: Fix NULL pointer dereference in Winbind.
+    * BUG 9868: Fix making LIBNDR_PREG_OBJ.
+
+
+o   Stefan Metzmacher &amp;amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9545: Fix the build of vfs_notify_fam.
+    * BUG 9803: Change '--with-dmapi' to 'default=auto' to match the autoconf
+      build.
+    * BUG 9804: wafsamba: Display the default value in help for
+      SAMBA3_ADD_OPTION.
+    * BUG 9382: Add support for PFC_FLAG_OBJECT_UUID when parsing packets.
+
+
+o   Andreas Schneider &amp;amp;lt;asn&amp;lt; at &amp;gt;samba.org&amp;amp;gt;
+    * BUG 9139: Fix the username map optimization.
+    * BUG 9699: Fix adding case sensitive spn.
+    * BUG 9766: Cache name_to_sid/sid_to_name correctly.
+    * BUG 9817: Fix 'map untrusted to domain' with NTLMv2.
+
+
+o   Richard Sharpe &amp;amp;lt;realrichardsharpe&amp;lt; at &amp;gt;gmail.com&amp;amp;gt;
+    * BUG 9722:  Properly handle oplock breaks in compound requests.
+
+
+o   Ralph Wuerthner &amp;amp;lt;ralph.wuerthner&amp;lt; at &amp;gt;de.ibm.com&amp;amp;gt;
+    * BUG 9782: Fix panic when running 'smbtorture smb.base'.
+&amp;lt;/pre&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;


&lt;/pre&gt;</description>
    <dc:creator>Karolin Seeger</dc:creator>
    <dc:date>2013-05-21T07:13:04</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77869">
    <title>[SCM] Samba Shared Repository - annotated tag samba-4.0.6 created</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77869</link>
    <description>&lt;pre&gt;The annotated tag, samba-4.0.6 has been created
        at  5d29139bcb1d9f5e02bf1f3fcf4e88c995b82806 (tag)
   tagging  4800b9f543c15e160a3c5e9ce46c16cba6c7c895 (commit)
  replaces  samba-4.0.5
 tagged by  Karolin Seeger
        on  Tue May 21 08:50:32 2013 +0200

- Log -----------------------------------------------------------------
samba: tag release samba-4.0.6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQBRmxk4bzORW2Vot+oRAv/rAJ0dBXo56nANdWNN+GfTxU2pQ1cdIACgkg/x
uY3HZH12CzUVrSTiFQjtly8=
=ZaX/
-----END PGP SIGNATURE-----

Alexander Bokovoy (1):
      getpass: Don't fail if stdin is not a tty

Anand Avati (1):
      check_parent_exists() can change errno. Ensure we preserve it across calls.

Andreas Schneider (4):
      BUG 9699: Fix adding case sensitive spn.
      BUG 9139: Fix the username map optimization.
      BUG 9766: Cache name_to_sid/sid_to_name correctly.
      BUG 9817: Fix 'map untrusted to domain' with NTLMv2.

Andrew Bartlett (3):
      build: Remove extra space in shebang
      build: Replace #!/usr/bin/env python with passed in PYTHON=
      auth/ntlmssp: Avoid use-after-free of user_info after logon failure at log level 5

Björn Baumbach (1):
      docs: smb.conf: fix max read/write/trans default values (bug #9871)

David Disseldorp (2):
      Bug 9807 - wbinfo: fix segfault in wbinfo_pam_logon
      bug 9830: fix panic in nt_printer_publish_ads

Jeremy Allison (34):
      Change source3/modules/vfs_dirsort.c from MALLOC -&amp;gt; TALLOC.
      Protect against early error in SMB_VFS_NEXT_READDIR.
      Use an index i rather than re-using a state variable.
      Protect open_and_sort_dir() from the directory changing size.
      Clean error paths in opendir and fd_opendir by only setting handle data on success.
      Check SMB_VFS_NEXT_OPENDIR return in dirsort_opendir().
      Convert mtime from a time_t to a struct timespec.
      Remove the use of dirfd inside the vfs_dirsort.c.
      Remove unneeded initializations (we already talloc_zero).
      Ensure we test the dirsort module in make test.
      Fix bug in old create temp SMB request. Only use VFS functions.
      Ensure we don't do an SMB2 aio write if RECVFILE is active.
      If we already have an smb1req attached to the struct smbd_smb2_request, don't recreate it.
      Add function smbd_smb2_unread_bytes().
      Allow smbd_smb2_request_error_ex() to cope with unread bytes on error.
      Add utility function get_min_receive_file_size().
      Add macro SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN.
      Add extra fields into struct smbd_smb2_request_read_state to support receivefile.
      Add stub static function that will turn on/off receivefile code path.
      The guts of the receivefile code changes.
      Add the internals of is_smb2_recvfile_write.
      Ensure drain_socket() operates on a blocking socket.
      Ensure the RECVFILE path in vfs_write_data() operates on a blocking socket.
      Ensure the RECVFILE path in vfs_pwrite_data() operates on a blocking socket.
      Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
      In the struct smb_Dir destructor, use the fsp back pointer to release resources.
      Remove the "Ugly hack" that was the second use of dirfd().
      Remove dependency on detection of HAVE_DIRFD for use of fdopendir().
      Fix bug #9822 - Samba crashing during Win8 sync.
      Only do the 1 second delay for sharing violations for SMB1, not SMB2.
      Ensure we don't try and cancel anything that is in a compound-related request.
      Move a variable into the area of code where it's used.
      The core of the fix to allow opens to go async inside a compound request.
      Remove the compound_related_in_progress state from the smb2 global state.

Karolin Seeger (3):
      VERSION: Bump version number up to 4.0.6
      WHATSNEW: Add release notes for Samba 4.0.6.
      VERSION: Disable git snapshots for the 4.0.6 release.

Ralph Wuerthner (3):
      s3:smbd: do not access data behind req-&amp;gt;buf+req-&amp;gt;buflen in srvstr_get_path_req_wcard()
      s3:smbd: convert srvstr_pull_req_talloc() into a function
      s3:smbd: do not access data behind req-&amp;gt;buf+req-&amp;gt;buflen in srvstr_pull_req_talloc()

Richard Sharpe (1):
      Tests processing an oplock break within a compound SMB2 request.

Stefan Metzmacher (5):
      s3:modules: fix the build of vfs_notify_fam (bug #9545)
      s3:wscript: change --with-dmapi to default=auto to match the autoconf build
      wafsamba: display the default value in help for SAMBA3_ADD_OPTION
      s3:librpc: add support for PFC_FLAG_OBJECT_UUID when parsing packets (bug #9382)
      doc-xml/smbdotconf: fix server [min|max] protocol documentation (bug 9883)

Volker Lendecke (8):
      vfs_fake_perms: Slightly streamline code
      vfs_fake_perms: Slightly streamline code
      vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs
      docs: Fix bug 9809 -- missing entry in specfile
      smbd: Fix signing when the async echo handler kicks in
      winbind4: Fix bug 9832 -- talloc use after free
      winbind: Fix bug 9854 -- NULL pointer dereference
      Makefile: Fix bug 9868 -- Don't know how to make LIBNDR_PREG_OBJ.

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


&lt;/pre&gt;</description>
    <dc:creator>Karolin Seeger</dc:creator>
    <dc:date>2013-05-21T06:55:51</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77868">
    <title>[SCM] Samba Shared Repository - branch v4-0-stable updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77868</link>
    <description>&lt;pre&gt;The branch, v4-0-stable has been updated
       via  4800b9f VERSION: Disable git snapshots for the 4.0.6 release.
       via  4b2c301 doc-xml/smbdotconf: fix server [min|max] protocol documentation (bug 9883)
       via  3c33b54 docs: smb.conf: fix max read/write/trans default values (bug #9871)
       via  84e860a WHATSNEW: Add release notes for Samba 4.0.6.
       via  282ad05 Makefile: Fix bug 9868 -- Don't know how to make LIBNDR_PREG_OBJ.
       via  cd9be74 Tests processing an oplock break within a compound SMB2 request.
       via  457af02 Remove the compound_related_in_progress state from the smb2 global state.
       via  5ab0457 The core of the fix to allow opens to go async inside a compound request.
       via  805b029 Move a variable into the area of code where it's used.
       via  0fea4e3 Ensure we don't try and cancel anything that is in a compound-related request.
       via  0770400 Only do the 1 second delay for sharing violations for SMB1, not SMB2.
       via  23a75ad winbind: Fix bug 9854 -- NULL pointer dereference
       via  ed22de6 check_parent_exists() can change errno. Ensure we preserve it across calls.
       via  a752308 Fix bug #9822 - Samba crashing during Win8 sync.
       via  e83dc71 Remove dependency on detection of HAVE_DIRFD for use of fdopendir().
       via  93d866e Remove the "Ugly hack" that was the second use of dirfd().
       via  44d4728 In the struct smb_Dir destructor, use the fsp back pointer to release resources.
       via  ecdcb62 Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
       via  2a09b5d winbind4: Fix bug 9832 -- talloc use after free
       via  973bbc4 auth/ntlmssp: Avoid use-after-free of user_info after logon failure at log level 5
       via  ae3aa28 BUG 9817: Fix 'map untrusted to domain' with NTLMv2.
       via  ad6f289 bug 9830: fix panic in nt_printer_publish_ads
       via  6886a68 s3:librpc: add support for PFC_FLAG_OBJECT_UUID when parsing packets (bug #9382)
       via  7e140cf Ensure the RECVFILE path in vfs_pwrite_data() operates on a blocking socket.
       via  05e8a78 Ensure the RECVFILE path in vfs_write_data() operates on a blocking socket.
       via  160a9f3 Ensure drain_socket() operates on a blocking socket.
       via  1758eaa Add the internals of is_smb2_recvfile_write.
       via  cd0da23 The guts of the receivefile code changes.
       via  0d190cf Add stub static function that will turn on/off receivefile code path.
       via  5bd69d5 Add extra fields into struct smbd_smb2_request_read_state to support receivefile.
       via  97fc9b9 Add macro SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN.
       via  1828c74 Add utility function get_min_receive_file_size().
       via  6083839 Allow smbd_smb2_request_error_ex() to cope with unread bytes on error.
       via  8854426 Add function smbd_smb2_unread_bytes().
       via  67839e1 If we already have an smb1req attached to the struct smbd_smb2_request, don't recreate it.
       via  07ab7e6 Ensure we don't do an SMB2 aio write if RECVFILE is active.
       via  d94190f smbd: Fix signing when the async echo handler kicks in
       via  9fe3d7d build: Replace #!/usr/bin/env python with passed in PYTHON=
       via  03ef312 build: Remove extra space in shebang
       via  3f8ea16 docs: Fix bug 9809 -- missing entry in specfile
       via  07d6347 Fix bug in old create temp SMB request. Only use VFS functions.
       via  389face Bug 9807 - wbinfo: fix segfault in wbinfo_pam_logon
       via  376c36b wafsamba: display the default value in help for SAMBA3_ADD_OPTION
       via  35000ea s3:wscript: change --with-dmapi to default=auto to match the autoconf build
       via  9bfcb9f Ensure we test the dirsort module in make test.
       via  2870ba2 Remove unneeded initializations (we already talloc_zero).
       via  a677246 Remove the use of dirfd inside the vfs_dirsort.c.
       via  b8712d0 Convert mtime from a time_t to a struct timespec.
       via  f8da00d Check SMB_VFS_NEXT_OPENDIR return in dirsort_opendir().
       via  38858df Clean error paths in opendir and fd_opendir by only setting handle data on success.
       via  c0b62e9 Protect open_and_sort_dir() from the directory changing size.
       via  bb3a65a Use an index i rather than re-using a state variable.
       via  c483976 Protect against early error in SMB_VFS_NEXT_READDIR.
       via  d95f2b0 Change source3/modules/vfs_dirsort.c from MALLOC -&amp;gt; TALLOC.
       via  284f579 s3:smbd: do not access data behind req-&amp;gt;buf+req-&amp;gt;buflen in srvstr_pull_req_talloc()
       via  c22b34a s3:smbd: convert srvstr_pull_req_talloc() into a function
       via  8394dd2 s3:smbd: do not access data behind req-&amp;gt;buf+req-&amp;gt;buflen in srvstr_get_path_req_wcard()
       via  86dbc31 BUG 9766: Cache name_to_sid/sid_to_name correctly.
       via  09758ce BUG 9139: Fix the username map optimization.
       via  4bebda4 [PATCH] getpass: Don't fail if stdin is not a tty
       via  077865d BUG 9699: Fix adding case sensitive spn.
       via  686104b vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs
       via  67214f6 vfs_fake_perms: Slightly streamline code
       via  3089e8c vfs_fake_perms: Slightly streamline code
       via  25e7ea2 s3:modules: fix the build of vfs_notify_fam (bug #9545)
       via  5d5f301 VERSION: Bump version number up to 4.0.6
      from  ed09ee7 VERSION: Disable git snapshots for the 4.0.5 release.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |    2 +-
 WHATSNEW.txt                                       |  106 +++++++++-
 auth/ntlmssp/ntlmssp_server.c                      |    2 +-
 buildtools/wafsamba/samba3.py                      |   11 +-
 buildtools/wafsamba/samba_python.py                |   10 +
 buildtools/wafsamba/wafsamba.py                    |   15 ++-
 docs-xml/smbdotconf/protocol/servermaxprotocol.xml |   10 -
 docs-xml/smbdotconf/protocol/serverminprotocol.xml |    2 +-
 docs-xml/smbdotconf/protocol/smb2maxread.xml       |    7 +-
 docs-xml/smbdotconf/protocol/smb2maxtrans.xml      |    7 +-
 docs-xml/smbdotconf/protocol/smb2maxwrite.xml      |    7 +-
 lib/replace/getpass.c                              |    7 +-
 nsswitch/wbinfo.c                                  |    7 +-
 packaging/RHEL/samba.spec.tmpl                     |    1 +
 selftest/knownfail                                 |    1 +
 selftest/target/Samba3.pm                          |    1 +
 source3/Makefile.in                                |    2 +-
 source3/auth/auth_winbind.c                        |   10 +-
 source3/auth/user_util.c                           |   12 +-
 source3/include/srvstr.h                           |    9 -
 source3/lib/recvfile.c                             |   17 ++-
 source3/lib/system.c                               |    4 +-
 source3/libads/ldap.c                              |   14 +-
 source3/librpc/rpc/dcerpc_helpers.c                |    4 +
 source3/modules/vfs_dirsort.c                      |  140 +++++++-----
 source3/modules/vfs_fake_perms.c                   |   66 ++++--
 source3/modules/wscript_build                      |    4 +
 source3/printing/nt_printing_ads.c                 |   10 +-
 source3/smbd/aio.c                                 |    5 +
 source3/smbd/dir.c                                 |   46 ++--
 source3/smbd/filename.c                            |    9 +-
 source3/smbd/globals.h                             |    4 +-
 source3/smbd/open.c                                |    3 +-
 source3/smbd/process.c                             |    2 +-
 source3/smbd/proto.h                               |    2 +
 source3/smbd/reply.c                               |  147 ++++++++-----
 source3/smbd/smb2_glue.c                           |   22 ++-
 source3/smbd/smb2_server.c                         |  245 +++++++++++++++-----
 source3/smbd/vfs.c                                 |   26 ++-
 source3/winbindd/winbindd_cache.c                  |   21 ++
 source3/wscript                                    |   34 +++-
 source4/torture/smb2/compound.c                    |  163 +++++++++++++
 source4/winbind/wb_server.c                        |    2 +-
 wscript                                            |    7 +-
 44 files changed, 933 insertions(+), 293 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 2217866..3ed42f6 100644
--- a/VERSION
+++ b/VERSION
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,7 +25,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=0
-SAMBA_VERSION_RELEASE=5
+SAMBA_VERSION_RELEASE=6
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 2f8d863..c8f08da 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,4 +1,105 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
                    =============================
+                   Release Notes for Samba 4.0.6
+                           May 21, 2013
+                   =============================
+
+
+This is is the latest stable release of Samba 4.0.
+
+Major enhancements in Samba 4.0.6 include:
+
+o  Fix crash during Win8 sync (bug #9822).
+o  Fix segfault when loging in with wrong password from w2k8r2 (bug #9834).
+
+
+Changes since 4.0.5:
+--------------------
+
+o   Jeremy Allison &amp;lt;jra&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9412: SMB2 server doesn't support recvfile.
+    * BUG 9722: Properly handle oplock breaks in compound requests.
+    * BUG 9777: vfs_dirsort uses non-stackable calls, dirfd(), malloc instead
+      of talloc and doesn't cope with directories being modified whilst reading.
+    * BUG 9811: Old DOS SMB CTEMP request uses a non-VFS function to access the
+      filesystem.
+    * BUG 9822: Fix crash during Win8 sync.
+
+
+o   Anand Avati &amp;lt;avati&amp;lt; at &amp;gt;redhat.com&amp;gt;
+    * BUG 9833: Function called in unix_convert() path can overwrite errno.
+
+
+o   Andrew Bartlett &amp;lt;abartlet&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9785: Use specified python for runtime installation of Samba.
+    * BUG 9834: Fix segfault when loging in with wrong password from w2k8r2.
+
+
+o   Alexander Bokovoy &amp;lt;ab&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9767: Fix 'net ads join' when called via stdin.
+
+
+o   David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9807: wbinfo: Fix segfault in wbinfo_pam_logon.
+    * BUG 9830: Fix panic in nt_printer_publish_ads.
+
+
+o   Volker Lendecke &amp;lt;vl&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9775: Fix segfault for "artificial" conn_structs in vfs_fake_perms.
+    * BUG 9809: Package new dbwrap_tool man page.
+    * BUG 9824: SMB signing and the async echo responder don't work together.
+    * BUG 9832: talloc use after free in winbind4.
+    * BUG 9854: Fix NULL pointer dereference in Winbind.
+    * BUG 9868: Fix making LIBNDR_PREG_OBJ.
+
+
+o   Stefan Metzmacher &amp;lt;metze&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9545: Fix the build of vfs_notify_fam.
+    * BUG 9803: Change '--with-dmapi' to 'default=auto' to match the autoconf
+      build.
+    * BUG 9804: wafsamba: Display the default value in help for
+      SAMBA3_ADD_OPTION.
+    * BUG 9382: Add support for PFC_FLAG_OBJECT_UUID when parsing packets.
+
+
+o   Andreas Schneider &amp;lt;asn&amp;lt; at &amp;gt;samba.org&amp;gt;
+    * BUG 9139: Fix the username map optimization.
+    * BUG 9699: Fix adding case sensitive spn.
+    * BUG 9766: Cache name_to_sid/sid_to_name correctly.
+    * BUG 9817: Fix 'map untrusted to domain' with NTLMv2.
+
+
+o   Richard Sharpe &amp;lt;realrichardsharpe&amp;lt; at &amp;gt;gmail.com&amp;gt;
+    * BUG 9722:  Properly handle oplock breaks in compound requests.
+
+
+o   Ralph Wuerthner &amp;lt;ralph.wuerthner&amp;lt; at &amp;gt;de.ibm.com&amp;gt;
+    * BUG 9782: Fix panic when running 'smbtorture smb.base'.
+
+
+######################################################################
+Reporting bugs &amp;amp; Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.0 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.0.5
                            April 9, 2013
                    =============================
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -185,8 +286,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; database (https://bugzilla.samba.org/).
 == The Samba Team
 ======================================================================
 
-Release notes for older releases follow:
-----------------------------------------
+
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.0.4
diff --git a/auth/ntlmssp/ntlmssp_server.c b/auth/ntlmssp/ntlmssp_server.c
index d9bea1c..442bd5d 100644
--- a/auth/ntlmssp/ntlmssp_server.c
+++ b/auth/ntlmssp/ntlmssp_server.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -449,11 +449,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static NTSTATUS ntlmssp_server_check_password(struct gensec_security *gensec_sec
       &amp;amp;gensec_ntlmssp-&amp;gt;server_returned_info,
       user_session_key, lm_session_key);
 }
-talloc_free(user_info);
 
 if (!NT_STATUS_IS_OK(nt_status)) {
 DEBUG(5, (__location__ ": Checking NTLMSSP password for %s\\%s failed: %s\n", user_info-&amp;gt;client.domain_name, user_info-&amp;gt;client.account_name, nt_errstr(nt_status)));
 }
+TALLOC_FREE(user_info);
 
 NT_STATUS_NOT_OK_RETURN(nt_status);
 
diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index 476d8fc..fd063ad 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -8,8 +8,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; from samba_autoconf import library_flags
 
 def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True,
                       with_name="with", without_name="without"):
+    if default is None:
+        default_str="auto"
+    elif default == True:
+        default_str="yes"
+    elif default == False:
+        default_str="no"
+    else:
+        default_str=str(default)
+
     if help == ():
-        help = ("Build with %s support" % option)
+        help = ("Build with %s support (default=%s)" % (option, default_str))
     if dest is None:
         dest = "with_%s" % option.replace('-', '_')
 
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index b2172f7..847b431 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5,6 +5,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; from samba_utils import *
 from samba_autoconf import *
 
 from Configure import conf
+
+&amp;lt; at &amp;gt;conf
+def SAMBA_CHECK_PYTHON(conf, mandatory=True):
+    # enable tool to build python extensions
+    conf.find_program('python', var='PYTHON', mandatory=mandatory)
+    conf.check_tool('python')
+    path_python = conf.find_program('python')
+    conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
+    conf.check_python_version((2,4,2))
+
 &amp;lt; at &amp;gt;conf
 def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
     if conf.env["python_headers_checked"] == []:
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index f7156ec..3559cc1 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -696,14 +696,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; def copy_and_fix_python_path(task):
         replacement="""sys.path.insert(0, "%s")
 sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
 
+    shebang = None
+
+    if task.env["PYTHON"][0] == "/":
+        replacement_shebang = "#!%s" % task.env["PYTHON"]
+    else:
+        replacement_shebang = "#!/usr/bin/env %s" % task.env["PYTHON"]
+
     installed_location=task.outputs[0].bldpath(task.env)
     source_file = open(task.inputs[0].srcpath(task.env))
     installed_file = open(installed_location, 'w')
+    lineno = 0
     for line in source_file:
         newline = line
-        if pattern in line:
+        if lineno == 0 and task.env["PYTHON_SPECIFIED"] == True and line[:2] == "#!":
+            newline = replacement_shebang
+        elif pattern in line:
             newline = line.replace(pattern, replacement)
         installed_file.write(newline)
+        lineno = lineno + 1
     installed_file.close()
     os.chmod(installed_location, 0755)
     return 0
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -727,6 +738,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
                             target=inst_file)
         bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONARCHDIR"])
         bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONDIR"])
+        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), str(bld.env["PYTHON_SPECIFIED"]))
+        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHON"])
         file = inst_file
     if base_name:
         file = os.path.join(base_name, file)
diff --git a/docs-xml/smbdotconf/protocol/servermaxprotocol.xml b/docs-xml/smbdotconf/protocol/servermaxprotocol.xml
index 94184c8..822e42b 100644
--- a/docs-xml/smbdotconf/protocol/servermaxprotocol.xml
+++ b/docs-xml/smbdotconf/protocol/servermaxprotocol.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -10,16 +10,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     &amp;lt;para&amp;gt;Possible values are :&amp;lt;/para&amp;gt;
     &amp;lt;itemizedlist&amp;gt;
 &amp;lt;listitem&amp;gt;
-    &amp;lt;para&amp;gt;&amp;lt;constant&amp;gt;CORE&amp;lt;/constant&amp;gt;: Earliest version. No 
-    concept of user names.&amp;lt;/para&amp;gt;
-&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;
-    &amp;lt;para&amp;gt;&amp;lt;constant&amp;gt;COREPLUS&amp;lt;/constant&amp;gt;: Slight improvements on 
-    CORE for efficiency.&amp;lt;/para&amp;gt;
-&amp;lt;/listitem&amp;gt;
-
-&amp;lt;listitem&amp;gt;
     &amp;lt;para&amp;gt;&amp;lt;constant&amp;gt;LANMAN1&amp;lt;/constant&amp;gt;: First &amp;lt;emphasis&amp;gt;modern&amp;lt;/emphasis&amp;gt;
     version of the protocol. Long filename support.&amp;lt;/para&amp;gt;
 &amp;lt;/listitem&amp;gt;
diff --git a/docs-xml/smbdotconf/protocol/serverminprotocol.xml b/docs-xml/smbdotconf/protocol/serverminprotocol.xml
index 4edecc4..c324fcb 100644
--- a/docs-xml/smbdotconf/protocol/serverminprotocol.xml
+++ b/docs-xml/smbdotconf/protocol/serverminprotocol.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -15,6 +15,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 &amp;lt;related&amp;gt;server max protocol&amp;lt;/related&amp;gt;
 
-&amp;lt;value type="default"&amp;gt;CORE&amp;lt;/value&amp;gt;
+&amp;lt;value type="default"&amp;gt;LANMAN1&amp;lt;/value&amp;gt;
 &amp;lt;value type="example"&amp;gt;NT1&amp;lt;/value&amp;gt;
 &amp;lt;/samba:parameter&amp;gt;
diff --git a/docs-xml/smbdotconf/protocol/smb2maxread.xml b/docs-xml/smbdotconf/protocol/smb2maxread.xml
index 2666821..045e7d9 100644
--- a/docs-xml/smbdotconf/protocol/smb2maxread.xml
+++ b/docs-xml/smbdotconf/protocol/smb2maxread.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -8,10 +8,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;manvolnum&amp;gt;8&amp;lt;/manvolnum&amp;gt;&amp;lt;/citerefentry&amp;gt; will return to a client, informing the client of the largest
 size that may be returned by a single SMB2 read call.
 &amp;lt;/para&amp;gt;
-&amp;lt;para&amp;gt;The maximum is 65536 bytes (64KB), which is the same as a Windows Vista SMB2 server.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;The maximum is 1048576 bytes (1MiB), which is the same as a Windows Server 2008 r2.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;Please note that the default is 1MiB, but it's limit is based on the
+smb2 dialect (64KiB for SMB2.0, 1MiB for SMB2.1 with LargeMTU).
+Large MTU is not supported over NBT (tcp port 139).&amp;lt;/para&amp;gt;
 &amp;lt;/description&amp;gt;
 
 &amp;lt;related&amp;gt;smb2 max write&amp;lt;/related&amp;gt;
 &amp;lt;related&amp;gt;smb2 max trans&amp;lt;/related&amp;gt;
-&amp;lt;value type="default"&amp;gt;65536&amp;lt;/value&amp;gt;
+&amp;lt;value type="default"&amp;gt;1048576&amp;lt;/value&amp;gt;
 &amp;lt;/samba:parameter&amp;gt;
diff --git a/docs-xml/smbdotconf/protocol/smb2maxtrans.xml b/docs-xml/smbdotconf/protocol/smb2maxtrans.xml
index 1c01ccc..d4d83b9 100644
--- a/docs-xml/smbdotconf/protocol/smb2maxtrans.xml
+++ b/docs-xml/smbdotconf/protocol/smb2maxtrans.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -8,10 +8,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;manvolnum&amp;gt;8&amp;lt;/manvolnum&amp;gt;&amp;lt;/citerefentry&amp;gt; will return to a client, informing the client of the largest
 size of buffer that may be used in querying file meta-data via QUERY_INFO and related SMB2 calls.
 &amp;lt;/para&amp;gt;
-&amp;lt;para&amp;gt;The maximum is 65536 bytes (64KB), which is the same as a Windows Vista SMB2 server.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;The maximum is 1048576 bytes (1MiB), which is the same as a Windows Server 2008 r2.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;Please note that the default is 1MiB, but it's limit is based on the
+smb2 dialect (64KiB for SMB2.0, 1MiB for SMB2.1 with LargeMTU).
+Large MTU is not supported over NBT (tcp port 139).&amp;lt;/para&amp;gt;
 &amp;lt;/description&amp;gt;
 
 &amp;lt;related&amp;gt;smb2 max read&amp;lt;/related&amp;gt;
 &amp;lt;related&amp;gt;smb2 max write&amp;lt;/related&amp;gt;
-&amp;lt;value type="default"&amp;gt;65536&amp;lt;/value&amp;gt;
+&amp;lt;value type="default"&amp;gt;1048576&amp;lt;/value&amp;gt;
 &amp;lt;/samba:parameter&amp;gt;
diff --git a/docs-xml/smbdotconf/protocol/smb2maxwrite.xml b/docs-xml/smbdotconf/protocol/smb2maxwrite.xml
index a302a94..1789bc6 100644
--- a/docs-xml/smbdotconf/protocol/smb2maxwrite.xml
+++ b/docs-xml/smbdotconf/protocol/smb2maxwrite.xml
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -8,10 +8,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 &amp;lt;manvolnum&amp;gt;8&amp;lt;/manvolnum&amp;gt;&amp;lt;/citerefentry&amp;gt; will return to a client, informing the client of the largest
 size that may be sent to the server by a single SMB2 write call.
 &amp;lt;/para&amp;gt;
-&amp;lt;para&amp;gt;The maximum is 65536 bytes (64KB), which is the same as a Windows Vista SMB2 server.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;The maximum is 1048576 bytes (1MiB), which is the same as a Windows Server 2008 r2.&amp;lt;/para&amp;gt;
+&amp;lt;para&amp;gt;Please note that the default is 1MiB, but it's limit is based on the
+smb2 dialect (64KiB for SMB2.0, 1MiB for SMB2.1 with LargeMTU).
+Large MTU is not supported over NBT (tcp port 139).&amp;lt;/para&amp;gt;
 &amp;lt;/description&amp;gt;
 
 &amp;lt;related&amp;gt;smb2 max read&amp;lt;/related&amp;gt;
 &amp;lt;related&amp;gt;smb2 max trans&amp;lt;/related&amp;gt;
-&amp;lt;value type="default"&amp;gt;65536&amp;lt;/value&amp;gt;
+&amp;lt;value type="default"&amp;gt;1048576&amp;lt;/value&amp;gt;
 &amp;lt;/samba:parameter&amp;gt;
diff --git a/lib/replace/getpass.c b/lib/replace/getpass.c
index f95109f..3627222 100644
--- a/lib/replace/getpass.c
+++ b/lib/replace/getpass.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -138,7 +138,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void gotintr_sig(int signum)
 char *rep_getpass(const char *prompt)
 {
 FILE *in, *out;
-int echo_off;
+int echo_off, is_a_tty;
 static char buf[256];
 static size_t bufsize = sizeof(buf);
 size_t nread;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -160,8 +160,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; char *rep_getpass(const char *prompt)
 setvbuf(in, NULL, _IONBF, 0);
 
 /* Turn echoing off if it is on now.  */
+is_a_tty = isatty(fileno(in)) &amp;gt; 0;
 
-if (tcgetattr (fileno (in), &amp;amp;t) == 0) {
+if (is_a_tty &amp;amp;&amp;amp; (tcgetattr (fileno (in), &amp;amp;t) == 0)) {
 if (ECHO_IS_ON(t)) {
 TURN_ECHO_OFF(t);
 echo_off = tcsetattr (fileno (in), TCSAFLUSH, &amp;amp;t) == 0;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -196,7 +197,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; char *rep_getpass(const char *prompt)
 if (gotintr &amp;amp;&amp;amp; in_fd == -1) {
 in = fopen ("/dev/tty", "w+");
 }
-if (in != NULL)
+if ((in != NULL) &amp;amp;&amp;amp; is_a_tty)
 tcsetattr (fileno (in), TCSANOW, &amp;amp;t);
 }
 
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index aee4004..762382c 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1736,7 +1736,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool wbinfo_pam_logon(char *username)
 {
 wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 struct wbcLogonUserParams params;
-struct wbcAuthErrorInfo *error;
+struct wbcAuthErrorInfo *error = NULL;
 char *s = NULL;
 char *p = NULL;
 TALLOC_CTX *frame = talloc_tos();
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1787,16 +1787,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static bool wbinfo_pam_logon(char *username)
 d_printf("plaintext password authentication %s\n",
  WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");
 
-if (!WBC_ERROR_IS_OK(wbc_status)) {
+if (!WBC_ERROR_IS_OK(wbc_status) &amp;amp;&amp;amp; (error != NULL)) {
 d_fprintf(stderr,
   "error code was %s (0x%x)\nerror message was: %s\n",
   error-&amp;gt;nt_string,
   (int)error-&amp;gt;nt_status,
   error-&amp;gt;display_string);
 wbcFreeMemory(error);
-return false;
 }
-return true;
+return WBC_ERROR_IS_OK(wbc_status);
 }
 
 /* Save creds with winbind */
diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl
index 8439256..7df7cb5 100644
--- a/packaging/RHEL/samba.spec.tmpl
+++ b/packaging/RHEL/samba.spec.tmpl
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -370,6 +370,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; fi
 %{_mandir}/man8/winbindd.8*
 %{_mandir}/man1/ntlm_auth.1*
 %{_mandir}/man1/wbinfo.1*
+%{_mandir}/man1/dbwrap_*.1*
 %{_mandir}/man8/vfs_*.8*
 %{_mandir}/man8/idmap_*.8*
 
diff --git a/selftest/knownfail b/selftest/knownfail
index e3964d6..262b889 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -107,6 +107,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 ^samba4.smb2.rename.no_share_delete_no_delete_access\(.*\)$
 ^samba4.smb2.rename.msword
 ^samba4.smb2.compound.related3
+^samba4.smb2.compound.compound-break
 ^samba4.winbind.struct.*.show_sequence     # Not yet working in winbind
 ^samba4.*base.delaywrite.*update of write time and SMBwrite truncate\(.*\)$
 ^samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand\(.*\)$
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 70304fe..2061d97 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -937,6 +937,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; sub provision($$$$$$)
 path = $shrdir
 comment = encrypt smb username is [%U]
 smb encrypt = required
+vfs objects = $vfs_modulesdir_abs/dirsort.so
 [tmpguest]
 path = $shrdir
         guest ok = yes
diff --git a/source3/Makefile.in b/source3/Makefile.in
index f6305c6..55505df 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -333,7 +333,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; LIBNDR_SPOOLSS_OBJ = autoconf/librpc/gen_ndr/ndr_spoolss.o \
   ../librpc/ndr/ndr_spoolss_buf.o
 
 LIBNDR_NTPRINTING_OBJ = autoconf/librpc/gen_ndr/ndr_ntprinting.o \
-../librpc/ndr/ndr_ntprinting.o \
+../librpc/ndr/ndr_ntprinting.o
 
 LIBNDR_PREG_OBJ = autoconf/librpc/gen_ndr/ndr_preg.o \
   ../librpc/ndr/ndr_preg.o
diff --git a/source3/auth/auth_winbind.c b/source3/auth/auth_winbind.c
index d4ace2c..2b5c84d 100644
--- a/source3/auth/auth_winbind.c
+++ b/source3/auth/auth_winbind.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -62,9 +62,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 }
 
 /* Send off request */
-
 params.account_name= user_info-&amp;gt;client.account_name;
-params.domain_name= user_info-&amp;gt;mapped.domain_name;
+/*
+ * We need to send the domain name from the client to the DC. With
+ * NTLMv2 the domain name is part of the hashed second challenge,
+ * if we change the domain name, the DC will fail to verify the
+ * challenge cause we changed the domain name, this is like a
+ * man in the middle attack.
+ */
+params.domain_name= user_info-&amp;gt;client.domain_name;
 params.workstation_name= user_info-&amp;gt;workstation_name;
 
 params.flags= 0;
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index 4842192..082c885 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -427,12 +427,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
 x_fclose(f);
 
 /*
- * Setup the last_from and last_to as an optimization so
+ * If we didn't successfully map a user in the loop above,
+ * setup the last_from and last_to as an optimization so
  * that we don't scan the file again for the same user.
  */
-
-set_last_from_to(user_in, user_in);
-store_map_in_gencache(ctx, user_in, user_in);
+if (!mapped_user) {
+DEBUG(8, ("The user '%s' has no mapping. "
+  "Skip it next time.\n", user_in));
+set_last_from_to(user_in, user_in);
+store_map_in_gencache(ctx, user_in, user_in);
+}
 
 return mapped_user;
 }
diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h
index 7e7d8a2..2c6e7ef 100644
--- a/source3/include/srvstr.h
+++ b/source3/include/srvstr.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,12 +19,3 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #define srvstr_pull_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \
     pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags)
-
-/* pull a string from the smb_buf part of a packet. In this case the


&lt;/pre&gt;</description>
    <dc:creator>Karolin Seeger</dc:creator>
    <dc:date>2013-05-21T06:55:46</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77867">
    <title>[SCM] Samba Shared Repository - branch v4-0-test updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77867</link>
    <description>&lt;pre&gt;The branch, v4-0-test has been updated
       via  c497442 VERSION: Bump version number up to 4.0.7...
       via  4800b9f VERSION: Disable git snapshots for the 4.0.6 release.
      from  4b2c301 doc-xml/smbdotconf: fix server [min|max] protocol documentation (bug 9883)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit c497442fbb14e2ae050a02307b3c269c632407c0
Author: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 09:29:07 2013 +0200

    VERSION: Bump version number up to 4.0.7...
    
    and re-enable git snapshots.
    
    Signed-off-by: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 4800b9f543c15e160a3c5e9ce46c16cba6c7c895
Author: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 09:27:51 2013 +0200

    VERSION: Disable git snapshots for the 4.0.6 release.
    
    Signed-off-by: Karolin Seeger &amp;lt;kseeger&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 VERSION |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index f7a1c23..0eb98b6 100644
--- a/VERSION
+++ b/VERSION
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,7 +25,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=0
-SAMBA_VERSION_RELEASE=6
+SAMBA_VERSION_RELEASE=7
 
 ########################################################
 # If a official release has a serious bug              #


&lt;/pre&gt;</description>
    <dc:creator>Karolin Seeger</dc:creator>
    <dc:date>2013-05-21T06:48:05</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77866">
    <title>autobuild: intermittent test failure detected</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77866</link>
    <description>&lt;pre&gt;The autobuild test system has detected an intermittent failing test in 
the current master tree.

The autobuild log of the failure is available here:

   http://git.samba.org/autobuild.flakey/2013-05-21-0341/flakey.log

The samba3 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-21-0341/samba3.stderr
   http://git.samba.org/autobuild.flakey/2013-05-21-0341/samba3.stdout

The source4 build logs are available here:

   http://git.samba.org/autobuild.flakey/2013-05-21-0341/samba.stderr
   http://git.samba.org/autobuild.flakey/2013-05-21-0341/samba.stdout
  
The top commit at the time of the failure was:

commit f80d56a1a0d62c5a1cdbe78ec3214b9f53e28946
Author: GÃ¼nther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 11:23:22 2013 +0200

    s4-torture: No need to disable rpc.spoolss.win test when compiled with MIT kerberos.
    
    Guenther
    
    Signed-off-by: GÃ¼nther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Mon May 20 20:35:33 CEST 2013 on sn-devel-104

&lt;/pre&gt;</description>
    <dc:creator>autobuild</dc:creator>
    <dc:date>2013-05-21T01:41:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.network.samba.cvs/77865">
    <title>[SCM] Samba Shared Repository - branch master updated</title>
    <link>http://permalink.gmane.org/gmane.network.samba.cvs/77865</link>
    <description>&lt;pre&gt;The branch, master has been updated
       via  f80d56a s4-torture: No need to disable rpc.spoolss.win test when compiled with MIT kerberos.
       via  8b7788c selftest: mark the spoolss add print processor tests as knownfail for now.
       via  00ee6a6 s4-torture: add simple tests for spoolss_{Add|Delete}PrintProcessor.
       via  fdf9474 doserr: add mapping for WERR_PRINT_PROCESSOR_ALREADY_INSTALLED.
       via  9744bf5 spoolss: fill in IDL for spoolss_DeletePrintProcessor.
       via  e8797a3 s4-torture: also deal with "Microsoft XPS Document Writer v4" as default driver.
       via  cc153fe s4-torture: add ndr test for spoolss_RpcSetJobNamedProperty.
       via  c568a2e s4-torture: add ndr test for spoolss_GetCorePrinterDrivers.
       via  c51866e s4-torture: add simple test for spoolss_RpcSendRecvBidiData.
       via  aa1e5f2 s4-torture: add test for spoolss_RpcEnumJobNamedProperties.
       via  3d567f6 spoolss: add spoolss_MonitorContainer IDL.
       via  1aafc84 spoolss: make RPC_PrintNamedProperty public
       via  cc38511 spoolss: fill in IDL for JobNamedProperty calls.
       via  ec29957 spoolss: make more container objects public for iremotewinspool.
       via  5a5ed68 spoolss: add idl for spoolss_RpcSendRecvBidiData.
       via  b072bb7 s4-torture: add missing NTSTATUS checks in test_AddJob().
       via  69d9e3e spoolss: add [ms_union] to spoolss.idl where appropriate.
       via  229108e spoolss: fix string types in spoolss_JTEXP.
       via  393ad20 spoolss: Fix two size elements in the devmode private spoolss_JTEXP struct.
      from  d7708fd talloc: Fix a typo

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


- Log -----------------------------------------------------------------
commit f80d56a1a0d62c5a1cdbe78ec3214b9f53e28946
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri May 17 11:23:22 2013 +0200

    s4-torture: No need to disable rpc.spoolss.win test when compiled with MIT kerberos.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Autobuild-User(master): David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;
    Autobuild-Date(master): Mon May 20 20:35:33 CEST 2013 on sn-devel-104

commit 8b7788c5d8ecbac3b8a41cdbb4fec7f0e73a9b76
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri Feb 1 14:53:12 2013 +0100

    selftest: mark the spoolss add print processor tests as knownfail for now.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 00ee6a648b6290d6d3ddcb35fe5aa4c797222684
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri Feb 1 14:07:50 2013 +0100

    s4-torture: add simple tests for spoolss_{Add|Delete}PrintProcessor.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit fdf94747599e1461873fb2a5466f1e55d904333f
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri Feb 1 14:07:07 2013 +0100

    doserr: add mapping for WERR_PRINT_PROCESSOR_ALREADY_INSTALLED.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 9744bf519b1fcdab59ba7d55b2b664a6b44b30bd
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Fri Feb 1 02:34:11 2013 +0100

    spoolss: fill in IDL for spoolss_DeletePrintProcessor.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit e8797a3ecc03cbbdbc51c3952ac72fd663d5849c
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Thu Jan 31 22:06:20 2013 +0100

    s4-torture: also deal with "Microsoft XPS Document Writer v4" as default driver.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit cc153fe86f780d4aefe40999064b294b612e92d6
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Thu Jan 31 14:56:17 2013 +0100

    s4-torture: add ndr test for spoolss_RpcSetJobNamedProperty.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit c568a2e5c58d01fdd27156e84b361e49c4666fb1
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue Jan 22 10:17:27 2013 +0100

    s4-torture: add ndr test for spoolss_GetCorePrinterDrivers.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit c51866eadf6159a6fa76af28be3b9a724ed28b46
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Thu Jan 31 20:44:54 2013 +0100

    s4-torture: add simple test for spoolss_RpcSendRecvBidiData.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit aa1e5f29af2a4560eecaac08ed62c2e63d3c8504
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Mon Jan 21 22:09:22 2013 +0100

    s4-torture: add test for spoolss_RpcEnumJobNamedProperties.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 3d567f6a962a59cb69b702e7ed2c968246c26566
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Sun Feb 24 14:06:59 2013 +0100

    spoolss: add spoolss_MonitorContainer IDL.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 1aafc844a721746b4feddbd2d547463a43821a2f
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Thu Jan 24 23:31:19 2013 +0100

    spoolss: make RPC_PrintNamedProperty public
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit cc38511903dbf34eeb358759f00341f60688acdb
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Mon Jan 21 21:37:12 2013 +0100

    spoolss: fill in IDL for JobNamedProperty calls.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit ec29957e884d345009edac18ad362ba91de39f9c
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Sat Jan 19 00:20:42 2013 +0100

    spoolss: make more container objects public for iremotewinspool.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 5a5ed68d0a92b36ddad9160deaf58314c13b2b49
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Sat Jan 19 00:47:42 2013 +0100

    spoolss: add idl for spoolss_RpcSendRecvBidiData.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit b072bb76dbdd96ee676c2bfbbffe58a187ef25ac
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue Feb 5 16:10:34 2013 +0100

    s4-torture: add missing NTSTATUS checks in test_AddJob().
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 69d9e3ef870fdd643bdc6fb4c893fa26d06fb2cf
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Wed Jan 30 20:05:51 2013 +0100

    spoolss: add [ms_union] to spoolss.idl where appropriate.
    
    Normally we would activate [ms_union] for the entire interface but given the
    fact we use this IDL file also for custom-marshalled structures we would
    generate union arm alignment also for the custom-marshalled unions where they
    are inappropriate. Thus, only enable [ms_union] only for unions that are part of
    the MS-RPRN IDL.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 229108e26645e121fa5ec06911f573dce8198c07
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Wed Jan 30 15:55:18 2013 +0100

    spoolss: fix string types in spoolss_JTEXP.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

commit 393ad20577c7fa66928ecb34bc8b323feb881ea5
Author: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
Date:   Tue Jan 29 21:57:58 2013 +0100

    spoolss: Fix two size elements in the devmode private spoolss_JTEXP struct.
    
    Guenther
    
    Signed-off-by: Günther Deschner &amp;lt;gd&amp;lt; at &amp;gt;samba.org&amp;gt;
    
    Reviewed-by: David Disseldorp &amp;lt;ddiss&amp;lt; at &amp;gt;samba.org&amp;gt;

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

Summary of changes:
 libcli/util/doserr.c                        |    1 +
 librpc/idl/spoolss.idl                      |  211 +++++++++++--
 selftest/knownfail                          |    1 +
 source3/rpc_server/spoolss/srv_spoolss_nt.c |    6 +-
 source4/rpc_server/spoolss/dcesrv_spoolss.c |    6 +-
 source4/torture/ndr/spoolss.c               |   73 +++++
 source4/torture/rpc/rpc.c                   |    2 +-
 source4/torture/rpc/spoolss.c               |  453 ++++++++++++++++++++++++++-
 source4/torture/rpc/spoolss_win.c           |    3 -
 source4/torture/wscript_build               |    4 +-
 10 files changed, 714 insertions(+), 46 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/doserr.c b/libcli/util/doserr.c
index a0c152d..f16db42 100644
--- a/libcli/util/doserr.c
+++ b/libcli/util/doserr.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -309,6 +309,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static const struct werror_code_struct dos_errs[] =
 { "WERR_PASSWORD_RESTRICTION", WERR_PASSWORD_RESTRICTION },
 { "WERR_WRONG_PASSWORD", WERR_WRONG_PASSWORD },
 { "WERR_CLASS_NOT_REGISTERED", WERR_CLASS_NOT_REGISTERED },
+{ "WERR_PRINT_PROCESSOR_ALREADY_INSTALLED", WERR_PRINT_PROCESSOR_ALREADY_INSTALLED },
 /*****************************************************************************
  Auto-generated Win32 error from:
  http://msdn.microsoft.com/en-us/library/cc231199%28PROT.10%29.aspx
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index a43449b..e7fecfe 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -28,7 +28,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 uint16 millisecond;
 } spoolss_Time;
 
-typedef struct {
+typedef [public] struct {
 [value(ndr_size_spoolss_Time(time, ndr-&amp;gt;flags))] uint32 size;
 [unique] spoolss_Time *time;
 } spoolss_TimeCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -427,10 +427,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 uint32 dwSize;
 [value(SPOOLSS_DM_SIGNATURE_JTEXP)] spoolss_DM_Signature dwSignature;
 [value(0)] uint32 dwVersion;
-[value(16)] uint32 wJTHdrSize;
-uint32 wCoreMFOSize;
-[string,charset(UTF16)] uint16 *ModelName;
-nstring_array FeatureOptionPairs;
+[value(16)] uint16 wJTHdrSize;
+uint16 wCoreMFOSize; /* must be sizeof the two following elements, must be dwSize - 16*/
+nstring ModelName;
+[flag(STR_UTF8|STR_NULLTERM|NDR_REMAINING)] string_array FeatureOptionPairs;
 } spoolss_JTEXP;
 
 /* Device Mode Extra Data: OEM_DMEXTRA */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -885,7 +885,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x01 */
-typedef struct {
+typedef [public] struct {
 [value(_ndr_size_spoolss_DeviceMode(devmode, ndr-&amp;gt;flags))] uint32 _ndr_size;
 [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
 } spoolss_DevmodeContainer;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1053,7 +1053,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 uint32 size_high;
 } spoolss_SetJobInfo4;
 
-typedef [public] union {
+typedef [ms_union,public] union {
 [case(1)] spoolss_SetJobInfo1 *info1;
 [case(2)] spoolss_SetJobInfo2 *info2;
 [case(3)] spoolss_JobInfo3    *info3;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1061,7 +1061,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 [default];
 } spoolss_SetJobInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_SetJobInfo info;
 } spoolss_JobInfoContainer;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1251,7 +1251,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 uint32 *devmode_ptr;
 } spoolss_SetPrinterInfo9;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(0)] spoolss_SetPrinterInfo0 *info0;
 [case(1)] spoolss_SetPrinterInfo1 *info1;
 [case(2)] spoolss_SetPrinterInfo2 *info2;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1265,7 +1265,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 [default];
 } spoolss_SetPrinterInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_SetPrinterInfo info;
 } spoolss_SetPrinterInfoCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1428,7 +1428,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 hyper min_inbox_driver_ver_version;
 } spoolss_AddDriverInfo8;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(1)] spoolss_AddDriverInfo1 *info1;
 [case(2)] spoolss_AddDriverInfo2 *info2;
 [case(3)] spoolss_AddDriverInfo3 *info3;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1437,7 +1437,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 [case(8)] spoolss_AddDriverInfo8 *info8;
 } spoolss_AddDriverInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_AddDriverInfo info;
 } spoolss_AddDriverInfoCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1746,14 +1746,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 [string,charset(UTF16)] uint16 *datatype;
 } spoolss_DocumentInfo1;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(1)] spoolss_DocumentInfo1 *info1;
 [case(2)]; /* TODO */
 [case(3)]; /* TODO */
 [default];
 } spoolss_DocumentInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_DocumentInfo info;
 } spoolss_DocumentInfoCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2047,12 +2047,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 uint32 lang_id;
 } spoolss_AddFormInfo2;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(1)] spoolss_AddFormInfo1 *info1;
 [case(2)] spoolss_AddFormInfo2 *info2;
 } spoolss_AddFormInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_AddFormInfo info;
 } spoolss_AddFormInfoCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2279,14 +2279,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 DATA_BLOB monitor_data; /* relative ?? */
 } spoolss_SetPortInfoFF;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(1)] spoolss_SetPortInfo1 *info1;
 [case(2)] spoolss_SetPortInfo2 *info2;
 [case(3)] spoolss_SetPortInfo3 *info3;
 [case(0xff)] spoolss_SetPortInfoFF *infoFF;
 } spoolss_SetPortInfo;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_SetPrinterInfo info;
 } spoolss_SetPortInfoContainer;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2365,6 +2365,27 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x2e */
+
+typedef struct {
+[string,charset(URF16)] uint16 *monitor_name;
+} spoolss_AddMonitorInfo1;
+
+typedef struct {
+[string,charset(URF16)] uint16 *monitor_name;
+[string,charset(URF16)] uint16 *environment;
+[string,charset(URF16)] uint16 *dll_name;
+} spoolss_AddMonitorInfo2;
+
+typedef [ms_union,switch_type(uint32)] union {
+[case(1)] spoolss_AddMonitorInfo1 *info1;
+[case(2)] spoolss_AddMonitorInfo2 *info2;
+} spoolss_AddMonitorInfo;
+
+typedef [public] struct {
+uint32 level;
+[switch_is(level)] spoolss_MonitorInfo info;
+} spoolss_MonitorContainer;
+
 [todo] WERROR spoolss_AddMonitor(
 );
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2375,7 +2396,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x30 */
-[todo] WERROR spoolss_DeletePrintProcessor(
+WERROR spoolss_DeletePrintProcessor(
+[in,unique] [string,charset(UTF16)] uint16 *server,
+[in,unique] [string,charset(UTF16)] uint16 *architecture,
+[in] [string,charset(UTF16)] uint16 print_processor_name[]
 );
 
 /******************/
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2549,7 +2573,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 /******************/
 /* Function: 0x3d */
 
-typedef struct {
+typedef [public] struct {
 uint32 monitor_data_size;
 [size_is(monitor_data_size),unique] uint8 *monitor_data;
 } spoolss_PortVarContainer;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2660,7 +2684,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 PRINTER_NOTIFY_OPTIONS_REFRESH= 0x00000001
 } spoolssNotifyOptionFlags;
 
-typedef struct {
+typedef [public] struct {
 [value(2)] uint32 version;
 spoolssNotifyOptionFlags flags;
 uint32 count;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2692,7 +2716,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 NOTIFY_TABLE_SECURITYDESCRIPTOR = 0x0005
 } spoolss_NotifyTable;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union, switch_type(uint32)] union {
 [case(1)] uint32 integer[2];
 [case(2)] spoolss_NotifyString string;
 [case(3)] spoolss_DevmodeContainer devmode;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2708,14 +2732,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 [switch_is(variable_type)] spoolss_NotifyData data;
 } spoolss_Notify;
 
-typedef struct {
+typedef [public] struct {
 [value(2)] uint32 version;
 uint32 flags;
 uint32 count;
 [size_is(count)] spoolss_Notify notifies[];
 } spoolss_NotifyInfo;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(0)] spoolss_NotifyInfo *info0;
 } spoolss_ReplyPrinterInfo;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -2775,13 +2799,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 udlong reserved;
 } spoolss_UserLevel3;
 
-typedef [switch_type(uint32)] union {
+typedef [ms_union,switch_type(uint32)] union {
 [case(1)]  spoolss_UserLevel1 *level1;
 [case(2)]  spoolss_UserLevel2 *level2;
 [case(3)]  spoolss_UserLevel3 *level3;
 } spoolss_UserLevel;
 
-typedef struct {
+typedef [public] struct {
 uint32 level;
 [switch_is(level)] spoolss_UserLevel user_info;
 } spoolss_UserLevelCtr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3158,7 +3182,76 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x61 */
-[todo] WERROR spoolss_61(
+
+const string BIDI_ACTION_ENUM_SCHEMA = "EnumSchema";
+const string BIDI_ACTION_GET = "Get";
+const string BIDI_ACTION_SET = "Set";
+const string BIDI_ACTION_GET_ALL = "GetAll";
+
+typedef enum {
+BIDI_NULL= 0x00000000,
+BIDI_INT= 0x00000001,
+BIDI_FLOAT= 0x00000002,
+BIDI_BOOL= 0x00000003,
+BIDI_STRING= 0x00000004,
+BIDI_TEXT= 0x00000005,
+BIDI_ENUM= 0x00000006,
+BIDI_BLOB= 0x00000007
+} BIDI_TYPE;
+
+typedef struct {
+uint32 cbBuf;
+[size_is(cbBuf), unique] uint8 *pszString;
+} RPC_BINARY_CONTAINER;
+
+typedef [ms_union,switch_type(uint32)] union {
+[case(BIDI_NULL)]uint32 bData;
+[case(BIDI_BOOL)]uint32 bData;
+[case(BIDI_INT)] uint32 iData;
+[case(BIDI_STRING)][unique] [string,charset(UTF16)] uint16 *sData;
+[case(BIDI_TEXT)][unique] [string,charset(UTF16)] uint16 *sData;
+[case(BIDI_ENUM)][unique] [string,charset(UTF16)] uint16 *sData;
+/*[case(BIDI_FLOAT)]float fData;*/
+[case(BIDI_BLOB)]RPC_BINARY_CONTAINER biData;
+} RPC_BIDI_DATA_u;
+
+typedef struct {
+uint32 dwBidiType;
+[switch_is(dwBidiType)] RPC_BIDI_DATA_u u;
+} RPC_BIDI_DATA;
+
+typedef struct {
+uint32 dwReqNumber;
+[unique] [string,charset(UTF16)] uint16 *pSchema;
+RPC_BIDI_DATA data;
+} RPC_BIDI_REQUEST_DATA;
+
+typedef [public] struct {
+[value(1)] uint32 Version;
+uint32 Flags;
+uint32 Count;
+[size_is(Count), unique] RPC_BIDI_REQUEST_DATA *aData[];
+} RPC_BIDI_REQUEST_CONTAINER;
+
+typedef struct {
+uint32 dwResult;
+uint32 dwReqNumber;
+[unique] [string,charset(UTF16)] uint16 *pSchema;
+RPC_BIDI_DATA data;
+} RPC_BIDI_RESPONSE_DATA;
+
+typedef [public] struct {
+[value(1)] uint32 Version;
+uint32 Flags;
+uint32 Count;
+[size_is(Count), unique] RPC_BIDI_RESPONSE_DATA *aData[];
+} RPC_BIDI_RESPONSE_CONTAINER;
+
+WERROR spoolss_RpcSendRecvBidiData(
+[in] policy_handle hPrinter,
+[in,unique] [string,charset(UTF16)] uint16 *pAction,
+[in] RPC_BIDI_REQUEST_CONTAINER *pReqData,
+[out] RPC_BIDI_RESPONSE_CONTAINER **ppRespData
 );
 
 /******************/
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3183,14 +3276,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x66 */
-typedef struct {
+typedef [public] struct {
 GUID core_driver_guid;
 NTTIME driver_date;
 hyper driver_version;
 [charset(UTF8)] uint8 formname[520];
 } spoolss_CorePrinterDriver;
 
-WERROR spoolss_GetCorePrinterDrivers(
+[public] WERROR spoolss_GetCorePrinterDrivers(
 [in,unique] [string,charset(UTF16)] uint16 *servername,
 [in,ref] [string,charset(UTF16)] uint16 *architecture,
 [in] uint32 core_driver_size,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3243,21 +3336,73 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cpp_quote("#define spoolss_security_descriptor security_descriptor")
 
 /******************/
 /* Function: 0x6e */
-[todo] WERROR spoolss_RpcGetJobNamedPropertyValue(
+
+const string SPLFILE_CONTENT_TYPE_PROP_NAME= "Spool File Contents";
+const string SPLFILE_CONTENT_TYPE_XPS_MS= "TYPE_XPS_MS";
+const string SPLFILE_CONTENT_TYPE_XPS_OPEN= "TYPE_XPS_OPEN";
+const string SPLFILE_CONTENT_TYPE_PDL_POSTSCRIPT= "TYPE_PDL_POSTSCRIPT";
+const string SPLFILE_CONTENT_TYPE_PDL_UNKNOWN= "TYPE_PDL_UNKNOWN";
+
+typedef enum {
+kRpcPropertyTypeString= 1,
+kRpcPropertyTypeInt32= 2,
+kRpcPropertyTypeInt64= 3,
+kRpcPropertyTypeByte= 4,
+kRpcPropertyTypeBuffer= 5
+} RPC_EPrintPropertyType;
+
+typedef struct {
+uint32 cbBuf;
+[size_is(cbBuf)] uint8 *pBuf;
+} propertyBlob;
+
+typedef [ms_union,switch_type(RPC_EPrintPropertyType)] union {
+[case(kRpcPropertyTypeString)] [string,charset(UTF16)] uint16 *propertyString;
+[case(kRpcPropertyTypeInt32)] uint32 propertyInt32;
+[case(kRpcPropertyTypeInt64)] hyper propertyInt64;
+[case(kRpcPropertyTypeByte)] uint8 propertyByte;
+[case(kRpcPropertyTypeBuffer)] propertyBlob propertyBlob;
+} RPC_PrintPropertyValueUnion;
+
+typedef [public] struct {
+RPC_EPrintPropertyType ePropertyType;
+[switch_is(ePropertyType)] RPC_PrintPropertyValueUnion value;
+} RPC_PrintPropertyValue;
+
+typedef [public] struct {
+[string,charset(UTF16)] uint16 *propertyName;
+RPC_PrintPropertyValue propertyValue;
+} RPC_PrintNamedProperty;
+
+WERROR spoolss_RpcGetJobNamedPropertyValue(
+[in,ref] policy_handle *hPrinter,
+[in] uint32 JobId,
+[in] [string,charset(UTF16)] uint16 *pszName,
+[out,ref] RPC_PrintPropertyValue *pValue
 );
 
 /******************/
 /* Function: 0x6f */
-[todo] WERROR spoolss_RpcSetJobNamedProperty(
+[public] WERROR spoolss_RpcSetJobNamedProperty(
+[in,ref] policy_handle *hPrinter,
+[in] uint32 JobId,
+[in,ref] RPC_PrintNamedProperty *pProperty
 );
 
 /******************/
 /* Function: 0x70 */
-[todo] WERROR spoolss_RpcDeleteJobNamedProperty(
+WERROR spoolss_RpcDeleteJobNamedProperty(
+[in,ref] policy_handle *hPrinter,
+[in] uint32 JobId,
+[in] [string,charset(UTF16)] uint16 *pszName
 );
 
 /******************/
 /* Function: 0x71 */
-[todo] WERROR spoolss_RpcEnumJobNamedProperties(
+WERROR spoolss_RpcEnumJobNamedProperties(
+[in,ref] policy_handle *hPrinter,
+[in] uint32 JobId,
+[out,ref] uint32 *pcProperties,
+[out,ref,size_is(,*pcProperties)] RPC_PrintNamedProperty **ppProperties
 );
 }
diff --git a/selftest/knownfail b/selftest/knownfail
index a7f347e..a06bab6 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -215,6 +215,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 ^samba3.raw.session.*reauth2 # maybe fix this?
 ^samba3.rpc.spoolss.printer.addprinter.driver_info_winreg # knownfail or flapping?
 ^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping?
+^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
 #
 # The following tests fail against plugin_s4_dc (aka s3fs) currently.
 # These need to be examined and either fixed or correctly categorised.
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 891f429..7482443 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -10852,11 +10852,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; WERROR _spoolss_60(struct pipes_struct *p,
 }
 
 /****************************************************************
- _spoolss_61
+ _spoolss_RpcSendRecvBidiData
 ****************************************************************/
 
-WERROR _spoolss_61(struct pipes_struct *p,
-   struct spoolss_61 *r)
+WERROR _spoolss_RpcSendRecvBidiData(struct pipes_struct *p,
+    struct spoolss_RpcSendRecvBidiData *r)
 {
 p-&amp;gt;fault_state = DCERPC_FAULT_OP_RNG_ERROR;
 return WERR_NOT_SUPPORTED;
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index e3df4e0..cb892a6 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1592,10 +1592,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static WERROR dcesrv_spoolss_60(struct dcesrv_call_state *dce_call, TALLOC_CTX *
 
 
 /*
-  spoolss_61
+  spoolss_RpcSendRecvBidiData
 */
-static WERROR dcesrv_spoolss_61(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-       struct spoolss_61 *r)
+static WERROR dcesrv_spoolss_RpcSendRecvBidiData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+       struct spoolss_RpcSendRecvBidiData *r)
 {
 DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }
diff --git a/source4/torture/ndr/spoolss.c b/source4/torture/ndr/spoolss.c
index 52a5b03..5818fdf 100644
--- a/source4/torture/ndr/spoolss.c
+++ b/source4/torture/ndr/spoolss.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1699,6 +1699,75 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static const uint8_t setprinter_64_req_data[] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
+static const uint8_t getcoreprinterdrivers_64_req_data[] = {
+0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00,
+0x31, 0x00, 0x39, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+0x38, 0x00, 0x2e, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x38, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x64, 0x00,
+0x6f, 0x00, 0x77, 0x00, 0x73, 0x00, 0x20, 0x00, 0x78, 0x00, 0x36, 0x00,
+0x34, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x44, 0x00,
+0x32, 0x00, 0x30, 0x00, 0x45, 0x00, 0x41, 0x00, 0x33, 0x00, 0x37, 0x00,
+0x32, 0x00, 0x2d, 0x00, 0x44, 0x00, 0x44, 0x00, 0x33, 0x00, 0x35, 0x00,
+0x2d, 0x00, 0x34, 0x00, 0x39, 0x00, 0x35, 0x00, 0x30, 0x00, 0x2d, 0x00,
+0x39, 0x00, 0x45, 0x00, 0x44, 0x00, 0x38, 0x00, 0x2d, 0x00, 0x41, 0x00,
+0x36, 0x00, 0x33, 0x00, 0x33, 0x00, 0x35, 0x00, 0x41, 0x00, 0x46, 0x00,
+0x45, 0x00, 0x37, 0x00, 0x39, 0x00, 0x46, 0x00, 0x30, 0x00, 0x7d, 0x00,


&lt;/pre&gt;</description>
    <dc:creator>David Disseldorp</dc:creator>
    <dc:date>2013-05-20T18:36:02</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.network.samba.cvs">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.network.samba.cvs</link>
  </textinput>
</rdf:RDF>
