[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Thu Nov 16 06:24:02 UTC 2023


The branch, master has been updated
       via  fe1d45cf1e9 s4:librpc: Add functions converting between bytes and UTF‐16 strings
       via  5f3f3c0cc3e s4:librpc: Remove trailing whitespace
       via  df19006c782 tests/krb5: Allow creating Group Managed Service Accounts
       via  7a9ad610226 pidl: Don’t overwrite exception set by PyUnicode_AsEncodedString()
       via  ddb98e7d611 pidl: Remove trailing whitespace
       via  e04f627e4f2 librpc:ndr: Fix comment
       via  204a46b712c librpc:ndr: Don’t duplicate strings needlessly
       via  e01e6202e60 librpc:ndr: Move call to convert_string_talloc() on to its own line
       via  2e2b80f895d librpc:ndr: Introduce common out path in ndr_push_string()
       via  5e580fadeed librpc:ndr: Fix error message
       via  4b03c6de54b librpc:ndr: Fix code formatting
       via  939ceb233ef util/charset: Add talloc_utf16_str[n]dup()
       via  b6ff89f6fb3 util/charset: Include missing headers
       via  3f0809f1eef util/charset: Remove unnecessary cast
      from  3f908e19a04 s4-scripting: Remove repl_cleartext_pwd.py

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


- Log -----------------------------------------------------------------
commit fe1d45cf1e90e9d75f3a47d65b920e2a7e472c97
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 11:20:22 2023 +1300

    s4:librpc: Add functions converting between bytes and UTF‐16 strings
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Nov 16 06:23:35 UTC 2023 on atb-devel-224

commit 5f3f3c0cc3ef7ca5237ba1e4865259e02f41a12c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Nov 8 21:09:14 2023 +1300

    s4:librpc: Remove trailing whitespace
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit df19006c7825609c18a6e21d3920696bc0955e70
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Nov 13 17:07:02 2023 +1300

    tests/krb5: Allow creating Group Managed Service Accounts
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7a9ad610226dfbdb5e645e6fe98fd266a960e2d1
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Nov 15 12:10:36 2023 +1300

    pidl: Don’t overwrite exception set by PyUnicode_AsEncodedString()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ddb98e7d611f7c3160af4ea54bb6cf6bdf1ad0a3
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 9 14:08:19 2023 +1300

    pidl: Remove trailing whitespace
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e04f627e4f2c6b2a2501634fd212e2527f4e0891
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Nov 15 15:07:53 2023 +1300

    librpc:ndr: Fix comment
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 204a46b712cb025d2462b7e4319c04d451e2d550
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 10:15:36 2023 +1300

    librpc:ndr: Don’t duplicate strings needlessly
    
    If the source string doesn’t need to be converted, there’s no reason for
    it to be talloc‐allocated.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e01e6202e606476066231b0b84903c604db07a6e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 14:50:58 2023 +1300

    librpc:ndr: Move call to convert_string_talloc() on to its own line
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2e2b80f895dbe436290321074464b54f2943640f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 10:22:26 2023 +1300

    librpc:ndr: Introduce common out path in ndr_push_string()
    
    This ensures that ‘dest’ gets freed on failure.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5e580fadeed52ab723c1f6252dd4a49d0824a229
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Nov 13 17:04:34 2023 +1300

    librpc:ndr: Fix error message
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4b03c6de54bfe7773ea97bf6707c6144433acf11
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 10:43:12 2023 +1300

    librpc:ndr: Fix code formatting
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 939ceb233ef94a0d2d45da39076ba3e78665c776
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Thu Nov 16 11:10:28 2023 +1300

    util/charset: Add talloc_utf16_str[n]dup()
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b6ff89f6fb32a74365cc7116beb1ef949aaae021
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Nov 15 15:26:56 2023 +1300

    util/charset: Include missing headers
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3f0809f1eef116454584a84b270a1fd7feeebe64
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Nov 13 12:21:20 2023 +1300

    util/charset: Remove unnecessary cast
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/util/charset/charset.h               |   6 ++
 lib/util/charset/convert_string.c        |   2 +-
 lib/util/charset/util_unistr.c           |  44 ++++++++++
 librpc/ndr/ndr_string.c                  | 129 +++++++++++++++++++----------
 pidl/lib/Parse/Pidl/NDR.pm               |  82 +++++++++----------
 pidl/lib/Parse/Pidl/Samba4/Header.pm     |   2 +-
 pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 134 +++++++++++++++----------------
 pidl/lib/Parse/Pidl/Samba4/Python.pm     |   1 -
 pidl/lib/Parse/Pidl/Typelist.pm          |   8 +-
 python/samba/tests/krb5/kdc_base_test.py |  25 ++++--
 source4/librpc/rpc/pyrpc_util.c          |  49 ++++++++++-
 source4/librpc/rpc/pyrpc_util.h          |   4 +
 12 files changed, 319 insertions(+), 167 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index 195655ba1e5..aa691734713 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -26,6 +26,8 @@
 #define __CHARSET_H__
 
 #include <talloc.h>
+#include <stdbool.h>
+#include <stdint.h>
 
 /* this defines the charset types used in samba */
 typedef enum {
@@ -127,6 +129,10 @@ limited by 'n' bytes
 **/
 size_t utf16_null_terminated_len_n(const void *src, size_t n);
 
+uint16_t *talloc_utf16_strlendup(TALLOC_CTX *mem_ctx, const char *str, size_t len);
+uint16_t *talloc_utf16_strdup(TALLOC_CTX *mem_ctx, const char *str);
+uint16_t *talloc_utf16_strndup(TALLOC_CTX *mem_ctx, const char *str, 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/convert_string.c b/lib/util/charset/convert_string.c
index 9fa721b6d12..859b002ecbc 100644
--- a/lib/util/charset/convert_string.c
+++ b/lib/util/charset/convert_string.c
@@ -354,7 +354,7 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic,
 	const char *inbuf = NULL;
 	char *outbuf = NULL, *ob = NULL;
 	smb_iconv_t descriptor;
-	void **dest = (void **)dst;
+	void **dest = dst;
 
 	*dest = NULL;
 	if (converted_size != NULL) {
diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
index 7d8ff68074b..54b7b939b1b 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -243,6 +243,50 @@ size_t utf16_null_terminated_len_n(const void *src, size_t n)
 	return len;
 }
 
+uint16_t *talloc_utf16_strlendup(TALLOC_CTX *mem_ctx, const char *str, size_t len)
+{
+	uint16_t *new_str = NULL;
+
+	/* Check for overflow. */
+	if (len > SIZE_MAX - 2) {
+		return NULL;
+	}
+
+	/*
+	 * Allocate the new string, including space for the
+	 * UTF‐16 null terminator.
+	 */
+	new_str = talloc_size(mem_ctx, len + 2);
+	if (new_str == NULL) {
+		return NULL;
+	}
+
+	memcpy(new_str, str, len);
+
+	{
+		/*
+		 * Ensure that the UTF‐16 string is
+		 * null‐terminated.
+		 */
+
+		char *new_bytes = (char *)new_str;
+
+		new_bytes[len] = '\0';
+		new_bytes[len + 1] = '\0';
+	}
+
+	return new_str;
+}
+
+uint16_t *talloc_utf16_strdup(TALLOC_CTX *mem_ctx, const char *str)
+{
+	return talloc_utf16_strlendup(mem_ctx, str, utf16_len(str));
+}
+
+uint16_t *talloc_utf16_strndup(TALLOC_CTX *mem_ctx, const char *str, size_t n)
+{
+	return talloc_utf16_strlendup(mem_ctx, str, utf16_len_n(str, n));
+}
 
 /**
  * Determine the length and validity of a utf-8 string.
diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c
index 1f7bfff2e71..80054fa9be6 100644
--- a/librpc/ndr/ndr_string.c
+++ b/librpc/ndr/ndr_string.c
@@ -138,7 +138,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, ndr_flags_type
 
 	case LIBNDR_FLAG_STR_NULLTERM:
 		/*
-		 * We ensure that conv_str_len cannot return 0 by
+		 * We ensure that conv_src_len cannot equal 0 by
 		 * requiring that there be enough bytes for at least
 		 * the NULL terminator
 		 */
@@ -185,10 +185,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, ndr_flags_type
 			}
 			converted_size = MIN(strlen(as)+1, conv_src_len);
 		} else if (!convert_string_talloc(ndr->current_mem_ctx, chset,
-					   CH_UNIX, ndr->data + ndr->offset,
-					   conv_src_len * byte_mul,
-					   &as,
-					   &converted_size)) {
+						  CH_UNIX, ndr->data + ndr->offset,
+						  conv_src_len * byte_mul,
+						  &as,
+						  &converted_size)) {
 			return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
 					      "Bad character conversion with flags 0x%"PRI_LIBNDR_FLAGS, flags);
 		}
