[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Aug 27 08:37:01 UTC 2024


The branch, master has been updated
       via  fab7416a3d2 idl: dnsp.h references NTTIME
       via  50c7373f449 idl: misc.idl references DATA_BLOB
       via  707265817c0 pidl: Add headerhelper idl property
       via  7548d9ad5a2 lib: Make a few functions static
       via  1cdb9605b5d libsmb: Simplify pdb_sethexpwd with hex_byte()
       via  f10160af895 pidl:Samba4/Header: only include ntstatus.h if required
       via  282ee7dd3f9 pidl: add scalarTypeUsed() helper to find if a type was actually used...
       via  1602b0120ba lib: Add libcli/util/ntstatus.h in a few headers where it's needed
       via  9b0fe3e66a1 idl: Remove unused KRB5_EDATA_NTSTATUS
       via  25370c79af8 smbd: Inline set_sticky_write_time_path into set_sticky_write_time_fsp
       via  6d356dcbaf4 smbd: Modernize a few DEBUGs
       via  367bea1ca53 smbd: Introduce "ace" helper variable
       via  99e4dc2ee12 idl: security.idl compiles with only secace.h
       via  cca1bf8793b pidl: replace.h is sufficient in ndr_*.c
       via  56ec6fe5ed0 lib: Add a few explicit includes
       via  8291eb5f9b2 libndr: Use _talloc_array() to benefit from overflow protection
       via  4a200370764 libndr: Remove 368 bytes from R/W data into R/O text segment
       via  93b2651896d smbd: Modernize a few DEBUGs
       via  3cc3329420e ctdb: Add a NULL check to convert_node_map_to_list()
      from  232ab02faf9 source3/wscript: Introduce auto mode to build ceph vfs modules

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


- Log -----------------------------------------------------------------
commit fab7416a3d2e1e7d59579449deda490c16b6df69
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 25 19:50:34 2024 +0200

    idl: dnsp.h references NTTIME
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Tue Aug 27 08:36:11 UTC 2024 on atb-devel-224

commit 50c7373f449a71dcc0de20ea1c75cc47ec6c8a3b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 25 19:51:00 2024 +0200

    idl: misc.idl references DATA_BLOB
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 707265817c02285d6a139c3e23ec5e9f6690a93d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 23 16:39:58 2024 +0200

    pidl: Add headerhelper idl property
    
    Add includes to for example misc.h if needed, so that misc.h can be
    directly included without prerequisites
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 7548d9ad5a23f7282e8a6028040c48d16dcca63f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 25 19:29:24 2024 +0200

    lib: Make a few functions static
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 1cdb9605b5d22b5f34889e090fe94e3bc019416e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 25 12:08:49 2024 +0200

    libsmb: Simplify pdb_sethexpwd with hex_byte()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit f10160af8959a7211cea4d16d777141d8c52bfea
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 23 17:25:34 2024 +0200

    pidl:Samba4/Header: only include ntstatus.h if required
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 282ee7dd3f99ec0ed1691b25aacfad96d4b11514
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 23 17:24:19 2024 +0200

    pidl: add scalarTypeUsed() helper to find if a type was actually used...
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 1602b0120bae2296fa8edca8cbd35dacb41001c8
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 23 15:53:51 2024 +0200

    lib: Add libcli/util/ntstatus.h in a few headers where it's needed
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 9b0fe3e66a114a465b68fde766b9ba9c1b95224b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 23 15:39:30 2024 +0200

    idl: Remove unused KRB5_EDATA_NTSTATUS
    
    I think the last user went away with e2028837b95 in 2017
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 25370c79af8194ed69911a4d45824c488f2aae37
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 25 13:23:21 2024 +0200

    smbd: Inline set_sticky_write_time_path into set_sticky_write_time_fsp
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 6d356dcbaf45f4a36d474881002eb6586c955233
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Aug 5 13:45:07 2024 +0200

    smbd: Modernize a few DEBUGs
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 367bea1ca5387484046f4c7105b31b2f48eb9141
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Aug 5 13:42:09 2024 +0200

    smbd: Introduce "ace" helper variable
    
    Use "psd->dacl->aces[0]" once instead of 3 times
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 99e4dc2ee1229e54382dda3e2ab75e59bdc47f26
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Aug 22 18:00:12 2024 +0200

    idl: security.idl compiles with only secace.h
    
    It does not need all of security.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit cca1bf8793be8bee514583a1d1286b1f57ca83b4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Aug 22 17:20:07 2024 +0200

    pidl: replace.h is sufficient in ndr_*.c
    
    Avoid a few uses of includes.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 56ec6fe5ed02fb37ea80216d468746d6c77edb7a
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Aug 22 18:25:06 2024 +0200

    lib: Add a few explicit includes
    
    Required to trim down includes from gen_ndr/*security*
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 8291eb5f9b2fdf10b5faac06cef601bdd8825376
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 21 14:03:22 2024 +0200

    libndr: Use _talloc_array() to benefit from overflow protection
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 4a20037076453e58a3b98b81ad666fd438f7d4d7
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 21 13:46:20 2024 +0200

    libndr: Remove 368 bytes from R/W data into R/O text segment
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 93b2651896d9ea13fc4918bd843d9daabd37c2aa
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 21 11:14:45 2024 +0200

    smbd: Modernize a few DEBUGs
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

commit 3cc3329420e68dcea6c37425c3b90d6d358344af
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 20 12:48:20 2024 +0200

    ctdb: Add a NULL check to convert_node_map_to_list()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jennifer Sutton <jsutton at samba.org>

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

Summary of changes:
 auth/credentials/credentials.h                |   1 +
 ctdb/server/ctdb_server.c                     |   1 +
 lib/addns/dns.h                               |  10 ---
 lib/addns/dnsrecord.c                         |  24 +++---
 libcli/security/claims-conversions.c          |   1 +
 libcli/security/dom_sid.h                     |   1 +
 librpc/ABI/{ndr-5.0.0.sigs => ndr-6.0.0.sigs} |   5 +-
 librpc/idl/dnsp.idl                           |   1 +
 librpc/idl/misc.idl                           |   7 +-
 librpc/idl/security.idl                       |   2 +-
 librpc/ndr/ndr.c                              | 110 ++++++++++++++++++--------
 librpc/ndr/ndr_compression.c                  |   2 +-
 librpc/wscript_build                          |   2 +-
 pidl/lib/Parse/Pidl/NDR.pm                    |   1 +
 pidl/lib/Parse/Pidl/Samba4/Header.pm          |  33 +++++---
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm      |   2 +-
 pidl/lib/Parse/Pidl/Typelist.pm               |  15 +++-
 source3/include/messages.h                    |   1 +
 source3/locking/posix.c                       |  34 ++++----
 source3/locking/share_mode_lock.h             |   1 +
 source3/passdb/passdb.c                       |  18 +----
 source3/registry/reg_api.c                    |   1 +
 source3/smbd/dosmode.c                        |  23 +-----
 source3/smbd/proto.h                          |   1 -
 source3/smbd/smb2_nttrans.c                   |  22 +++---
 source4/dsdb/gmsa/util.c                      |   1 +
 source4/kdc/ad_claims.c                       |   1 +
 27 files changed, 181 insertions(+), 140 deletions(-)
 copy librpc/ABI/{ndr-5.0.0.sigs => ndr-6.0.0.sigs} (98%)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h
index 8a6f26be31c..4a39899e751 100644
--- a/auth/credentials/credentials.h
+++ b/auth/credentials/credentials.h
@@ -25,6 +25,7 @@
 #include "../lib/util/time.h"
 #include "../lib/util/data_blob.h"
 #include "librpc/gen_ndr/misc.h"
+#include "libcli/util/ntstatus.h"
 
 struct cli_credentials;
 struct ccache_container;
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 0e12e8e834d..a1344bae1ae 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -106,6 +106,7 @@ static int convert_node_map_to_list(struct ctdb_context *ctdb,
 		node->name = talloc_asprintf(node, "%s:%u",
 					     ctdb_addr_to_str(&node->address),
 					     ctdb_addr_to_port(&node->address));
+		CTDB_NO_MEMORY(ctdb, node->name);
 
 		node->flags = node_map->node[i].flags;
 		if (!(node->flags & NODE_FLAGS_DELETED)) {
diff --git a/lib/addns/dns.h b/lib/addns/dns.h
index 6e605cbec2e..5c11b398ff7 100644
--- a/lib/addns/dns.h
+++ b/lib/addns/dns.h
@@ -259,16 +259,6 @@ DNS_ERROR dns_create_tkey_record(TALLOC_CTX *mem_ctx, const char *keyname,
 				 time_t expiration, uint16_t mode, uint16_t error,
 				 uint16_t key_length, const uint8_t *key,
 				 struct dns_rrec **prec);
-DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
-					const char *name,
-					const struct sockaddr_storage *ip,
-					struct dns_rrec **prec);
-DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name,
-				   uint16_t type, uint16_t r_class,
-				   struct dns_rrec **prec);
-DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
-					    const char *name, uint32_t type,
-					    struct dns_rrec **prec);
 DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
 			      uint32_t ttl, const struct sockaddr_storage *pss,
 			      struct dns_rrec **prec);
diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c
index c1a65956909..3c5a81c9c4c 100644
--- a/lib/addns/dnsrecord.c
+++ b/lib/addns/dnsrecord.c
@@ -179,10 +179,11 @@ DNS_ERROR dns_create_aaaa_record(TALLOC_CTX *mem_ctx, const char *host,
 #endif
 }
 
-DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
-					const char *name,
-					const struct sockaddr_storage *ss,
-					struct dns_rrec **prec)
+static DNS_ERROR dns_create_name_in_use_record(
+	TALLOC_CTX *mem_ctx,
+	const char *name,
+	const struct sockaddr_storage *ss,
+	struct dns_rrec **prec)
 {
 	if (ss != NULL) {
 		switch (ss->ss_family) {
@@ -201,17 +202,20 @@ DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
 			       NULL, prec);
 }
 
-DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
-					    const char *name, uint32_t type,
-					    struct dns_rrec **prec)
+static DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
+						   const char *name,
+						   uint32_t type,
+						   struct dns_rrec **prec)
 {
 	return dns_create_rrec(mem_ctx, name, type, DNS_CLASS_NONE, 0,
 			       0, NULL, prec);
 }
 
-DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name,
-				   uint16_t type, uint16_t r_class,
-				   struct dns_rrec **prec)
+static DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx,
+					  const char *name,
+					  uint16_t type,
+					  uint16_t r_class,
+					  struct dns_rrec **prec)
 {
 	return dns_create_rrec(mem_ctx, name, type, r_class, 0, 0, NULL, prec);
 }
diff --git a/libcli/security/claims-conversions.c b/libcli/security/claims-conversions.c
index ccf1375fc8f..50b21f3085b 100644
--- a/libcli/security/claims-conversions.c
+++ b/libcli/security/claims-conversions.c
@@ -22,6 +22,7 @@
 #include "libcli/security/claims-conversions.h"
 #include "lib/util/debug.h"
 #include "lib/util/stable_sort.h"
+#include "libcli/security/dom_sid.h"
 
 #include "librpc/gen_ndr/conditional_ace.h"
 #include "librpc/gen_ndr/claims.h"
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h
index 5e1c5d90958..84e20f4aaa5 100644
--- a/libcli/security/dom_sid.h
+++ b/libcli/security/dom_sid.h
@@ -26,6 +26,7 @@
 #include "replace.h"
 #include <talloc.h>
 #include "lib/util/data_blob.h"
+#include "libcli/util/ntstatus.h"
 #include "librpc/gen_ndr/security.h"
 
 /* Some well-known SIDs */
diff --git a/librpc/ABI/ndr-5.0.0.sigs b/librpc/ABI/ndr-6.0.0.sigs
similarity index 98%
copy from librpc/ABI/ndr-5.0.0.sigs
copy to librpc/ABI/ndr-6.0.0.sigs
index ecfcd7ad3af..cfc27b32a9a 100644
--- a/librpc/ABI/ndr-5.0.0.sigs
+++ b/librpc/ABI/ndr-6.0.0.sigs
@@ -32,7 +32,6 @@ ndr_policy_handle_equal: bool (const struct policy_handle *, const struct policy
 ndr_print_DATA_BLOB: void (struct ndr_print *, const char *, DATA_BLOB)
 ndr_print_GUID: void (struct ndr_print *, const char *, const struct GUID *)
 ndr_print_HRESULT: void (struct ndr_print *, const char *, HRESULT)
-ndr_print_KRB5_EDATA_NTSTATUS: void (struct ndr_print *, const char *, const struct KRB5_EDATA_NTSTATUS *)
 ndr_print_NTSTATUS: void (struct ndr_print *, const char *, NTSTATUS)
 ndr_print_NTTIME: void (struct ndr_print *, const char *, NTTIME)
 ndr_print_NTTIME_1sec: void (struct ndr_print *, const char *, NTTIME)
@@ -98,7 +97,6 @@ ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type)
 ndr_pull_DATA_BLOB: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, DATA_BLOB *)
 ndr_pull_GUID: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct GUID *)
 ndr_pull_HRESULT: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, HRESULT *)
