[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Mon Dec 14 03:57:08 MST 2009


The branch, master has been updated
       via  a3b7e84... librpc/ndr: avoid comparison_fn_t to fix the openchange build on solaris
       via  6bc29ec... add ignore for autogenrated files as they are not used by s3
       via  155bdea... torture: add new tests for dfsblobs
       via  8f8613d... idl: introduce new file: dfsblobs.idl
       via  05effef... librpc/ndr: add missing prototypes for relative_short functions
      from  e316624... spoolss: fix spoolss_PrinterData size calculation.

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


- Log -----------------------------------------------------------------
commit a3b7e84a65e3ddc94edc36fd1b4641849b9ee0be
Author: Brian Lu <brian.lu at sun.com>
Date:   Mon Dec 14 11:08:07 2009 +0100

    librpc/ndr: avoid comparison_fn_t to fix the openchange build on solaris
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6bc29eced5ced62b6ab636d6e6072aee9c2e6a3f
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Dec 13 18:44:02 2009 +0300

    add ignore for autogenrated files as they are not used by s3
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 155bdea7b24d70e37ecab9f6cf90ddd993f0dabf
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Dec 13 18:41:53 2009 +0300

    torture: add new tests for dfsblobs
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 8f8613dcef4a7c1af322c2b5154bf2347d356170
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Dec 13 05:03:03 2009 +0300

    idl: introduce new file: dfsblobs.idl
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 05effef1aaeac038b930b29862403a09d5a8db8b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Dec 14 10:52:56 2009 +0100

    librpc/ndr: add missing prototypes for relative_short functions
    
    metze

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

Summary of changes:
 .gitignore                    |    4 ++
 librpc/idl/dfsblobs.idl       |  116 +++++++++++++++++++++++++++++++++++++++++
 librpc/ndr/libndr.h           |    5 ++-
 source4/librpc/config.mk      |    7 ++-
 source4/torture/config.mk     |    2 +-
 source4/torture/ndr/dfsblob.c |   50 ++++++++++++++++++
 source4/torture/ndr/ndr.c     |    1 +
 7 files changed, 182 insertions(+), 3 deletions(-)
 create mode 100644 librpc/idl/dfsblobs.idl
 create mode 100644 source4/torture/ndr/dfsblob.c


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 13dd2d8..e88fad0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,6 +77,10 @@ source3/lib/netapi/examples/Makefile
 source3/lib/netapi/tests/Makefile
 source3/library-versions
 librpc/gen_ndr/cli_krb5pac.*
+librpc/gen_ndr/cli_dfsblobs.*
+librpc/gen_ndr/dfsblobs.h
+librpc/gen_ndr/ndr_dfsblobs.*
+librpc/gen_ndr/srv_dfsblobs.*
 source3/librpc/gen_ndr/cli_libnetapi.c
 source3/librpc/gen_ndr/cli_libnetapi.h
 source3/librpc/gen_ndr/cli_messaging.*
diff --git a/librpc/idl/dfsblobs.idl b/librpc/idl/dfsblobs.idl
new file mode 100644
index 0000000..ffd3e6e
--- /dev/null
+++ b/librpc/idl/dfsblobs.idl
@@ -0,0 +1,116 @@
+#include "idl_types.h"
+
+import "misc.idl";
+/*
+dfs blobs interface definition
+*/
+
+
+[
+	pointer_default(unique),
+	helpstring("dfs referral blobs"),
+	uuid("12345778-1234-abcd-0001-00000003")
+]
+
+
+interface dfsblobs
+{
+	typedef [bitmap32bit] bitmap {
+		DFS_HEADER_FLAG_REFERAL_SVR	= 0x00000001,
+		DFS_HEADER_FLAG_STORAGE_SVR	= 0x00000002,
+		DFS_HEADER_FLAG_TARGET_BCK	= 0x00000004
+	} DFS_HEADER_FLAG;
+
+	typedef [enum16bit] enum {
+		DFS_SERVER_NON_ROOT	= 0x0000,
+		DFS_SERVER_ROOT		= 0x0001
+	} DFS_SERVER_TYPE;
+
+	typedef [enum16bit] enum {
+		DFS_FLAG_REFERRAL_DOMAIN_RESP		= 0x0002,
+		DFS_FLAG_REFERRAL_FIRST_TARGET_SET	= 0x0004
+	} DFS_FLAGS_REFERRAL;
+
+	typedef struct {
+		uint16 size;
+		uint16 server_type;
+		uint16 entry_flags;
+		nstring *share_name;
+	} dfs_referral_v1;
+
+	typedef struct {
+		uint16 size;
+		DFS_SERVER_TYPE server_type;
+		DFS_FLAGS_REFERRAL entry_flags;
+		uint32 proximity;
+		uint32 ttl;
+		[relative_short] nstring *DFS_path;
+		[relative_short] nstring *DFS_alt_path;
+		[relative_short] nstring *netw_address;
+	} dfs_referral_v2;
+
+	typedef struct {
+		[relative_short] nstring *DFS_path;
+		[relative_short] nstring *DFS_alt_path;
+		[relative_short] nstring *netw_address;
+		/* As stated in MS DFSC 2.2.4.3.1 this array was guid but now MUST be 16 null bytes*/
+		uint8	service_site_guid[16];
+	} dfs_normal_referral;
+
+	typedef struct {
+		[relative_short] nstring *special_name;
+		uint16 nb_expanded_names;
+		[relative_short] [flag(STR_NOTERM|NDR_REMAINING)] string_array *expanded_names;
+		/*[relative_short] nstring_array expanded_names2;*/
+		/* As stated in MS DFSC 2.2.4.3.1 this array was guid but now MUST be 16 null bytes*/
+		uint8	service_site_guid[16];
+	} dfs_domain_referral;
+
+	typedef [nodiscriminant] union {
+		[case(0)] dfs_normal_referral r1;
+		[case(2)] dfs_domain_referral r2;
+		[default];
+	} dfs_referral;
+
+	typedef [flag(NDR_NOALIGN)] struct {
+		uint16 size;
+		DFS_SERVER_TYPE server_type;
+		DFS_FLAGS_REFERRAL entry_flags;
+		uint32 ttl;
+		[switch_is(entry_flags & DFS_FLAG_REFERRAL_DOMAIN_RESP)] dfs_referral referrals;
+	} dfs_referral_v3;
+
+	typedef struct {
+		uint16 size;
+		DFS_SERVER_TYPE server_type;
+		DFS_FLAGS_REFERRAL entry_flags;
+		uint32 ttl;
+		dfs_normal_referral referrals;
+	} dfs_referral_v4;
+
+	typedef [nodiscriminant] union {
+		[case(1)] dfs_referral_v1 v1;
+		[case(2)] dfs_referral_v2 v2;
+		[case(3)] dfs_referral_v3 v3;
+		[case(4)] dfs_referral_v4 v4;
+		[default];
+	} dfs_referral_version;
+
+	typedef [flag(NDR_NOALIGN)] [relative_base] struct {
+		uint16	version;
+		[switch_is(version)] dfs_referral_version referral;
+	} dfs_referral_type;
+
+	typedef [public] struct {
+		uint16	path_consumed;
+		uint16	nb_referrals;
+		uint32	header_flags;
+		dfs_referral_type referral_entries[nb_referrals];
+	} dfs_referral_resp;
+
+	[public] void dfs_GetDFSReferral(
+		[in]		uint16 max_referral_level,
+		[in]		nstring servername,
+		[out,ref]	dfs_referral_resp *resp
+		);
+}
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index dbdc0e6..09e5334 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -383,13 +383,16 @@ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset
 enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset);
 enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p);
 enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_short_relative_ptr1(struct ndr_push *ndr, const void *p);
 enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p);
+enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, const void *p);
 uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr);
 void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset);
 enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset);
 enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p);
 enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset);
 enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p);
+enum ndr_err_code ndr_pull_relative_ptr_short(struct ndr_pull *ndr, uint16_t *v);
 size_t ndr_align_size(uint32_t offset, size_t n);
 struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience);
 enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size);
@@ -433,7 +436,7 @@ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
 			 struct ndr_token_list **list, 
 			 const void *key, 
 			 uint32_t value);
-enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, comparison_fn_t _cmp_fn, bool _remove_tok);
+enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, int(*_cmp_fn)(const void*,const void*), bool _remove_tok);
 enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v);
 uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key);
 enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p);
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 501b88b..5f8bc88 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -134,6 +134,11 @@ PUBLIC_DEPENDENCIES = LIBNDR NDR_DRSUAPI
 
 NDR_DRSBLOBS_OBJ_FILES = ../librpc/gen_ndr/ndr_drsblobs.o ../librpc/ndr/ndr_drsblobs.o
 
+[SUBSYSTEM::NDR_DFSBLOBS]
+PUBLIC_DEPENDENCIES = LIBNDR
+
+NDR_DFSBLOBS_OBJ_FILES = ../librpc/gen_ndr/ndr_dfsblobs.o
+
 [SUBSYSTEM::NDR_SASL_HELPERS]
 PUBLIC_DEPENDENCIES = LIBNDR
 