@@ -234,7 +234,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, ndr_flags_type
 			}
 		}
 		if (converted_size > 0 && as[converted_size-1] != '\0') {
-			DEBUG(6,("long string '%s', send without NULL termination (which was expected)\n", as));
+			DEBUG(6,("long string '%s', sent without NULL termination (which was expected)\n", as));
 		}
 	}
 
@@ -255,7 +255,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, ndr_flags_type
 	int do_convert = 1, chset = CH_UTF16;
 	libndr_flags flags = ndr->flags;
 	unsigned byte_mul = 2;
-	uint8_t *dest = NULL;
+	const uint8_t *dest = NULL;
+	uint8_t *dest_to_free = NULL;
+	static const uint8_t null_byte[] = {0};
+	enum ndr_err_code ndr_err = NDR_ERR_SUCCESS;
 
 	if (!(ndr_flags & NDR_SCALARS)) {
 		return NDR_ERR_SUCCESS;
@@ -306,23 +309,21 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, ndr_flags_type
 
 	if (s_len == 0) {
 		d_len = 0;
-		dest = (uint8_t *)talloc_strdup(ndr, "");
-		if (dest == NULL) {
-			return ndr_push_error(ndr, NDR_ERR_ALLOC,
-					      "Failed to talloc_strdup() in ndr_string_push()");
-		}
+		dest = null_byte;
 	} else if (!do_convert) {
 		d_len = s_len;
-		dest = (uint8_t *)talloc_strndup(ndr, s, s_len);
-		if (dest == NULL) {
-			return ndr_push_error(ndr, NDR_ERR_ALLOC,
-					      "Failed to talloc_strndup() in ndr_string_push()");
+		dest = (const uint8_t *)s;
+	} else {
+		bool ok;
+
+		ok = convert_string_talloc(ndr, CH_UNIX, chset, s, s_len,
+					   &dest_to_free, &d_len);
+		if (!ok) {
+			return ndr_push_error(ndr, NDR_ERR_CHARCNV,
+					      "Bad character push conversion with flags 0x%"PRI_LIBNDR_FLAGS, flags);
 		}
-	} else if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len,
-					  &dest, &d_len))
-	{
-		return ndr_push_error(ndr, NDR_ERR_CHARCNV,
-				      "Bad character push conversion with flags 0x%"PRI_LIBNDR_FLAGS, flags);
+
+		dest = dest_to_free;
 	}
 
 	if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
