build: moved librpc/rpc/*.c into a rpccommon library
authorAndrew Tridgell <tridge@samba.org>
Thu, 24 Feb 2011 00:55:45 +0000 (11:55 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 24 Feb 2011 01:42:37 +0000 (02:42 +0100)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Feb 24 02:42:37 CET 2011 on sn-devel-104

17 files changed:
librpc/rpc/binding.c
librpc/rpc/binding_handle.c
librpc/rpc/dcerpc_error.c
librpc/rpc/dcerpc_util.c
librpc/rpc/rpc_common.h [new file with mode: 0644]
librpc/wscript_build
source3/wscript_build
source4/librpc/rpc/dcerpc.c
source4/librpc/rpc/dcerpc_smb.c
source4/librpc/rpc/dcerpc_smb2.c
source4/librpc/rpc/dcerpc_sock.c
source4/librpc/rpc/dcerpc_util.c
source4/librpc/wscript_build
source4/rpc_server/common/reply.c
source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcesrv_auth.c
source4/torture/rpc/epmapper.c

index b7c3a40a0d14763d950adc9a8acace91bb48a9f7..2a0295b1e84303f6b2a2fd0344222a7c7a41c916 100644 (file)
@@ -27,6 +27,8 @@
 #include "librpc/gen_ndr/ndr_epmapper.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
+
 #undef strcasecmp
 #undef strncasecmp
 
index 93c0fd4f00eadc57fb975714a68c6875f3518867..9ad7a9bde874e0068a3c903d5a8fcbced6aa486b 100644 (file)
@@ -23,6 +23,7 @@
 #include <tevent.h>
 #include "../lib/util/tevent_ntstatus.h"
 #include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
 
 struct dcerpc_binding_handle {
        void *private_data;
index 17095e50576f44c5d9bc548470b2c2f81021d68d..7c983866647c5b96cfab04a536ad16cc63dc4417 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
 
 struct dcerpc_fault_table {
        const char *errstr;
index 1db43df34a8361cfbb339b1623dd5ca3d822348d..a405ca8966af4752603d5fd8ab1a8c919ef427c1 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/util/tevent_ntstatus.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "rpc_common.h"
 
 /* we need to be able to get/set the fragment length without doing a full
    decode */
diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
new file mode 100644 (file)
index 0000000..3f5216b
--- /dev/null
@@ -0,0 +1,101 @@
+#ifndef __DEFAULT_LIBRPC_RPCCOMMON_H__
+#define __DEFAULT_LIBRPC_RPCCOMMON_H__
+
+/* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
+
+
+/* The following definitions come from ../librpc/rpc/binding.c  */
+
+const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
+
+/* The following definitions come from ../librpc/rpc/dcerpc_util.c  */
+
+void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
+uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
+void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
+uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
+
+/**
+* @brief       Pull a dcerpc_auth structure, taking account of any auth
+*              padding in the blob. For request/response packets we pass
+*              the whole data blob, so auth_data_only must be set to false
+*              as the blob contains data+pad+auth and no just pad+auth.
+*
+* @param pkt           - The ncacn_packet strcuture
+* @param mem_ctx       - The mem_ctx used to allocate dcerpc_auth elements
+* @param pkt_trailer   - The packet trailer data, usually the trailing
+*                        auth_info blob, but in the request/response case
+*                        this is the stub_and_verifier blob.
+* @param auth          - A preallocated dcerpc_auth *empty* structure
+* @param auth_length   - The length of the auth trail, sum of auth header
+*                        lenght and pkt->auth_length
+* @param auth_data_only        - Whether the pkt_trailer includes only the auth_blob
+*                        (+ padding) or also other data.
+*
+* @return              - A NTSTATUS error code.
+*/
+NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
+                                 TALLOC_CTX *mem_ctx,
+                                 DATA_BLOB *pkt_trailer,
+                                 struct dcerpc_auth *auth,
+                                 uint32_t *auth_length,
+                                 bool auth_data_only);
+struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
+                                                struct tevent_context *ev,
+                                                struct tstream_context *stream);
+NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct ncacn_packet **pkt,
+                                      DATA_BLOB *buffer);
+
+/* The following definitions come from ../librpc/rpc/binding_handle.c  */
+
+struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
+                                       const struct dcerpc_binding_handle_ops *ops,
+                                       const struct GUID *object,
+                                       const struct ndr_interface_table *table,
+                                       void *pstate,
+                                       size_t psize,
+                                       const char *type,
+                                       const char *location);
+void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h);
+void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
+                                      struct tevent_context *ev);
+bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
+uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
+                                          uint32_t timeout);
+struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
+                                               struct tevent_context *ev,
+                                               struct dcerpc_binding_handle *h,
+                                               const struct GUID *object,
+                                               uint32_t opnum,
+                                               uint32_t in_flags,
+                                               const uint8_t *in_data,
+                                               size_t in_length);
+NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
+                                            TALLOC_CTX *mem_ctx,
+                                            uint8_t **out_data,
+                                            size_t *out_length,
+                                            uint32_t *out_flags);
+struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
+                                               struct tevent_context *ev,
+                                               struct dcerpc_binding_handle *h);
+NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req);
+struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       struct dcerpc_binding_handle *h,
+                                       const struct GUID *object,
+                                       const struct ndr_interface_table *table,
+                                       uint32_t opnum,
+                                       TALLOC_CTX *r_mem,
+                                       void *r_ptr);
+NTSTATUS dcerpc_binding_handle_call_recv(struct tevent_req *req);
+NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
+                                   const struct GUID *object,
+                                   const struct ndr_interface_table *table,
+                                   uint32_t opnum,
+                                   TALLOC_CTX *r_mem,
+                                   void *r_ptr);
+#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
index 1c41af377f549d9ac8901d9c5cd67818e98af3fb..354dec14b7a4c4e10d861072107eb1c852eca31f 100644 (file)
@@ -565,3 +565,8 @@ bld.SAMBA_LIBRARY('ndr',
        depends_on='PIDL_MISC',
        vnum='0.0.1'
        )
