[SCM] Samba Shared Repository - branch v4-10-stable updated

Karolin Seeger kseeger at samba.org
Fri Feb 22 08:05:39 UTC 2019


The branch, v4-10-stable has been updated
       via  3d91947b53e VERSION: Disable GIT_SNAPSHOT for the 4.10.0rc3 release.
       via  1f749eb6f6a WHATSNEW: Add release notes for Samba 4.10.0rc3.
       via  a3a9630a464 waf: Check for libnscd
       via  d8911eaa54d WHATSNEW: Add note that python2 support will be dropped on v4.11
       via  be6f8d41ca7 waf: Do not install internal header
       via  9bf434a941b lib:util: Move discard_const(_p) to own header for libndr.h
       via  66bf14d8322 pidl: Use NDR_ZERO_STRUCT(P) macros
       via  f6a44c807a9 librpc:ndr: Add NDR_ZERO_STRUCT(P) macros
       via  2ba1d9dd8d2 librpc:ndr: Implement ndr_zero_memory()
       via  6d2af886f40 tldap: avoid more use after free errors
       via  9a530ee4f91 tldap: avoid a use after free crash
       via  1ed75df5711 s3:vfs: Correctly check if OFD locks should be enabled or not
       via  fcd5865f3ff s3:vfs: Initialize pid to 0 in test_netatalk_lock()
       via  fbc8ea71c5c s4: torture: vfs_fruit. Change test_fruit_locking_conflict() to match the vfs_fruit working server code.
       via  72bcae77752 s3: VFS: vfs_fruit. Fix the NetAtalk deny mode compatibility code.
       via  eba5d055376 smbd: uid: Don't crash if 'force group' is added to an existing share connection.
       via  f68aab42318 s3: tests: Add regression test for smbd crash on share force group change with existing connection.
       via  d6dbd33fdcd printing: check lp_load_printers() prior to pcap cache update
       via  3d0450ef3c5 printing: drop pcap_cache_loaded() guard around load_printers()
       via  7621c622f83 s3-smbd: use fruit:model string for mDNS registration
       via  e21e24d8345 ldb: Release ldb 1.5.3
       via  bb850a07502 ldb: Add even more comments on what strict does to the list intersections
       via  2a915942295 ldb: Rename variable
       via  62fea7e9c3f ldb: Elaborate on ldb_kv_search_indexed() comments
       via  f7774530936 ldb: Remove comment that no longer makes sense
       via  7fc34817657 ldb: Avoid inefficient one-level searches
       via  0c75bfe674b VERSION: Bump version up to 4.10.0rc2...
      from  61e654828c1 VERSION: Diable GIT_SNAPSHOT for the 4.10.0rc2 release.

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


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

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       |  89 +++++++--
 lib/ldb/ABI/{ldb-1.5.1.sigs => ldb-1.5.3.sigs}     |   0
 ...yldb-util-1.1.10.sigs => pyldb-util-1.5.3.sigs} |   0
 ...-util-1.1.10.sigs => pyldb-util.py3-1.5.3.sigs} |   0
 lib/ldb/ldb_key_value/ldb_kv_index.c               |  76 ++++++--
 lib/ldb/wscript                                    |   2 +-
 lib/util/discard.h                                 |  51 ++++++
 lib/util/memory.h                                  |  27 ---
 lib/util/samba_util.h                              |   1 +
 lib/util/wscript_build                             |  18 +-
 librpc/ABI/{ndr-0.1.2.sigs => ndr-0.2.0.sigs}      |   1 +
 librpc/ndr/libndr.h                                |  10 +-
 librpc/ndr/util.c                                  |   5 +
 librpc/wscript_build                               |   2 +-
 pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm            |   2 +-
 pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm            |   2 +-
 pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm           |   6 +-
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm           |   6 +-
 selftest/selftesthelpers.py                        |   1 +
 selftest/target/Samba3.pm                          |   5 +
 source3/include/proto.h                            |   2 +-
 source3/lib/tldap.c                                |   1 -
 source3/lib/tldap_util.c                           |   2 -
 source3/lib/util.c                                 |   7 +-
 source3/libsmb/samlogon_cache.c                    |   1 +
 source3/modules/vfs_default.c                      |  14 +-
 source3/modules/vfs_fruit.c                        | 204 ++++++++++-----------
 source3/printing/load.c                            |   4 +-
 source3/printing/pcap.c                            |   5 +
 source3/printing/queue_process.c                   |   6 +-
 source3/printing/spoolssd.c                        |   8 +-
 source3/script/tests/test_force_group_change.sh    |  73 ++++++++
 source3/selftest/tests.py                          |   4 +
 source3/smbd/avahi_register.c                      |  27 +++
 source3/smbd/files.c                               |   9 +
 source3/smbd/uid.c                                 |  35 +++-
 source3/wscript                                    |   3 +
 source3/wscript_build                              |   1 +
 source4/torture/vfs/fruit.c                        |  26 ++-
 40 files changed, 516 insertions(+), 222 deletions(-)
 copy lib/ldb/ABI/{ldb-1.5.1.sigs => ldb-1.5.3.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.5.3.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.5.3.sigs} (100%)
 create mode 100644 lib/util/discard.h
 copy librpc/ABI/{ndr-0.1.2.sigs => ndr-0.2.0.sigs} (99%)
 create mode 100755 source3/script/tests/test_force_group_change.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index a251f875c42..92fe2780494 100644
