The branch, v4-3-stable has been updated
       via  0c12970 VERSION: Disable git snapshots for the 4.3.4 release.
       via  f700a19 WHATSNEW: Add release notes for Samba 4.3.4.
       via  97d39ca s3:torture: add traverse testing to LOCAL-RBTREE
       via  49f04d1 dbwrap_rbt: fix modifying the db during traverse
       via  4a0f277 dbwrap_rbt: add nested traverse protection
       via  a9071dc dbwrap_rbt: use talloc_zero_size() instead of a partial 
ZERO_STRUCT()
       via  c36c6e9 Revert "Fix bug #11394 -  Crash: Bad talloc magic value - 
access after free"
       via  234861b password_lockout: test creds.get_kerberos_state()
       via  7870c0c auth: keep track of lastLogon and lastLogonTimestamp
       via  5e60671 password_lockout tests: add assertLoginFailure()
       via  fe51036 auth: increase resolution for password grace period 
calculation
       via  ca7cd60 pycredentials: add get_kerberos_state() method
       via  7c50b7a smbd: do not disable "store dos attributes" on-the-fly
       via  6be8237 s3:smbd: fix a corner case of the symlink verification
       via  1ae26f8 s3: libsmb: Correctly initialize the list head when keeping 
a list of primary followed by DFS connections.
       via  9d43c74 vfs_streams_xattr: fix and simplify streams_xattr_get_name()
       via  deec633 vfs_fruit: hide the Netatalk metadata xattr in streaminfo
       via  535812d vfs_fruit: add and use define for the Netatalk metadata 
xattr
       via  48bce69 s4:torture:vfs_fruit: add test test_read_afpinfo
       via  dad33c3 s4:torture:vfs_fruit: add tests for AFP_Resource 
delete-on-close and eof
       via  4c00711 vfs_fruit: ignore delete on the AFP_Resource stream
       via  093575e s4:torture:vfs_fruit: update AFP_AfpInfo IO tests
       via  de829e6 vfs_fruit: fix offset and len handling for AFP_AfpInfo 
stream
       via  f8bc71f s4:torture:vfs_fruit: test nulling out AFP_AfpInfo stream
       via  89f4adb vfs_fruit: writing all 0 to AFP_AfpInfo stream
       via  3a31406 s4:torture:vfs_fruit: add tests for AFP_AfpInfo 
delete-on-close and eof
       via  f85e4e6 vfs_fruit: handling of ftruncate() on AFP_AfpInfo stream
       via  a52778b s4:torture:vfs_fruit: file without AFP_AfpInfo
       via  a0d3a3a vfs_fruit: stat AFP_AfpInfo must fail when it doesn't exist
       via  2482f7a vfs_fruit: fix some debug messages
       via  e150a70 s3:lib/errmap_unix: map EOVERFLOW to 
NT_STATUS_ALLOTTED_SPACE_EXCEEDED
       via  a9d4091 s4:torture:vfs_fruit: fix flakey test_write_atalk_rfork_io 
with OS X
       via  ba97d85 s4:torture:vfs_fruit: fix test_rename_dir_openfile() to 
work with OS X
       via  adbe3fd s4:torture:vfs_fruit: fix test_aapl() to work with OS X
       via  7ed3a98 s4:torture:vfs_fruit: skip test_stream_names() without 
"localdir"
       via  33851cb s4:torture:vfs_fruit: skip test_adouble_conversion() 
without "localdir"
       via  2d9ddc1 s4:torture:vfs_fruit: skip test test_read_atalk_metadata() 
without "localdir" and rename it
       via  8acd795 s4:torture:vfs_fruit: add explicit cleanup of testfiles
       via  9aefc7d s4:torture:vfs_fruit: add --option=torture:osx for 
enable_aapl()
       via  86b653b s4:torture:vfs_fruit: enhance check_stream
       via  eb5df33 s4:torture:vfs_fruit: use AFPINFO_STREAM_NAME
       via  7fb8371 s4:torture:vfs_fruit: tweak check_stream_list()
       via  a985c92 s4:torture:vfs_fruit: rename tree1 -> tree
       via  9215fc8 s4:torture:vfs_fruit: remove unused tree2
       via  a1774eb docs: Fix typos in man vfs_gpfs.
       via  a7fa3a6 smbd: make "hide dot files" option work with "store dos 