@@ -338,48 +339,88 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, ndr_flags_type
 	switch (flags & LIBNDR_STRING_FLAGS) {
 	case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
 	case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
-		NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, c_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, 0);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, c_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_bytes(ndr, dest, d_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
 		break;
 
 	case LIBNDR_FLAG_STR_LEN4:
 	case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM:
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
-		NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, 0);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, c_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_bytes(ndr, dest, d_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
 		break;
 
 	case LIBNDR_FLAG_STR_SIZE4:
 	case LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
-		NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+		ndr_err = ndr_push_uint32(ndr, NDR_SCALARS, c_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_bytes(ndr, dest, d_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
 		break;
 
 	case LIBNDR_FLAG_STR_SIZE2:
 	case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM:
-		NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, c_len));
-		NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+		ndr_err = ndr_push_uint16(ndr, NDR_SCALARS, c_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
+		ndr_err = ndr_push_bytes(ndr, dest, d_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
 		break;
 
 	case LIBNDR_FLAG_STR_NULLTERM:
-		NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+		ndr_err = ndr_push_bytes(ndr, dest, d_len);
+		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			goto out;
+		}
 		break;
 
 	default:
 		if (ndr->flags & LIBNDR_FLAG_REMAINING) {
-			NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
+			ndr_err = ndr_push_bytes(ndr, dest, d_len);
+			if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+				goto out;
+			}
 			break;
 		}
 
-		return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRI_LIBNDR_FLAGS"\n",
-				      ndr->flags & LIBNDR_STRING_FLAGS);
+		ndr_err = ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRI_LIBNDR_FLAGS"\n",
+					 ndr->flags & LIBNDR_STRING_FLAGS);
+		goto out;
 	}
 
