[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Feb 14 16:33:02 UTC 2019


The branch, master has been updated
       via  08b91f5e037 gitlab-ci: Rename DOCKER to CONTAINER
       via  6d232f3f7c6 waf: Do not install internal header
       via  96df6878ed5 lib:util: Move discard_const(_p) to own header for libndr.h
       via  532ce0d20a8 pidl: Use NDR_ZERO_STRUCT(P) macros
       via  666802a3db3 librpc:ndr: Add NDR_ZERO_STRUCT(P) macros
       via  2a7086f1ac4 librpc:ndr: Implement ndr_zero_memory()
       via  eeabe171152 lib:util: Add GPL header to tftw.c
       via  4985d73c256 lib:util: Add missing "replace.h" header in tftw
      from  ea2de21dd8a s4 dsdb util: samdb_client_site_name clean up

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


- Log -----------------------------------------------------------------
commit 08b91f5e0373e3b76a8d3968013b9fc13c9fc82e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Feb 14 08:19:46 2019 +0100

    gitlab-ci: Rename DOCKER to CONTAINER
    
    This is just a runc container, not tied to docker. See podman.io
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bj at sernet.de>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Feb 14 17:32:38 CET 2019 on sn-devel-144

commit 6d232f3f7c64f9b01439326e0e9b6d9df9a0bcbb
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 13 10:44:45 2019 +0100

    waf: Do not install internal header
    
    We should not install header files without an public API:
    
    - memory.h
    - safe_strings.h
    - talloc_stack.h
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 96df6878ed521b7e744d703abb32a585500d3b94
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 6 16:05:48 2019 +0100

    lib:util: Move discard_const(_p) to own header for libndr.h
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 532ce0d20a8016c1270ea689de627da8aa4abfdd
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 13 10:41:19 2019 +0100

    pidl: Use NDR_ZERO_STRUCT(P) macros
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 666802a3db3115ca09f3ffed58c8e4a8cabd65de
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 13 10:38:02 2019 +0100

    librpc:ndr: Add NDR_ZERO_STRUCT(P) macros
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 2a7086f1ac4ad91fb7cd958e9386abb996794ed1
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 13 10:35:13 2019 +0100

    librpc:ndr: Implement ndr_zero_memory()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit eeabe171152fdb09fe2f51a0a41b1c5e4df25efd
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 6 17:03:59 2019 +0100

    lib:util: Add GPL header to tftw.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 4985d73c256d763909618a3d5ca4e66ab8f19337
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Feb 6 17:03:28 2019 +0100

    lib:util: Add missing "replace.h" header in tftw
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13778
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 .gitlab-ci.yml                                | 10 +++---
 lib/util/discard.h                            | 51 +++++++++++++++++++++++++++
 lib/util/memory.h                             | 27 --------------
 lib/util/samba_util.h                         |  1 +
 lib/util/tftw.c                               | 14 ++++++++
 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 ++--
 source3/libsmb/samlogon_cache.c               |  1 +
 15 files changed, 113 insertions(+), 43 deletions(-)
 create mode 100644 lib/util/discard.h
 copy librpc/ABI/{ndr-0.1.2.sigs => ndr-0.2.0.sigs} (99%)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 53b2acf121f..8dce4af6e0b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,15 +3,15 @@
 
 variables:
   # we run autobuild.py inside a samba CI docker image located on gitlab's registry
-  SAMBA_CI_DOCKER_REGISTRY: registry.gitlab.com
-  SAMBA_CI_DOCKER_NAME: samba-team/samba
-  SAMBA_CI_DOCKER_TAG: latest
-  SAMBA_CI_DOCKER_IMAGE: $SAMBA_CI_DOCKER_REGISTRY/$SAMBA_CI_DOCKER_NAME:$SAMBA_CI_DOCKER_TAG
+  SAMBA_CI_CONTAINER_REGISTRY: registry.gitlab.com
+  SAMBA_CI_CONTAINER_NAME: samba-team/samba
+  SAMBA_CI_CONTAINER_TAG: latest
+  SAMBA_CI_CONTAINER_IMAGE: $SAMBA_CI_CONTAINER_REGISTRY/$SAMBA_CI_CONTAINER_NAME:$SAMBA_CI_CONTAINER_TAG
   GIT_STRATEGY: fetch
   GIT_DEPTH: "3"
 
 .shared_template:
-  image: $SAMBA_CI_DOCKER_IMAGE
+  image: $SAMBA_CI_CONTAINER_IMAGE
   stage: build
   tags:
     - docker
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 8c21c30ebc9..615bb13d6c2 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/tftw.c b/lib/util/tftw.c
index c460e32be04..b731a2ef03a 100644
--- a/lib/util/tftw.c
+++ b/lib/util/tftw.c
@@ -2,8 +2,22 @@
  * Copyright (c) 2008-2018 by Andreas Schneider <asn at samba.org>
  *
  * Adopted from the csync source code
+ *
+ * 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/>.
  */
 
+#include "replace.h"
 #include <errno.h>
 #include <sys/types.h>
 #include <dirent.h>
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 64778b3e4c3..5ca72c5c03c 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -127,7 +127,23 @@ else:
                     tftw.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
index b2df28dde09..0eb7eba9e5e 100644
--- a/librpc/ndr/util.c
+++ b/librpc/ndr/util.c
@@ -29,3 +29,8 @@ _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name
 	char addr[INET6_ADDRSTRLEN];
 	ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss));
 }
