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

Karolin Seeger kseeger at samba.org
Tue Nov 19 13:22:04 UTC 2019


The branch, v4-11-test has been updated
       via  70c829304e0 ctdb-tcp: Close inflight connecting TCP sockets after fork
       via  0b78c29a0fa ctdb-tcp: Drop tracking of file descriptor for incoming connections
       via  77deaadca8e ctdb-tcp: Avoid orphaning the TCP incoming queue
       via  bc152b8473a ctdb-tcp: Check incoming queue to see if incoming connection is up
       via  3e5b173ef44 gitlab-ci: Run samba-fileserver-heimdalkrb5
       via  7d7e6326493 bootstrap: Add heimdal-multidev for Debian and Ubuntu
       via  af83d6adf94 autobuild: Add test for build with system heimdal library
       via  ce4ab72c01f krb5_plugin: Fix developer build with newer heimdal system library
       via  060ff2dd504 krb5_plugin: Use C99 initializer
       via  95f267704e7 selftest: system-heimdal: workaround upstream "host" canon bug
       via  83299928bbf wscript: Fix build with system heimdal
       via  9010e9f373e s3: libsmb: Ensure return from net_share_enum_rpc() sets cli->raw_status on error.
      from  78ead63dbff s3: utils: smbtree. Ensure we don't call cli_RNetShareEnum() on an SMB1 connection.

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


- Log -----------------------------------------------------------------
commit 70c829304e0d24c228bde79a6dd6597e7e2e185a
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Nov 7 15:26:01 2019 +0100

    ctdb-tcp: Close inflight connecting TCP sockets after fork
    
    Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets
    while sitting in the async connect() syscall are not freed via
    ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure.
    Free this structure as well.
    
    If an outgoing TCP socket leaks into a long-running child process (possibly the
    recovery daemon), this connection will never be closed as seen by the
    destination node. Because with recent changes incoming connections will not be
    accepted as long as any incoming connection is alive, with that socket leak
    into the recovery daemon we will never again be able to successfully connect to
    the node that is affected by this leak. Further attempts to connect will be
    discarded by the destination as long as the recovery daemon keeps this socket
    alive.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
    RN: Avoid communication breakdown on node reconnect
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f)
    
    Autobuild-User(v4-11-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-11-test): Tue Nov 19 13:21:18 UTC 2019 on sn-devel-184

commit 0b78c29a0fa091d54871cac084e9673605ae6a4e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 29 17:28:22 2019 +1100

    ctdb-tcp: Drop tracking of file descriptor for incoming connections
    
    This file descriptor is owned by the incoming queue.  It will be
    closed when the queue is torn down.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit bf47bc18bb8a94231870ef821c0352b7a15c2e28)

commit 77deaadca8e8dbc3c92ea16893099c72f6dc874e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 29 15:29:11 2019 +1100

    ctdb-tcp: Avoid orphaning the TCP incoming queue
    
    CTDB's incoming queue handling does not check whether an existing
    queue exists, so can overwrite the pointer to the queue.  This used to
    be harmless until commit c68b6f96f26664459187ab2fbd56767fb31767e0
    changed the read callback to use a parent structure as the callback
    data.  Instead of cleaning up an orphaned queue on disconnect, as
    before, this will now free the new queue.
    
    At first glance it doesn't seem possible that 2 incoming connections
    from the same node could be processed before the intervening
    disconnect.  However, the incoming connections and disconnect occur on
    different file descriptors.  The queue can become orphaned on node A
    when the following sequence occurs:
    
    1. Node A comes up
    2. Node A accepts an incoming connection from node B
    3. Node B processes a timeout before noticing that outgoing the queue is writable
    4. Node B tears down the outgoing connection to node A
    5. Node B initiates a new connection to node A
    6. Node A accepts an incoming connection from node B
    
    Node A processes then the disconnect of the old incoming connection
    from (2) but tears down the new incoming connection from (6).  This
    then occurs until the originally affected node is restarted.
    
    However, due to the number of outgoing connection attempts and
    associated teardowns, this induces the same behaviour on the
    corresponding incoming queue on all nodes that node A attempts to
    connect to.  Therefore, other nodes become affected and need to be
    restarted too.
    
    As a result, the whole cluster probably needs to be restarted to
    recover from this situation.
    
    The problem can occur any time CTDB is started on a node.
    
    The fix is to avoid accepting new incoming connections when a queue
    for incoming connections is already present.  The connecting node will
    simply retry establishing its outgoing connection.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit d0baad257e511280ff3e5c7372c38c43df841070)

