[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Jan 12 01:20:01 UTC 2021


The branch, master has been updated
       via  1c2460a87e5 lib: Fix 'charset' dependencies
       via  1701041d532 lib: Avoid "includes.h" in lib/util/charset/
       via  9de2c2c12d2 lib: Remove using talloc_stack from lib/util/charset/
       via  cb1bcba227f lib: lib/param/param.h references TALLOC_CTX
       via  922b8d18c31 librpc: gen_ndr/dcerpc.h references DATA_BLOB
       via  cc01ba1b0ea librpc: Align a few integer types
       via  1b054aa0a52 rpc_client: Simplify rpc_pipe_open_ncalrpc()
       via  ad5aabf8a11 rpc_client: Use common "goto fail" for all error cases
       via  2745f6ec743 rpc_client: Fix an error path memleak in rpc_pipe_open_ncalrpc()
       via  d51b4ac5276 rpc_client: Error from rpc_pipe_open_ncalrpc() for path overflow
       via  eecd5e87837 epmapper3: Fix a DEBUG message
       via  457afe052f7 epmapper3: Fix a typo
       via  ca0104d4518 rpc_server: Fix an error path memleak
       via  93d387fb6d7 rpc_server: Avoid a pointless ZERO_STRUCTP
       via  f9f7aafaeb2 rpc_server: Move a variable closer to its use
       via  83d85833bba rpc_server: Fix a typo
       via  e60c435744b auth4: Use global_sid_Anonymous
       via  6b73ffb69dd auth4: Use global_sid_System
       via  8b5eda7535c lib: Move utf16_len[_n]() to lib/util/charset/
       via  ae78cf0d61e build: Make smb_panic() available as a subsystem of its own
       via  49ab5431c5b lib: Avoid all_string_sub() in smb_panic()
       via  3d0e55b6d98 build: Move weird.c and charset_macosxfs.c to ICONV_WRAPPER
       via  8c02ebdbf84 lib: Simplify "weird" charset code
       via  8f08390c282 lib: Move ucs2_align() to 'charset' subsystem
       via  9c16c212fda smbd: Slightly simplify smbd_smb2_create_send()
      from  b31405e31bc vfs_glusterfs: support read dirfsps in vfs_gluster_openat()

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


- Log -----------------------------------------------------------------
commit 1c2460a87e57b9714ead40bb8977a3785002abf5
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 9 18:26:00 2021 +0100

    lib: Fix 'charset' dependencies
    
    With this, 'charset' could be a SAMBA_LIBRARY without any undefined symbols
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jan 12 01:19:26 UTC 2021 on sn-devel-184

commit 1701041d532bb6684c33e89420273631c063a2fa
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 9 18:22:15 2021 +0100

    lib: Avoid "includes.h" in lib/util/charset/
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9de2c2c12d29d2e1af1cb1b0d919191cd14522dc
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 9 18:20:34 2021 +0100

    lib: Remove using talloc_stack from lib/util/charset/
    
    'charset' should be as standalone as possible, and for this one use
    talloc_stackframe() is not really necessary.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cb1bcba227f00ae444056cc2e0475623abbe7860
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 3 21:52:06 2021 +0100

    lib: lib/param/param.h references TALLOC_CTX
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 922b8d18c311035ebbe0625b3d14dc5fbeb03539
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 3 21:51:34 2021 +0100

    librpc: gen_ndr/dcerpc.h references DATA_BLOB
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cc01ba1b0eac7d0266ee9da3a2b6d28fee5c5edc
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 31 10:16:21 2020 +0100

    librpc: Align a few integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1b054aa0a52489ac183a47c2b2cdc66228d53738
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 18:42:18 2021 +0100

    rpc_client: Simplify rpc_pipe_open_ncalrpc()
    
    Consolidate close(fd)
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ad5aabf8a1194269a25c68da6af991a489ba061c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 18:31:33 2021 +0100

    rpc_client: Use common "goto fail" for all error cases
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2745f6ec743df4c8ae98d59335bf64d6520d5aa5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 18:31:17 2021 +0100

    rpc_client: Fix an error path memleak in rpc_pipe_open_ncalrpc()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d51b4ac5276cfeaa9994eb5465066e8f4ce1b4d7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 18:28:20 2021 +0100

    rpc_client: Error from rpc_pipe_open_ncalrpc() for path overflow
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eecd5e878372cf595444befb13ce92eb9d196ba8
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:16:43 2021 +0100

    epmapper3: Fix a DEBUG message
    
    This is not function dcesrv_interface_register()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 457afe052f7c767722b50a0b3f7c26cc296fa975
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:15:49 2021 +0100

    epmapper3: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ca0104d4518bf4ca4e50441afb2d3dfb44e9513d
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:12:26 2021 +0100

    rpc_server: Fix an error path memleak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 93d387fb6d771fd74cca84693ecfb45c07baa294
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:10:47 2021 +0100

    rpc_server: Avoid a pointless ZERO_STRUCTP
    
    We've done talloc_zero() 4 lines above.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f9f7aafaeb2fca24c1ee9b3034ceb8dd447de734
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:07:54 2021 +0100

    rpc_server: Move a variable closer to its use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 83d85833bba6d4e34a9b761cd1787775d68d65bc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 10 13:01:45 2021 +0100

    rpc_server: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e60c435744b869318a14f69f6aa0bc67e3cceb8f
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 9 22:53:29 2021 +0100

    auth4: Use global_sid_Anonymous
    
    dom_sid_dup() is much simpler than dom_sid_parse_talloc()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6b73ffb69dd1c786f4a64c4c07689a2d87952e89
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 9 22:51:38 2021 +0100

    auth4: Use global_sid_System
    
    dom_sid_dup() is much simpler than dom_sid_parse_talloc()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8b5eda7535c9f0dcef010e6edeb9deec8a8213a0
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 5 10:27:12 2021 +0100

    lib: Move utf16_len[_n]() to lib/util/charset/
    
    util_unistr.c references it, avoid broken dependencies
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ae78cf0d61e62f1292af9d713aa8c06b9b379d91
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 11 13:59:00 2021 +0100

    build: Make smb_panic() available as a subsystem of its own
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 49ab5431c5b10ead543bf8bf2c0455dcfb262d59
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 11 13:55:38 2021 +0100

    lib: Avoid all_string_sub() in smb_panic()
    
    smb_panic() should be available everywhere. Avoid a dependency on
    all_string_sub(), this pulls in a lot of other dependencies. The only
    change is that this uses "strstr" instead of "strstr_m", but having
    non-ascii panic actions strings can be called rare.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3d0e55b6d98d1178a00b0a68af576ca64d5f93cb
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 4 14:25:36 2021 +0100

    build: Move weird.c and charset_macosxfs.c to ICONV_WRAPPER
    
    iconv.c directly references them, it does not make sense to have it
    without them.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8c02ebdbf84cc8141754313c0b5bb0ee1c56afb2
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 4 12:28:20 2021 +0100

    lib: Simplify "weird" charset code
    
    Don't depend on DEBUG. This is a pure developer module, the developer
    should be able to figure out what's going on after this has abort()ed.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8f08390c282c19f866fe75a8115dcdecb6fe5d68
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 4 11:14:56 2021 +0100

    lib: Move ucs2_align() to 'charset' subsystem
    
    Fix a circular dependency: util_str_common.c depends on 'charset',
    which depends on util_str_common.c. Fix that.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9c16c212fda67734c604f799ea25348d721312e0
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 27 12:13:51 2020 +0100

    smbd: Slightly simplify smbd_smb2_create_send()
    
    If we return unconditionally, "else" is not needed
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/param/param.h                          |  2 ++
 lib/util/charset/charset.h                 | 15 +++++++++
 lib/util/charset/charset_macosxfs.c        |  3 +-
 lib/util/charset/convert_string.c          |  5 ++-
 lib/util/charset/pull_push.c               |  3 +-
 lib/util/charset/util_str.c                | 40 +++++++++++++----------
 lib/util/charset/util_unistr.c             | 43 ++++++++++++++++++++++++-
 lib/util/charset/util_unistr_w.c           |  6 +++-
 lib/util/charset/weird.c                   | 45 ++++++++++++--------------
 lib/util/charset/wscript_build             | 17 ++++++++--
 lib/util/fault.c                           | 17 ++++++++--
 lib/util/samba_util.h                      | 14 --------
 lib/util/util_str.c                        | 31 ------------------
 lib/util/util_str_common.c                 |  7 ----
 lib/util/wscript_build                     | 51 +++++++++++++++++++++++++-----
 librpc/rpc/binding.c                       | 12 +++----
 librpc/rpc/dcesrv_core.c                   |  4 +--
 librpc/rpc/dcesrv_core.h                   |  2 +-
 librpc/rpc/rpc_common.h                    |  2 ++
 source3/include/proto.h                    |  1 -
 source3/rpc_client/cli_pipe.c              | 31 ++++++++++--------
 source3/rpc_server/epmapper/srv_epmapper.c |  8 ++---
 source3/smbd/smb2_create.c                 |  6 ++--
 source4/auth/system_session.c              |  4 +--
 24 files changed, 227 insertions(+), 142 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/param.h b/lib/param/param.h
index 762a8270481..f7204c5702d 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -20,6 +20,8 @@
 #ifndef _PARAM_H /* _PARAM_H */
 #define _PARAM_H 
 
+#include <talloc.h>
+
 struct loadparm_s3_helpers;
 struct loadparm_substitution;
 
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index ef7911a6254..c62832cccd6 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -93,6 +93,21 @@ typedef struct smb_iconv_s {
 struct loadparm_context;
 struct smb_iconv_handle;
 
+size_t ucs2_align(const void *base_ptr, const void *p, int flags);
+
+/**
+return the number of bytes occupied by a buffer in CH_UTF16 format
+the result includes the null termination
+**/
+size_t utf16_len(const void *buf);
+
+/**
+return the number of bytes occupied by a buffer in CH_UTF16 format
+the result includes the null termination
+limited by 'n' bytes
+**/
+size_t utf16_len_n(const void *src, size_t n);
+
 char *strchr_m(const char *s, char c);
 /**
  * Calculate the number of units (8 or 16-bit, depending on the
diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c
index 97a366a1532..55a6df85fb7 100644
--- a/lib/util/charset/charset_macosxfs.c
+++ b/lib/util/charset/charset_macosxfs.c
@@ -29,7 +29,8 @@
  * source.
  */
 
-#include "includes.h"
+#include "replace.h"
+#include "charset.h"
 #include "charset_proto.h"
 #undef realloc
 
diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c
index b725b53cb5a..96a3af68d27 100644
--- a/lib/util/charset/convert_string.c
+++ b/lib/util/charset/convert_string.c
@@ -21,8 +21,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
-#include "includes.h"
+#include "replace.h"
 #include "system/iconv.h"
+#include "charset.h"
+#include "lib/util/debug.h"
+#include "lib/util/fault.h"
 
 /**
  * @file
diff --git a/lib/util/charset/pull_push.c b/lib/util/charset/pull_push.c
index cf25efa5a5e..1a79e6aa400 100644
--- a/lib/util/charset/pull_push.c
+++ b/lib/util/charset/pull_push.c
@@ -21,8 +21,9 @@
 
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/locale.h"
+#include "charset.h"
 
 /**
  * Copy a string from a unix char* src to a UCS2 destination,
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index d1148c7387a..2a4ccd93673 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -22,8 +22,10 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/locale.h"
+#include "charset.h"
+#include "lib/util/fault.h"
 
 #ifdef strcasecmp
 #undef strcasecmp
@@ -528,15 +530,14 @@ _PUBLIC_ bool strhasupper(const char *string)
 
 char *strstr_m(const char *src, const char *findstr)
 {
+	TALLOC_CTX *mem_ctx = NULL;
 	smb_ucs2_t *p;
 	smb_ucs2_t *src_w, *find_w;
 	const char *s;
 	char *s2;
-	char *retp;
+	char *retp = NULL;
 	size_t converted_size, findstr_len = 0;
 
-	TALLOC_CTX *frame; /* Only set up in the iconv case */
-
 	/* for correctness */
 	if (!findstr[0]) {
 		return discard_const_p(char, src);
@@ -571,31 +572,36 @@ char *strstr_m(const char *src, const char *findstr)
 	s = src;
 #endif
 
-	frame = talloc_stackframe();
-
-	if (!push_ucs2_talloc(frame, &src_w, src, &converted_size)) {
-		TALLOC_FREE(frame);
+	/*
+	 * Use get_iconv_handle() just as a non-NULL talloc ctx. In
+	 * case we leak memory, this should then be more obvious in
+	 * the talloc report.
+	 */
+	mem_ctx = talloc_new(get_iconv_handle());
+	if (mem_ctx == NULL) {
 		return NULL;
 	}
 
-	if (!push_ucs2_talloc(frame, &find_w, findstr, &converted_size)) {
-		TALLOC_FREE(frame);
-		return NULL;
+	if (!push_ucs2_talloc(mem_ctx, &src_w, src, &converted_size)) {
+		goto done;
+	}
+
+	if (!push_ucs2_talloc(mem_ctx, &find_w, findstr, &converted_size)) {
+		goto done;
 	}
 
 	p = strstr_w(src_w, find_w);
 
 	if (!p) {
-		TALLOC_FREE(frame);
-		return NULL;
+		goto done;
 	}
 
 	*p = 0;
-	if (!pull_ucs2_talloc(frame, &s2, src_w, &converted_size)) {
-		TALLOC_FREE(frame);
-		return NULL;
+	if (!pull_ucs2_talloc(mem_ctx, &s2, src_w, &converted_size)) {
+		goto done;
 	}
 	retp = discard_const_p(char, (s+strlen(s2)));
-	TALLOC_FREE(frame);
+done:
+	TALLOC_FREE(mem_ctx);
 	return retp;
 }
diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
index 2cc87186dae..4658d91b0c8 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -18,8 +18,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/locale.h"
+#include "charset.h"
+#include "lib/util/byteorder.h"
+#include "lib/util/fault.h"
 
 /**
  String replace.
@@ -180,6 +183,44 @@ _PUBLIC_ size_t count_chars_m(const char *s, char c)
 	return count;
 }
 
+size_t ucs2_align(const void *base_ptr, const void *p, int flags)
+{
+	if (flags & (STR_NOALIGN|STR_ASCII)) {
+		return 0;
+	}
+	return PTR_DIFF(p, base_ptr) & 1;
+}
+
+/**
+return the number of bytes occupied by a buffer in CH_UTF16 format
+the result includes the null termination
+**/
+size_t utf16_len(const void *buf)
+{
+	size_t len;
+
+	for (len = 0; SVAL(buf,len); len += 2) ;
+
+	return len + 2;
+}
+
+/**
+return the number of bytes occupied by a buffer in CH_UTF16 format
+the result includes the null termination
+limited by 'n' bytes
+**/
+size_t utf16_len_n(const void *src, size_t n)
+{
+	size_t len;
+
+	for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ;
+
+	if (len+2 <= n) {
+		len += 2;
+	}
+
+	return len;
+}
 
 /**
  * Copy a string from a char* unix src to a dos codepage string destination.
diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c
index db8a8dde79f..88d5531bb71 100644
--- a/lib/util/charset/util_unistr_w.c
+++ b/lib/util/charset/util_unistr_w.c
@@ -19,7 +19,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
+#include "charset.h"
+#include "lib/util/byteorder.h"
+#include "lib/util/debug.h"
+#include "lib/util/fault.h"
 
 /* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
 #define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((const unsigned char *)(src))[0],\
diff --git a/lib/util/charset/weird.c b/lib/util/charset/weird.c
index 79b07b022a1..9752e01e323 100644
--- a/lib/util/charset/weird.c
+++ b/lib/util/charset/weird.c
@@ -18,7 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "charset_proto.h"
 
 #ifdef DEVELOPER
@@ -54,19 +54,17 @@ size_t weird_pull(void *cd, const char **inbuf, size_t *inbytesleft,
 				    weird_table[i].to, 
 				    weird_table[i].len) == 0) {
 				if (*inbytesleft < weird_table[i].len) {
-					DEBUG(0,("ERROR: truncated weird string\n"));
-					/* smb_panic("weird_pull"); */
-
-				} else {
-					(*outbuf)[0] = weird_table[i].from;
-					(*outbuf)[1] = 0;
-					(*inbytesleft)  -= weird_table[i].len;
-					(*outbytesleft) -= 2;
-					(*inbuf)  += weird_table[i].len;
-					(*outbuf) += 2;
-					done = 1;
-					break;
+					abort();
 				}
+
+				(*outbuf)[0] = weird_table[i].from;
+				(*outbuf)[1] = 0;
+				(*inbytesleft)  -= weird_table[i].len;
+				(*outbytesleft) -= 2;
+				(*inbuf)  += weird_table[i].len;
+				(*outbuf) += 2;
+				done = 1;
+				break;
 			}
 		}
 		if (done) continue;
@@ -98,18 +96,17 @@ size_t weird_push(void *cd, const char **inbuf, size_t *inbytesleft,
 			if ((*inbuf)[0] == weird_table[i].from &&
 			    (*inbuf)[1] == 0) {
 				if (*outbytesleft < weird_table[i].len) {
-					DEBUG(0,("No room for weird character\n"));
-					/* smb_panic("weird_push"); */
-				} else {
-					memcpy(*outbuf, weird_table[i].to, 
-					       weird_table[i].len);
-					(*inbytesleft)  -= 2;
-					(*outbytesleft) -= weird_table[i].len;
-					(*inbuf)  += 2;
-					(*outbuf) += weird_table[i].len;
-					done = 1;
-					break;
+					abort();
 				}
+				memcpy(*outbuf,
+				       weird_table[i].to,
+				       weird_table[i].len);
+				(*inbytesleft)  -= 2;
+				(*outbytesleft) -= weird_table[i].len;
+				(*inbuf)  += 2;
+				(*outbuf) += weird_table[i].len;
+				done = 1;
+				break;
 			}
 		}
 		if (done) continue;
diff --git a/lib/util/charset/wscript_build b/lib/util/charset/wscript_build
index 8fed718e7dc..c69a17170ad 100644
--- a/lib/util/charset/wscript_build
+++ b/lib/util/charset/wscript_build
@@ -1,11 +1,22 @@
 #!/usr/bin/env python
 
 bld.SAMBA_SUBSYSTEM('ICONV_WRAPPER',
-                    source='iconv.c',
+                    source='''
+                    iconv.c
+                    weird.c
+                    charset_macosxfs.c
+                    ''',
                     public_deps='iconv replace talloc ' +  bld.env['icu-libs'])
 
 bld.SAMBA_SUBSYSTEM('charset',
                     public_headers='charset.h',
-                    source='codepoints.c convert_string.c util_str.c util_unistr_w.c pull_push.c util_unistr.c weird.c charset_macosxfs.c',
-                    deps='DYNCONFIG ICONV_WRAPPER',
+                    source='''
+                    codepoints.c
+                    convert_string.c
+                    util_str.c
+                    util_unistr_w.c
+                    pull_push.c
+                    util_unistr.c
+                    ''',
+                    deps='DYNCONFIG ICONV_WRAPPER smb-panic samba-debug',
                     public_deps='talloc')
diff --git a/lib/util/fault.c b/lib/util/fault.c
index b1da1bb4121..90552a391b6 100644
--- a/lib/util/fault.c
+++ b/lib/util/fault.c
@@ -35,7 +35,6 @@
 
 #include "debug.h"
 #include "lib/util/signal.h" /* Avoid /usr/include/signal.h */
-#include "substitute.h"
 #include "fault.h"
 
 static struct {
@@ -134,8 +133,22 @@ static void smb_panic_default(const char *why)
 		if (strlcpy(cmdstring, panic_action, sizeof(cmdstring)) < sizeof(cmdstring)) {
 			int result;
 			char pidstr[20];
+			char subst[200];
+			char *p = NULL;
 			snprintf(pidstr, sizeof(pidstr), "%d", (int) getpid());
-			all_string_sub(cmdstring, "%d", pidstr, sizeof(cmdstring));
+
+			p = strstr(cmdstring, "%d");
+			if (p != NULL) {
+				snprintf(subst,
+					 sizeof(subst),
+					 "%.*s%s%s",
+					 (int)(p-cmdstring),
+					 cmdstring,
+					 pidstr,
+					 p+2);
+				strlcpy(cmdstring, subst, sizeof(cmdstring));
+			}
+
 			DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmdstring));
 			result = system(cmdstring);
 
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 4ff3f7ff35c..f0bfa809d7b 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -312,20 +312,6 @@ _PUBLIC_ bool conv_str_size_error(const char * str, uint64_t * val);
  */
 _PUBLIC_ bool conv_str_u64(const char * str, uint64_t * val);
 
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-**/
-_PUBLIC_ size_t utf16_len(const void *buf);
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-limited by 'n' bytes
-**/
-_PUBLIC_ size_t utf16_len_n(const void *src, size_t n);
-_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags);
-
 /**
  * @brief Constant time compare to memory regions.
  *
diff --git a/lib/util/util_str.c b/lib/util/util_str.c
index c7773e0c927..da1989f80f2 100644
--- a/lib/util/util_str.c
+++ b/lib/util/util_str.c
@@ -305,37 +305,6 @@ _PUBLIC_ bool set_boolean(const char *boolean_string, bool *boolean)
 	return false;
 }
 
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-**/
-_PUBLIC_ size_t utf16_len(const void *buf)
-{
-	size_t len;
-
-	for (len = 0; SVAL(buf,len); len += 2) ;
-
-	return len + 2;
-}
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-limited by 'n' bytes
-**/
-_PUBLIC_ size_t utf16_len_n(const void *src, size_t n)
-{
-	size_t len;
-
-	for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ;
-
-	if (len+2 <= n) {
-		len += 2;
-	}
-
-	return len;
-}
-
 _PUBLIC_ int memcmp_const_time(const void *s1, const void *s2, size_t n)
 {
 	const uint8_t *p1 = s1, *p2 = s2;
diff --git a/lib/util/util_str_common.c b/lib/util/util_str_common.c
index 7bdba9a7a8c..bf0fec8eca4 100644
--- a/lib/util/util_str_common.c
+++ b/lib/util/util_str_common.c
@@ -59,13 +59,6 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2)
 	return (*psz1 - *psz2);
 }
 
