[PATCH] Some fixes for Solaris CC

Jeremy Allison jra at samba.org
Fri Feb 1 11:58:34 UTC 2019


On Wed, Jan 30, 2019 at 08:52:39PM +0100, Volker Lendecke via samba-technical wrote:
> Hi!
> 
> Review appreciated!

LGTM. RB+ and pushed !

Jeremy.

> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: 0551-370000-0, mailto:kontakt at sernet.de
> Gesch.F.: Dr. Johannes Loxen und Reinhild Jung
> AG Göttingen: HR-B 2816 - http://www.sernet.de

> From 45f80d318ee765eeeab45a7f771c9d2ddbb89428 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Thu, 24 Jan 2019 10:37:21 +0100
> Subject: [PATCH 1/3] librpc: Solaris cc does not like unnamed struct members
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  librpc/ndr/ndr_compression.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/librpc/ndr/ndr_compression.c b/librpc/ndr/ndr_compression.c
> index f06a076a71f..c4a13a2f3ba 100644
> --- a/librpc/ndr/ndr_compression.c
> +++ b/librpc/ndr/ndr_compression.c
> @@ -34,7 +34,7 @@ struct ndr_compression_state {
>  			uint8_t *dict;
>  			size_t dict_size;
>  		} mszip;
> -	};
> +	} alg;
>  };
>  
>  static voidpf ndr_zlib_alloc(voidpf opaque, uInt items, uInt size)
> @@ -59,7 +59,7 @@ static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *n
>  	DATA_BLOB plain_chunk;
>  	uint32_t plain_chunk_offset;
>  	uint32_t plain_chunk_size;
> -	z_stream *z = state->mszip.z;
> +	z_stream *z = state->alg.mszip.z;
>  	int z_ret;
>  
>  	plain_chunk_size = decompressed_len;
> @@ -125,8 +125,8 @@ static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *n
>  	 * uncompressed output as dictionnary.
>  	 */
>  
> -	if (state->mszip.dict_size) {
> -		z_ret = inflateSetDictionary(z, state->mszip.dict, state->mszip.dict_size);
> +	if (state->alg.mszip.dict_size) {
> +		z_ret = inflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
>  		if (z_ret != Z_OK) {
>  			return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
>  					      "zlib inflateSetDictionary error %s (%d) %s (PULL)",
> @@ -164,8 +164,8 @@ static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *n
>  	 * we can just store that instead of copying the memory over
>  	 * the dict temp buffer.
>  	 */
> -	state->mszip.dict = plain_chunk.data;
> -	state->mszip.dict_size = plain_chunk.length;
> +	state->alg.mszip.dict = plain_chunk.data;
> +	state->alg.mszip.dict_size = plain_chunk.length;
>  
>  	z_ret = inflateReset(z);
>  	if (z_ret != Z_OK) {
> @@ -217,7 +217,7 @@ static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *n
>  	comp_chunk.data[0] = 'C';
>  	comp_chunk.data[1] = 'K';
>  
> -	z = state->mszip.z;
> +	z = state->alg.mszip.z;
>  	z->next_in	= plain_chunk.data;
>  	z->avail_in	= plain_chunk.length;
>  	z->total_in	= 0;
> @@ -234,8 +234,8 @@ static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *n
>  	 * same CFFOLDER as a dictionnary for the compression.
>  	 */
>  
> -	if (state->mszip.dict_size) {
> -		z_ret = deflateSetDictionary(z, state->mszip.dict, state->mszip.dict_size);
> +	if (state->alg.mszip.dict_size) {
> +		z_ret = deflateSetDictionary(z, state->alg.mszip.dict, state->alg.mszip.dict_size);
>  		if (z_ret != Z_OK) {
>  			return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
>  					      "zlib deflateSetDictionary error %s (%d) %s (PUSH)",
> @@ -274,7 +274,7 @@ static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *n
>  				      zError(z_ret), z_ret, z->msg);
>  	}
>  
> -	if (plain_chunk.length > talloc_array_length(state->mszip.dict)) {
> +	if (plain_chunk.length > talloc_array_length(state->alg.mszip.dict)) {
>  		return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
>  				      "zlib dict buffer is too big (PUSH)");
>  	}
> @@ -289,8 +289,8 @@ static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *n
>  	 * still going to been valid for the lifetime of the
>  	 * compressions state object.
>  	 */
> -	memcpy(state->mszip.dict, plain_chunk.data, plain_chunk.length);
> -	state->mszip.dict_size = plain_chunk.length;
> +	memcpy(state->alg.mszip.dict, plain_chunk.data, plain_chunk.length);
> +	state->alg.mszip.dict_size = plain_chunk.length;
>  
>  	DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
>  		 (unsigned int)plain_chunk.length,
> @@ -805,11 +805,11 @@ static enum ndr_err_code generic_mszip_init(TALLOC_CTX *mem_ctx,
>  	z->zfree  = ndr_zlib_free;
>  	z->opaque = mem_ctx;
>  
> -	state->mszip.z = z;
> -	state->mszip.dict_size = 0;
> +	state->alg.mszip.z = z;
> +	state->alg.mszip.dict_size = 0;
>  	/* pre-alloc dictionnary */
> -	state->mszip.dict = talloc_array(mem_ctx, uint8_t, 0x8000);
> -	NDR_ERR_HAVE_NO_MEMORY(state->mszip.dict);
> +	state->alg.mszip.dict = talloc_array(mem_ctx, uint8_t, 0x8000);
> +	NDR_ERR_HAVE_NO_MEMORY(state->alg.mszip.dict);
>  
>  	return NDR_ERR_SUCCESS;
>  }
> @@ -820,8 +820,8 @@ static void generic_mszip_free(struct ndr_compression_state *state)
>  		return;
>  	}
>  
> -	TALLOC_FREE(state->mszip.z);
> -	TALLOC_FREE(state->mszip.dict);
> +	TALLOC_FREE(state->alg.mszip.z);
> +	TALLOC_FREE(state->alg.mszip.dict);
>  }
>  
>  
> @@ -842,11 +842,11 @@ enum ndr_err_code ndr_pull_compression_state_init(struct ndr_pull *ndr,
>  		break;
>  	case NDR_COMPRESSION_MSZIP_CAB:
>  		NDR_CHECK(generic_mszip_init(ndr, s));
> -		z_ret = inflateInit2(s->mszip.z, -MAX_WBITS);
> +		z_ret = inflateInit2(s->alg.mszip.z, -MAX_WBITS);
>  		if (z_ret != Z_OK) {
>  			return ndr_pull_error(ndr, NDR_ERR_COMPRESSION,
>  					      "zlib inflateinit2 error %s (%d) %s (PULL)",
> -					      zError(z_ret), z_ret, s->mszip.z->msg);
> +					      zError(z_ret), z_ret, s->alg.mszip.z->msg);
>  		}
>  		break;
>  	default:
> @@ -897,7 +897,7 @@ enum ndr_err_code ndr_push_compression_state_init(struct ndr_push *ndr,
>  		break;
>  	case NDR_COMPRESSION_MSZIP_CAB:
>  		NDR_CHECK(generic_mszip_init(ndr, s));
> -		z_ret = deflateInit2(s->mszip.z,
> +		z_ret = deflateInit2(s->alg.mszip.z,
>  				     Z_DEFAULT_COMPRESSION,
>  				     Z_DEFLATED,
>  				     -MAX_WBITS,
> @@ -906,7 +906,7 @@ enum ndr_err_code ndr_push_compression_state_init(struct ndr_push *ndr,
>  		if (z_ret != Z_OK) {
>  			return ndr_push_error(ndr, NDR_ERR_COMPRESSION,
>  					      "zlib inflateinit2 error %s (%d) %s (PUSH)",
> -					      zError(z_ret), z_ret, s->mszip.z->msg);
> +					      zError(z_ret), z_ret, s->alg.mszip.z->msg);
>  		}
>  		break;
>  	default:
> -- 
> 2.11.0
> 
> 
> From 20ce6db406ab77e5f47947bd6fd8dc9f58ff4062 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Thu, 24 Jan 2019 10:38:41 +0100
> Subject: [PATCH 2/3] libcli: Solaris cc can't return void values
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  libcli/auth/tests/ntlm_check.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libcli/auth/tests/ntlm_check.c b/libcli/auth/tests/ntlm_check.c
> index 65c7b086008..886a1a342f8 100644
> --- a/libcli/auth/tests/ntlm_check.c
> +++ b/libcli/auth/tests/ntlm_check.c
> @@ -180,7 +180,7 @@ static void test_ntlm_allowed(void **state)
>  
>  static void test_ntlm_allowed_lm_supplied(void **state)
>  {
> -	return test_ntlm_allowed(state);
> +	test_ntlm_allowed(state);
>  }
>  
>  static void test_ntlm_disabled(void **state)
> @@ -345,7 +345,7 @@ static void test_ntlmv2_only_ntlm(void **state)
>  
>  static void test_ntlmv2_only_ntlm_and_lanman(void **state)
>  {
> -	return test_ntlmv2_only_ntlm(state);
> +	test_ntlmv2_only_ntlm(state);
>  }
>  
>  static void test_ntlmv2_only_ntlm_once(void **state)
> -- 
> 2.11.0
> 
> 
> From 9d1898b0b533559dfc82cae94b7004947948b368 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Thu, 24 Jan 2019 10:39:38 +0100
> Subject: [PATCH 3/3] torture4: Solaris cc can't deal with empty initializers
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  source4/torture/smb2/delete-on-close.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/source4/torture/smb2/delete-on-close.c b/source4/torture/smb2/delete-on-close.c
> index 12cdb8540b8..441ca96309e 100644
> --- a/source4/torture/smb2/delete-on-close.c
> +++ b/source4/torture/smb2/delete-on-close.c
> @@ -584,9 +584,9 @@ static bool test_doc_read_only(struct torture_context *tctx,
>  			       struct smb2_tree *tree)
>  {
>  	struct smb2_handle dir_handle;
> -	union smb_setfileinfo sfinfo = { };
> -	struct smb2_create create = { };
> -	struct smb2_close close = { };
> +	union smb_setfileinfo sfinfo = {0};
> +	struct smb2_create create = {0};
> +	struct smb2_close close = {0};
>  	NTSTATUS status, expected_status;
>  	bool ret = true, delete_readonly;
>  
> @@ -603,7 +603,7 @@ static bool test_doc_read_only(struct torture_context *tctx,
>  	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
>  					"CREATE directory failed\n");
>  
> -	create = (struct smb2_create) { };
> +	create = (struct smb2_create) {0};
>  	create.in.desired_access = SEC_RIGHTS_DIR_ALL;
>  	create.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
>  		NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
> @@ -628,7 +628,7 @@ static bool test_doc_read_only(struct torture_context *tctx,
>  
>  	torture_comment(tctx, "Creating file with READ_ONLY attribute.\n");
>  
> -	create = (struct smb2_create) { };
> +	create = (struct smb2_create) {0};
>  	create.in.desired_access = SEC_RIGHTS_DIR_ALL;
>  	create.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
>  	create.in.file_attributes = FILE_ATTRIBUTE_READONLY;
> @@ -649,7 +649,7 @@ static bool test_doc_read_only(struct torture_context *tctx,
>  	torture_comment(tctx, "Testing CREATE with DELETE_ON_CLOSE on "
>  			"READ_ONLY attribute file.\n");
>  
> -	create = (struct smb2_create) { };
> +	create = (struct smb2_create) {0};
>  	create.in.desired_access = SEC_RIGHTS_FILE_READ | SEC_STD_DELETE;
>  	create.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
>  	create.in.file_attributes = 0;
> @@ -667,7 +667,7 @@ static bool test_doc_read_only(struct torture_context *tctx,
>  	torture_comment(tctx, "Testing setting DELETE_ON_CLOSE disposition on "
>  			" file with READONLY attribute.\n");
>  
> -	create = (struct smb2_create) { };
> +	create = (struct smb2_create) {0};
>  	create.in.desired_access = SEC_RIGHTS_FILE_READ | SEC_STD_DELETE;;
>  	create.in.create_options = 0;
>  	create.in.file_attributes = 0;
> -- 
> 2.11.0
> 




More information about the samba-technical mailing list