librpc: Move dcerpc_log_packet from s4 librpc to common librpc
authorSamuel Cabrero <scabrero@suse.de>
Thu, 24 Jan 2019 11:03:45 +0000 (12:03 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 18 Oct 2019 16:07:36 +0000 (16:07 +0000)
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
librpc/rpc/dcerpc_util.c
librpc/rpc/rpc_common.h
source4/librpc/rpc/dcerpc_util.c

index 3386d5e2f15259c5805bb459205448077343dce3..01dc2e7061d8e3a9e1590d30b99bb693ac2a1c43 100644 (file)
@@ -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;i<num_examples;i++) {
+               char *name=NULL;
+               int ret;
+               ret = asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
+                              lockdir, ndr->name, 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);
+       }
+}
index 7cd6d16bf58e53a32d41bc3e702970aaf58d1d99..9812146d0bae833a3f46e276bbda106c58f3a004 100644 (file)
@@ -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__ */
index b856ebe5620311cb8bd1563915a9f12e6a9b9def..bd79a072bc8c0787abf35719311a01bb4c7f5bb5 100644 (file)
@@ -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;i<num_examples;i++) {
-               char *name=NULL;
-               int ret;
-               ret = asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
-                              lockdir, ndr->name, 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