attributes = yes"
       via  76edbf5 lib/async_req: do not install async_connect_send_test.
       via  795c543 lib/param: add a fixed unified 
lpcfg_string_{free,set,set_upper}() infrastructure
       via  b8ecf97 samba-tool: fsmo.py throws an uncaught exception if no
       via  95ed8b7 s4:torture:vfs_fruit: add a test for POSIX rename
       via  685ad2d vfs_fruit: enable POSIX directory rename semantics
       via  dfbf293 vfs_fruit: add a flag that tracks whether use of AAPL was 
negotiated
       via  02968ec s3:smbd: file_struct: seperate POSIX directory rename cap 
from POSIX open
       via  db3d0c6 s3:smbd: convert file_struct.posix_open to a bitmap with 
flags
       via  420f38f VERSION: Bump version up to 4.3.4...
       via  fba7e79 Merge tag 'samba-4.3.3' into v4-3-test
       via  569ce95 Fix bug #11394 -  Crash: Bad talloc magic value - access 
after free
       via  392b2d3 docs: Fix some typos in the idmap backend section.
       via  0230180 doc: fix a typo in the smb.conf manpage, explanation of 
idmap config
      from  b7676d1 VERSION: Disable git snapshots for the 4.3.3 release.

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


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

Summary of changes:
 VERSION                                       |    2 +-
 WHATSNEW.txt                                  |   77 +-
 auth/credentials/pycredentials.c              |    8 +
 docs-xml/manpages/vfs_gpfs.8.xml              |    6 +-
 docs-xml/smbdotconf/winbind/idmapconfig.xml   |   15 +-
 lib/async_req/wscript_build                   |    3 +-
 lib/dbwrap/dbwrap_rbt.c                       |  159 +--
 lib/param/loadparm.c                          |   56 +-
 python/samba/netcmd/fsmo.py                   |    3 +-
 source3/include/proto.h                       |    1 -
 source3/include/vfs.h                         |   12 +-
 source3/lib/errmap_unix.c                     |    3 +
 source3/libsmb/libsmb_server.c                |    4 +-
 source3/locking/locking.c                     |    3 +-
 source3/modules/vfs_acl_common.c              |    4 +-
 source3/modules/vfs_fruit.c                   |  185 +++-
 source3/modules/vfs_streams_xattr.c           |   39 +-
 source3/param/loadparm.c                      |  246 +++--
 source3/selftest/tests.py                     |    4 +-
 source3/smbd/close.c                          |    6 +-
 source3/smbd/dosmode.c                        |   32 +-
 source3/smbd/fileio.c                         |    8 +-
 source3/smbd/open.c                           |   10 +-
 source3/smbd/reply.c                          |    2 +-
 source3/smbd/smb2_close.c                     |    2 +-
 source3/smbd/vfs.c                            |   82 +-
 source3/torture/torture.c                     |   39 +
 source4/auth/ntlm/auth_sam.c                  |    9 +-
 source4/auth/sam.c                            |  158 ++-
 source4/dsdb/tests/python/password_lockout.py |  359 ++++++-
 source4/kdc/hdb-samba4.c                      |    7 +-
 source4/torture/vfs/fruit.c                   | 1359 +++++++++++++++++++++----
 32 files changed, 2264 insertions(+), 639 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 083561f..ad5d0cb 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=3
-SAMBA_VERSION_RELEASE=3
+SAMBA_VERSION_RELEASE=4
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index ba2e101..4d03b61 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,77 @@
                    =============================
