[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Thu Jul 15 17:54:01 MDT 2010


The branch, master has been updated
       via  7cf4797... s3-dcerpc: fix c++ warning.
       via  f4c6c7e... Move the remnants of rpc_parse code under registry/
       via  7520d8e... s3-parse_prs: Remove unuesd functions
       via  53945a2... s3-dcerpc: Use a local function to dump pdu regions
       via  67b6fe3... s3-misc: Move smb_io_time() to regfio.c
       via  100d37f... s3-dcerpc: Use DATA_BLOB for pipes_struct input data
       via  8f2bfa8... s3-dcerpc: Use DATA_BLOB instead of prs_struct for req_data
       via  8e9cd41... s3-dcerpc: Use DATA_BLOB instead of prs_struct for rpc_out
       via  3b83211... s3-dcerpc: Avoid unnecessary memory allocation for dcerpc_ctx_list
       via  ff121c8... s3-dcerpc: Use DATA_BLOB instead of prs_struct for reply_pdu
       via  b44a91b... s3-dcerpc: Use DATA_BLOB instead of prs_struct for incoming fragments
       via  cc15396... s3-dcerpc: Read a pdu in 2 steps, header first the payload
       via  79c207e... s3-dceprc: Use IDL defined constants for length calculations
       via  84c50a2... Reformat and cleanup
       via  bd19c96... s3-dcerpc: Move common helpers into a common file
       via  ca3bdca... s3-dcerpc: Padding is never done on a DCERPC_PKT_BIND_ACK packet.
       via  cb3725a... dcerpc: remove ncacn_packet_header and related functions
       via  f9a15d1... s3-dcerpc: Refactor code and stop using ncacn_packet_header
       via  2452a7a... s3-dcerpc: consolidate respones packet creation code
       via  8cd3912... s3-dcerpc: Convert frag from prs_struct to a simple DATA_BLOB
       via  31b59bb... s3-dcerpc: Convert rdata from prs_struct to a simple DATA_BLOB
       via  8246214... s3-dcerpc: Remove unused functions and headers
       via  8ffac96... s3-dcerpc: Stop using hand marshalling in create_next_pdu_noauth()
       via  a678d4e... s3-dcerpc: Stop using hand marshalling in create_next_pdu_schannel()
       via  5918a6c... s3-dcerpc: Stop using hand marshalling in create_next_pdu_ntlmssp()
       via  f0626d1... s3-dcerpc: Stop using hand marshalling in rpc_finish_auth3_bind_send()
       via  7d9c62c... s3-dcerpc: Do not parse the packet twice.
       via  282db1f... s3-dcerpc: Remove unused function
       via  137743f... s3-dcerpc: Do not reparse the header
       via  459c8e3... s3-dcerpc: Pull the whole packet at once instead of fetching just the header
       via  602e10f... s3-dcerpc: Delay parsing rpc header in client code
      from  8ce15b3... Fix bug - 7551 smbclient does not return proper exit code.

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


- Log -----------------------------------------------------------------
commit 7cf4797dd3c13555dee59fdf0c959ac66b7633b1
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jul 16 01:11:39 2010 +0200

    s3-dcerpc: fix c++ warning.
    
    Guenther

commit f4c6c7e7b8714e8ab6b1245ab95e19133956d83e
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 17:45:29 2010 -0400

    Move the remnants of rpc_parse code under registry/
    
    The registry code is the only last user of this code.
    Move everything under registry/ and hope someone will get rid od
    it completely from there in the future.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 7520d8e9263f43e756d73dfd036cab215fe0d5fb
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 17:27:11 2010 -0400

    s3-parse_prs: Remove unuesd functions
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 53945a2e990df92cdee8b54b3d1c3ade0305e99c
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 16:54:14 2010 -0400

    s3-dcerpc: Use a local function to dump pdu regions
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 67b6fe3dc39aaf88787471b1ce10f47db74c5b1e
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 16:19:04 2010 -0400

    s3-misc: Move smb_io_time() to regfio.c
    
    This is the last file using this function and we do not want anyone
    else to keep using hand marshalled stuff anyway.
    So make it also private to that file.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 100d37fc4624690423f6a932709b3f9046d05c64
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 10:28:59 2010 -0400

    s3-dcerpc: Use DATA_BLOB for pipes_struct input data
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8f2bfa88b5846528aa78840979a8ce8babef2cc0
Author: Simo Sorce <idra at samba.org>
Date:   Thu Jul 15 08:48:51 2010 -0400

    s3-dcerpc: Use DATA_BLOB instead of prs_struct for req_data
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8e9cd4144e0997991c1b54acf4e62213bce9019e
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 23:31:38 2010 -0400

    s3-dcerpc: Use DATA_BLOB instead of prs_struct for rpc_out
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 3b83211cd8859429541b383bafb657d58f16fe30
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 19:57:01 2010 -0400

    s3-dcerpc: Avoid unnecessary memory allocation for dcerpc_ctx_list
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit ff121c89d365db657128bb53bd63d18c8bfa7155
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 19:39:54 2010 -0400

    s3-dcerpc: Use DATA_BLOB instead of prs_struct for reply_pdu
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit b44a91b2206b514ff47b8841d607ffd2cc297c8b
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 18:29:32 2010 -0400

    s3-dcerpc: Use DATA_BLOB instead of prs_struct for incoming fragments
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit cc15396c8a70270d4c85055111e58d71f5c96dd6
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 16:15:13 2010 -0400

    s3-dcerpc: Read a pdu in 2 steps, header first the payload
    
    We can't really cope with receiving more data than expected anyway
    as there is code that checks if the size of the buffer is consistent with
    pkt->frag_length and throws an error if not.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 79c207ed62ef661add5d48ea898b7a415a9c17d9
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 13:56:13 2010 -0400

    s3-dceprc: Use IDL defined constants for length calculations
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 84c50a248e3a7c02d6cbcbb5ce49a6580700d39a
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 14:01:44 2010 -0400

    Reformat and cleanup
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit bd19c964d54571b1cdb8e4f1ea47a24e790e6e3c
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 12:18:49 2010 -0400

    s3-dcerpc: Move common helpers into a common file
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit ca3bdca52e93ec492f06f18d8428e80bbad375be
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 11:09:04 2010 -0400

    s3-dcerpc: Padding is never done on a DCERPC_PKT_BIND_ACK packet.
    
    Empirically verified against Windows.
    It never pads the auth credentials on this packet type.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit cb3725a9310d88a8d5226025292e25d178d7a4db
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 02:04:04 2010 -0400

    dcerpc: remove ncacn_packet_header and related functions
    
    ncacn_packet_header was an artifact and it is not necessary anymore
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit f9a15d1d94b4ea97f560536c32780b1c7e43c451
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jul 14 01:59:10 2010 -0400

    s3-dcerpc: Refactor code and stop using ncacn_packet_header
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 2452a7a4c1094047f4c67f0901b746e069639f8f
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 23:56:01 2010 -0400

    s3-dcerpc: consolidate respones packet creation code
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8cd3912afa51468e14d13b77394a308dd184b775
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 18:01:16 2010 -0400

    s3-dcerpc: Convert frag from prs_struct to a simple DATA_BLOB
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 31b59bbf99835279a0a78858aca2f327150eb5e2
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 15:43:44 2010 -0400

    s3-dcerpc: Convert rdata from prs_struct to a simple DATA_BLOB
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8246214e7ef5374acc0a1f97f4f1203374fba7f8
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 12:03:21 2010 -0400

    s3-dcerpc: Remove unused functions and headers
    
    parse_rpc.c is dead, long live parse_rpc.c !
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8ffac961db75aa3e0727e0c8f3e15cb0916f64d7
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 11:53:41 2010 -0400

    s3-dcerpc: Stop using hand marshalling in create_next_pdu_noauth()
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit a678d4e3b4766ce9520152da3d8d3ba299a470f1
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 09:52:56 2010 -0400

    s3-dcerpc: Stop using hand marshalling in create_next_pdu_schannel()
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 5918a6c751e9dc1a93c4e1851149a270c4216ee1
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 09:26:13 2010 -0400

    s3-dcerpc: Stop using hand marshalling in create_next_pdu_ntlmssp()
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit f0626d14f051c11cdb2356bd730342249feeb0a9
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 10:27:37 2010 -0400

    s3-dcerpc: Stop using hand marshalling in rpc_finish_auth3_bind_send()
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 7d9c62c646d3bc72d19c2d188305680ce0cd8ad0
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 08:49:35 2010 -0400

    s3-dcerpc: Do not parse the packet twice.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 282db1f5d28fe923700faef4576aa78d312547c0
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 08:39:03 2010 -0400

    s3-dcerpc: Remove unused function
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 137743fac2ef917e2e9ba7d85840aa392e3a6946
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 08:29:21 2010 -0400

    s3-dcerpc: Do not reparse the header
    
    Instead pass back and use the packet we have already parsed.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 459c8e32fd49766ba7382c4c3da1d0c61d9deadb
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jul 13 07:59:12 2010 -0400

    s3-dcerpc: Pull the whole packet at once instead of fetching just the header
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 602e10f3fdb5f0f94e5f22b639121220d419d47f
Author: Simo Sorce <idra at samba.org>
Date:   Mon Jul 12 09:36:39 2010 -0400

    s3-dcerpc: Delay parsing rpc header in client code
    
    Signed-off-by: Günther Deschner <gd at samba.org>

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

Summary of changes:
 librpc/idl/dcerpc.idl                      |   12 -
 pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm    |   15 +-
 source3/Makefile.in                        |    8 +-
 source3/include/ntdomain.h                 |   42 +-
 source3/include/proto.h                    |  111 +--
 source3/include/regfio.h                   |    1 +
 source3/include/rpc_dce.h                  |   28 +-
 source3/librpc/gen_ndr/README              |    1 -
 source3/librpc/rpc/dcerpc.h                |   27 +
 source3/librpc/rpc/dcerpc_helpers.c        |  212 ++++
 source3/registry/reg_parse_prs.c           |  867 ++++++++++++++++
 source3/registry/reg_parse_prs.h           |  101 ++
 source3/registry/reg_perfcount.h           |    2 +
 source3/registry/regfio.c                  |   33 +
 source3/rpc_client/cli_pipe.c              | 1510 ++++++++++------------------
 source3/rpc_client/ndr.c                   |   29 +-
 source3/rpc_parse/parse_misc.c             |   87 --
 source3/rpc_parse/parse_prs.c              |  918 -----------------
 source3/rpc_parse/parse_rpc.c              |  110 --
 source3/rpc_server/rpc_ncacn_np_internal.c |   45 +-
 source3/rpc_server/srv_pipe.c              | 1028 +++++++------------
 source3/rpc_server/srv_pipe_hnd.c          |  104 +--
 source3/rpc_server/srv_winreg_nt.c         |    1 +
 source3/winbindd/winbindd_dual_ndr.c       |   17 +-
 24 files changed, 2229 insertions(+), 3080 deletions(-)
 delete mode 100644 source3/librpc/gen_ndr/README
 create mode 100644 source3/librpc/rpc/dcerpc_helpers.c
 create mode 100644 source3/registry/reg_parse_prs.c
 create mode 100644 source3/registry/reg_parse_prs.h
 delete mode 100644 source3/rpc_parse/parse_misc.c
 delete mode 100644 source3/rpc_parse/parse_prs.c
 delete mode 100644 source3/rpc_parse/parse_rpc.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
index 68def36..d98d7bd 100644
--- a/librpc/idl/dcerpc.idl
+++ b/librpc/idl/dcerpc.idl
@@ -317,18 +317,6 @@ interface dcerpc
 	/* little-endian flag */
 	const uint8 DCERPC_DREP_LE  = 0x10;
 
-	/* header only version of ncacn_packet */
-	typedef [public] struct {
-		uint8 rpc_vers;	        /* RPC version */
-		uint8 rpc_vers_minor;   /* Minor version */
-		dcerpc_pkt_type ptype;  /* Packet type */
-		uint8 pfc_flags;        /* Fragmentation flags */
-		uint8 drep[4];	        /* NDR data representation */
-		uint16 frag_length;     /* Total length of fragment */
-		uint16 auth_length;     /* authenticator length */
-		uint32 call_id;	        /* Call identifier */
-	} ncacn_packet_header;
-
 	typedef [public] struct {
 		uint8 rpc_vers;	        /* RPC version */
 		uint8 rpc_vers_minor;   /* Minor version */
diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index a25d12b..0ea43e4 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -145,7 +145,6 @@ sub ParseFunction($$)
 	pidl "struct ndr_pull *pull;";
 	pidl "struct ndr_push *push;";
 	pidl "enum ndr_err_code ndr_err;";
-	pidl "DATA_BLOB blob;";
 	pidl "struct $fn->{NAME} *r;";
 	pidl "";
 	pidl "call = &ndr_table_$if->{NAME}.calls[$op];";
@@ -155,12 +154,7 @@ sub ParseFunction($$)
 	pidl "\treturn false;";
 	pidl "}";
 	pidl "";
-	pidl "if (!prs_data_blob(&p->in_data.data, &blob, r)) {";
-	pidl "\ttalloc_free(r);";
-	pidl "\treturn false;";
-	pidl "}";
-	pidl "";
-	pidl "pull = ndr_pull_init_blob(&blob, r);";
+	pidl "pull = ndr_pull_init_blob(&p->in_data.data, r);";
 	pidl "if (pull == NULL) {";
 	pidl "\ttalloc_free(r);";
 	pidl "\treturn false;";
@@ -211,11 +205,8 @@ sub ParseFunction($$)
 	pidl "\treturn false;";
 	pidl "}";
 	pidl "";
-	pidl "blob = ndr_push_blob(push);";
-	pidl "if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {";
-	pidl "\ttalloc_free(r);";
-	pidl "\treturn false;";
-	pidl "}";
+	pidl "p->out_data.rdata = ndr_push_blob(push);";
+	pidl "talloc_steal(p->mem_ctx, p->out_data.rdata.data);";
 	pidl "";
 	pidl "talloc_free(r);";
 	pidl "";
diff --git a/source3/Makefile.in b/source3/Makefile.in
index b980b7f..9676b37 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -354,10 +354,9 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \
 
 # this includes only the low level parse code, not stuff
 # that requires knowledge of security contexts
-RPC_PARSE_OBJ1 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
+REG_PARSE_PRS_OBJ = registry/reg_parse_prs.o
 
-RPC_PARSE_OBJ2 = rpc_parse/parse_rpc.o \
-		 rpc_client/init_netlogon.o \
+RPC_PARSE_OBJ2 = rpc_client/init_netlogon.o \
 		 rpc_client/init_lsa.o
 
 LIBREPLACE_OBJ = @LIBREPLACE_OBJS@
@@ -488,7 +487,7 @@ LIBSMB_ERR_OBJ0 = $(NTERR_OBJ) $(DOSERR_OBJ) $(ERRORMAP_OBJ) $(DCE_RPC_ERR_OBJ)
 LIBSMB_ERR_OBJ1 = ../libcli/auth/smbdes.o ../libcli/auth/smbencrypt.o ../libcli/auth/msrpc_parse.o ../libcli/auth/session.o
 
 LIBSMB_ERR_OBJ = $(LIBSMB_ERR_OBJ0) $(LIBSMB_ERR_OBJ1) \
-		 $(RPC_PARSE_OBJ1) \
+		 $(REG_PARSE_PRS_OBJ) \
 		 $(SECRETS_OBJ)
 
 LIBSMB_OBJ0 = \
@@ -565,6 +564,7 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
 		   librpc/gen_ndr/cli_drsuapi.o \
 		   librpc/gen_ndr/cli_spoolss.o \
 		   ../librpc/rpc/dcerpc_util.o \
+		   librpc/rpc/dcerpc_helpers.o \
 		   $(LIBNDR_GEN_OBJ) \
 		   $(RPCCLIENT_NDR_OBJ)
 
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index d000692..629e51c 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -28,46 +28,11 @@
  * in the NTDOM branch - it didn't belong there.
  */
 
-#define prs_init_empty( _ps_, _ctx_, _io_ ) (void) prs_init((_ps_), 0, (_ctx_), (_io_))
-
-typedef struct _prs_struct {
-	bool io; /* parsing in or out of data stream */
-	/* 
-	 * If the (incoming) data is big-endian. On output we are
-	 * always little-endian.
-	 */ 
-	bool bigendian_data;
-	uint8 align; /* data alignment */
-	bool is_dynamic; /* Do we own this memory or not ? */
-	uint32 data_offset; /* Current working offset into data. */
-	uint32 buffer_size; /* Current allocated size of the buffer. */
-	uint32 grow_size; /* size requested via prs_grow() calls */
-	/* The buffer itself. If "is_dynamic" is true this
-	 * MUST BE TALLOC'ed off mem_ctx. */
-	char *data_p;
-	TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */
-} prs_struct;
-
-/*
- * Defines for io member of prs_struct.
- */
-
-#define MARSHALL 0
-#define UNMARSHALL 1
-
-#define MARSHALLING(ps) (!(ps)->io)
-#define UNMARSHALLING(ps) ((ps)->io)
-
-#define RPC_BIG_ENDIAN 		1
-#define RPC_LITTLE_ENDIAN	0
-
-#define RPC_PARSE_ALIGN 4
-
 typedef struct _output_data {
 	/*
 	 * Raw RPC output data. This does not include RPC headers or footers.
 	 */
-	prs_struct rdata;
+	DATA_BLOB rdata;
 
 	/* The amount of data sent from the current rdata struct. */
 	uint32 data_sent_length;
@@ -76,7 +41,7 @@ typedef struct _output_data {
 	 * The current fragment being returned. This inclues
 	 * headers, data and authentication footer.
 	 */
-	prs_struct frag;
+	DATA_BLOB frag;
 
 	/* The amount of data sent from the current PDU. */
 	uint32 current_pdu_sent;
@@ -105,7 +70,8 @@ typedef struct _input_data {
 	 * the rpc headers and auth footers removed.
 	 * The maximum length of this (1Mb) is strictly enforced.
 	 */
-	prs_struct data;
+	DATA_BLOB data;
+
 } input_data;
 
 struct handle_list;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index cfa68da..ad16e7e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4838,44 +4838,20 @@ void set_profile_level(int level, struct server_id src);
 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
 
 /* The following definitions come from rpc_client/cli_pipe.c  */
+bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
+const struct ndr_interface_table *get_iface_from_syntax(
+	const struct ndr_syntax_id *syntax);
+const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
+                                     const struct ndr_syntax_id *syntax);
+enum dcerpc_AuthType map_pipe_auth_type_to_rpc_auth_type(enum pipe_auth_type auth_type);
 
 struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
 					 struct event_context *ev,
 					 struct rpc_pipe_client *cli,
 					 uint8_t op_num,
-					 prs_struct *req_data);
+					 DATA_BLOB *req_data);
 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
-			       prs_struct *reply_pdu);
-NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
-				  enum dcerpc_pkt_type ptype,
-				  uint8_t pfc_flags,
-				  uint16_t auth_length,
-				  uint32_t call_id,
-				  union dcerpc_payload *u,
-				  DATA_BLOB *blob);
-NTSTATUS dcerpc_push_ncacn_packet_header(TALLOC_CTX *mem_ctx,
-					 enum dcerpc_pkt_type ptype,
-					 uint8_t pfc_flags,
-					 uint16_t frag_length,
-					 uint16_t auth_length,
-					 uint32_t call_id,
-					 DATA_BLOB *blob);
-NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
-				  const DATA_BLOB *blob,
-				  struct ncacn_packet *r);
-NTSTATUS dcerpc_pull_ncacn_packet_header(TALLOC_CTX *mem_ctx,
-					 const DATA_BLOB *blob,
-					 struct ncacn_packet_header *r);
-NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
-				 enum dcerpc_AuthType auth_type,
-				 enum dcerpc_AuthLevel auth_level,
-				 uint8_t auth_pad_length,
-				 uint32_t auth_context_id,
-				 const DATA_BLOB *credentials,
-				 DATA_BLOB *blob);
-NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
-				 const DATA_BLOB *blob,
-				 struct dcerpc_auth *r);
+			       DATA_BLOB *reply_pdu);
 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
 				      struct event_context *ev,
 				      struct rpc_pipe_client *cli,
