From 0c93b7dff7600074977bb4504169488b090f1d46 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 11 Jul 2010 17:49:06 -0400 Subject: s3-dcerpc: Remove unused functions and headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/include/proto.h | 11 -- source3/include/rpc_dce.h | 62 ---------- source3/rpc_parse/parse_rpc.c | 282 ------------------------------------------ 3 files changed, 355 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 0fbe70a89c..d7b70cb4b2 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5102,20 +5102,9 @@ 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); -void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags, - uint32 call_id, int data_len, int auth_len); -bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth); NTSTATUS dcerpc_pull_dcerpc_bind(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct dcerpc_bind *r); -void init_rpc_hdr_ba(RPC_HDR_BA *rpc, - uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - const char *pipe_addr, - uint8 num_results, uint16 result, uint16 reason, - const struct ndr_syntax_id *transfer); -bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth); -void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum); -bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth); 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, diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index f43976c4db..202382781e 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -33,27 +33,8 @@ #define RPC_IFACE_LEN (UUID_SIZE + 4) -/* RPC_HDR - dce rpc header */ -typedef struct rpc_hdr_info { - uint8 major; /* 5 - RPC major version */ - uint8 minor; /* 0 - RPC minor version */ - uint8 pkt_type; /* dcerpc_pkt_type - RPC response packet */ - uint8 flags; /* DCE/RPC flags */ - uint8 pack_type[4]; /* 0x1000 0000 - little-endian packed data representation */ - uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ - uint16 auth_len; /* 0 - authentication length */ - uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ -} RPC_HDR; - #define RPC_HEADER_LEN 16 -/* RPC_HDR_REQ - ms request rpc header */ -typedef struct rpc_hdr_req_info { - uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ - uint16 context_id; /* presentation context identifier */ - uint16 opnum; /* opnum */ -} RPC_HDR_REQ; - #define RPC_HDR_REQ_LEN 8 /* RPC_HDR_RESP - ms response rpc header */ @@ -66,28 +47,6 @@ typedef struct rpc_hdr_resp_info { #define RPC_HDR_RESP_LEN 8 -/* this seems to be the same string name depending on the name of the pipe, - * but is more likely to be linked to the interface name - * "srvsvc", "\\PIPE\\ntsvcs" - * "samr", "\\PIPE\\lsass" - * "wkssvc", "\\PIPE\\wksvcs" - * "NETLOGON", "\\PIPE\\NETLOGON" - */ -/* RPC_ADDR_STR */ -typedef struct rpc_addr_info { - uint16 len; /* length of the string including null terminator */ - fstring str; /* the string above in single byte, null terminated form */ -} RPC_ADDR_STR; - -/* RPC_HDR_BBA - bind acknowledge, and alter context response. */ -typedef struct rpc_hdr_bba_info { - uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ - uint16 max_rsize; /* max receive fragment size (0x1630) */ - uint32 assoc_gid; /* associated group id (0x0) */ -} RPC_HDR_BBA; - -#define RPC_HDR_BBA_LEN 8 - /* RPC_HDR_AUTH */ typedef struct rpc_hdr_auth_info { uint8 auth_type; /* See XXX_AUTH_TYPE above. */ @@ -99,25 +58,4 @@ typedef struct rpc_hdr_auth_info { #define RPC_HDR_AUTH_LEN 8 -/* RPC_RESULTS - can only cope with one reason, right now... */ -typedef struct rpc_results_info { - /* uint8[] # 4-byte alignment padding, against SMB header */ - - uint8 num_results; /* the number of results (0x01) */ - - /* uint8[] # 4-byte alignment padding, against SMB header */ - - uint16 result; /* result (0x00 = accept) */ - uint16 reason; /* reason (0x00 = no reason specified) */ -} RPC_RESULTS; - -/* RPC_HDR_BA */ -typedef struct rpc_hdr_ba_info { - RPC_HDR_BBA bba; - - RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ - RPC_RESULTS res ; /* results and reasons */ - struct ndr_syntax_id transfer; /* the transfer syntax from the request */ -} RPC_HDR_BA; - #endif /* _DCE_RPC_H */ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 623e867801..8ece183251 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -27,168 +27,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - Inits an RPC_HDR structure. -********************************************************************/ - -void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags, - uint32 call_id, int data_len, int auth_len) -{ - hdr->major = 5; /* RPC version 5 */ - hdr->minor = 0; /* minor version 0 */ - hdr->pkt_type = pkt_type; /* RPC packet type */ - hdr->flags = flags; /* dce/rpc flags */ - hdr->pack_type[0] = 0x10; /* little-endian data representation */ - hdr->pack_type[1] = 0; /* packed data representation */ - hdr->pack_type[2] = 0; /* packed data representation */ - hdr->pack_type[3] = 0; /* packed data representation */ - hdr->frag_len = data_len; /* fragment length, fill in later */ - hdr->auth_len = auth_len; /* authentication length */ - hdr->call_id = call_id; /* call identifier - match incoming RPC */ -} - -/******************************************************************* - Reads or writes an RPC_HDR structure. -********************************************************************/ - -bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); - depth++; - - if(!prs_uint8 ("major ", ps, depth, &rpc->major)) - return False; - - if(!prs_uint8 ("minor ", ps, depth, &rpc->minor)) - return False; - if(!prs_uint8 ("pkt_type ", ps, depth, &rpc->pkt_type)) - return False; - if(!prs_uint8 ("flags ", ps, depth, &rpc->flags)) - return False; - - /* We always marshall in little endian format. */ - if (MARSHALLING(ps)) - rpc->pack_type[0] = 0x10; - - if(!prs_uint8("pack_type0", ps, depth, &rpc->pack_type[0])) - return False; - if(!prs_uint8("pack_type1", ps, depth, &rpc->pack_type[1])) - return False; - if(!prs_uint8("pack_type2", ps, depth, &rpc->pack_type[2])) - return False; - if(!prs_uint8("pack_type3", ps, depth, &rpc->pack_type[3])) - return False; - - /* - * If reading and pack_type[0] == 0 then the data is in big-endian - * format. Set the flag in the prs_struct to specify reverse-endainness. - */ - - if (UNMARSHALLING(ps) && rpc->pack_type[0] == 0) { - DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); - prs_set_endian_data(ps, RPC_BIG_ENDIAN); - } - - if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len)) - return False; - if(!prs_uint16("auth_len ", ps, depth, &rpc->auth_len)) - return False; - if(!prs_uint32("call_id ", ps, depth, &rpc->call_id)) - return False; - return True; -} - -/******************************************************************* - Reads or writes an struct ndr_syntax_id structure. -********************************************************************/ - -static bool smb_io_rpc_iface(const char *desc, struct ndr_syntax_id *ifc, - prs_struct *ps, int depth) -{ - if (ifc == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_iface"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!smb_io_uuid( "uuid", &ifc->uuid, ps, depth)) - return False; - - if(!prs_uint32 ("version", ps, depth, &ifc->if_version)) - return False; - - return True; -} - -/******************************************************************* - Inits an RPC_ADDR_STR structure. -********************************************************************/ - -static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) -{ - str->len = strlen(name) + 1; - fstrcpy(str->str, name); -} - -/******************************************************************* - Reads or writes an RPC_ADDR_STR structure. -********************************************************************/ - -static bool smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) -{ - if (str == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); - depth++; - if(!prs_align(ps)) - return False; - - if(!prs_uint16 ( "len", ps, depth, &str->len)) - return False; - if(!prs_uint8s (True, "str", ps, depth, (uchar*)str->str, MIN(str->len, sizeof(str->str)) )) - return False; - return True; -} - -/******************************************************************* - Inits an RPC_HDR_BBA structure. -********************************************************************/ - -static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) -{ - bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ - bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ - bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ -} - -/******************************************************************* - Reads or writes an RPC_HDR_BBA structure. -********************************************************************/ - -static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); - depth++; - - if(!prs_uint16("max_tsize", ps, depth, &rpc->max_tsize)) - return False; - if(!prs_uint16("max_rsize", ps, depth, &rpc->max_rsize)) - return False; - if(!prs_uint32("assoc_gid", ps, depth, &rpc->assoc_gid)) - return False; - return True; -} - NTSTATUS dcerpc_pull_dcerpc_bind(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct dcerpc_bind *r) @@ -204,126 +42,6 @@ NTSTATUS dcerpc_pull_dcerpc_bind(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -/******************************************************************* - Inits an RPC_RESULTS structure. - - lkclXXXX only one reason at the moment! -********************************************************************/ - -static void init_rpc_results(RPC_RESULTS *res, - uint8 num_results, uint16 result, uint16 reason) -{ - res->num_results = num_results; /* the number of results (0x01) */ - res->result = result ; /* result (0x00 = accept) */ - res->reason = reason ; /* reason (0x00 = no reason specified) */ -} - -/******************************************************************* - Reads or writes an RPC_RESULTS structure. - - lkclXXXX only one reason at the moment! -********************************************************************/ - -static bool smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) -{ - if (res == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_results"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint8 ("num_results", ps, depth, &res->num_results)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("result ", ps, depth, &res->result)) - return False; - if(!prs_uint16("reason ", ps, depth, &res->reason)) - return False; - return True; -} - -/******************************************************************* - Init an RPC_HDR_BA structure. - - lkclXXXX only one reason at the moment! - -********************************************************************/ - -void init_rpc_hdr_ba(RPC_HDR_BA *rpc, - uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - const char *pipe_addr, - uint8 num_results, uint16 result, uint16 reason, - const struct ndr_syntax_id *transfer) -{ - init_rpc_hdr_bba (&rpc->bba, max_tsize, max_rsize, assoc_gid); - init_rpc_addr_str(&rpc->addr, pipe_addr); - init_rpc_results (&rpc->res, num_results, result, reason); - - /* the transfer syntax from the request */ - memcpy(&rpc->transfer, transfer, sizeof(rpc->transfer)); -} - -/******************************************************************* - Reads or writes an RPC_HDR_BA structure. -********************************************************************/ - -bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); - depth++; - - if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) - return False; - if(!smb_io_rpc_addr_str("", &rpc->addr, ps, depth)) - return False; - if(!smb_io_rpc_results("", &rpc->res, ps, depth)) - return False; - if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) - return False; - return True; -} - -/******************************************************************* - Init an RPC_HDR_REQ structure. -********************************************************************/ - -void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) -{ - hdr->alloc_hint = alloc_hint; /* allocation hint */ - hdr->context_id = 0; /* presentation context identifier */ - hdr->opnum = opnum; /* opnum */ -} - -/******************************************************************* - Reads or writes an RPC_HDR_REQ structure. -********************************************************************/ - -bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); - depth++; - - if(!prs_uint32("alloc_hint", ps, depth, &rpc->alloc_hint)) - return False; - if(!prs_uint16("context_id", ps, depth, &rpc->context_id)) - return False; - if(!prs_uint16("opnum ", ps, depth, &rpc->opnum)) - return False; - return True; -} - /******************************************************************* Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -- cgit