--- a/VERSION
+++ b/VERSION
@@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=2
+SAMBA_VERSION_RC_RELEASE=3
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 8bbb1fd705f..2d535610583 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
 Release Announcements
 =====================
 
-This is the second release candidate of Samba 4.10.  This is *not*
+This is the third release candidate of Samba 4.10.  This is *not*
 intended for production environments and is designed for testing
 purposes only.  Please report any defects via the Samba bug reporting
 system at https://bugzilla.samba.org/.
@@ -27,19 +27,19 @@ rebuild the Group Policy Objects from the XML after generalization.
 (The administrator needs to correct the values of XML entities between
 the backup and restore to account for the change in domain).
 
-kdc prefork
+KDC prefork
 -----------
 
 The KDC now supports the pre-fork process model and worker processes will be
 forked for the KDC when the pre-fork process model is selected for samba.
 
-prefork 'prefork children'
+Prefork 'prefork children'
 --------------------------
 
 The default value for this smdb.conf parameter has been increased from 1 to
 4.
 
-netlogon prefork
+Netlogon prefork
 ----------------
 
 DCERPC now supports pre-forked NETLOGON processes. The netlogon processes are
@@ -63,7 +63,7 @@ information about how the users are spread across groups in your domain.
 The 'samba-tool group list --verbose' command has also been updated to include
 the number of users in each group.
 
-prefork process restart
+Prefork process restart
 -----------------------
 
 The pre-fork process model now restarts failed processes. The delay between
@@ -75,7 +75,7 @@ delay between restart attempts up until it reaches "prefork maximum backoff".
 Using the default sequence the restart delays (in seconds) are:
   0, 10, 20, ..., 120, 120, ...
 
-standard process model
+Standard process model
 ----------------------
 
 When using the standard process model samba forks a new process to handle ldap
@@ -87,23 +87,38 @@ exceeded Samba drops new connections immediately.
 python3 support
 ---------------
 
-The version of python which is now the default for samba is python3.
-'configure' & 'make' will execute using python3. It is possible to still
-specify an additional python version with '--extra-python'
-e.g. '--extra-python=/usr/bin/python2'. It should be noted that support for
-this option will be deprecated in a future release.
+This is the first release of Samba which has full support for Python 3.
+Samba 4.10 still has support for Python 2, however, Python 3 will be used by
+default, i.e. 'configure' & 'make' will execute using python3.
 
-What if I need to build with python2? To build with python2 you *must* set
-the 'PYTHON' environment variable to override the python3 default for both
-'configure' and 'make' steps.
-
-   'PYTHON=python2 ./configure.developer'
-&
+To build Samba with python2 you *must* set the 'PYTHON' environment variable
+for both the 'configure' and 'make' steps, i.e.
+   'PYTHON=python2 ./configure'
    'PYTHON=python2 make'
+This will override the python3 default.
+
+Alternatively, it is possible to produce Samba Python bindings for both
+Python 2 and Python 3. To do so, specify '--extra-python=/usr/bin/python2'
+as part of the 'configure' command. Note that python3 will still be used as
+the default in this case.
+
+Note that Samba 4.10 supports Python 3.4 onwards.
+
+Future Python support
+---------------------
+
+Samba 4.10 will be the last release that comes with full support for
+Python 2. Unfortunately, the Samba Team doesn't have the resources to support
+both Python 2 and Python 3 long-term.
+
+Samba 4.11 will not have any runtime support for Python 2. This means if
+you use Python 2 bindings it is time to migrate to Python 3 now.
 