+
+_PUBLIC_ void ndr_zero_memory(void *ptr, size_t len)
+{
+	memset_s(ptr, len, 0, len);
+}
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 9669dfce2bf..8e113c422b2 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -725,7 +725,7 @@ bld.SAMBA_LIBRARY('ndr',
     public_deps='samba-errors talloc samba-util util_str_hex',
     public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h',
     header_path= [('*gen_ndr*', 'gen_ndr')],
-    vnum='0.1.2',
+    vnum='0.2.0',
     abi_directory='ABI',
     abi_match='ndr_* GUID_*',
     )
diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index c87d17a5a78..fa7303b8543 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -103,7 +103,7 @@ sub CallWithStruct($$$$$$)
 		if (grep(/out/, @{$_->{DIRECTION}})) { $hasout = 1; }
 	}
 
-	pidl "ZERO_STRUCT(r->out);" if ($hasout);
+	pidl "NDR_ZERO_STRUCT(r->out);" if ($hasout);
 
 	foreach (@{$fn->{ELEMENTS}}) {
 		my @dir = @{$_->{DIRECTION}};
diff --git a/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm b/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
index 35e6e3f0d19..de050e8f8c6 100644
--- a/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
@@ -101,7 +101,7 @@ static $tn dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TAL
 		return status;
 	}
 
-	ZERO_STRUCT(r.in.ORPCthis);
+	NDR_ZERO_STRUCT(r.in.ORPCthis);
 	r.in.ORPCthis.version.MajorVersion = COM_MAJOR_VERSION;
 	r.in.ORPCthis.version.MinorVersion = COM_MINOR_VERSION;
 ";
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
index 040cd5a4bd3..734e86dd183 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
@@ -496,7 +496,7 @@ sub ParseFunction_Send($$$$)
 
 	if (defined($fn->{RETURN_TYPE})) {
 		$self->pidl("/* Result */");
-		$self->pidl("ZERO_STRUCT(state->orig.out.result);");
+		$self->pidl("NDR_ZERO_STRUCT(state->orig.out.result);");
 		$self->pidl("");
 	}
 
@@ -585,7 +585,7 @@ sub ParseFunction_Done($$$$)
 	}
 
 	$self->pidl("/* Reset temporary structure */");
-	$self->pidl("ZERO_STRUCT(state->tmp);");
+	$self->pidl("NDR_ZERO_STRUCT(state->tmp);");
 	$self->pidl("");
 
 	$self->pidl("tevent_req_done(req);");
@@ -698,7 +698,7 @@ sub ParseFunction_Sync($$$$)
 
 	if (defined($fn->{RETURN_TYPE})) {
 		$self->pidl("/* Result */");
-		$self->pidl("ZERO_STRUCT(r.out.result);");
+		$self->pidl("NDR_ZERO_STRUCT(r.out.result);");
 		$self->pidl("");
 	}
 
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index eae58a9a432..432e52f89c4 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1134,7 +1134,7 @@ sub ParseElementPullLevel
 	if (has_property($e, "skip") or has_property($e, "skip_noinit")) {
 		$self->pidl("/* [skip] '$var_name' */");
 		if (not has_property($e, "skip_noinit")) {
-			$self->pidl("ZERO_STRUCT($var_name);");
+			$self->pidl("NDR_ZERO_STRUCT($var_name);");
 		}
 		return;
 	}
@@ -2551,7 +2551,7 @@ sub ParseFunctionPull($$)
 	# out to be too tricky (tridge)
 	foreach my $e (@{$fn->{ELEMENTS}}) {
 		next unless grep(/out/, @{$e->{DIRECTION}});
-		$self->pidl("ZERO_STRUCT(r->out);");
+		$self->pidl("NDR_ZERO_STRUCT(r->out);");
 		$self->pidl("");
 		last;
 	}
@@ -2600,7 +2600,7 @@ sub ParseFunctionPull($$)
 			if (grep(/in/, @{$e->{DIRECTION}})) {
 				$self->pidl("*r->out.$e->{NAME} = *r->in.$e->{NAME};");
 			} else {
-				$self->pidl("ZERO_STRUCTP(r->out.$e->{NAME});");
+				$self->pidl("NDR_ZERO_STRUCTP(r->out.$e->{NAME});");
 			}
 		}
 	}
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index 494eb10a6a8..a9ddaab1a41 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -27,6 +27,7 @@
 #include "system/time.h"
 #include "lib/util/debug.h"
 #include "lib/util/talloc_stack.h"
+#include "lib/util/memory.h" /* for SAFE_FREE() */
 #include "source3/lib/util_path.h"
 #include "librpc/gen_ndr/ndr_krb5pac.h"
 #include "../libcli/security/security.h"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list