-ndr_pull_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, struct KRB5_EDATA_NTSTATUS *)
 ndr_pull_NTSTATUS: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTSTATUS *)
 ndr_pull_NTTIME: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTTIME *)
 ndr_pull_NTTIME_1sec: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, NTTIME *)
@@ -176,7 +174,6 @@ ndr_pull_winreg_Type: enum ndr_err_code (struct ndr_pull *, ndr_flags_type, enum
 ndr_push_DATA_BLOB: enum ndr_err_code (struct ndr_push *, ndr_flags_type, DATA_BLOB)
 ndr_push_GUID: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct GUID *)
 ndr_push_HRESULT: enum ndr_err_code (struct ndr_push *, ndr_flags_type, HRESULT)
-ndr_push_KRB5_EDATA_NTSTATUS: enum ndr_err_code (struct ndr_push *, ndr_flags_type, const struct KRB5_EDATA_NTSTATUS *)
 ndr_push_NTSTATUS: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTSTATUS)
 ndr_push_NTTIME: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTTIME)
 ndr_push_NTTIME_1sec: enum ndr_err_code (struct ndr_push *, ndr_flags_type, NTTIME)
@@ -273,5 +270,5 @@ ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, ui
 ndr_token_retrieve_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *, comparison_fn_t, bool)
 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_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\3146"}, if_version = 1
 ndr_zero_memory: void (void *, size_t)
