[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Apr 13 07:45:02 MDT 2015


The branch, master has been updated
       via  2a6e170 witness: add WITNESS_UNSPECIFIED_VERSION to IDL.
       via  11586f1 s4-torture: skip witness_AsyncNotify test for now.
       via  fbd1c24 s4-torture: add witness torture rpc testsuite.
       via  737fc04 srvsvc: add cluster specific share types to IDL.
       via  19cc0d7 s4-torture: add witness torture ndr testsuite.
       via  1307401 librpc: further fixes for witness.idl.
      from  0c6c081 s4:torture/winbind: add torture:winbindd_domain_without_prefix option

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


- Log -----------------------------------------------------------------
commit 2a6e170096e5b86918fa4f150e511e8dd08a63ec
Author: Günther Deschner <gd at samba.org>
Date:   Mon Apr 13 13:05:59 2015 +0200

    witness: add WITNESS_UNSPECIFIED_VERSION to IDL.
    
    This version is seen in witness_GetInterfaceList replies from Windows Server
    2012 R2.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Mon Apr 13 15:44:42 CEST 2015 on sn-devel-104

commit 11586f16479cd728fe4d84020a05939ab33dae73
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 2 13:19:59 2015 +0200

    s4-torture: skip witness_AsyncNotify test for now.
    
    We need to use real async calls in this test and add some clusapi commands so we
    can remotely modify the cluster to actually trigger notifications.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit fbd1c2450685c8ac690d833e02d503c97bd9b40e
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jan 16 13:49:46 2015 +0100

    s4-torture: add witness torture rpc testsuite.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 737fc0410e6079060766ab2f6937d8b2ee5a7998
Author: Günther Deschner <gd at samba.org>
Date:   Mon Feb 23 15:34:35 2015 +0100

    srvsvc: add cluster specific share types to IDL.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 19cc0d70cb2f36b0659021a05194eb500afa7dcb
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jan 16 13:43:01 2015 +0100

    s4-torture: add witness torture ndr testsuite.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 130740100b2473448b3f530d1a0c463d7bbfa236
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Feb 4 15:43:39 2014 +0100

    librpc: further fixes for witness.idl.
    
    Signed-off-by: Gregor Beck <gbeck at sernet.de>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 librpc/idl/srvsvc.idl           |  11 +-
 librpc/idl/witness.idl          |  62 ++++-
 selftest/skip                   |   1 +
 source3/rpcclient/cmd_witness.c |  10 +-
 source4/torture/ndr/ndr.c       |   1 +
 source4/torture/ndr/witness.c   | 316 ++++++++++++++++++++++
 source4/torture/rpc/rpc.c       |   1 +
 source4/torture/rpc/witness.c   | 579 ++++++++++++++++++++++++++++++++++++++++
 source4/torture/wscript_build   |   6 +-
 9 files changed, 968 insertions(+), 19 deletions(-)
 create mode 100644 source4/torture/ndr/witness.c
 create mode 100644 source4/torture/rpc/witness.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl
index 96f85e6..db804e5 100644
--- a/librpc/idl/srvsvc.idl
+++ b/librpc/idl/srvsvc.idl
@@ -414,7 +414,16 @@ import "misc.idl", "security.idl", "svcctl.idl";
 		STYPE_DEVICE_HIDDEN    = STYPE_DEVICE|STYPE_HIDDEN,
 		STYPE_IPC      = 3,	/* Interprocess communication (IPC) */
 		STYPE_IPC_TEMPORARY = STYPE_IPC|STYPE_TEMPORARY,
-		STYPE_IPC_HIDDEN    = STYPE_IPC|STYPE_HIDDEN
+		STYPE_IPC_HIDDEN    = STYPE_IPC|STYPE_HIDDEN,
+		STYPE_CLUSTER_FS		= 0x02000000,	/* A cluster share */
+		STYPE_CLUSTER_FS_TEMPORARY	= STYPE_CLUSTER_FS|STYPE_TEMPORARY,
+		STYPE_CLUSTER_FS_HIDDEN		= STYPE_CLUSTER_FS|STYPE_HIDDEN,
+		STYPE_CLUSTER_SOFS		= 0x04000000,	/* A Scale-Out cluster share */
+		STYPE_CLUSTER_SOFS_TEMPORARY	= STYPE_CLUSTER_SOFS|STYPE_TEMPORARY,
+		STYPE_CLUSTER_SOFS_HIDDEN	= STYPE_CLUSTER_SOFS|STYPE_HIDDEN,
+		STYPE_CLUSTER_DFS		= 0x08000000,	/* A DFS share in a cluster */
+		STYPE_CLUSTER_DFS_TEMPORARY	= STYPE_CLUSTER_DFS|STYPE_TEMPORARY,
+		STYPE_CLUSTER_DFS_HIDDEN	= STYPE_CLUSTER_DFS|STYPE_HIDDEN
 	} srvsvc_ShareType;
 
 	typedef struct {
diff --git a/librpc/idl/witness.idl b/librpc/idl/witness.idl
index cf60536..8f5f9bf 100644
--- a/librpc/idl/witness.idl
+++ b/librpc/idl/witness.idl
@@ -13,7 +13,8 @@ interface witness
 {
 	typedef [v1_enum] enum {
 		WITNESS_V1 = 0x00010001,
-		WITNESS_V2 = 0x00020000
+		WITNESS_V2 = 0x00020000,
+		WITNESS_UNSPECIFIED_VERSION = 0xFFFFFFFF
 	} witness_version;
 
 	/*****************/
@@ -45,14 +46,14 @@ interface witness
 		[size_is(num_interfaces)] witness_interfaceInfo *interfaces;
 	} witness_interfaceList;
 
-	WERROR witness_GetInterfaceList(
+	[public] WERROR witness_GetInterfaceList(
 		[out] witness_interfaceList **interface_list
 		);
 
 	/*****************/
 	/* Function 0x01 */
 
-	WERROR witness_Register(
+	[public] WERROR witness_Register(
 		[out,ref] policy_handle *context_handle,
 		[in] witness_version version,
 		[in,unique,string,charset(UTF16)] uint16 *net_name,
@@ -63,7 +64,7 @@ interface witness
 	/*****************/
 	/* Function 0x02 */
 
-	WERROR witness_UnRegister(
+	[public] WERROR witness_UnRegister(
 		[in] policy_handle context_handle
 		);
 
@@ -77,14 +78,55 @@ interface witness
 		WITNESS_NOTIFY_IP_CHANGE       = 4
 	} witness_notifyResponse_type;
 
-	typedef struct {
-		witness_notifyResponse_type message_type;
-		uint32 length;
-		uint32 num_messages;
-		[size_is(length)] uint8 *message_buffer;
+	typedef [v1_enum] enum {
+		WITNESS_RESOURCE_STATE_UNKNOWN     = 0x00,
+		WITNESS_RESOURCE_STATE_AVAILABLE   = 0x01,
+		WITNESS_RESOURCE_STATE_UNAVAILABLE = 0xff
+	} witness_ResourceChange_type;
+
+	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize,public] struct {
+		[value(ndr_size_witness_ResourceChange(r,ndr->flags))] uint32 length;
+		witness_ResourceChange_type type;
+		nstring name;
+	} witness_ResourceChange;
+
+	typedef [bitmap32bit] bitmap {
+		WITNESS_IPADDR_V4      = 0x01,
+		WITNESS_IPADDR_V6      = 0x02,
+		WITNESS_IPADDR_ONLINE  = 0x08,
+		WITNESS_IPADDR_OFFLINE = 0x10
+	} witness_IPaddrInfo_flags;
+
+	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
+		witness_IPaddrInfo_flags flags;
+		ipv4address ipv4;
+		ipv6address ipv6;
+	} witness_IPaddrInfo;
+
+	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
+		[value(r->num*ndr_size_witness_IPaddrInfo(r->addr, ndr->flags))] uint32 length;
+		[value(0)] uint32 reserved;
+		uint32 num;
+		witness_IPaddrInfo addr[num];
+	} witness_IPaddrInfoList;
+
+	typedef [public,switch_type(witness_notifyResponse_type),nodiscriminant, flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] union {
+		[case(WITNESS_NOTIFY_RESOURCE_CHANGE)] witness_ResourceChange resource_change;
+		[case(WITNESS_NOTIFY_CLIENT_MOVE)]     witness_IPaddrInfoList client_move;
+		[case(WITNESS_NOTIFY_SHARE_MOVE)]      witness_IPaddrInfoList share_move;
+		[case(WITNESS_NOTIFY_IP_CHANGE)]       witness_IPaddrInfoList ip_change;
+	} witness_notifyResponse_message;
+
+	typedef [flag(NDR_PAHEX)] struct {
+		witness_notifyResponse_type type;
+		[value(messages->length)] uint32 length;
+		uint32 num;
+		/* [switch_is(type), size_is(num)] witness_notifyResponse_message *messages; */
+		/* [size_is(length)] uint8 *messages; */
+		[subcontext(4), subcontext_size(length), flag(NDR_REMAINING)] DATA_BLOB *messages;
 	} witness_notifyResponse;
 
-	WERROR witness_AsyncNotify(
+	[public] WERROR witness_AsyncNotify(
 		[in] policy_handle context_handle,
 		[out] witness_notifyResponse **response
 		);
diff --git a/selftest/skip b/selftest/skip
index a66fffb..7790594 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -84,6 +84,7 @@
 ^samba4.rpc.frsapi							# Not provided by Samba 4
 ^samba4.rpc.ntsvcs							# Not provided by Samba 4
 ^samba4.rpc.dfs								# Not provided by Samba 4
+^samba4.rpc.witness							# Not provided by Samba 4
 ^samba4.rpc.clusapi							# clusapi server support not yet provided
 ^samba4.*.base.samba3.*						# Samba3-specific test
 ^samba4.*.raw.samba3.*						# Samba3-specific test
diff --git a/source3/rpcclient/cmd_witness.c b/source3/rpcclient/cmd_witness.c
index 1812449..315fa50 100644
--- a/source3/rpcclient/cmd_witness.c
+++ b/source3/rpcclient/cmd_witness.c
@@ -453,7 +453,7 @@ static WERROR cmd_witness_AsyncNotify(struct rpc_pipe_client *cli,
 		goto done;
 	}
 
-	switch(response->message_type) {
+	switch(response->type) {
 	case WITNESS_NOTIFY_RESOURCE_CHANGE:
 		d_printf("Resource change");
 		read_response = AsyncNotify_Change;
@@ -471,15 +471,15 @@ static WERROR cmd_witness_AsyncNotify(struct rpc_pipe_client *cli,
 		read_response = AsyncNotify_Move;
 		break;
 	default:
-		d_printf("Unknown (0x%x)", (int)response->message_type);
+		d_printf("Unknown (0x%x)", (int)response->type);
 	}
-	d_printf(" with %d messages\n", response->num_messages);
+	d_printf(" with %d messages\n", response->num);
 
 	if (read_response) {
 		unsigned n;
-		const uint8_t *pos = response->message_buffer;
+		const uint8_t *pos = response->messages->data;
 
-		for (n=0; n<response->num_messages; n++) {
+		for (n=0; n<response->num; n++) {
 			read_response(frame, &pos);
 		}
 	}
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 1b0f968..3ca7476 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -399,6 +399,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
 	torture_suite_add_suite(suite, ndr_nbt_suite(suite));
 	torture_suite_add_suite(suite, ndr_ntlmssp_suite(suite));
 	torture_suite_add_suite(suite, ndr_backupkey_suite(suite));
+	torture_suite_add_suite(suite, ndr_witness_suite(suite));
 	torture_suite_add_suite(suite, ndr_string_suite(suite));
 
 	torture_suite_add_simple_test(suite, "string terminator",
diff --git a/source4/torture/ndr/witness.c b/source4/torture/ndr/witness.c
new file mode 100644
index 0000000..fa96e01
--- /dev/null
+++ b/source4/torture/ndr/witness.c
@@ -0,0 +1,316 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for witness ndr operations
+
+   Copyright (C) Guenther Deschner 2015
+
+   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 "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_witness.h"
+#include "torture/ndr/proto.h"
+#include "param/param.h"
+
+static const uint8_t witness_GetInterfaceList_data[] = {
+	0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x44, 0x00, 0x45, 0x00,
+	0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x2c, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x05, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x44, 0x00, 0x45, 0x00,
+	0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x2d, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool witness_GetInterfaceList_check(struct torture_context *tctx,
+					   struct witness_GetInterfaceList *r)
+{
+	struct witness_interfaceList *l;
+
+	torture_assert(tctx, r->out.interface_list, "r->out.interface_list");
+
+	l = *(r->out.interface_list);
+
+	torture_assert_int_equal(tctx, l->num_interfaces, 2, "l->num_interfaces");
+	torture_assert(tctx, l->interfaces, "l->interfaces");
+
+	torture_assert_str_equal(tctx, l->interfaces[0].group_name, "NODE2", "l->interfaces[0].group_name");
+	torture_assert_int_equal(tctx, l->interfaces[0].version, -1, "l->interfaces[0].version");
+	torture_assert_int_equal(tctx, l->interfaces[0].state, 1, "l->interfaces[0].state");
+	torture_assert_str_equal(tctx, l->interfaces[0].ipv4, "192.168.3.44", "l->interfaces[0].state");
+	torture_assert_int_equal(tctx, l->interfaces[0].flags, 5, "l->interfaces[0].flags");
+
+	torture_assert_str_equal(tctx, l->interfaces[1].group_name, "NODE1", "l->interfaces[0].group_name");
+	torture_assert_int_equal(tctx, l->interfaces[1].version, -1, "l->interfaces[0].version");
+	torture_assert_int_equal(tctx, l->interfaces[1].state, 1, "l->interfaces[0].state");
+	torture_assert_str_equal(tctx, l->interfaces[1].ipv4, "192.168.3.45", "l->interfaces[0].state");
+	torture_assert_int_equal(tctx, l->interfaces[1].flags, 1, "l->interfaces[0].flags");
+	torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
+
+	return true;
+}
+
+static const uint8_t witness_Register_data_IN[] = {
+	0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x73, 0x00, 0x6f, 0x00,
+	0x66, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
+	0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x39, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x38, 0x00, 0x2e, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x35, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x54, 0x00,
+	0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x41, 0x00,
+	0x00, 0x00
+};
+
+static bool witness_Register_check_IN(struct torture_context *tctx,
+				      struct witness_Register *r)
+{
+	torture_assert_int_equal(tctx, r->in.version, 65537, "r->in.version");
+	torture_assert_str_equal(tctx, r->in.net_name, "sofs", "r->in.net_name");
+	torture_assert_str_equal(tctx, r->in.ip_address, "192.168.3.45", "r->in.ip_address");
+	torture_assert_str_equal(tctx, r->in.client_computer_name, "MTHELENA", "r->in.client_computer_name");
+
+	return true;
+}
+
+static const uint8_t witness_Register_data_OUT[] = {
+	0x00, 0x00, 0x00, 0x00, 0x33, 0x86, 0xb8, 0x3a, 0x57, 0x1e, 0x1a, 0x4c,
+	0x85, 0x6c, 0xd1, 0xbc, 0x4b, 0x15, 0xbb, 0xb1, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool witness_Register_check_OUT(struct torture_context *tctx,
+				       struct witness_Register *r)
+{
+	struct GUID guid;
+
+	torture_assert(tctx, r->out.context_handle, "r->out.context_handle");
+	torture_assert_int_equal(tctx, r->out.context_handle->handle_type, 0, "r->out.context_handle->handle_type");
+	torture_assert_ntstatus_ok(tctx, GUID_from_string("3ab88633-1e57-4c1a-856c-d1bc4b15bbb1", &guid), "");
+	torture_assert_mem_equal(tctx, &r->out.context_handle->uuid, &guid, sizeof(guid), "r->out.context_handle->uuid");
+	torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
+
+	return true;
+}
+
+static const uint8_t witness_UnRegister_data_IN[] = {
+	0x00, 0x00, 0x00, 0x00, 0x33, 0x86, 0xb8, 0x3a, 0x57, 0x1e, 0x1a, 0x4c,
+	0x85, 0x6c, 0xd1, 0xbc, 0x4b, 0x15, 0xbb, 0xb1
+};
+
+static bool witness_UnRegister_check_IN(struct torture_context *tctx,
+					struct witness_UnRegister *r)
+{
+	struct GUID guid;
+
+	torture_assert_int_equal(tctx, r->in.context_handle.handle_type, 0, "r->in.context_handle.handle_type");
+	torture_assert_ntstatus_ok(tctx, GUID_from_string("3ab88633-1e57-4c1a-856c-d1bc4b15bbb1", &guid), "");
+	torture_assert_mem_equal(tctx, &r->in.context_handle.uuid, &guid, sizeof(guid), "r->in.context_handle.uuid");
+
+	return true;
+}
+
+static const uint8_t witness_UnRegister_data_OUT[] = {
+	0x00, 0x00, 0x00, 0x00
+};
+
+static bool witness_UnRegister_check_OUT(struct torture_context *tctx,
+					 struct witness_UnRegister *r)
+{
+	torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
+
+	return true;
+}
+
+static const uint8_t witness_AsyncNotify_data_IN[] = {
+	0x00, 0x00, 0x00, 0x00, 0xee, 0xf2, 0xb9, 0x1f, 0x4d, 0x2a, 0xf8, 0x4b,
+	0xaf, 0x8b, 0xcb, 0x9d, 0x45, 0x29, 0xa9, 0xab
+};
+
+static bool witness_AsyncNotify_check_IN(struct torture_context *tctx,
+					 struct witness_AsyncNotify *r)
+{
+	struct GUID guid;
+
+	torture_assert_int_equal(tctx, r->in.context_handle.handle_type, 0, "r->in.context_handle.handle_type");
+	torture_assert_ntstatus_ok(tctx, GUID_from_string("1fb9f2ee-2a4d-4bf8-af8b-cb9d4529a9ab", &guid), "");
+	torture_assert_mem_equal(tctx, &r->in.context_handle.uuid, &guid, sizeof(guid), "r->in.context_handle.uuid");
+
+	return true;
+}
+
+static const uint8_t witness_AsyncNotify_data_OUT[] = {
+	0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x12, 0x00, 0x00, 0x00,
+	0x12, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x53, 0x00, 0x4f, 0x00,
+	0x46, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static bool witness_AsyncNotify_check_OUT(struct torture_context *tctx,
+					  struct witness_AsyncNotify *r)
+{
+	struct witness_notifyResponse *n;
+
+	torture_assert(tctx, r->out.response, "r->out.response");
+
+	n = *(r->out.response);
+
+	torture_assert_int_equal(tctx, n->type, WITNESS_NOTIFY_RESOURCE_CHANGE, "type");
+	torture_assert_int_equal(tctx, n->length, 18, "length");
+	torture_assert_int_equal(tctx, n->num, 1, "num");
+#if 0
+                        messages                 : *
+                            messages                 : DATA_BLOB length=18
+[0000] 12 00 00 00 FF 00 00 00   53 00 4F 00 46 00 53 00   ........ S.O.F.S.
+[0010] 00 00
+#endif
+	return true;
+}
+
+struct torture_suite *ndr_witness_suite(TALLOC_CTX *ctx)
+{
+	struct torture_suite *suite = torture_suite_create(ctx, "witness");
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_GetInterfaceList,
+					   witness_GetInterfaceList_data,
+					   NDR_OUT,
+					   witness_GetInterfaceList_check);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_Register,
+					   witness_Register_data_IN,
+					   NDR_IN,
+					   witness_Register_check_IN);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_Register,
+					   witness_Register_data_OUT,
+					   NDR_OUT,
+					   witness_Register_check_OUT);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_UnRegister,
+					   witness_UnRegister_data_IN,
+					   NDR_IN,
+					   witness_UnRegister_check_IN);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_UnRegister,
+					   witness_UnRegister_data_OUT,
+					   NDR_OUT,
+					   witness_UnRegister_check_OUT);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_AsyncNotify,
+					   witness_AsyncNotify_data_IN,
+					   NDR_IN,
+					   witness_AsyncNotify_check_IN);
+
+	torture_suite_add_ndr_pull_fn_test(suite,
+					   witness_AsyncNotify,
+					   witness_AsyncNotify_data_OUT,
+					   NDR_OUT,
+					   witness_AsyncNotify_check_OUT);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list