+                   Release Notes for Samba 4.3.4
+                         January 12, 2016
+                   =============================
+
+
+This is the latest stable release of Samba 4.3.
+
+
+Changes since 4.3.3:
+--------------------
+
+o  Michael Adam <[email protected]>
+   * BUG 11619: doc: Fix a typo in the smb.conf manpage, explanation of idmap
+     config.
+   * BUG 11647: s3:smbd: Fix a corner case of the symlink verification.
+
+o  Jeremy Allison <[email protected]>
+   * BUG 11624: s3: libsmb: Correctly initialize the list head when keeping a
+     list of primary followed by DFS connections.
+   * BUG 11625: Reduce the memory footprint of empty string options.
+
+o  Douglas Bagnall <[email protected]>
+   * BUG 11659: Update lastLogon and lastLogonTimestamp.
+
+o  Ralph Boehme <[email protected]>
+   * BUG 11065: vfs_fruit: Enable POSIX directory rename semantics.
+   * BUG 11466: Copying files with vfs_fruit fails when using vfs_streams_xattr
+     without stream prefix and type suffix.
+   * BUG 11645: smbd: Make "hide dot files" option work with "store dos
+     attributes = yes".
+
+o  Günther Deschner <[email protected]>
+   * BUG 11639: lib/async_req: Do not install async_connect_send_test.
+
+o  Stefan Metzmacher <[email protected]>
+   * BUG 11394: Crash: Bad talloc magic value - access after free.
+
+o  Rowland Penny <[email protected]>
+   * BUG 11613: samba-tool: Fix uncaught exception if no fSMORoleOwner
+     attribute is given.
+
+o  Karolin Seeger <[email protected]>
+   * BUG 11619: docs: Fix some typos in the idmap backend section.
+   * BUG 11641: docs: Fix typos in man vfs_gpfs.
+
+o  Uri Simchoni <[email protected]>
+   * BUG 11649: smbd: Do not disable "store dos attributes" on-the-fly.
+
+
+#######################################
+Reporting bugs & 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.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Older release notes to follow:
+------------------------------
+
+                   =============================
                    Release Notes for Samba 4.3.3
                          December 16, 2015
                    =============================
@@ -142,8 +215,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Older release notes to follow:
-------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.3.2
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
index e32d9a9..5fc2a70 100644
--- a/auth/credentials/pycredentials.c
+++ b/auth/credentials/pycredentials.c
@@ -209,6 +209,12 @@ static PyObject *py_creds_get_nt_hash(pytalloc_Object 
*self)
        return PyString_FromStringAndSize(discard_const_p(char, ntpw->hash), 
16);
 }
 