-_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags)
-{
-	if (flags & (STR_NOALIGN|STR_ASCII))
-		return 0;
-	return PTR_DIFF(p, base_ptr) & 1;
-}
-
 /**
  String replace.
  NOTE: oldc and newc must be 7 bit characters
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 7ae14130173..000c9be6f4f 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -74,15 +74,50 @@ bld.SAMBA_LIBRARY('talloc_report_printf',
                   private_library=True
                   )
 
+bld.SAMBA_SUBSYSTEM('smb-panic',
+                    source='''
+                    fault.c
+                    signal.c
+                    ''',
+                    deps='''
+                    replace
+                    samba-debug
+                    LIBUNWIND
+                    ''',
+                    local_include=False)
+
 bld.SAMBA_SUBSYSTEM('samba-util-core',
-                    source='''data_blob.c util_file.c sys_popen.c time.c
-                              signal.c util.c idtree.c fault.c
-                              substitute.c util_process.c util_strlist.c
-                              strv_util.c bitmap.c select.c pidfile.c
-                              become_daemon.c mkdir_p.c''',
-                    deps='''time-basic samba-debug socket-blocking talloc
-                            tevent execinfo pthread strv tini smb_strtox''',
-                    public_deps='systemd systemd-daemon sys_rw LIBUNWIND',


-- 
Samba Shared Repository



More information about the samba-cvs mailing list