+
+bld.SAMBA_LIBRARY('rpccommon',
+                  source='rpc/dcerpc_error.c rpc/binding.c rpc/dcerpc_util.c rpc/binding_handle.c',
+                  deps='ndr tevent NDR_DCERPC LIBTSOCKET',
+                  private_library=True)
index 1c8c2a15e84b752a219fa83f6de9975779cf0d93..0008bd016e23ba619e5abecf3389811d03d08711 100644 (file)
@@ -122,10 +122,6 @@ LIBNMB_SRC = '''libsmb/unexpected.c libsmb/namecache.c libsmb/nmblib.c
              libsmb/namequery.c libsmb/conncache.c
              libads/dns.c libads/sitename_cache.c'''
 
-DCE_RPC_ERR_SRC = '../librpc/rpc/dcerpc_error.c'
-
-LIBSMB_ERR_SRC = '''${DCE_RPC_ERR_SRC}'''
-
 LIBNTLMSSP_SRC = '''
                libsmb/ntlmssp.c
                libsmb/ntlmssp_wrap.c'''
@@ -152,10 +148,8 @@ LIBMSRPC_SRC = '''
                rpc_client/rpc_transport_np.c
                rpc_client/rpc_transport_sock.c
                rpc_client/rpc_transport_tstream.c
-               ../librpc/rpc/binding.c
-               ../librpc/rpc/dcerpc_util.c
                librpc/rpc/dcerpc_helpers.c
-               ../librpc/rpc/binding_handle.c'''
+               '''
 
 #
 # registry-related objects
@@ -684,7 +678,7 @@ bld.SAMBA3_SUBSYSTEM('msrpc3',
                     source='${LIBMSRPC_SRC}',
                     deps='''ndr ndr-util NDR_SECURITY NDR_DCERPC NDR_SCHANNEL
                     RPC_NDR_EPMAPPER COMMON_SCHANNEL LIBCLI_AUTH