@@ -352,7 +357,7 @@ PUBLIC_DEPENDENCIES = \
 	NDR_FRSRPC NDR_FRSAPI NDR_FRSTRANS \
 	NDR_NFS4ACL NDR_NTP_SIGND \
 	NDR_DCOM NDR_WMI NDR_NAMED_PIPE_AUTH \
-	NDR_NTLMSSP
+	NDR_NTLMSSP NDR_DFSBLOBS
 
 NDR_TABLE_OBJ_FILES = ../librpc/ndr/ndr_table.o $(gen_ndrsrcdir)/tables.o
 
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 00362b6..7976df2 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -94,7 +94,7 @@ mkinclude libnetapi/config.mk
 [SUBSYSTEM::TORTURE_NDR]
 PRIVATE_DEPENDENCIES = torture SERVICE_SMB
 
-TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o)
+TORTURE_NDR_OBJ_FILES = $(addprefix $(torturesrcdir)/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o dfsblob.o)
 
 $(eval $(call proto_header_template,$(torturesrcdir)/ndr/proto.h,$(TORTURE_NDR_OBJ_FILES:.o=.c)))
 
diff --git a/source4/torture/ndr/dfsblob.c b/source4/torture/ndr/dfsblob.c
new file mode 100644
index 0000000..353f9f5
--- /dev/null
+++ b/source4/torture/ndr/dfsblob.c
@@ -0,0 +1,50 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Test DFS blobs.
+
+   Copyright (C) Matthieu Patou <mat at matws.net> 2009
+
+   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_dfsblobs.h"
+
+static const uint8_t dfs_get_ref_in[] = {
+	0x03, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00,
+	0x4b, 0x00, 0x33, 0x00, 0x00, 0x00 };
+
+static const uint8_t dfs_get_ref_out[] = {
+	0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x58, 0x02, 0x00, 0x00, 0x22, 0x00,
+	0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00,
+	0x32, 0x00, 0x4b, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00,
+	0x33, 0x00, 0x2d, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x31, 0x00, 0x00, 0x00 };
+
+struct torture_suite *ndr_dfsblob_suite(TALLOC_CTX *ctx)
+{
+	struct torture_suite *suite = torture_suite_create(ctx, "dfsblob");
+
+	torture_suite_add_ndr_pull_fn_test(suite, dfs_GetDFSReferral, dfs_get_ref_in, NDR_IN, NULL);
+	torture_suite_add_ndr_pull_fn_test(suite, dfs_GetDFSReferral, dfs_get_ref_out, NDR_OUT, NULL);
+
+	return suite;
+}
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 7bd3631..8602003 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -252,6 +252,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
 	torture_suite_add_suite(suite, ndr_lsa_suite(suite));
 	torture_suite_add_suite(suite, ndr_epmap_suite(suite));
 	torture_suite_add_suite(suite, ndr_dfs_suite(suite));
+	torture_suite_add_suite(suite, ndr_dfsblob_suite(suite));
 	torture_suite_add_suite(suite, ndr_netlogon_suite(suite));
 	torture_suite_add_suite(suite, ndr_drsuapi_suite(suite));
 	torture_suite_add_suite(suite, ndr_spoolss_suite(suite));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list