@@ -5042,77 +5018,6 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 			const struct ndr_interface_table *table,
 			uint32 opnum, void *r);
 
-/* The following definitions come from rpc_parse/parse_misc.c  */
-
-bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
-bool smb_io_uuid(const char *desc, struct GUID *uuid, 
-		 prs_struct *ps, int depth);
-
-/* The following definitions come from rpc_parse/parse_prs.c  */
-
-void prs_dump(const char *name, int v, prs_struct *ps);
-void prs_dump_before(const char *name, int v, prs_struct *ps);
-void prs_dump_region(const char *name, int v, prs_struct *ps,
-		     int from_off, int to_off);
-void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name);
-bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io);
-void prs_mem_free(prs_struct *ps);
-void prs_mem_clear(prs_struct *ps);
-char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count);
-char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count);
-TALLOC_CTX *prs_get_mem_context(prs_struct *ps);
-void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic);
-bool prs_set_buffer_size(prs_struct *ps, uint32 newsize);
-bool prs_grow(prs_struct *ps, uint32 extra_space);
-bool prs_force_grow(prs_struct *ps, uint32 extra_space);
-char *prs_data_p(prs_struct *ps);
-uint32 prs_data_size(prs_struct *ps);
-uint32 prs_offset(prs_struct *ps);
-bool prs_set_offset(prs_struct *ps, uint32 offset);
-bool prs_append_prs_data(prs_struct *dst, prs_struct *src);
-bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start,
-			  uint32_t len);
-bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
-bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len);
-bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len);
-bool prs_copy_all_data_out(char *dst, prs_struct *src);
-void prs_set_endian_data(prs_struct *ps, bool endian);
-bool prs_align(prs_struct *ps);
-bool prs_align_uint16(prs_struct *ps);
-bool prs_align_uint64(prs_struct *ps);
-bool prs_align_custom(prs_struct *ps, uint8 boundary);
-bool prs_align_needed(prs_struct *ps, uint32 needed);
-char *prs_mem_get(prs_struct *ps, uint32 extra_size);
-void prs_switch_type(prs_struct *ps, bool io);
-bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
-bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
-bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
-bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32);
-bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64);
-bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
-bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
-bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
-bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len);
-bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
-bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
-
-/* The following definitions come from rpc_parse/parse_rpc.c  */
-
-bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
-const struct ndr_interface_table *get_iface_from_syntax(
-        const struct ndr_syntax_id *syntax);
-const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
-				      const struct ndr_syntax_id *syntax);
-NTSTATUS dcerpc_pull_dcerpc_bind(TALLOC_CTX *mem_ctx,
-				 const DATA_BLOB *blob,
-				 struct dcerpc_bind *r);
-bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
-void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
-				uint8 auth_type, uint8 auth_level,
-				uint8 auth_pad_len,
-				uint32 auth_context_id);
-bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
-
 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
 
 /* The following definitions come from rpc_server/rpc_handles.c  */