diff --git a/librpc/idl/dnsp.idl b/librpc/idl/dnsp.idl
index 0cb18bfcd8a..7d2cb4c60ec 100644
--- a/librpc/idl/dnsp.idl
+++ b/librpc/idl/dnsp.idl
@@ -18,6 +18,7 @@ import "misc.idl";
   version(0.0),
   pointer_default(unique),
   helper("../librpc/ndr/ndr_dnsp.h"),
+  headerhelper("lib/util/time.h"),
   helpstring("DNSP interfaces")
 ]
 
diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl
index a705b53b5f3..968847e6b57 100644
--- a/librpc/idl/misc.idl
+++ b/librpc/idl/misc.idl
@@ -7,6 +7,7 @@
 
 [
 	pyhelper("librpc/ndr/py_misc.c"),
+	headerhelper("lib/util/data_blob.h"),
 	pointer_default(unique)
 ]
 interface misc
@@ -52,12 +53,6 @@ interface misc
 		SEC_CHAN_RODC        = 7
 	} netr_SchannelType;
 
-	typedef [public] struct {
-		NTSTATUS ntstatus;
-		uint32 unknown1;
-		uint32 unknown2; /* 0x00000001 */
-	} KRB5_EDATA_NTSTATUS;
-
 	typedef [public,v1_enum] enum {
 		REG_NONE                       = 0,
 		REG_SZ                         = 1,
diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl
index edeed285943..d88cd92671a 100644
--- a/librpc/idl/security.idl
+++ b/librpc/idl/security.idl
@@ -31,7 +31,7 @@ cpp_quote("#define dom_sid0 dom_sid")
 	 */
 	uuid("cbf7d408-2d6c-11e2-ae5b-0b5692790e18"),
 	version(0.0),
-	helper("../libcli/security/security.h"),
+	helper("../libcli/security/secace.h"),
 	pyhelper("librpc/ndr/py_security.c"),
 	pointer_default(unique)
 ]
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 1eaa278d820..9e538f68267 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -2007,41 +2007,83 @@ _PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const vo
 	return ndr_pull_set_offset(ndr, rel_offset);
 }
 
