summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_misc.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-04 23:49:43 +0100
committerGünther Deschner <gd@samba.org>2009-02-05 00:48:50 +0100
commite28a806a6b65320e5727a4237da57f879c509d26 (patch)
tree82214220ca7fe23ae2202a1de5377e26d2ae0b29 /source3/rpc_parse/parse_misc.c
parent542251f7ae56ea7ac54ff8807d5f04b3598b96f2 (diff)
downloadsamba-e28a806a6b65320e5727a4237da57f879c509d26.tar.gz
samba-e28a806a6b65320e5727a4237da57f879c509d26.tar.bz2
samba-e28a806a6b65320e5727a4237da57f879c509d26.zip
s3-parsing: remove a lot of unused structures and their hand marshalling.
Guenther
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r--source3/rpc_parse/parse_misc.c1137
1 files changed, 0 insertions, 1137 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 7d1d00a373..38d5b95376 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -26,27 +26,6 @@
#define DBGC_CLASS DBGC_RPC_PARSE
/*******************************************************************
- Reads or writes a UTIME type.
-********************************************************************/
-
-static bool smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth)
-{
- if (t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_utime");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32 ("time", ps, depth, &t->time))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Reads or writes an NTTIME structure.
********************************************************************/
@@ -89,53 +68,6 @@ bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime)
}
/*******************************************************************
- Gets an enumeration handle from an ENUM_HND structure.
-********************************************************************/
-
-uint32 get_enum_hnd(ENUM_HND *enh)
-{
- return (enh && enh->ptr_hnd != 0) ? enh->handle : 0;
-}
-
-/*******************************************************************
- Inits an ENUM_HND structure.
-********************************************************************/
-
-void init_enum_hnd(ENUM_HND *enh, uint32 hnd)
-{
- DEBUG(5,("smb_io_enum_hnd\n"));
-
- enh->ptr_hnd = (hnd != 0) ? 1 : 0;
- enh->handle = hnd;
-}
-
-/*******************************************************************
- Reads or writes an ENUM_HND structure.
-********************************************************************/
-
-bool smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth)
-{
- if (hnd == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_enum_hnd");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_hnd", ps, depth, &hnd->ptr_hnd)) /* pointer */
- return False;
-
- if (hnd->ptr_hnd != 0) {
- if(!prs_uint32("handle ", ps, depth, &hnd->handle )) /* enum handle */
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
Reads or writes a DOM_SID structure.
********************************************************************/
@@ -174,67 +106,6 @@ bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth)
}
/*******************************************************************
- Inits a DOM_SID2 structure.
-********************************************************************/
-
-void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid)
-{
- sid2->sid = *sid;
- sid2->num_auths = sid2->sid.num_auths;
-}
-
-/*******************************************************************
- Reads or writes a DOM_SID2 structure.
-********************************************************************/
-
-bool smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2)
-{
- uint32 data_p;
-
- /* caputure the pointer value to stream */
-
- data_p = *sid2 ? 0xf000baaa : 0;
-
- if ( !prs_uint32("dom_sid2_p", ps, depth, &data_p ))
- return False;
-
- /* we're done if there is no data */
-
- if ( !data_p )
- return True;
-
- if (UNMARSHALLING(ps)) {
- if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) )
- return False;
- }
-
- return True;
-}
-/*******************************************************************
- Reads or writes a DOM_SID2 structure.
-********************************************************************/
-
-bool smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth)
-{
- if (sid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_dom_sid2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_auths", ps, depth, &sid->num_auths))
- return False;
-
- if(!smb_io_dom_sid("sid", &sid->sid, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Reads or writes a struct GUID
********************************************************************/
@@ -263,163 +134,6 @@ bool smb_io_uuid(const char *desc, struct GUID *uuid,
}
/*******************************************************************
-creates a STRHDR structure.
-********************************************************************/
-
-void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer)
-{
- hdr->str_max_len = max_len;
- hdr->str_str_len = len;
- hdr->buffer = buffer;
-}
-
-/*******************************************************************
- Reads or writes a STRHDR structure.
-********************************************************************/
-
-bool smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth)
-{
- if (hdr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_strhdr");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("str_str_len", ps, depth, &hdr->str_str_len))
- return False;
- if(!prs_uint16("str_max_len", ps, depth, &hdr->str_max_len))
- return False;
- if(!prs_uint32("buffer ", ps, depth, &hdr->buffer))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a UNIHDR structure.
-********************************************************************/
-
-void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2)
-{
- hdr->uni_str_len = 2 * (str2->uni_str_len);
- hdr->uni_max_len = 2 * (str2->uni_max_len);
- hdr->buffer = (str2->uni_str_len != 0) ? 1 : 0;
-}
-
-/*******************************************************************
- Reads or writes a UNIHDR structure.
-********************************************************************/
-
-bool smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth)
-{
- if (hdr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_unihdr");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("uni_str_len", ps, depth, &hdr->uni_str_len))
- return False;
- if(!prs_uint16("uni_max_len", ps, depth, &hdr->uni_max_len))
- return False;
- if(!prs_uint32("buffer ", ps, depth, &hdr->buffer))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a BUFHDR structure.
-********************************************************************/
-
-void init_buf_hdr(BUFHDR *hdr, int max_len, int len)
-{
- hdr->buf_max_len = max_len;
- hdr->buf_len = len;
-}
-
-/*******************************************************************
- prs_uint16 wrapper. Call this and it sets up a pointer to where the
- uint16 should be stored, or gets the size if reading.
- ********************************************************************/
-
-bool smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset)
-{
- (*offset) = prs_offset(ps);
- if (ps->io) {
-
- /* reading. */
-
- if(!smb_io_hdrbuf(desc, hdr, ps, depth))
- return False;
-
- } else {
-
- /* writing. */
-
- if(!prs_set_offset(ps, prs_offset(ps) + (sizeof(uint32) * 2)))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- smb_io_hdrbuf wrapper. Call this and it retrospectively stores the size.
- Does nothing on reading, as that is already handled by ...._pre()
- ********************************************************************/
-
-bool smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth,
- uint32 ptr_hdrbuf, uint32 max_len, uint32 len)
-{
- if (!ps->io) {
- /* writing: go back and do a retrospective job. i hate this */
-
- uint32 old_offset = prs_offset(ps);
-
- init_buf_hdr(hdr, max_len, len);
- if(!prs_set_offset(ps, ptr_hdrbuf))
- return False;
- if(!smb_io_hdrbuf(desc, hdr, ps, depth))
- return False;
-
- if(!prs_set_offset(ps, old_offset))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a BUFHDR structure.
-********************************************************************/
-
-bool smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth)
-{
- if (hdr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_hdrbuf");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("buf_max_len", ps, depth, &hdr->buf_max_len))
- return False;
- if(!prs_uint32("buf_len ", ps, depth, &hdr->buf_len))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Inits a UNISTR structure.
********************************************************************/
@@ -458,82 +172,6 @@ bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth)
}
/*******************************************************************
- Allocate the RPC_DATA_BLOB memory.
-********************************************************************/
-
-static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len)
-{
- if (len) {
- str->buffer = (uint8 *)TALLOC_ZERO(talloc_tos(), len);
- if (str->buffer == NULL)
- smb_panic("create_rpc_blob: talloc fail");
- str->buf_len = len;
- } else {
- str->buffer = NULL;
- str->buf_len = 0;
- }
-}
-
-/*******************************************************************
- Inits a RPC_DATA_BLOB structure from a uint32
-********************************************************************/
-
-void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val)
-{
- ZERO_STRUCTP(str);
-
- /* set up string lengths. */
- create_rpc_blob(str, sizeof(uint32));
- SIVAL(str->buffer, 0, val);
-}
-
-/*******************************************************************
- Inits a RPC_DATA_BLOB structure.
-********************************************************************/
-
-void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len)
-{
- ZERO_STRUCTP(str);
-
- /* set up string lengths. */
- if (len) {
- create_rpc_blob(str, len*2);
- rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE);
- }
-}
-
-/*******************************************************************
- Inits a RPC_DATA_BLOB structure from a hex string.
-********************************************************************/
-
-void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf)
-{
- ZERO_STRUCTP(str);
- if (buf && *buf) {
- size_t len = strlen(buf);
- create_rpc_blob(str, len);
- str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len,
- buf, len);
- }
-}
-
-/*******************************************************************
- Inits a RPC_DATA_BLOB structure.
-********************************************************************/
-
-void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len)
-{
- ZERO_STRUCTP(str);
-
- /* max buffer size (allocated size) */
- if (buf != NULL && len) {
- create_rpc_blob(str, len);
- memcpy(str->buffer, buf, len);
- }
- str->buf_len = len;
-}
-
-/*******************************************************************
reads or writes a BUFFER5 structure.
the buf_len member tells you how large the buffer is.
********************************************************************/
@@ -609,77 +247,6 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from)
}
/*******************************************************************
- Creates a STRING2 structure.
-********************************************************************/
-
-void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len)
-{
- /* set up string lengths. */
- SMB_ASSERT(max_len >= str_len);
-
- /* Ensure buf is valid if str_len was set. Coverity check. */
- if (str_len && !buf) {
- return;
- }
-
- str->str_max_len = max_len;
- str->offset = 0;
- str->str_str_len = str_len;
-
- /* store the string */
- if(str_len != 0) {
- str->buffer = (uint8 *)TALLOC_ZERO(talloc_tos(),
- str->str_max_len);
- if (str->buffer == NULL)
- smb_panic("init_string2: malloc fail");
- memcpy(str->buffer, buf, str_len);
- }
-}
-
-/*******************************************************************
- Reads or writes a STRING2 structure.
- XXXX NOTE: STRING2 structures need NOT be null-terminated.
- the str_str_len member tells you how long the string is;
- the str_max_len member tells you how large the buffer is.
-********************************************************************/
-
-bool smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth)
-{
- if (str2 == NULL)
- return False;
-
- if (buffer) {
-
- prs_debug(ps, depth, desc, "smb_io_string2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("str_max_len", ps, depth, &str2->str_max_len))
- return False;
- if(!prs_uint32("offset ", ps, depth, &str2->offset))
- return False;
- if(!prs_uint32("str_str_len", ps, depth, &str2->str_str_len))
- return False;
-
- /* buffer advanced by indicated length of string
- NOT by searching for null-termination */
- if(!prs_string2(True, "buffer ", ps, depth, str2))
- return False;
-
- } else {
-
- prs_debug(ps, depth, desc, "smb_io_string2 - NULL");
- depth++;
- memset((char *)str2, '\0', sizeof(*str2));
-
- }
-
- return True;
-}
-
-/*******************************************************************
Inits a UNISTR2 structure.
********************************************************************/
@@ -735,36 +302,6 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
str->uni_max_len++;
}
-/*******************************************************************
- Inits a UNISTR4 structure.
-********************************************************************/
-
-void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags)
-{
- uni4->string = TALLOC_P( talloc_tos(), UNISTR2 );
- if (!uni4->string) {
- smb_panic("init_unistr4: talloc fail");
- return;
- }
- init_unistr2( uni4->string, buf, flags );
-
- uni4->length = 2 * (uni4->string->uni_str_len);
- uni4->size = 2 * (uni4->string->uni_max_len);
-}
-
-void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf )
-{
- uni4->string = TALLOC_P( ctx, UNISTR2 );
- if (!uni4->string) {
- smb_panic("init_unistr4_w: talloc fail");
- return;
- }
- init_unistr2_w( ctx, uni4->string, buf );
-
- uni4->length = 2 * (uni4->string->uni_str_len);
- uni4->size = 2 * (uni4->string->uni_max_len);
-}
-
/**
* Inits a UNISTR2 structure.
* @param ctx talloc context to allocate string on
@@ -970,583 +507,6 @@ bool smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *
}
/*******************************************************************
- now read/write UNISTR4
-********************************************************************/
-
-bool prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4)
-{
- void *ptr;
- prs_debug(ps, depth, desc, "prs_unistr4");
- depth++;
-
- if ( !prs_uint16("length", ps, depth, &uni4->length ))
- return False;
- if ( !prs_uint16("size", ps, depth, &uni4->size ))
- return False;
-
- ptr = uni4->string;
-
- if ( !prs_pointer( desc, ps, depth, &ptr, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
- return False;
-
- uni4->string = (UNISTR2 *)ptr;
-
- return True;
-}
-
-/*******************************************************************
- now read/write UNISTR4 header
-********************************************************************/
-
-bool prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4)
-{
- prs_debug(ps, depth, desc, "prs_unistr4_hdr");
- depth++;
-
- if ( !prs_uint16("length", ps, depth, &uni4->length) )
- return False;
- if ( !prs_uint16("size", ps, depth, &uni4->size) )
- return False;
- if ( !prs_io_unistr2_p(desc, ps, depth, &uni4->string) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
- now read/write UNISTR4 string
-********************************************************************/
-
-bool prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4)
-{
- prs_debug(ps, depth, desc, "prs_unistr4_str");
- depth++;
-
- if ( !prs_io_unistr2(desc, ps, depth, uni4->string) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a UNISTR4_ARRAY structure.
-********************************************************************/
-
-bool prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array )
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "prs_unistr4_array");
- depth++;
-
- if(!prs_uint32("count", ps, depth, &array->count))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (array->count) {
- if ( !(array->strings = TALLOC_ZERO_ARRAY( talloc_tos(), UNISTR4, array->count)) )
- return False;
- } else {
- array->strings = NULL;
- }
- }
-
- /* write the headers and then the actual string buffer */
-
- for ( i=0; i<array->count; i++ ) {
- if ( !prs_unistr4_hdr( "string", ps, depth, &array->strings[i]) )
- return False;
- }
-
- for (i=0;i<array->count;i++) {
- if ( !prs_unistr4_str("string", ps, depth, &array->strings[i]) )
- return False;
- }
-
- return True;
-}
-
-/********************************************************************
- initialise a UNISTR_ARRAY from a char**
-********************************************************************/
-
-bool init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings )
-{
- unsigned int i;
-
- array->count = count;
-
- /* allocate memory for the array of UNISTR4 objects */
-
- if (array->count) {
- if ( !(array->strings = TALLOC_ZERO_ARRAY(talloc_tos(), UNISTR4, count )) )
- return False;
- } else {
- array->strings = NULL;
- }
-
- for ( i=0; i<count; i++ )
- init_unistr4( &array->strings[i], strings[i], UNI_STR_TERMINATE );
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_RID structure.
-********************************************************************/
-
-void init_dom_rid(DOM_RID *prid, uint32 rid, uint16 type, uint32 idx)
-{
- prid->type = type;
- prid->rid = rid;
- prid->rid_idx = idx;
-}
-
-/*******************************************************************
- Reads or writes a DOM_RID structure.
-********************************************************************/
-
-bool smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth)
-{
- if (rid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_dom_rid");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("type ", ps, depth, &rid->type))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("rid ", ps, depth, &rid->rid))
- return False;
- if(!prs_uint32("rid_idx", ps, depth, &rid->rid_idx))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_RID2 structure.
-********************************************************************/
-
-bool smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth)
-{
- if (rid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_dom_rid2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("type ", ps, depth, &rid->type))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("rid ", ps, depth, &rid->rid))
- return False;
- if(!prs_uint32("rid_idx", ps, depth, &rid->rid_idx))
- return False;
- if(!prs_uint32("unknown", ps, depth, &rid->unknown))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-creates a DOM_RID3 structure.
-********************************************************************/
-
-void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type)
-{
- rid3->rid = rid;
- rid3->type1 = type;
- rid3->ptr_type = 0x1; /* non-zero, basically. */
- rid3->type2 = 0x1;
- rid3->unk = type;
-}
-
-/*******************************************************************
-reads or writes a DOM_RID3 structure.
-********************************************************************/
-
-bool smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth)
-{
- if (rid3 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_dom_rid3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("rid ", ps, depth, &rid3->rid))
- return False;
- if(!prs_uint32("type1 ", ps, depth, &rid3->type1))
- return False;
- if(!prs_uint32("ptr_type", ps, depth, &rid3->ptr_type))
- return False;
- if(!prs_uint32("type2 ", ps, depth, &rid3->type2))
- return False;
- if(!prs_uint32("unk ", ps, depth, &rid3->unk))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_RID4 structure.
-********************************************************************/
-
-void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid)
-{
- rid4->unknown = unknown;
- rid4->attr = attr;
- rid4->rid = rid;
-}
-
-/*******************************************************************
- Inits a DOM_CLNT_SRV structure.
-********************************************************************/
-
-void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv,
- const char *comp_name)
-{
- DEBUG(5,("init_clnt_srv: %d\n", __LINE__));
-
- if (logon_srv != NULL) {
- logcln->undoc_buffer = 1;
- init_unistr2(&logcln->uni_logon_srv, logon_srv, UNI_STR_TERMINATE);
- } else {
- logcln->undoc_buffer = 0;
- }
-
- if (comp_name != NULL) {
- logcln->undoc_buffer2 = 1;
- init_unistr2(&logcln->uni_comp_name, comp_name, UNI_STR_TERMINATE);
- } else {
- logcln->undoc_buffer2 = 0;
- }
-}
-
-/*******************************************************************
- Inits or writes a DOM_CLNT_SRV structure.
-********************************************************************/
-
-bool smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth)
-{
- if (logcln == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_clnt_srv");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("undoc_buffer ", ps, depth, &logcln->undoc_buffer))
- return False;
-
- if (logcln->undoc_buffer != 0) {
- if(!smb_io_unistr2("unistr2", &logcln->uni_logon_srv, logcln->undoc_buffer, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("undoc_buffer2", ps, depth, &logcln->undoc_buffer2))
- return False;
-
- if (logcln->undoc_buffer2 != 0) {
- if(!smb_io_unistr2("unistr2", &logcln->uni_comp_name, logcln->undoc_buffer2, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_LOG_INFO structure.
-********************************************************************/
-
-void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acct_name,
- uint16 sec_chan, const char *comp_name)
-{
- DEBUG(5,("make_log_info %d\n", __LINE__));
-
- loginfo->undoc_buffer = 1;
-
- init_unistr2(&loginfo->uni_logon_srv, logon_srv, UNI_STR_TERMINATE);
- init_unistr2(&loginfo->uni_acct_name, acct_name, UNI_STR_TERMINATE);
-
- loginfo->sec_chan = sec_chan;
-
- init_unistr2(&loginfo->uni_comp_name, comp_name, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes a DOM_LOG_INFO structure.
-********************************************************************/
-
-bool smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth)
-{
- if (loginfo == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_log_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("undoc_buffer", ps, depth, &loginfo->undoc_buffer))
- return False;
-
- if(!smb_io_unistr2("unistr2", &loginfo->uni_logon_srv, True, ps, depth))
- return False;
- if(!smb_io_unistr2("unistr2", &loginfo->uni_acct_name, True, ps, depth))
- return False;
-
- if(!prs_uint16("sec_chan", ps, depth, &loginfo->sec_chan))
- return False;
-
- if(!smb_io_unistr2("unistr2", &loginfo->uni_comp_name, True, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_CHAL structure.
-********************************************************************/
-
-bool smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth)
-{
- if (chal == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_chal");
- depth++;
-
- if(!prs_uint8s (False, "data", ps, depth, chal->data, 8))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_CRED structure.
-********************************************************************/
-
-bool smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth)
-{
- if (cred == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_cred");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_chal ("", &cred->challenge, ps, depth))
- return False;
-
- if(!smb_io_utime("", &cred->timestamp, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_CLNT_INFO2 structure.
-********************************************************************/
-
-void init_clnt_info2(DOM_CLNT_INFO2 *clnt,
- const char *logon_srv, const char *comp_name,
- const DOM_CRED *clnt_cred)
-{
- DEBUG(5,("make_clnt_info: %d\n", __LINE__));
-
- init_clnt_srv(&clnt->login, logon_srv, comp_name);
-
- if (clnt_cred != NULL) {
- clnt->ptr_cred = 1;
- memcpy(&clnt->cred, clnt_cred, sizeof(clnt->cred));
- } else {
- clnt->ptr_cred = 0;
- }
-}
-
-/*******************************************************************
- Reads or writes a DOM_CLNT_INFO2 structure.
-********************************************************************/
-
-bool smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth)
-{
- if (clnt == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_clnt_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_clnt_srv("", &clnt->login, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_cred", ps, depth, &clnt->ptr_cred))
- return False;
- if(!smb_io_cred("", &clnt->cred, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_CLNT_INFO structure.
-********************************************************************/
-
-void init_clnt_info(DOM_CLNT_INFO *clnt,
- const char *logon_srv, const char *acct_name,
- uint16 sec_chan, const char *comp_name,
- const DOM_CRED *cred)
-{
- DEBUG(5,("make_clnt_info\n"));
-
- init_log_info(&clnt->login, logon_srv, acct_name, sec_chan, comp_name);
- memcpy(&clnt->cred, cred, sizeof(clnt->cred));
-}
-
-/*******************************************************************
- Reads or writes a DOM_CLNT_INFO structure.
-********************************************************************/
-
-bool smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth)
-{
- if (clnt == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_clnt_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_log_info("", &clnt->login, ps, depth))
- return False;
- if(!smb_io_cred("", &clnt->cred, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a DOM_LOGON_ID structure.
-********************************************************************/
-
-void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high)
-{
- DEBUG(5,("make_logon_id: %d\n", __LINE__));
-
- logonid->low = log_id_low;
- logonid->high = log_id_high;
-}
-
-/*******************************************************************
- Reads or writes a DOM_LOGON_ID structure.
-********************************************************************/
-
-bool smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth)
-{
- if (logonid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_logon_id");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("low ", ps, depth, &logonid->low ))
- return False;
- if(!prs_uint32("high", ps, depth, &logonid->high))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an OWF_INFO structure.
-********************************************************************/
-
-void init_owf_info(OWF_INFO *hash, const uint8 data[16])
-{
- DEBUG(5,("init_owf_info: %d\n", __LINE__));
-
- if (data != NULL)
- memcpy(hash->data, data, sizeof(hash->data));
- else
- memset((char *)hash->data, '\0', sizeof(hash->data));
-}
-
-/*******************************************************************
- Reads or writes an OWF_INFO structure.
-********************************************************************/
-
-bool smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth)
-{
- if (hash == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_owf_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s (False, "data", ps, depth, hash->data, 16))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_GID structure.
-********************************************************************/
-
-bool smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth)
-{
- if (gid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_gid");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("g_rid", ps, depth, &gid->g_rid))
- return False;
- if(!prs_uint32("attr ", ps, depth, &gid->attr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Reads or writes an POLICY_HND structure.
********************************************************************/
@@ -1654,103 +614,6 @@ bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64)
}
/*******************************************************************
-reads or writes a BUFHDR2 structure.
-********************************************************************/
-bool smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_bufhdr2");
- depth++;
-
- if (!prs_align(ps))
- return False;
- if (!prs_uint32("info_level", ps, depth, &(hdr->info_level)))
- return False;
- if (!prs_uint32("length ", ps, depth, &(hdr->length )))
- return False;
- if (!prs_uint32("buffer ", ps, depth, &(hdr->buffer )))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a BUFHDR4 structure.
-********************************************************************/
-bool smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_bufhdr4");
- depth++;
-
- if (!prs_align(ps))
- return False;
- if (!prs_uint32("size", ps, depth, &hdr->size))
- return False;
- if (!prs_uint32("buffer", ps, depth, &hdr->buffer))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a RPC_DATA_BLOB structure.
-********************************************************************/
-
-bool smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_rpc_blob");
- depth++;
-
- if (!prs_align(ps))
- return False;
- if ( !prs_uint32("buf_len", ps, depth, &blob->buf_len) )
- return False;
-
- if ( blob->buf_len == 0 )
- return True;
-
- if (UNMARSHALLING(ps)) {
- blob->buffer = PRS_ALLOC_MEM(ps, uint8, blob->buf_len);
- if (!blob->buffer) {
- return False;
- }
- }
-
- if ( !prs_uint8s(True, "buffer", ps, depth, blob->buffer, blob->buf_len) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-creates a UNIHDR structure.
-********************************************************************/
-
-bool make_uni_hdr(UNIHDR *hdr, int len)
-{
- if (hdr == NULL)
- {
- return False;
- }
- hdr->uni_str_len = 2 * len;
- hdr->uni_max_len = 2 * len;
- hdr->buffer = len != 0 ? 1 : 0;
-
- return True;
-}
-
-/*******************************************************************
-creates a BUFHDR2 structure.
-********************************************************************/
-bool make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer)
-{
- hdr->info_level = info_level;
- hdr->length = length;
- hdr->buffer = buffer;
-
- return True;
-}
-
-/*******************************************************************
return the length of a UNISTR string.
********************************************************************/