diff --git a/source3/include/regfio.h b/source3/include/regfio.h
index 840fbcd..f2d952b 100644
--- a/source3/include/regfio.h
+++ b/source3/include/regfio.h
@@ -23,6 +23,7 @@
  * Thanks Nigel!
  ***********************************************************/
 
+#include "registry/reg_parse_prs.h"
 
 #ifndef _REGFIO_H
 #define _REGFIO_H
diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h
index 2023827..7be8a8a 100644
--- a/source3/include/rpc_dce.h
+++ b/source3/include/rpc_dce.h
@@ -22,7 +22,7 @@
 #ifndef _DCE_RPC_H /* _DCE_RPC_H */
 #define _DCE_RPC_H 
 
-#define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 	0x20
+#define SCHANNEL_SIG_SIZE 0x20
 
 /* Maximum size of the signing data in a fragment. */
 #define RPC_MAX_SIGN_SIZE 0x38 /* 56 */
@@ -31,31 +31,9 @@
 /* #define MAX_PDU_FRAG_LEN 0x1630		this is what wnt sets */
 #define RPC_MAX_PDU_FRAG_LEN 0x10b8			/* this is what w2k sets */
 
-#define RPC_IFACE_LEN (UUID_SIZE + 4)
-
 #define RPC_HEADER_LEN 16
 