-	talloc_free(dest);
-
-	return NDR_ERR_SUCCESS;
+out:
+	talloc_free(dest_to_free);
+	return ndr_err;
 }
 
 /**
@@ -753,11 +794,11 @@ _PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uin
 	NDR_PULL_NEED_BYTES(ndr, element_size);
 
 	for (i = 0; i < element_size; i++) {
-		 if (ndr->data[ndr->offset+i] != 0) {
+		if (ndr->data[ndr->offset+i] != 0) {
 			ndr->offset = save_offset;
 
 			return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String terminator not present or outside string boundaries");
-		 }
+		}
 	}
 
 	ndr->offset = save_offset;
@@ -865,10 +906,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, ndr_flags_type
 		}
 
 		if (!convert_string(CH_UNIX, chset,
-			     var, strlen(var),
-			     ndr->data+ndr->offset, required, &size)) {
+				    var, strlen(var),
+				    ndr->data+ndr->offset, required, &size)) {
 			return ndr_push_error(ndr, NDR_ERR_CHARCNV,
-				      "Bad character conversion");
+					      "Bad character conversion");
 		}
 
 		/* Make sure the remaining part of the string is filled with zeroes */
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 48fc2cb20c8..1f95cdfd739 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -198,7 +198,7 @@ sub GetElementLevelTable($$$)
 				$length = $size;
 			}
 
-			if ($e == $e->{PARENT}->{ELEMENTS}[-1] 
+			if ($e == $e->{PARENT}->{ELEMENTS}[-1]
 				and $e->{PARENT}->{TYPE} ne "FUNCTION") {
 				$is_surrounding = 1;
 			}
@@ -257,7 +257,7 @@ sub GetElementLevelTable($$$)
 			$pt = $pointer_default;
 		}
 
-		push (@$order, { 
+		push (@$order, {
 			TYPE => "POINTER",
 			POINTER_TYPE => $pt,
 			POINTER_INDEX => $pointer_idx,
@@ -265,13 +265,13 @@ sub GetElementLevelTable($$$)
 			LEVEL => $level
 		});
 
-		warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer") 
+		warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
 			if ($i == 1 and $pt ne "ref" and
-				$e->{PARENT}->{TYPE} eq "FUNCTION" and 
+				$e->{PARENT}->{TYPE} eq "FUNCTION" and
 				not has_property($e, "in"));
 
 		$pointer_idx++;
-		
+
 		# everything that follows will be deferred
 		$is_deferred = 1 if ($level ne "TOP");
 
@@ -288,9 +288,9 @@ sub GetElementLevelTable($$$)
 				$array_length = $array_size;
 				$is_varying =0;
 			}
-		} 
-		
-		if (scalar(@size_is) == 0 and has_property($e, "string") and 
+		}
+
+		if (scalar(@size_is) == 0 and has_property($e, "string") and
 		    $i == $e->{POINTERS}) {
 			$is_string = 1;
 			$is_varying = $is_conformant = has_property($e, "noheader")?0:1;
@@ -312,7 +312,7 @@ sub GetElementLevelTable($$$)
 			});
 
 			$is_deferred = 0;
