svn commit: samba r15473 - in trunk/source/rpc_parse: .
jelmer at samba.org
jelmer at samba.org
Sat May 6 16:16:50 GMT 2006
Author: jelmer
Date: 2006-05-06 16:16:50 +0000 (Sat, 06 May 2006)
New Revision: 15473
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15473
Log:
Add utility functions for conversion to and from DATA_BLOB
Modified:
trunk/source/rpc_parse/parse_prs.c
Changeset:
Modified: trunk/source/rpc_parse/parse_prs.c
===================================================================
--- trunk/source/rpc_parse/parse_prs.c 2006-05-06 15:46:53 UTC (rev 15472)
+++ trunk/source/rpc_parse/parse_prs.c 2006-05-06 16:16:50 UTC (rev 15473)
@@ -1792,3 +1792,32 @@
return (memcmp(digest_final, verf->packet_digest,
sizeof(verf->packet_digest)) == 0);
}
+
+/*******************************************************************
+creates a new prs_struct containing a DATA_BLOB
+********************************************************************/
+BOOL prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
+{
+ if (!prs_init( prs, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL ))
+ return False;
+
+
+ if (!prs_copy_data_in(prs, (char *)blob->data, blob->length))
+ return False;
+
+ return True;
+}
+
+/*******************************************************************
+return the contents of a prs_struct in a DATA_BLOB
+********************************************************************/
+BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
+{
+ blob->length = prs_offset(prs);
+ blob->data = talloc_zero_size(mem_ctx, blob->length);
+
+ if (!prs_copy_all_data_out((char *)blob->data, prs))
+ return False;
+
+ return True;
+}
More information about the samba-cvs
mailing list