-static const struct {
-	enum ndr_err_code err;
-	const char *string;
-} ndr_err_code_strings[] = {
-	{ NDR_ERR_SUCCESS, "Success" },
-	{ NDR_ERR_ARRAY_SIZE, "Bad Array Size" },
-	{ NDR_ERR_BAD_SWITCH, "Bad Switch" },
-	{ NDR_ERR_OFFSET, "Offset Error" },
-	{ NDR_ERR_RELATIVE, "Relative Pointer Error" },
-	{ NDR_ERR_CHARCNV, "Character Conversion Error" },
-	{ NDR_ERR_LENGTH, "Length Error" },
-	{ NDR_ERR_SUBCONTEXT, "Subcontext Error" },
-	{ NDR_ERR_COMPRESSION, "Compression Error" },
-	{ NDR_ERR_STRING, "String Error" },
-	{ NDR_ERR_VALIDATE, "Validate Error" },
-	{ NDR_ERR_BUFSIZE, "Buffer Size Error" },
-	{ NDR_ERR_ALLOC, "Allocation Error" },
-	{ NDR_ERR_RANGE, "Range Error" },
-	{ NDR_ERR_TOKEN, "Token Error" },
-	{ NDR_ERR_IPV4ADDRESS, "IPv4 Address Error" },
-	{ NDR_ERR_INVALID_POINTER, "Invalid Pointer" },
-	{ NDR_ERR_UNREAD_BYTES, "Unread Bytes" },
-	{ NDR_ERR_NDR64, "NDR64 assertion error" },
-	{ NDR_ERR_INCOMPLETE_BUFFER, "Incomplete Buffer" },
-	{ NDR_ERR_MAX_RECURSION_EXCEEDED, "Maximum Recursion Exceeded" },
-	{ NDR_ERR_UNDERFLOW, "Underflow" },
-	{ 0, NULL }
-};
-
 _PUBLIC_ const char *ndr_map_error2string(enum ndr_err_code ndr_err)
 {
-	int i;
-	for (i = 0; ndr_err_code_strings[i].string != NULL; i++) {
-		if (ndr_err_code_strings[i].err == ndr_err)
-			return ndr_err_code_strings[i].string;
+	const char *ret = "Unknown error";
+
+	switch (ndr_err) {
+	case NDR_ERR_SUCCESS:
+		ret = "Success";
+		break;
+	case NDR_ERR_ARRAY_SIZE:
+		ret = "Bad Array Size";
+		break;
+	case NDR_ERR_BAD_SWITCH:
+		ret = "Bad Switch";
+		break;
+	case NDR_ERR_OFFSET:
+		ret = "Offset Error";
+		break;
+	case NDR_ERR_RELATIVE:
+		ret = "Relative Pointer Error";
+		break;
+	case NDR_ERR_CHARCNV:
+		ret = "Character Conversion Error";
+		break;
+	case NDR_ERR_LENGTH:
+		ret = "Length Error";
+		break;
+	case NDR_ERR_SUBCONTEXT:
+		ret = "Subcontext Error";
+		break;
+	case NDR_ERR_COMPRESSION:
+		ret = "Compression Error";
+		break;
+	case NDR_ERR_STRING:
+		ret = "String Error";
+		break;
+	case NDR_ERR_VALIDATE:
+		ret = "Validate Error";
+		break;
+	case NDR_ERR_BUFSIZE:
+		ret = "Buffer Size Error";
+		break;
+	case NDR_ERR_ALLOC:
+		ret = "Allocation Error";
+		break;
+	case NDR_ERR_RANGE:
+		ret = "Range Error";
+		break;
+	case NDR_ERR_TOKEN:
+		ret = "Token Error";
+		break;
+	case NDR_ERR_IPV4ADDRESS:
+		ret = "IPv4 Address Error";
+		break;
+	case NDR_ERR_INVALID_POINTER:
+		ret = "Invalid Pointer";
+		break;
+	case NDR_ERR_UNREAD_BYTES:
+		ret = "Unread Bytes";
+		break;
+	case NDR_ERR_NDR64:
+		ret = "NDR64 assertion error";
+		break;
+	case NDR_ERR_INCOMPLETE_BUFFER:
+		ret = "Incomplete Buffer";
+		break;
+	case NDR_ERR_MAX_RECURSION_EXCEEDED:
+		ret = "Maximum Recursion Exceeded";
+		break;
+	case NDR_ERR_UNDERFLOW:
+		ret = "Underflow";
+		break;
+	case NDR_ERR_IPV6ADDRESS:
+		ret = "Invalid IPv6 address";
+		break;
+	case NDR_ERR_FLAGS:
+		ret = "Invalid NDR flags";
+		break;
 	}
-	return "Unknown error";
+	return ret;
 }
diff --git a/librpc/ndr/ndr_compression.c b/librpc/ndr/ndr_compression.c
index 6630b5170ef..04d810a5cb3 100644
--- a/librpc/ndr/ndr_compression.c
+++ b/librpc/ndr/ndr_compression.c
@@ -43,7 +43,7 @@ struct ndr_compression_state {
 
 static voidpf ndr_zlib_alloc(voidpf opaque, uInt items, uInt size)
 {
-	return talloc_zero_size(opaque, items * size);
+	return _talloc_array(opaque, size, items, __location__);
 }
 
 static void  ndr_zlib_free(voidpf opaque, voidpf address)
diff --git a/librpc/wscript_build b/librpc/wscript_build
index b1765863d9c..6cb4e1cff2b 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -674,7 +674,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='5.0.0',
+    vnum='6.0.0',
     abi_directory='ABI',
     abi_match='!ndr_table_* ndr_* GUID_* _ndr_pull_error* _ndr_push_error*',
     )
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 18db6cfe258..3cb72aa3e9a 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -1118,6 +1118,7 @@ my %property_list = (
 	"endpoint"		=> ["INTERFACE"],
 	"pointer_default"	=> ["INTERFACE"],
 	"helper"		=> ["INTERFACE"],
+	"headerhelper"		=> ["INTERFACE"],
 	"pyhelper"		=> ["INTERFACE"],
 	"authservice"		=> ["INTERFACE"],
 	"restricted"	        => ["INTERFACE"],
diff --git a/pidl/lib/Parse/Pidl/Samba4/Header.pm b/pidl/lib/Parse/Pidl/Samba4/Header.pm
index a0b002f6724..137dc27514e 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -13,7 +13,7 @@ require Exporter;
 use strict;
 use warnings;
 use Parse::Pidl qw(fatal);
-use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
+use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference scalarTypeUsed);
 use Parse::Pidl::Util qw(has_property is_constant unmake_str ParseExpr);
 use Parse::Pidl::Samba4 qw(is_intree ElementStars ArrayBrackets choose_header);
 
@@ -401,6 +401,13 @@ sub HeaderInterface($)
 	pidl "#ifndef _HEADER_$interface->{NAME}\n";
 	pidl "#define _HEADER_$interface->{NAME}\n\n";
 
+	if (has_property($interface, "headerhelper")) {
+	    foreach my $h (split /,/, $interface->{PROPERTIES}->{headerhelper}) {
+		pidl("#include $h\n");
+	    }
+	    pidl("\n");
+	}
+
 	foreach my $c (@{$interface->{CONSTS}}) {
 		HeaderConst($c);
 	}
@@ -437,7 +444,6 @@ sub Parse($)
 
 	$res = "";
 	%headerstructs = ();
-	pidl "/* header auto-generated by pidl */\n\n";
 
 	my $ifacename = "";
 
@@ -449,6 +455,17 @@ sub Parse($)
 		}
 	}
 