-Note: Support for python2 (with the exception of a build configured with
-      'PYTHON=python2 ./configure --disable-python' and built with
-      'PYTHON=python2 make') will be deprecated in the next release.
+If you are building Samba using the '--disable-python' option (i.e. you're
+excluding all the run-time Python support), then this will continue to work
+on a system that supports either python2 or python3.
+
+Also note that Samba 4.11 will most likely only support Python 3.6 onwards.
 
 JSON logging
 ------------
@@ -209,6 +224,40 @@ smb.conf changes
                               sharemode" but for SMB getinfo
 
 
+CHANGES SINCE 4.10.0rc2
+=======================
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 13690: smbd: uid: Don't crash if 'force group' is added to an existing
+     share connection.
+   * BUG 13770: s3: VFS: vfs_fruit. Fix the NetAtalk deny mode compatibility
+     code.
+
+o  Andrew Bartlett <abartlet at samba.org>
+   * ldb: Release ldb 1.5.3
+   * BUG 13762: Avoid inefficient one-level searches.
+   * BUG 13772: The test api.py should not rely on order of entries in dict.
+
+o  Tim Beale <timbeale at catalyst.net.nz>
+   * BUG 13762: ldb: Avoid inefficient one-level searches.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 13776: tldap: Avoid use after free errors.
+
+o  G√ľnther Deschner <gd at samba.org>
+   * BUG 13746: s3-smbd: Use fruit:model string for mDNS registration.
+
+o  David Disseldorp <ddiss at samba.org>
+   * BUG 13766: printing: Check lp_load_printers() prior to pcap cache update.
+
+o  Christof Schmitt <cs at samba.org>
+   * BUG 13787: waf: Check for libnscd.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 13770: s3:vfs: Correctly check if OFD locks should be enabled or not.
+   * BUG 13778: Public ZERO_STRUCT() uses undefined C11 function memset_s().
+
+
 CHANGES SINCE 4.10.0rc1
 =======================
 
diff --git a/lib/ldb/ABI/ldb-1.5.1.sigs b/lib/ldb/ABI/ldb-1.5.3.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-1.5.1.sigs
copy to lib/ldb/ABI/ldb-1.5.3.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-1.5.3.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.5.3.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util.py3-1.5.3.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util.py3-1.5.3.sigs
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index 6c21c19d654..6d02c91a597 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -1259,6 +1259,14 @@ static bool list_intersect(struct ldb_context *ldb,
 		return true;
 	}
 
+	/*
+	 * In both of the below we check for strict and in that
+	 * case do not optimise the intersection of this list,
+	 * we must never return an entry not in this
+	 * list.  This allows the index for
+	 * SCOPE_ONELEVEL to be trusted.
+	 */
+
 	/* the indexing code is allowed to return a longer list than
 	   what really matches, as all results are filtered by the
 	   full expression at the end - this shortcut avoids a lot of
@@ -1660,7 +1668,13 @@ static int ldb_kv_index_dn_one(struct ldb_module *module,
 			       struct dn_list *list,
 			       enum key_truncation *truncation)
 {
-	/* Ensure we do not shortcut on intersection for this list */
+	/*
+	 * Ensure we do not shortcut on intersection for this list.
+	 * We must never be lazy and return an entry not in this
+	 * list.  This allows the index for
+	 * SCOPE_ONELEVEL to be trusted.
+	 */
+
 	list->strict = true;
 	return ldb_kv_index_dn_attr(
 	    module, ldb_kv, LDB_KV_IDXONE, parent_dn, list, truncation);
@@ -2008,10 +2022,11 @@ int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
 		return ldb_operr(ldb);
 
 	case LDB_SCOPE_ONELEVEL:
+
 		/*
-		 * If we ever start to also load the index values for
-		 * the tree, we must ensure we strictly intersect with
-		 * this list, as we trust the ONELEVEL index
+		 * First, load all the one-level child objects (regardless of
+		 * whether they match the search filter or not). The database
+		 * maintains a one-level index, so retrieving this is quick.
 		 */
 		ret = ldb_kv_index_dn_one(ac->module,
 					  ldb_kv,
@@ -2024,9 +2039,12 @@ int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
 		}
 
 		/*
-		 * If we have too many matches, running the filter
-		 * tree over the SCOPE_ONELEVEL can be quite expensive
-		 * so we now check the filter tree index as well.
+		 * If we have too many children, running ldb_kv_index_filter()
+		 * over all the child objects can be quite expensive. So next
+		 * we do a separate indexed query using the search filter.
+		 *
+		 * This should be quick, but it may return objects that are not
+		 * the direct one-level child objects we're interested in.
 		 *
 		 * We only do this in the GUID index mode, which is
 		 * O(n*log(m)) otherwise the intersection below will
@@ -2037,33 +2055,55 @@ int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
 		 * fast enough in the small case.
 		 */
 		if (ldb_kv->cache->GUID_index_attribute != NULL) {
-			struct dn_list *idx_one_tree_list
+			struct dn_list *indexed_search_result
 				= talloc_zero(ac, struct dn_list);
-			if (idx_one_tree_list == NULL) {
+			if (indexed_search_result == NULL) {
 				talloc_free(dn_list);
 				return ldb_module_oom(ac->module);
 			}
 
 			if (!ldb_kv->cache->attribute_indexes) {
-				talloc_free(idx_one_tree_list);
+				talloc_free(indexed_search_result);
 				talloc_free(dn_list);
 				return LDB_ERR_OPERATIONS_ERROR;
 			}
+
 			/*
-			 * Here we load the index for the tree.
-			 *
-			 * We only care if this is successful, if the
-			 * index can't trim the result list down then
-			 * the ONELEVEL index is still good enough.
+			 * Try to do an indexed database search
 			 */
 			ret = ldb_kv_index_dn(
-			    ac->module, ldb_kv, ac->tree, idx_one_tree_list);
+			    ac->module, ldb_kv, ac->tree,
+			    indexed_search_result);
+
+			/*
+			 * We can stop if we're sure the object doesn't exist
+			 */
+			if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+				talloc_free(indexed_search_result);
+				talloc_free(dn_list);
+				return LDB_ERR_NO_SUCH_OBJECT;
+			}
+
+			/*
+			 * Once we have a successful search result, we
+			 * intersect it with the one-level children (dn_list).
+			 * This should give us exactly the result we're after
+			 * (we still need to run ldb_kv_index_filter() to
+			 * handle potential index truncation cases).
+			 *
+			 * The indexed search may fail because we don't support
+			 * indexing on that type of search operation, e.g.
+			 * matching against '*'. In which case we fall through
+			 * and run ldb_kv_index_filter() over all the one-level
+			 * children (which is still better than bailing out here
+			 * and falling back to a full DB scan).
+			 */
 			if (ret == LDB_SUCCESS) {
 				if (!list_intersect(ldb,
 						    ldb_kv,
 						    dn_list,
-						    idx_one_tree_list)) {
-					talloc_free(idx_one_tree_list);
+						    indexed_search_result)) {
+					talloc_free(indexed_search_result);
 					talloc_free(dn_list);
 					return LDB_ERR_OPERATIONS_ERROR;
 				}
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index ca0bf410f10..855ee4d556c 100644
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '1.5.2'
+VERSION = '1.5.3'
 
 import sys, os
 
diff --git a/lib/util/discard.h b/lib/util/discard.h
new file mode 100644
index 00000000000..d2b74ac989c
--- /dev/null
+++ b/lib/util/discard.h
@@ -0,0 +1,51 @@
+/*
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Andrew Tridgell 1992-1999
+   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2008
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SAMBA_DISCARD_H_
+#define _SAMBA_DISCARD_H_
+
+/**
+  this is a warning hack. The idea is to use this everywhere that we
+  get the "discarding const" warning from gcc. That doesn't actually
+  fix the problem of course, but it means that when we do get to
+  cleaning them up we can do it by searching the code for
+  discard_const.
+
+  It also means that other error types aren't as swamped by the noise
+  of hundreds of const warnings, so we are more likely to notice when
+  we get new errors.
+
+  Please only add more uses of this macro when you find it
+  _really_ hard to fix const warnings. Our aim is to eventually use
+  this function in only a very few places.
+
+  Also, please call this via the discard_const_p() macro interface, as that
+  makes the return type safe.
+*/
+#ifndef discard_const
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
+#endif
+
+/** Type-safe version of discard_const */
+#ifndef discard_const_p
+#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#endif
+
+#endif /* _SAMBA_DISCARD_H_ */
diff --git a/lib/util/memory.h b/lib/util/memory.h
index 3278f6b3c21..0e151cc5f66 100644
--- a/lib/util/memory.h
+++ b/lib/util/memory.h
@@ -94,31 +94,4 @@
 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
 #endif
 