-		} 
+		}
 	}
 
 	if ($is_pipe) {
@@ -331,10 +331,10 @@ sub GetElementLevelTable($$$)
 	if (defined(has_property($e, "subcontext"))) {
 		my $hdr_size = has_property($e, "subcontext");
 		my $subsize = has_property($e, "subcontext_size");
-		if (not defined($subsize)) { 
-			$subsize = -1; 
+		if (not defined($subsize)) {
+			$subsize = -1;
 		}
-		
+
 		push (@$order, {
 			TYPE => "SUBCONTEXT",
 			HEADER_SIZE => $hdr_size,
@@ -346,7 +346,7 @@ sub GetElementLevelTable($$$)
 
 	if (my $switch = has_property($e, "switch_is")) {
 		push (@$order, {
-			TYPE => "SWITCH", 
+			TYPE => "SWITCH",
 			SWITCH_IS => $switch,
 			IS_DEFERRED => $is_deferred
 		});
@@ -395,7 +395,7 @@ sub GetTypedefLevelTable($$$$)
 }
 
 #####################################################################
-# see if a type contains any deferred data 
+# see if a type contains any deferred data
 sub can_contain_deferred
 {
 	sub can_contain_deferred;
@@ -438,7 +438,7 @@ sub pointer_type($)
 	my $e = shift;
 
 	return undef unless $e->{POINTERS};
-	
+
 	return "ref" if (has_property($e, "ref"));
 	return "full" if (has_property($e, "ptr"));
 	return "sptr" if (has_property($e, "sptr"));
@@ -464,7 +464,7 @@ sub find_largest_alignment
 			# the NDR layer translates this into
 			# an alignment of 4 for NDR and 8 for NDR64
 			$a = 5;
-		} elsif (has_property($e, "subcontext")) { 
+		} elsif (has_property($e, "subcontext")) {
 			$a = 1;
 		} elsif (has_property($e, "transmit_as")) {
 			$a = align_type($e->{PROPERTIES}->{transmit_as},
@@ -497,7 +497,7 @@ sub align_type
 	return 0 if ($e eq "EMPTY");
 
 	unless (hasType($e)) {
-	    # it must be an external type - all we can do is guess 
+	    # it must be an external type - all we can do is guess
 		# warning($e, "assuming alignment of unknown type '$e' is 4");
 	    return 4;
 	}
@@ -592,10 +592,10 @@ sub ParseStruct($$$)
 
 	CheckPointerTypes($struct, $pointer_default);
 
-	foreach my $x (@{$struct->{ELEMENTS}}) 
+	foreach my $x (@{$struct->{ELEMENTS}})
 	{
 		my $e = ParseElement($x, $pointer_default, $ms_union);
-		if ($x != $struct->{ELEMENTS}[-1] and 
+		if ($x != $struct->{ELEMENTS}[-1] and
 			$e->{LEVELS}[0]->{IS_SURROUNDING}) {
 			fatal($x, "conformant member not at end of struct");
 		}
@@ -617,7 +617,7 @@ sub ParseStruct($$$)
 	if ($struct->{NAME}) {
 		$align = align_type($struct->{NAME});
 	}
-		
+
 	return {
 		TYPE => "STRUCT",
 		NAME => $struct->{NAME},
@@ -654,7 +654,7 @@ sub ParseUnion($$)
 
 	CheckPointerTypes($e, $pointer_default);
 
-	foreach my $x (@{$e->{ELEMENTS}}) 
+	foreach my $x (@{$e->{ELEMENTS}})
 	{
 		my $t;
 		if ($x->{TYPE} eq "EMPTY") {
@@ -846,7 +846,7 @@ sub ParseFunction($$$$)
 	if ($d->{RETURN_TYPE} ne "void") {
 		$rettype = expandAlias($d->{RETURN_TYPE});
 	}
-	
+
 	return {
 			NAME => $d->{NAME},
 			TYPE => "FUNCTION",
@@ -938,7 +938,7 @@ sub ParseInterface($)
 
 	$version = "0.0";
 
-	if(defined $idl->{PROPERTIES}->{version}) { 
+	if(defined $idl->{PROPERTIES}->{version}) {
 		my @if_version = split(/\./, $idl->{PROPERTIES}->{version});
 		if ($if_version[0] == $idl->{PROPERTIES}->{version}) {
 				$version = $idl->{PROPERTIES}->{version};
@@ -954,7 +954,7 @@ sub ParseInterface($)
 		@endpoints = split /,/, $idl->{PROPERTIES}->{endpoint};
 	}
 
-	return { 
+	return {
 		NAME => $idl->{NAME},
 		UUID => lc(has_property($idl, "uuid") // ''),
 		VERSION => $version,
@@ -978,7 +978,7 @@ sub Parse($)
 	return undef unless (defined($idl));
 
 	Parse::Pidl::NDR::Validate($idl);
-	
+
 	my @ndr = ();
 
 	foreach (@{$idl}) {
@@ -1050,10 +1050,10 @@ sub ContainsDeferred($$)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list