+static PyObject *py_creds_get_kerberos_state(pytalloc_Object *self)
+{
+       int state = 
cli_credentials_get_kerberos_state(PyCredentials_AsCliCredentials(self));
+       return PyInt_FromLong(state);
+}
+
 static PyObject *py_creds_set_kerberos_state(pytalloc_Object *self, PyObject 
*args)
 {
        int state;
@@ -452,6 +458,8 @@ static PyMethodDef py_creds_methods[] = {
                "Parse credentials string." },
        { "get_nt_hash", (PyCFunction)py_creds_get_nt_hash, METH_NOARGS,
                NULL },
+       { "get_kerberos_state", (PyCFunction)py_creds_get_kerberos_state, 
METH_NOARGS,
+               NULL },
        { "set_kerberos_state", (PyCFunction)py_creds_set_kerberos_state, 
METH_VARARGS,
                NULL },
        { "set_krb_forwardable", (PyCFunction)py_creds_set_krb_forwardable, 
METH_VARARGS,
diff --git a/docs-xml/manpages/vfs_gpfs.8.xml b/docs-xml/manpages/vfs_gpfs.8.xml
index 7bb4e90..e0c5951 100644
--- a/docs-xml/manpages/vfs_gpfs.8.xml
+++ b/docs-xml/manpages/vfs_gpfs.8.xml
@@ -42,14 +42,14 @@
        </itemizedlist>
        </para>
 
-       <para><command>NOTE:</command>This module follows the posix-acl 
behaviour
+       <para><command>NOTE:</command> This module follows the posix-acl 
behaviour
        and hence allows permission stealing via chown. Samba might allow at a 
later
        point in time, to restrict the chown via this module as such 
restrictions
        are the responsibility of the underlying filesystem than of Samba.
        </para>
 
        <para>This module makes use of the smb.conf parameter
-       <smbconfoption name="acl map full control">acl map full 
control</smbconfoption>
+       <smbconfoption name="acl map full control"></smbconfoption>.
        When set to yes (the default), this parameter will add in the 
FILE_DELETE_CHILD
        bit on a returned ACE entry for a file (not a directory) that already
        contains all file permissions except for FILE_DELETE and 
FILE_DELETE_CHILD.
@@ -471,7 +471,7 @@
        </para>
        <para>
        At build time, only the header file <command>gpfs_gpl.h</command>
-       is required , which is a symlink to <command>gpfs.h</command> in
+       is required, which is a symlink to <command>gpfs.h</command> in
        gpfs versions newer than 3.2.1 PTF8.
        </para>
 </refsect1>
diff --git a/docs-xml/smbdotconf/winbind/idmapconfig.xml 
b/docs-xml/smbdotconf/winbind/idmapconfig.xml
index 434d379..db24784 100644
--- a/docs-xml/smbdotconf/winbind/idmapconfig.xml
+++ b/docs-xml/smbdotconf/winbind/idmapconfig.xml
@@ -38,21 +38,16 @@
                (<citerefentry><refentrytitle>idmap_tdb2</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
                ldap
                (<citerefentry><refentrytitle>idmap_ldap</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
-               ,
                rid
                (<citerefentry><refentrytitle>idmap_rid</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
-               ,
                hash
                (<citerefentry><refentrytitle>idmap_hash</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
-               ,
                autorid
                (<citerefentry><refentrytitle>idmap_autorid</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
-               ,
                ad
-               (<citerefentry><refentrytitle>idmap_ad</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
-               ,
-               and nss.
-               (<citerefentry><refentrytitle>idmap_nss</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>),
+               (<citerefentry><refentrytitle>idmap_ad</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>)
+               and nss
+               (<citerefentry><refentrytitle>idmap_nss</refentrytitle> 
<manvolnum>8</manvolnum></citerefentry>).
                The corresponding manual pages contain the details, but
                here is a summary.
                </para>
@@ -65,9 +60,9 @@
                mixture of the tdb and rid backend. It creates ranges for
                each domain encountered and then uses the rid algorithm for each
                of these automatically configured domains individually.
-               The ad backend usees unix IDs stored in Active Directory via
+               The ad backend uses unix ids stored in Active Directory via
                the standard schema extensions. The nss backend reverses
-               the standard winbindd setup and gets the unixids via names
+               the standard winbindd setup and gets the unix ids via names
                from nsswitch which can be useful in an ldap setup.
                </para></listitem>
                </varlistentry>
diff --git a/lib/async_req/wscript_build b/lib/async_req/wscript_build
index 9c25223..bf79fdd 100644
--- a/lib/async_req/wscript_build
+++ b/lib/async_req/wscript_build
@@ -9,5 +9,6 @@ bld.SAMBA_SUBSYSTEM('LIBASYNC_REQ',
 
 bld.SAMBA_BINARY('async_connect_send_test',
                  source='async_connect_send_test.c',
-                 deps='LIBASYNC_REQ'
+                 deps='LIBASYNC_REQ',
+                 install=False
 )
diff --git a/lib/dbwrap/dbwrap_rbt.c b/lib/dbwrap/dbwrap_rbt.c
index 03f2f57..a9cc641 100644
--- a/lib/dbwrap/dbwrap_rbt.c
+++ b/lib/dbwrap/dbwrap_rbt.c
@@ -22,11 +22,15 @@
 #include "dbwrap/dbwrap_private.h"
 #include "dbwrap/dbwrap_rbt.h"
 #include "../lib/util/rbtree.h"
+#include "../lib/util/dlinklist.h"
 
 #define DBWRAP_RBT_ALIGN(_size_) (((_size_)+15)&~15)
 
 struct db_rbt_ctx {
        struct rb_root tree;
+       struct db_rbt_node *nodes;
+       size_t traverse_read;
+       struct db_rbt_node **traverse_nextp;
 };
 
 struct db_rbt_rec {
@@ -38,6 +42,7 @@ struct db_rbt_rec {
 struct db_rbt_node {
        struct rb_node rb_node;
        size_t keysize, valuesize;
+       struct db_rbt_node *prev, *next;
 };
 
 /*
@@ -121,11 +126,16 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
        struct db_rbt_node *node;
 
        struct rb_node ** p;
-       struct rb_node * parent;
+       struct rb_node *parent = NULL;
+       struct db_rbt_node *parent_node = NULL;
 
        ssize_t reclen;
        TDB_DATA this_key, this_val;
 
+       if (db_ctx->traverse_read > 0) {
+               return NT_STATUS_MEDIA_WRITE_PROTECTED;
+       }
+
        if (rec_priv->node != NULL) {
 
                /*
@@ -153,18 +163,25 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
                return NT_STATUS_INSUFFICIENT_RESOURCES;
        }
 
-       node = talloc_size(db_ctx, reclen);
+       node = talloc_zero_size(db_ctx, reclen);
        if (node == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
        if (rec_priv->node != NULL) {
+               if (db_ctx->traverse_nextp != NULL) {
+                       if (*db_ctx->traverse_nextp == rec_priv->node) {
+                               *db_ctx->traverse_nextp = node;
+                       }
+               }
+
                /*
                 * We need to delete the key from the tree and start fresh,
                 * there's not enough space in the existing record
                 */
 
                rb_erase(&rec_priv->node->rb_node, &db_ctx->tree);
+               DLIST_REMOVE(db_ctx->nodes, rec_priv->node);
 
                /*
                 * Keep the existing node around for a while: If the record
@@ -172,8 +189,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
                 */
        }
 
-       ZERO_STRUCT(node->rb_node);
-
        node->keysize = rec->key.dsize;
        node->valuesize = data.dsize;
 
@@ -193,10 +208,11 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
                TDB_DATA search_key, search_val;
                int res;
 
-               parent = (*p);
-
                r = db_rbt2node(*p);
 
+               parent = (*p);
+               parent_node = r;
+
                db_rbt_parse_node(r, &search_key, &search_val);
 
                res = db_rbt_compare(this_key, search_key);
@@ -213,6 +229,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, 
TDB_DATA data, int flag)
        }
 
        rb_link_node(&node->rb_node, parent, p);
+       DLIST_ADD_AFTER(db_ctx->nodes, node, parent_node);
        rb_insert_color(&node->rb_node, &db_ctx->tree);
 
        return NT_STATUS_OK;
@@ -224,26 +241,27 @@ static NTSTATUS db_rbt_delete(struct db_record *rec)
                rec->db->private_data, struct db_rbt_ctx);
        struct db_rbt_rec *rec_priv = (struct db_rbt_rec *)rec->private_data;
 
+       if (db_ctx->traverse_read > 0) {
+               return NT_STATUS_MEDIA_WRITE_PROTECTED;
+       }
+
        if (rec_priv->node == NULL) {
                return NT_STATUS_OK;
        }
 
+       if (db_ctx->traverse_nextp != NULL) {
+               if (*db_ctx->traverse_nextp == rec_priv->node) {
+                       *db_ctx->traverse_nextp = rec_priv->node->next;
+               }
+       }
+
        rb_erase(&rec_priv->node->rb_node, &db_ctx->tree);
+       DLIST_REMOVE(db_ctx->nodes, rec_priv->node);
        TALLOC_FREE(rec_priv->node);
 
        return NT_STATUS_OK;
 }
 
-static NTSTATUS db_rbt_store_deny(struct db_record *rec, TDB_DATA data, int 
flag)
-{
-       return NT_STATUS_MEDIA_WRITE_PROTECTED;
-}
-
-static NTSTATUS db_rbt_delete_deny(struct db_record *rec)
-{
-       return NT_STATUS_MEDIA_WRITE_PROTECTED;
-}
-
 struct db_rbt_search_result {
        TDB_DATA key;
        TDB_DATA val;
@@ -385,75 +403,65 @@ static NTSTATUS db_rbt_parse_record(struct db_context 
*db, TDB_DATA key,
 }
 
 static int db_rbt_traverse_internal(struct db_context *db,
-                                   struct rb_node *n,
                                    int (*f)(struct db_record *db,
                                             void *private_data),
                                    void *private_data, uint32_t* count,
                                    bool rw)
 {
-       struct rb_node *rb_right;
-       struct rb_node *rb_left;
-       struct db_record rec;
-       struct db_rbt_rec rec_priv;
+       struct db_rbt_ctx *ctx = talloc_get_type_abort(
+               db->private_data, struct db_rbt_ctx);
+       struct db_rbt_node *cur = NULL;
+       struct db_rbt_node *next = NULL;
        int ret;
 
-       if (n == NULL) {
-               return 0;
-       }
+       for (cur = ctx->nodes; cur != NULL; cur = next) {
+               struct db_record rec;
+               struct db_rbt_rec rec_priv;
 
-       rb_left = n->rb_left;
-       rb_right = n->rb_right;
+               rec_priv.node = cur;
+               next = rec_priv.node->next;
 
-       ret = db_rbt_traverse_internal(db, rb_left, f, private_data, count, rw);
-       if (ret != 0) {
-               return ret;
-       }
-
-       rec_priv.node = db_rbt2node(n);
-       /* n might be altered by the callback function */
-       n = NULL;
-
-       ZERO_STRUCT(rec);
-       rec.db = db;
-       rec.private_data = &rec_priv;
-       if (rw) {
+               ZERO_STRUCT(rec);
+               rec.db = db;
+               rec.private_data = &rec_priv;
                rec.store = db_rbt_store;
                rec.delete_rec = db_rbt_delete;
-       } else {
-               rec.store = db_rbt_store_deny;
-               rec.delete_rec = db_rbt_delete_deny;
-       }
-       db_rbt_parse_node(rec_priv.node, &rec.key, &rec.value);
-
-       ret = f(&rec, private_data);
-       (*count) ++;
-       if (ret != 0) {
-               return ret;
-       }
+               db_rbt_parse_node(rec_priv.node, &rec.key, &rec.value);
 
-       if (rec_priv.node != NULL) {
-               /*
-                * If the current record is still there
-                * we should take the current rb_right.
-                */
-               rb_right = rec_priv.node->rb_node.rb_right;
+               if (rw) {
+                       ctx->traverse_nextp = &next;
+               }
+               ret = f(&rec, private_data);
+               (*count) ++;
+               if (rw) {
+                       ctx->traverse_nextp = NULL;
+               }
+               if (ret != 0) {
+                       return ret;
+               }
+               if (rec_priv.node != NULL) {
+                       next = rec_priv.node->next;
+               }
        }
 
-       return db_rbt_traverse_internal(db, rb_right, f, private_data, count, 
rw);
+       return 0;
 }
 
-static int db_rbt_traverse(struct db_context *db,
-                          int (*f)(struct db_record *db,
-                                   void *private_data),
-                          void *private_data)
+static int db_rbt_traverse_read(struct db_context *db,
+                               int (*f)(struct db_record *db,
+                                        void *private_data),
+                               void *private_data)
 {
        struct db_rbt_ctx *ctx = talloc_get_type_abort(
                db->private_data, struct db_rbt_ctx);
        uint32_t count = 0;
+       int ret;
 
-       int ret = db_rbt_traverse_internal(db, ctx->tree.rb_node,
-                                          f, private_data, &count,
-                                          true /* rw */);
+       ctx->traverse_read++;
+       ret = db_rbt_traverse_internal(db,
+                                      f, private_data, &count,
+                                      false /* rw */);
+       ctx->traverse_read--;
        if (ret != 0) {
                return -1;
        }
@@ -463,18 +471,27 @@ static int db_rbt_traverse(struct db_context *db,
        return count;
 }
 
-static int db_rbt_traverse_read(struct db_context *db,
-                               int (*f)(struct db_record *db,
-                                        void *private_data),
-                               void *private_data)
+static int db_rbt_traverse(struct db_context *db,
+                          int (*f)(struct db_record *db,
+                                   void *private_data),
+                          void *private_data)
 {
        struct db_rbt_ctx *ctx = talloc_get_type_abort(
                db->private_data, struct db_rbt_ctx);
        uint32_t count = 0;
+       int ret;
+
+       if (ctx->traverse_nextp != NULL) {
+               return -1;
+       };
+
+       if (ctx->traverse_read > 0) {
+               return db_rbt_traverse_read(db, f, private_data);
+       }
 
-       int ret = db_rbt_traverse_internal(db, ctx->tree.rb_node,
-                                          f, private_data, &count,
-                                          false /* rw */);


-- 
Samba Shared Repository

Reply via email to