commit bc152b8473a8041b014b000d64fffd397af2f9fe
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 29 15:25:26 2019 +1100

    ctdb-tcp: Check incoming queue to see if incoming connection is up
    
    This makes it consistent with the reverse case.  Also, in_fd will soon
    be removed.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit e62b3a05a874db13a848573d2e2fb1c157393b9c)

commit 3e5b173ef44a1f54d489e915f609570db37f1d18
Author: Christof Schmitt <cs at samba.org>
Date:   Wed Oct 30 14:24:58 2019 -0700

    gitlab-ci: Run samba-fileserver-heimdalkrb5
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Christof Schmitt <cs at samba.org>
    Autobuild-Date(master): Wed Nov 13 19:14:25 UTC 2019 on sn-devel-184
    
    (cherry picked from commit 5343cec5f0a5531af85d72021dba30c31a4a3f1b)

commit 7d7e63264932d8312135017a505e5d4315952afb
Author: Christof Schmitt <cs at samba.org>
Date:   Wed Oct 30 13:49:55 2019 -0700

    bootstrap: Add heimdal-multidev for Debian and Ubuntu
    
    This is required for testing the build with the
    configure option --with-system-heimdalkrb5.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 2efc243f1ad09eae46f6f99fb0646ecd4356c3f9)

commit af83d6adf94ae78a55f84a8743b2191b591d43a5
Author: Christof Schmitt <cs at samba.org>
Date:   Wed Oct 30 13:45:55 2019 -0700

    autobuild: Add test for build with system heimdal library
    
    The configure option --with-system-heimdalkrb5 requires --without-ad-dc.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 7965a204d68196acddf553959bb3407125baf31d)

commit ce4ab72c01f08e217f489a89fddb8b9428ecbc6e
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Nov 11 13:37:25 2019 -0700

    krb5_plugin: Fix developer build with newer heimdal system library
    
    Newer heimdal versions provide a different locator plugin interface. The
    function pointer for the old method has been renamed. Use an ifdef to
    initialize the correct pointer.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 85d23236200dbe013c09a4f23d982ef1baac240d)

commit 060ff2dd504e1e4b2e4f6daf456cdd38b8879337
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Nov 11 13:08:28 2019 -0700

    krb5_plugin: Use C99 initializer
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 1aef796e302058ad3327613964fa89abaf940c1c)

commit 95f267704e70171a5dbf5784c745de07c2c1b001
Author: Isaac Boukris <iboukris at samba.org>
Date:   Sat Nov 9 15:36:32 2019 +0000

    selftest: system-heimdal: workaround upstream "host" canon bug
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Isaac Boukris <iboukris at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 15ddd95d94688ed742a2965c4b269d7c84e2d858)

commit 83299928bbfb7bbd2b28b07cf6fe582b2a4e616e
Author: Christof Schmitt <cs at samba.org>
Date:   Wed Oct 30 13:15:48 2019 -0700

    wscript: Fix build with system heimdal
    
    Ubuntu has heimdal include files in /usr/include/heimdal. As the
    kerberos include files are pulled into many files through indirect
    includes, add the discovered include paths to EXTRA_INCLUDES to
    always have them available.
    
    Also set USING_SYSTEM_KRB5 when enabling the system heimdal build,
    to correctly handle the inclusion of the krb5-types.h file.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit be2d90b60d19eca408b60fe4e1b49f9b418f1b97)

