From 63b78894618a9badac595fbc59cea0f097feeded Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Thu, 24 Jan 2019 12:03:45 +0100 Subject: [PATCH] librpc: Move dcerpc_log_packet from s4 librpc to common librpc Signed-off-by: Samuel Cabrero Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- librpc/rpc/dcerpc_util.c | 36 +++++++++++++++++++++++++++++ librpc/rpc/rpc_common.h | 5 ++++ source4/librpc/rpc/dcerpc_util.c | 39 -------------------------------- 3 files changed, 41 insertions(+), 39 deletions(-) diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c index 3386d5e2f15..01dc2e7061d 100644 --- a/librpc/rpc/dcerpc_util.c +++ b/librpc/rpc/dcerpc_util.c @@ -1405,3 +1405,39 @@ NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob, return NT_STATUS_OK; } + +/* + log a rpc packet in a format suitable for ndrdump. This is especially useful + for sealed packets, where ethereal cannot easily see the contents + + this triggers on a debug level of >= 10 +*/ +void dcerpc_log_packet(const char *lockdir, + const struct ndr_interface_table *ndr, + uint32_t opnum, uint32_t flags, + const DATA_BLOB *pkt) +{ + const int num_examples = 20; + int i; + + if (lockdir == NULL) return; + + for (i=0;iname, opnum, i, + (flags&NDR_IN)?"in":"out"); + if (ret == -1) { + return; + } + if (!file_exist(name)) { + if (file_save(name, pkt->data, pkt->length)) { + DEBUG(10,("Logged rpc packet to %s\n", name)); + } + free(name); + break; + } + free(name); + } +} diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index 7cd6d16bf58..9812146d0ba 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -452,4 +452,9 @@ NTSTATUS dcerpc_ncacn_push_auth(DATA_BLOB *blob, struct ncacn_packet *pkt, struct dcerpc_auth *auth_info); +void dcerpc_log_packet(const char *lockdir, + const struct ndr_interface_table *ndr, + uint32_t opnum, uint32_t flags, + const DATA_BLOB *pkt); + #endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */ diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index b856ebe5620..bd79a072bc8 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -743,45 +743,6 @@ _PUBLIC_ NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p, return NT_STATUS_OK; } - -/* - log a rpc packet in a format suitable for ndrdump. This is especially useful - for sealed packets, where ethereal cannot easily see the contents - - this triggers on a debug level of >= 10 -*/ -_PUBLIC_ void dcerpc_log_packet(const char *lockdir, - const struct ndr_interface_table *ndr, - uint32_t opnum, uint32_t flags, - const DATA_BLOB *pkt) -{ - const int num_examples = 20; - int i; - - if (lockdir == NULL) return; - - for (i=0;iname, opnum, i, - (flags&NDR_IN)?"in":"out"); - if (ret == -1) { - return; - } - if (!file_exist(name)) { - if (file_save(name, pkt->data, pkt->length)) { - DEBUG(10,("Logged rpc packet to %s\n", name)); - } - free(name); - break; - } - free(name); - } -} - - - /* create a secondary context from a primary connection -- 2.47.3