+	foreach (@{$ndr}) {
+		($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_);
+		($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
+		($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
+		($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
+	}
+
+	my $res2 = $res;
+	$res = "";
+	pidl "/* header auto-generated by pidl */\n\n";
+
 	pidl "#ifndef _PIDL_HEADER_$ifacename\n";
 	pidl "#define _PIDL_HEADER_$ifacename\n\n";
 
@@ -457,16 +474,12 @@ sub Parse($)
 	}
 	pidl "#include <stdint.h>\n";
 	pidl "\n";
-	# FIXME: Include this only if NTSTATUS was actually used
-	pidl choose_header("libcli/util/ntstatus.h", "core/ntstatus.h") . "\n";
+	if (scalarTypeUsed("NTSTATUS")) {
+		pidl choose_header("libcli/util/ntstatus.h", "core/ntstatus.h") . "\n";
+	}
 	pidl "\n";
 
-	foreach (@{$ndr}) {
-		($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_);
-		($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
-		($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
-		($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
-	}
+	$res .= $res2;
 
 	pidl "#endif /* _PIDL_HEADER_$ifacename */\n";
 
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index d7386d5b2cc..920febabb85 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -3225,7 +3225,7 @@ sub GenerateIncludes($)
 {
 	my ($self) = @_;
 	if (is_intree()) {
-		$self->pidl("#include \"includes.h\"");
+		$self->pidl("#include \"replace.h\"");
 	} else {
 		$self->pidl("#ifndef _GNU_SOURCE");
 		$self->pidl("#define _GNU_SOURCE");
diff --git a/pidl/lib/Parse/Pidl/Typelist.pm b/pidl/lib/Parse/Pidl/Typelist.pm
index 2a98a16b2b5..af4ef13e7d2 100644
--- a/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/pidl/lib/Parse/Pidl/Typelist.pm
@@ -10,7 +10,7 @@ require Exporter;
 @EXPORT_OK = qw(hasType getType resolveType mapTypeName mapTypeSpecifier scalar_is_reference expandAlias
 	mapScalarType addType typeIs is_signed is_scalar enum_type_fn
 	bitmap_type_fn mapType typeHasBody is_fixed_size_scalar
-	is_string_type
+	is_string_type scalarTypeUsed
 );
 use vars qw($VERSION);
 $VERSION = '0.01';
@@ -115,6 +115,8 @@ sub expandAlias($)
 	return $name;
 }
 
+my %scalars_used = ();
+
 # map from a IDL type to a C header type
 sub mapScalarType($)
 {
@@ -122,11 +124,20 @@ sub mapScalarType($)
 
 	# it's a bug when a type is not in the list
 	# of known scalars or has no mapping
-	return $scalars{$name} if defined($scalars{$name});
+	if (defined($scalars{$name})) {
+		$scalars_used{$name} = $scalars{$name};
+		return $scalars{$name};
+	}
 
 	die("Unknown scalar type $name");
 }
 
+sub scalarTypeUsed($)
+{
+	my $name = shift;
+	return defined($scalars_used{$name});
+}
+
 sub addType($)
 {
 	my $t = shift;
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 23c90f73e25..95ba262ca25 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -23,6 +23,7 @@


-- 
Samba Shared Repository



More information about the samba-cvs mailing list