commit 9010e9f373e648811f04bd7d2d9a6fc799bb903c
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 31 14:38:35 2019 -0700

    s3: libsmb: Ensure return from net_share_enum_rpc() sets cli->raw_status on error.
    
    Convert net_share_enum_rpc() to return an NTSTATUS and ensure the
    status is set correctly on error so SMBC_errno() can return it.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14176
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Tue Nov  5 12:36:48 UTC 2019 on sn-devel-184
    
    (cherry picked from commit ff47cc661d432a9337ade9a232a4f49164652812)

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

Summary of changes:
 .gitlab-ci.yml                                    |  5 +++-
 bootstrap/config.py                               |  1 +
 bootstrap/generated-dists/debian7/bootstrap.sh    |  1 +
 bootstrap/generated-dists/debian7/packages.yml    |  1 +
 bootstrap/generated-dists/debian8/bootstrap.sh    |  1 +
 bootstrap/generated-dists/debian8/packages.yml    |  1 +
 bootstrap/generated-dists/debian9/bootstrap.sh    |  1 +
 bootstrap/generated-dists/debian9/packages.yml    |  1 +
 bootstrap/generated-dists/ubuntu1404/bootstrap.sh |  1 +
 bootstrap/generated-dists/ubuntu1404/packages.yml |  1 +
 bootstrap/generated-dists/ubuntu1604/bootstrap.sh |  1 +
 bootstrap/generated-dists/ubuntu1604/packages.yml |  1 +
 bootstrap/generated-dists/ubuntu1804/bootstrap.sh |  1 +
 bootstrap/generated-dists/ubuntu1804/packages.yml |  1 +
 bootstrap/sha1sum.txt                             |  2 +-
 ctdb/tcp/ctdb_tcp.h                               |  1 -
 ctdb/tcp/tcp_connect.c                            | 11 +++++---
 ctdb/tcp/tcp_init.c                               | 12 ++++-----
 ctdb/tcp/tcp_io.c                                 |  2 --
 nsswitch/krb5_plugin/winbind_krb5_locator.c       | 12 ++++++---
 script/autobuild.py                               | 12 +++++++++
 selftest/target/Samba.pm                          |  6 +++++
 source3/libsmb/libsmb_dir.c                       | 33 +++++++++++++++--------
 wscript_configure_system_heimdal                  |  3 +++
 24 files changed, 83 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 313ae01fa69..67a86d2b0c8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ variables:
   # Set this to the contents of bootstrap/sha1sum.txt
   # which is generated by bootstrap/template.py --render
   #
-  SAMBA_CI_CONTAINER_TAG: 339a70ba1881feec94109c5c4eafacf4ff6c43bc
+  SAMBA_CI_CONTAINER_TAG: 970e3a86b8a9dc10a0a3ec716ab355eb9664dc38
   #
   # We use the ubuntu1804 image as default as
   # it matches what we have on sn-devel-184.
@@ -176,6 +176,9 @@ samba-ad-dc-backup:
 samba-fileserver:
   extends: .private_template
 
+samba-ktest-heimdal:
+  extends: .private_template
+
 samba-ad-dc-1:
   extends: .private_template
 