-                    LIBTSOCKET krb5''',
+                    LIBTSOCKET krb5 rpccommon''',
                     vars=locals())
 
 bld.SAMBA3_SUBSYSTEM('LIBMSRPC_GEN',
@@ -773,8 +767,8 @@ bld.SAMBA3_SUBSYSTEM('LIB_NONSMBD',
                     vars=locals())
 
 bld.SAMBA3_SUBSYSTEM('LIBSMB_ERR',
-                    source=LIBSMB_ERR_SRC,
-                    deps='errors3 SECRETS3 ldap lber MSRPC_PARSE LIBCLI_AUTH',
+                    source='',
+                    deps='errors3 SECRETS3 ldap lber MSRPC_PARSE LIBCLI_AUTH rpccommon',
                     vars=locals())
 
 bld.SAMBA3_SUBSYSTEM('LIBNTLMSSP',
index 5a31b6a2bb192a6d2cca35d192b6c0529b4de3cf..3b67512f913cc7a8386eb0623ac5e4abcbe0bca7 100644 (file)
@@ -31,6 +31,7 @@
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
 #include "lib/util/tevent_ntstatus.h"
+#include "librpc/rpc/rpc_common.h"
 
 _PUBLIC_ NTSTATUS dcerpc_init(struct loadparm_context *lp_ctx)
 {
index 947a9c5f657b333edd5207a76e24557deb141420..5a404556c8fbc959190e07b369f5a5aec21373ea 100644 (file)
@@ -25,6 +25,7 @@
 #include "libcli/composite/composite.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/rpc/dcerpc_proto.h"
+#include "librpc/rpc/rpc_common.h"
 
 /* transport private information used by SMB pipe transport */
 struct smb_private {
index fbd847680f7743520a35b4c37d162ff25b1f06b7..46dc379f80c4927f3bf9537d5357fdb153320541 100644 (file)
@@ -27,6 +27,7 @@
 #include "libcli/raw/ioctl.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/rpc/dcerpc_proto.h"
+#include "librpc/rpc/rpc_common.h"
 
 /* transport private information used by SMB2 pipe transport */
 struct smb2_private {
index 4ab8c350914774c591b277e02a7fb242864847e8..782710c6c4585efbe1ec24afbb660b21f29580c2 100644 (file)
@@ -29,6 +29,7 @@
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/rpc/dcerpc_proto.h"
 #include "libcli/resolve/resolve.h"
+#include "librpc/rpc/rpc_common.h"
 
 /* transport private information used by general socket pipe transports */
 struct sock_private {
index d27b0f3f5bc7798958decc76a6423482d999863f..a84e9670205bbb95fcf6c7ab4d7f14cc6dcfab3d 100644 (file)
@@ -31,6 +31,7 @@
 #include "librpc/rpc/dcerpc_proto.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
+#include "librpc/rpc/rpc_common.h"
 
 /*
   find a dcerpc call on an interface by name
index c9c4a225083b0a0f2f160860b789b0cfa6e03e10..0d6589ec80f658ff9d9a2fa49451a642e105607d 100755 (executable)
@@ -154,11 +154,9 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_WINSIF',
 bld.SAMBA_LIBRARY('dcerpc',
        source='''rpc/dcerpc.c rpc/dcerpc_auth.c rpc/dcerpc_schannel.c
        rpc/dcerpc_util.c rpc/dcerpc_smb.c rpc/dcerpc_smb2.c rpc/dcerpc_sock.c
-       rpc/dcerpc_connect.c rpc/dcerpc_secondary.c ../../librpc/rpc/binding.c
-       ../../librpc/rpc/dcerpc_error.c ../../librpc/rpc/dcerpc_util.c
-       ../../librpc/rpc/binding_handle.c''',
+       rpc/dcerpc_connect.c rpc/dcerpc_secondary.c''',
        pc_files='dcerpc.pc',
-       deps='samba_socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 ndr NDR_DCERPC RPC_NDR_EPMAPPER NDR_SCHANNEL RPC_NDR_NETLOGON RPC_NDR_MGMT gensec LIBCLI_AUTH LIBCLI_RAW LP_RESOLVE UTIL_TEVENT',
+       deps='samba_socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 ndr NDR_DCERPC RPC_NDR_EPMAPPER NDR_SCHANNEL RPC_NDR_NETLOGON RPC_NDR_MGMT gensec LIBCLI_AUTH LIBCLI_RAW LP_RESOLVE UTIL_TEVENT rpccommon',
        autoproto='rpc/dcerpc_proto.h',
        public_deps='credentials tevent talloc',
        public_headers='rpc/dcerpc.h ../../librpc/gen_ndr/mgmt.h ../../librpc/gen_ndr/ndr_mgmt.h ../../librpc/gen_ndr/ndr_mgmt_c.h ../../librpc/gen_ndr/epmapper.h ../../librpc/gen_ndr/ndr_epmapper.h ../../librpc/gen_ndr/ndr_epmapper_c.h',
index 83660c209ba875c5034bfc3ba48ec87f9caab911..92bd552ad11dd5e92d90dab477800ed1c356143e 100644 (file)
@@ -38,6 +38,7 @@
 #include "lib/socket/socket.h"
 #include "smbd/process_model.h"
 #include "lib/messaging/irpc.h"
+#include "librpc/rpc/rpc_common.h"
 
 
 /*
index 1371ad9b360821c152d538304fa458a0f046012c..fd26740ddc37f212794cea80d8544a57a2b7967f 100644 (file)
@@ -38,6 +38,7 @@
 #include "lib/socket/socket.h"
 #include "smbd/process_model.h"
 #include "lib/messaging/irpc.h"
+#include "librpc/rpc/rpc_common.h"
 
 /* this is only used when the client asks for an unknown interface */
 #define DUMMY_ASSOC_GROUP 0x0FFFFFFF
index 4c91fcb392b8d3b210b932f323f1b380b4d4dfb8..1e6aa24c82097bc2b99265183adbad1138ed9629 100644 (file)
@@ -30,6 +30,7 @@
 #include "auth/gensec/gensec.h"
 #include "auth/auth.h"
 #include "param/param.h"
+#include "librpc/rpc/rpc_common.h"
 
 /*
   parse any auth information from a dcerpc bind request
index 94e4652acd906608cef0e2b52e95bc57c510c6ff..fad6abecf717bc8e65073eb8b4e8f2ce410233e2 100644 (file)
@@ -24,6 +24,7 @@
 #include "librpc/rpc/dcerpc_proto.h"
 #include "torture/rpc/torture_rpc.h"
 #include "lib/util/util_net.h"
+#include "librpc/rpc/rpc_common.h"
 
 /*
   display any protocol tower