-/**
-  this is a warning hack. The idea is to use this everywhere that we
-  get the "discarding const" warning from gcc. That doesn't actually
-  fix the problem of course, but it means that when we do get to
-  cleaning them up we can do it by searching the code for
-  discard_const.
-
-  It also means that other error types aren't as swamped by the noise
-  of hundreds of const warnings, so we are more likely to notice when
-  we get new errors.
-
-  Please only add more uses of this macro when you find it
-  _really_ hard to fix const warnings. Our aim is to eventually use
-  this function in only a very few places.
-
-  Also, please call this via the discard_const_p() macro interface, as that
-  makes the return type safe.
-*/
-#ifndef discard_const
-#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
-#endif
-
-/** Type-safe version of discard_const */
-#ifndef discard_const_p
-#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-#endif
-
 #endif /* _SAMBA_MEMORY_H_ */
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 7b96a595d43..11c95b5bfe3 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -54,6 +54,7 @@ extern const char *panic_action;
 #endif
 
 #include "lib/util/memory.h"
+#include "lib/util/discard.h"
 
 #include "fault.h"
 
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 8fc402062fb..e3a004fa3c6 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -126,7 +126,23 @@ else:
                     tevent_debug.c memcache.c unix_match.c tfork.c''',
                   deps='samba-util-core DYNCONFIG close-low-fd tiniparser genrand util_str_hex',
                   public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid',
-                  public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h genrand.h tfork.h',
+                  public_headers='''
+                                 attr.h
+                                 byteorder.h
+                                 data_blob.h
+                                 debug.h
+                                 discard.h
+                                 time.h
+                                 string_wrappers.h
+                                 idtree.h
+                                 idtree_random.h
+                                 blocking.h
+                                 signal.h
+                                 substitute.h
+                                 fault.h
+                                 genrand.h
+                                 tfork.h
+                                 ''',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
                   local_include=False,
                   vnum='0.0.1',
diff --git a/librpc/ABI/ndr-0.1.2.sigs b/librpc/ABI/ndr-0.2.0.sigs
similarity index 99%
copy from librpc/ABI/ndr-0.1.2.sigs
copy to librpc/ABI/ndr-0.2.0.sigs
index bf9fdfc922c..6346f2fb491 100644
--- a/librpc/ABI/ndr-0.1.2.sigs
+++ b/librpc/ABI/ndr-0.2.0.sigs
@@ -261,3 +261,4 @@ ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const voi
 ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t)
 ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2
 ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1
+ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index c31496fe1dc..8a15fccfe09 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -26,7 +26,7 @@
 #define __LIBNDR_H__
 
 #include <talloc.h>
-#include "../lib/util/memory.h" /* for discard_const */
+#include "../lib/util/discard.h" /* for discard_const */
 #include "../lib/util/byteorder.h"
 #include "../lib/util/data_blob.h"
 #include "../lib/util/time.h"
@@ -411,6 +411,13 @@ enum ndr_compression_alg {
        if (unlikely(!(s))) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
 } while (0)
 
+#define NDR_ZERO_STRUCT(x) ndr_zero_memory(&(x), sizeof(x))
+#define NDR_ZERO_STRUCTP(x) do { \
+	if ((x) != NULL) { \
+		ndr_zero_memory((x), sizeof(*(x))); \
+	} \
+} while(0)
+
 /* these are used when generic fn pointers are needed for ndr push/pull fns */
 typedef enum ndr_err_code (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
 typedef enum ndr_err_code (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
@@ -493,6 +500,7 @@ void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct do
 size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
 void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
 void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
+void ndr_zero_memory(void *ptr, size_t len);
 bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
 char *ndr_syntax_id_to_string(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *id);
 bool ndr_syntax_id_from_string(const char *s, struct ndr_syntax_id *id);
diff --git a/librpc/ndr/util.c b/librpc/ndr/util.c


-- 
Samba Shared Repository



More information about the samba-cvs mailing list