diff --git a/bootstrap/config.py b/bootstrap/config.py
index 9126961fc93..a83a3efb983 100644
--- a/bootstrap/config.py
+++ b/bootstrap/config.py
@@ -102,6 +102,7 @@ PKGS = [
     ('libunwind-dev', 'libunwind-devel'),  # for back trace
     ('libglib2.0-dev', 'glib2-devel'),
     ('libicu-dev', 'libicu-devel'),
+    ('heimdal-multidev', ''),
 
     # NAME1, NAME2
     # for debian, locales provide locale support with language packs
diff --git a/bootstrap/generated-dists/debian7/bootstrap.sh b/bootstrap/generated-dists/debian7/bootstrap.sh
index 4e126cf5e8e..fcba67cb16f 100755
--- a/bootstrap/generated-dists/debian7/bootstrap.sh
+++ b/bootstrap/generated-dists/debian7/bootstrap.sh
@@ -30,6 +30,7 @@ apt-get -y install \
     git \
     glusterfs-common \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/debian7/packages.yml b/bootstrap/generated-dists/debian7/packages.yml
index 667825c283e..62fd54b1197 100644
--- a/bootstrap/generated-dists/debian7/packages.yml
+++ b/bootstrap/generated-dists/debian7/packages.yml
@@ -19,6 +19,7 @@ packages:
   - git
   - glusterfs-common
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/generated-dists/debian8/bootstrap.sh b/bootstrap/generated-dists/debian8/bootstrap.sh
index 4c8c65223f9..54e3f78db93 100755
--- a/bootstrap/generated-dists/debian8/bootstrap.sh
+++ b/bootstrap/generated-dists/debian8/bootstrap.sh
@@ -30,6 +30,7 @@ apt-get -y install \
     git \
     glusterfs-common \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/debian8/packages.yml b/bootstrap/generated-dists/debian8/packages.yml
index a2d4bdb0638..a65ca2f5d05 100644
--- a/bootstrap/generated-dists/debian8/packages.yml
+++ b/bootstrap/generated-dists/debian8/packages.yml
@@ -19,6 +19,7 @@ packages:
   - git
   - glusterfs-common
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/generated-dists/debian9/bootstrap.sh b/bootstrap/generated-dists/debian9/bootstrap.sh
index fa7051a67e1..4bc421437e6 100755
--- a/bootstrap/generated-dists/debian9/bootstrap.sh
+++ b/bootstrap/generated-dists/debian9/bootstrap.sh
@@ -30,6 +30,7 @@ apt-get -y install \
     git \
     glusterfs-common \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/debian9/packages.yml b/bootstrap/generated-dists/debian9/packages.yml
index 1e3bd0c380c..0021d64db62 100644
--- a/bootstrap/generated-dists/debian9/packages.yml
+++ b/bootstrap/generated-dists/debian9/packages.yml
@@ -19,6 +19,7 @@ packages:
   - git
   - glusterfs-common
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/generated-dists/ubuntu1404/bootstrap.sh b/bootstrap/generated-dists/ubuntu1404/bootstrap.sh
index 65625604f4b..34c7726e50c 100755
--- a/bootstrap/generated-dists/ubuntu1404/bootstrap.sh
+++ b/bootstrap/generated-dists/ubuntu1404/bootstrap.sh
@@ -29,6 +29,7 @@ apt-get -y install \
     gdb \
     git \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/ubuntu1404/packages.yml b/bootstrap/generated-dists/ubuntu1404/packages.yml
index 8838828d7b8..5dd5d008c6e 100644
--- a/bootstrap/generated-dists/ubuntu1404/packages.yml
+++ b/bootstrap/generated-dists/ubuntu1404/packages.yml
@@ -18,6 +18,7 @@ packages:
   - gdb
   - git
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/generated-dists/ubuntu1604/bootstrap.sh b/bootstrap/generated-dists/ubuntu1604/bootstrap.sh
index a47ef984cb5..8923e06d257 100755
--- a/bootstrap/generated-dists/ubuntu1604/bootstrap.sh
+++ b/bootstrap/generated-dists/ubuntu1604/bootstrap.sh
@@ -29,6 +29,7 @@ apt-get -y install \
     gdb \
     git \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/ubuntu1604/packages.yml b/bootstrap/generated-dists/ubuntu1604/packages.yml
index 23939c38e80..d42971db3b5 100644
--- a/bootstrap/generated-dists/ubuntu1604/packages.yml
+++ b/bootstrap/generated-dists/ubuntu1604/packages.yml
@@ -18,6 +18,7 @@ packages:
   - gdb
   - git
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/generated-dists/ubuntu1804/bootstrap.sh b/bootstrap/generated-dists/ubuntu1804/bootstrap.sh
index 45212ccfb81..3ec8f714aa0 100755
--- a/bootstrap/generated-dists/ubuntu1804/bootstrap.sh
+++ b/bootstrap/generated-dists/ubuntu1804/bootstrap.sh
@@ -30,6 +30,7 @@ apt-get -y install \
     git \
     glusterfs-common \
     gzip \
+    heimdal-multidev \
     hostname \
     htop \
     krb5-config \
diff --git a/bootstrap/generated-dists/ubuntu1804/packages.yml b/bootstrap/generated-dists/ubuntu1804/packages.yml
index f2c981fba83..8778af2bafb 100644
--- a/bootstrap/generated-dists/ubuntu1804/packages.yml
+++ b/bootstrap/generated-dists/ubuntu1804/packages.yml
@@ -19,6 +19,7 @@ packages:
   - git
   - glusterfs-common
   - gzip
+  - heimdal-multidev
   - hostname
   - htop
   - krb5-config
diff --git a/bootstrap/sha1sum.txt b/bootstrap/sha1sum.txt
index 52cf7350bc0..0a3dbf1adf0 100644
--- a/bootstrap/sha1sum.txt
+++ b/bootstrap/sha1sum.txt
@@ -1 +1 @@
-339a70ba1881feec94109c5c4eafacf4ff6c43bc
+970e3a86b8a9dc10a0a3ec716ab355eb9664dc38
diff --git a/ctdb/tcp/ctdb_tcp.h b/ctdb/tcp/ctdb_tcp.h
index 9a615fc6393..daabad74297 100644
--- a/ctdb/tcp/ctdb_tcp.h
+++ b/ctdb/tcp/ctdb_tcp.h
@@ -37,7 +37,6 @@ struct ctdb_tcp_node {
 	struct tevent_timer *connect_te;
 
 	struct ctdb_context *ctdb;
-	int in_fd;
 	struct ctdb_queue *in_queue;
 };
 
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 6123380ca9f..a75f35a809e 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -153,7 +153,7 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
 	 * as connected, but only if the corresponding listening
 	 * socket is also connected
 	 */
-	if (tnode->in_fd != -1) {
+	if (tnode->in_queue != NULL) {
 		node->ctdb->upcalls->node_connected(node);
 	}
 }
@@ -312,6 +312,13 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
 		return;
 	}
 