-#define RPC_HDR_REQ_LEN 8
-
-/* RPC_HDR_RESP - ms response rpc header */
-typedef struct rpc_hdr_resp_info {
-	uint32 alloc_hint;   /* allocation hint - data size (bytes) minus header and tail. */
-	uint16 context_id;   /* 0 - presentation context identifier */
-	uint8  cancel_count; /* 0 - cancel count */
-	uint8  reserved;     /* 0 - reserved. */
-} RPC_HDR_RESP;
-
-#define RPC_HDR_RESP_LEN 8
-
-/* RPC_HDR_AUTH */
-typedef struct rpc_hdr_auth_info {
-	uint8 auth_type; /* See XXX_AUTH_TYPE above. */
-	uint8 auth_level; /* See RPC_PIPE_AUTH_XXX_LEVEL above. */
-	uint8 auth_pad_len;
-	uint8 auth_reserved;
-	uint32 auth_context_id;
-} RPC_HDR_AUTH;
-
-#define RPC_HDR_AUTH_LEN 8
+#define RPC_BIG_ENDIAN 		1
+#define RPC_LITTLE_ENDIAN	0
 
 #endif /* _DCE_RPC_H */
diff --git a/source3/librpc/gen_ndr/README b/source3/librpc/gen_ndr/README
deleted file mode 100644
index 0c1fd16..0000000
--- a/source3/librpc/gen_ndr/README
+++ /dev/null
@@ -1 +0,0 @@
-This contains the generated files from PIDL for the IDL files in ../idl/*.idl
diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
index 0c120df..d18920c 100644
--- a/source3/librpc/rpc/dcerpc.h
+++ b/source3/librpc/rpc/dcerpc.h
@@ -111,4 +111,31 @@ _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
 					     const struct dcerpc_binding *binding,
 					     struct epm_tower *tower);
 
+struct NL_AUTH_MESSAGE;
+
+/* The following definitions come from librpc/rpc/dcerpc_helpers.c  */
+NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+				  enum dcerpc_pkt_type ptype,
+				  uint8_t pfc_flags,
+				  uint16_t auth_length,
+				  uint32_t call_id,
+				  union dcerpc_payload *u,
+				  DATA_BLOB *blob);
+NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+				  const DATA_BLOB *blob,
+				  struct ncacn_packet *r);
+NTSTATUS dcerpc_push_schannel_bind(TALLOC_CTX *mem_ctx,
+				   struct NL_AUTH_MESSAGE *r,
+				   DATA_BLOB *blob);
+NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
+				 enum dcerpc_AuthType auth_type,
+				 enum dcerpc_AuthLevel auth_level,
+				 uint8_t auth_pad_length,
+				 uint32_t auth_context_id,
+				 const DATA_BLOB *credentials,
+				 DATA_BLOB *blob);
+NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
+				 const DATA_BLOB *blob,
+				 struct dcerpc_auth *r);
+
 #endif /* __DCERPC_H__ */
diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
new file mode 100644
index 0000000..ce48a69
--- /dev/null
+++ b/source3/librpc/rpc/dcerpc_helpers.c
@@ -0,0 +1,212 @@
+/*
+ *  DCERPC Helper routines
+ *  Günther Deschner <gd at samba.org> 2010.
+ *  Simo Sorce <idra at samba.org> 2010.
+ *
+ *  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 "librpc/rpc/dcerpc.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "librpc/gen_ndr/ndr_schannel.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_PARSE
+
+/**
+* @brief NDR Encodes a ncacn_packet
+*
+* @param mem_ctx	The memory context the blob will be allocated on
+* @param ptype		The DCERPC packet type
+* @param pfc_flags	The DCERPC PFC Falgs
+* @param auth_length	The length of the trailing auth blob
+* @param call_id	The call ID
+* @param u		The payload of the packet
+* @param blob [out]	The encoded blob if successful
+*
+* @return an NTSTATUS error code
+*/
+NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+				  enum dcerpc_pkt_type ptype,
+				  uint8_t pfc_flags,
+				  uint16_t auth_length,
+				  uint32_t call_id,
+				  union dcerpc_payload *u,
+				  DATA_BLOB *blob)
+{
+	struct ncacn_packet r;
+	enum ndr_err_code ndr_err;
+
+	r.rpc_vers		= 5;
+	r.rpc_vers_minor	= 0;
+	r.ptype			= ptype;
+	r.pfc_flags		= pfc_flags;
+	r.drep[0]		= DCERPC_DREP_LE;
+	r.drep[1]		= 0;
+	r.drep[2]		= 0;
+	r.drep[3]		= 0;
+	r.auth_length		= auth_length;
+	r.call_id		= call_id;
+	r.u			= *u;
+
+	ndr_err = ndr_push_struct_blob(blob, mem_ctx, &r,
+		(ndr_push_flags_fn_t)ndr_push_ncacn_packet);
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		return ndr_map_error2ntstatus(ndr_err);
+	}
+
+	dcerpc_set_frag_length(blob, blob->length);
+
+
+	if (DEBUGLEVEL >= 10) {
+		/* set frag len for print function */
+		r.frag_length = blob->length;
+		NDR_PRINT_DEBUG(ncacn_packet, &r);
+	}
+
+	return NT_STATUS_OK;
+}
+
+/**
+* @brief Decodes a ncacn_packet
+*
+* @param mem_ctx	The memory context on which to allocate the packet
+*			elements
+* @param blob		The blob of data to decode
+* @param r		An empty ncacn_packet, must not be NULL


-- 
Samba Shared Repository


More information about the samba-cvs mailing list