+	if (tnode->in_queue != NULL) {
+		DBG_ERR("Incoming queue active, rejecting connection from %s\n",
+			ctdb_addr_to_str(&addr));
+		close(fd);
+		return;
+	}
+
 	ret = set_blocking(fd, false);
 	if (ret != 0) {
 		DBG_ERR("Failed to set socket non-blocking (%s)\n",
@@ -348,8 +355,6 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
 		return;
 	}
 
-	tnode->in_fd = fd;
-
        /*
 	* Mark the connecting node as connected, but only if the
 	* corresponding outbound connected is also up
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index a9cb9b36a01..0eb9799ac4a 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -43,11 +43,6 @@ static int tnode_destructor(struct ctdb_tcp_node *tnode)
 		tnode->out_fd = -1;
 	}
 
-	if (tnode->in_fd != -1) {
-		close(tnode->in_fd);
-		tnode->in_fd = -1;
-	}
-
 	return 0;
 }
 
@@ -61,7 +56,6 @@ static int ctdb_tcp_add_node(struct ctdb_node *node)
 	CTDB_NO_MEMORY(node->ctdb, tnode);
 
 	tnode->out_fd = -1;
-	tnode->in_fd = -1;
 	tnode->ctdb = node->ctdb;
 
 	node->private_data = tnode;
@@ -143,8 +137,14 @@ static void ctdb_tcp_shutdown(struct ctdb_context *ctdb)
 {
 	struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
 						struct ctdb_tcp);
+	uint32_t i;
+
 	talloc_free(ctcp);
 	ctdb->private_data = NULL;
+
+	for (i=0; i<ctdb->num_nodes; i++) {
+		TALLOC_FREE(ctdb->nodes[i]->private_data);
+	}
 }
 
 /*
diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c
index e8ebff887e1..2d8ec0f7062 100644
--- a/ctdb/tcp/tcp_io.c
+++ b/ctdb/tcp/tcp_io.c
@@ -76,8 +76,6 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
 
 failed:
 	TALLOC_FREE(tnode->in_queue);
-	close(tnode->in_fd);
-	tnode->in_fd = -1;
 	node->ctdb->upcalls->node_dead(node);
 
 	TALLOC_FREE(data);
diff --git a/nsswitch/krb5_plugin/winbind_krb5_locator.c b/nsswitch/krb5_plugin/winbind_krb5_locator.c
index 518c871b248..d08cdf72a59 100644
--- a/nsswitch/krb5_plugin/winbind_krb5_locator.c
+++ b/nsswitch/krb5_plugin/winbind_krb5_locator.c
@@ -409,10 +409,14 @@ static krb5_error_code smb_krb5_locator_lookup(void *private_data,
 #endif
 
 const krb5plugin_service_locate_ftable SMB_KRB5_LOCATOR_SYMBOL_NAME = {
-	0, /* version */
-	smb_krb5_locator_init,
-	smb_krb5_locator_close,
-	smb_krb5_locator_lookup,
+	.minor_version	= 0,
+	.init		= smb_krb5_locator_init,
+	.fini		= smb_krb5_locator_close,
+#ifdef KRB5_PLUGIN_LOCATE_VERSION_2
+	.old_lookup	= smb_krb5_locator_lookup,
+#else
+	.lookup	= smb_krb5_locator_lookup,
+#endif
 };
 
 #endif
diff --git a/script/autobuild.py b/script/autobuild.py
index ef75f507add..cf665bd6a7c 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -124,6 +124,7 @@ builddirs = {
     "samba": ".",
     "samba-nt4": ".",
     "samba-fileserver": ".",
+    "samba-ktest-heimdal": ".",
     "samba-ad-member": ".",
     "samba-xc": ".",
     "samba-o3": ".",
@@ -293,6 +294,17 @@ tasks = {
         ("check-clean-tree", "script/clean-source-tree.sh"),
         ],
 
+    "samba-ktest-heimdal": [
+        ("random-sleep", random_sleep(300, 900)),
+        ("configure", "./configure.developer --without-ad-dc --with-system-heimdalkrb5 --with-selftest-prefix=./bin/ab" + samba_configure_params),
+        ("make", "make -j"),
+        ("test", make_test(include_envs=[
+            "ktest",
+            ])),
+        ("lcov", LCOV_CMD),
+        ("check-clean-tree", "script/clean-source-tree.sh"),
+        ],
+
     "samba-ad-member": [
         ("random-sleep", random_sleep(300, 900)),
         ("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params),
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index c30f6fe33ce..2d0378d1b92 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -252,6 +252,7 @@ sub mk_krb5_conf($$)
 						 $ctx->{dnsname},
 						 $ctx->{domain},
 						 $ctx->{kdc_ipv4});
+	my $lc_domain = lc($ctx->{domain});
 	print KRB5CONF "
 #Generated krb5.conf for $ctx->{realm}
 
@@ -263,6 +264,11 @@ sub mk_krb5_conf($$)
  forwardable = yes
  allow_weak_crypto = yes
 
+ name_canon_rules=as-is:realm=$ctx->{realm}
+ name_canon_rules=as-is:realm=$ctx->{dnsname}
+ name_canon_rules=as-is:realm=$ctx->{domain}
+ name_canon_rules=as-is:realm=$lc_domain
+
  # We are running on the same machine, do not correct
  # system clock differences
  kdc_timesync = 0
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index ab20a127c49..14bfcdec6a7 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -350,7 +350,7 @@ dir_list_fn(const char *mnt,
 	return NT_STATUS_OK;
 }
 
-static int
+static NTSTATUS
 net_share_enum_rpc(struct cli_state *cli,
                    void (*fn)(const char *name,
                               uint32_t type,
@@ -377,7 +377,7 @@ net_share_enum_rpc(struct cli_state *cli,
 					     &pipe_hnd);
         if (!NT_STATUS_IS_OK(nt_status)) {
                 DEBUG(1, ("net_share_enum_rpc pipe open fail!\n"));
-                return -1;
+		goto done;
         }
 
 	ZERO_STRUCT(info_ctr);
@@ -400,18 +400,18 @@ net_share_enum_rpc(struct cli_state *cli,
         /* Was it successful? */
 	if (!NT_STATUS_IS_OK(nt_status)) {
                 /*  Nope.  Go clean up. */
-		result = ntstatus_to_werror(nt_status);
 		goto done;
 	}
 
 	if (!W_ERROR_IS_OK(result)) {
                 /*  Nope.  Go clean up. */
+		nt_status = werror_to_ntstatus(result);
 		goto done;
         }
 
 	if (total_entries == 0) {
                 /*  Nope.  Go clean up. */
-		result = WERR_GEN_FAILURE;
+		nt_status = NT_STATUS_NOT_FOUND;
 		goto done;
 	}
 
@@ -436,7 +436,7 @@ done:
         TALLOC_FREE(pipe_hnd);
 
         /* Tell 'em if it worked */
-        return W_ERROR_IS_OK(result) ? 0 : -1;
+        return nt_status;
 }
 
 
@@ -825,7 +825,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
 				}
 			} else if (srv ||
                                    (resolve_name(server, &rem_ss, 0x20, false))) {
-				int rc;
+				NTSTATUS status;
 
                                 /*
                                  * If we hadn't found the server, get one now
@@ -852,27 +852,38 @@ SMBC_opendir_ctx(SMBCCTX *context,
 
                                 /* List the shares ... */
 
-				rc = net_share_enum_rpc(srv->cli,
+				status = net_share_enum_rpc(srv->cli,
 							list_fn,
 							(void *)dir);
-				if (rc != 0 &&
+				if (!NT_STATUS_IS_OK(status) &&
 				    smbXcli_conn_protocol(srv->cli->conn) <=
 						PROTOCOL_NT1) {
 					/*
 					 * Only call cli_RNetShareEnum()
 					 * on SMB1 connections, not SMB2+.
 					 */
-					rc = cli_RNetShareEnum(srv->cli,
+					int rc = cli_RNetShareEnum(srv->cli,
 							       list_fn,
 							       (void *)dir);
+					if (rc != 0) {
+						status = cli_nt_error(srv->cli);
+					} else {
+						status = NT_STATUS_OK;
+					}
 				}
-				if (rc != 0) {
-					errno = cli_errno(srv->cli);
+				if (!NT_STATUS_IS_OK(status)) {
+					/*
+					 * Set cli->raw_status so SMBC_errno()
+					 * will correctly return the error.
+					 */
+					srv->cli->raw_status = status;
 					if (dir != NULL) {
 						SAFE_FREE(dir->fname);
 						SAFE_FREE(dir);
 					}
 					TALLOC_FREE(frame);
+					errno = map_errno_from_nt_status(
+								status);
 					return NULL;
 				}
                         } else {
diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal
index 0ff6dad2f55..235fa1912b7 100644
--- a/wscript_configure_system_heimdal
+++ b/wscript_configure_system_heimdal
@@ -18,6 +18,7 @@ if krb5_config:
             elif l.startswith("includedir="):
                 include_path = l.strip()[len("includedir="):]
                 heimdal_includedirs.append(include_path)
+                conf.ADD_EXTRA_INCLUDES(include_path)
                 conf.define('HEIMDAL_KRB5_TYPES_PATH',
                             include_path + "/krb5-types.h")
     finally:
@@ -97,3 +98,5 @@ finally:
 
 check_system_heimdal_binary("compile_et")
 check_system_heimdal_binary("asn1_compile")
+
+conf.define('USING_SYSTEM_KRB5', 1)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list