diff options
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 340 |
1 files changed, 236 insertions, 104 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e46a6e02a5..31dc252187 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -31,9 +31,9 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a BIGINT structure. ********************************************************************/ -void smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) +BOOL smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) { - if (bigint == NULL) return; + if (bigint == NULL) return False; prs_debug(ps, depth, desc, "smb_io_bigint"); depth++; @@ -42,14 +42,16 @@ void smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) prs_uint32("low ", ps, depth, &(bigint->low )); prs_uint32("high", ps, depth, &(bigint->high)); + + return True; } /******************************************************************* reads or writes a UTIME type. ********************************************************************/ -static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) { - if (t == NULL) return; + if (t == NULL) return False; prs_debug(ps, depth, desc, "smb_io_utime"); depth++; @@ -57,14 +59,16 @@ static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) prs_align(ps); prs_uint32 ("time", ps, depth, &(t->time)); + + return True; } /******************************************************************* reads or writes an NTTIME structure. ********************************************************************/ -void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) +BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) { - if (nttime == NULL) return; + if (nttime == NULL) return False; prs_debug(ps, depth, desc, "smb_io_time"); depth++; @@ -73,14 +77,16 @@ void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) prs_uint32("low ", ps, depth, &(nttime->low )); /* low part */ prs_uint32("high", ps, depth, &(nttime->high)); /* high part */ + + return True; } /******************************************************************* reads or writes a LOOKUP_LEVEL structure. ********************************************************************/ -void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) +BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) { - if (level == NULL) return; + if (level == NULL) return False; prs_debug(ps, depth, desc, "smb_io_lookup_level"); depth++; @@ -88,6 +94,8 @@ void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int de prs_align(ps); prs_uint16("value", ps, depth, &(level->value)); prs_align(ps); + + return True; } /******************************************************************* @@ -96,27 +104,31 @@ 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; + + return True; } /******************************************************************* makes an ENUM_HND structure. ********************************************************************/ -void make_enum_hnd(ENUM_HND *enh, uint32 hnd) +BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd) { - if (enh == NULL) return; + if (enh == NULL) return False; DEBUG(5,("smb_io_enum_hnd\n")); enh->ptr_hnd = (hnd != 0) ? 1 : 0; enh->handle = hnd; + + return True; } /******************************************************************* reads or writes an ENUM_HND structure. ********************************************************************/ -void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { - if (hnd == NULL) return; + if (hnd == NULL) return False; prs_debug(ps, depth, desc, "smb_io_enum_hnd"); depth++; @@ -128,16 +140,18 @@ void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { prs_uint32("handle ", ps, depth, &(hnd->handle )); /* enum handle */ } + + return True; } /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ -void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; - if (sid == NULL) return; + if (sid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; @@ -158,23 +172,27 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); + + return True; } /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ -void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +BOOL make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; + + return True; } /******************************************************************* reads or writes a DOM_SID2 structure. ********************************************************************/ -void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { - if (sid == NULL) return; + if (sid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_sid2"); depth++; @@ -184,24 +202,28 @@ void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) prs_uint32("num_auths", ps, depth, &(sid->num_auths)); smb_io_dom_sid("sid", &(sid->sid), ps, depth); + + return True; } /******************************************************************* creates a STRHDR structure. ********************************************************************/ -void make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) +BOOL make_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; + + return True; } /******************************************************************* reads or writes a STRHDR structure. ********************************************************************/ -void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; @@ -215,24 +237,28 @@ void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + + return True; } /******************************************************************* creates a STRHDR2 structure. ********************************************************************/ -void make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) +BOOL make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) { hdr->str_max_len = max_len; hdr->str_str_len = len; hdr->buffer = buffer; + + return True; } /******************************************************************* reads or writes a STRHDR2 structure. ********************************************************************/ -void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; @@ -246,24 +272,28 @@ void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + + return True; } /******************************************************************* creates a UNIHDR structure. ********************************************************************/ -void make_uni_hdr(UNIHDR *hdr, int len) +BOOL make_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; hdr->uni_max_len = 2 * len; hdr->buffer = len != 0 ? 1 : 0; + + return True; } /******************************************************************* reads or writes a UNIHDR structure. ********************************************************************/ -void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unihdr"); depth++; @@ -277,22 +307,26 @@ void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN; if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN; + + return True; } /******************************************************************* creates a BUFHDR structure. ********************************************************************/ -void make_buf_hdr(BUFHDR *hdr, int max_len, int len) +BOOL make_buf_hdr(BUFHDR *hdr, int max_len, int len) { hdr->buf_max_len = max_len; hdr->buf_len = len; + + return True; } /******************************************************************* prs_uint16 wrapper. call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading ********************************************************************/ -void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { (*offset) = ps->offset; if (ps->io) @@ -304,13 +338,15 @@ void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint { ps->offset += sizeof(uint32) * 2; } + + 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() ********************************************************************/ -void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, +BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) @@ -323,14 +359,16 @@ void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, smb_io_hdrbuf(desc, hdr, ps, depth); ps->offset = old_offset; } + + return True; } /******************************************************************* reads or writes a BUFHDR structure. ********************************************************************/ -void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_hdrbuf"); depth++; @@ -343,24 +381,28 @@ void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->buf_max_len > MAX_BUFFERLEN) hdr->buf_max_len = MAX_BUFFERLEN; if (hdr->buf_len > MAX_BUFFERLEN) hdr->buf_len = MAX_BUFFERLEN; + + return True; } /******************************************************************* creates a BUFHDR2 structure. ********************************************************************/ -void make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) +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; } /******************************************************************* reads or writes a BUFHDR2 structure. ********************************************************************/ -void smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; @@ -369,23 +411,27 @@ void smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) prs_uint32("info_level", ps, depth, &(hdr->info_level)); prs_uint32("length ", ps, depth, &(hdr->length )); prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + return True; } /******************************************************************* creates a UNIHDR2 structure. ********************************************************************/ -void make_uni_hdr2(UNIHDR2 *hdr, int len) +BOOL make_uni_hdr2(UNIHDR2 *hdr, int len) { make_uni_hdr(&(hdr->unihdr), len); hdr->buffer = len > 0 ? 1 : 0; + + return True; } /******************************************************************* reads or writes a UNIHDR2 structure. ********************************************************************/ -void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) { - if (hdr2 == NULL) return; + if (hdr2 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unihdr2"); depth++; @@ -394,34 +440,40 @@ void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth); prs_uint32("buffer", ps, depth, &(hdr2->buffer)); + + return True; } /******************************************************************* creates a UNISTR structure. ********************************************************************/ -void make_unistr(UNISTR *str, char *buf) +BOOL make_unistr(UNISTR *str, char *buf) { ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)-1); + + return True; } /******************************************************************* reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { - if (uni == NULL) return; + if (uni == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; prs_unistr("unistr", ps, depth, uni); + + return True; } /******************************************************************* creates a BUFFER3 structure from a uint32 ********************************************************************/ -void make_buffer3_uint32(BUFFER3 *str, uint32 val) +BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) { ZERO_STRUCTP(str); @@ -430,12 +482,14 @@ void make_buffer3_uint32(BUFFER3 *str, uint32 val) str->buf_len = sizeof(uint32); SIVAL(str->buffer, 0, val); + + return True; } /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -void make_buffer3_str(BUFFER3 *str, char *buf, int len) +BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) { ZERO_STRUCTP(str); @@ -445,21 +499,25 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len) /* store the string (little endian buffer) */ ascii_to_unibuf(str->buffer, buf, str->buf_len); + + return True; } /******************************************************************* creates a BUFFER3 structure from a hex string. ********************************************************************/ -void make_buffer3_hex(BUFFER3 *str, char *buf) +BOOL make_buffer3_hex(BUFFER3 *str, char *buf) { ZERO_STRUCTP(str); str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); + + return True; } /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -void make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) +BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) { ZERO_STRUCTP(str); @@ -470,6 +528,8 @@ void make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); } str->buf_len = buf != NULL ? len : 0; + + return True; } /******************************************************************* @@ -477,9 +537,9 @@ reads or writes a BUFFER3 structure. the uni_max_len member tells you how large the buffer is. the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) +BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) { - if (buf3 == NULL) return; + if (buf3 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_buffer3"); depth++; @@ -493,14 +553,16 @@ void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) prs_uint32("buf_len ", ps, depth, &(buf3->buf_len)); if (buf3->buf_len > MAX_UNISTRLEN) buf3->buf_len = MAX_UNISTRLEN; + + return True; } /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ -void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) { - if ((buf4 == NULL) || (buffer == 0)) return; + if ((buf4 == NULL) || (buffer == 0)) return False; prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; @@ -514,12 +576,14 @@ void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, in } prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); + + return True; } /******************************************************************* initialise a BUFFER5 structure. ********************************************************************/ -void init_buffer5(BUFFER5 **str) +BOOL init_buffer5(BUFFER5 **str) { BUFFER5 *buf5; @@ -528,12 +592,14 @@ void init_buffer5(BUFFER5 **str) buf5->buf_len=0; buf5->buffer=NULL; *str=buf5; + + return True; } /******************************************************************* clear a BUFFER5 structure. ********************************************************************/ -void clear_buffer5(BUFFER5 **str) +BOOL clear_buffer5(BUFFER5 **str) { BUFFER5 *buf5; @@ -544,30 +610,34 @@ void clear_buffer5(BUFFER5 **str) } free(buf5); *str=NULL; + + return True; } /******************************************************************* creates a BUFFER5 structure. ********************************************************************/ -void make_buffer5(BUFFER5 *str, char *buf, int len) +BOOL make_buffer5(BUFFER5 *str, char *buf, int len) { /* max buffer size (allocated size) */ str->buf_len = len; str->buffer = (uint16 *)malloc( sizeof(uint16) * len ); ascii_to_unistr(str->buffer, buf, len); + + return True; } /******************************************************************* reads or writes a BUFFER5 structure. the buf_len member tells you how large the buffer is. ********************************************************************/ -void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; - if (buf5 == NULL) return; + if (buf5 == NULL) return False; prs_align(ps); prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); @@ -579,12 +649,14 @@ void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) } prs_uint16s(True, "buffer ", ps, depth, buf5->buffer, buf5->buf_len); + + return True; } /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ -void make_buffer2(BUFFER2 *str, const char *buf, int len) +BOOL make_buffer2(BUFFER2 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -594,6 +666,8 @@ void make_buffer2(BUFFER2 *str, const char *buf, int len) /* store the string */ ascii_to_unibuf(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)-1)); + + return True; } /******************************************************************* @@ -601,9 +675,9 @@ reads or writes a BUFFER2 structure. the uni_max_len member tells you how large the buffer is. the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { - if (buf2 == NULL) return; + if (buf2 == NULL) return False; if (buffer) { @@ -630,12 +704,14 @@ void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i depth++; bzero(buf2, sizeof(*buf2)); } + + return True; } /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) { if (buf != NULL) { @@ -647,12 +723,14 @@ void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) *ptr = 0; make_unistr2(str, "", 0); } + + return True; } /******************************************************************* copies a UNISTR2 structure. ********************************************************************/ -void copy_unistr2(UNISTR2 *str, UNISTR2 *from) +BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from) { /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; @@ -661,12 +739,14 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) /* copy the string */ memcpy(str->buffer, from->buffer, sizeof(from->buffer)); + + return True; } /******************************************************************* creates a STRING2 structure. ********************************************************************/ -void make_string2(STRING2 *str, char *buf, int len) +BOOL make_string2(STRING2 *str, char *buf, int len) { /* set up string lengths. */ str->str_max_len = len; @@ -676,6 +756,8 @@ void make_string2(STRING2 *str, char *buf, int len) /* store the string */ if(len != 0) memcpy(str->buffer, buf, len); + + return True; } /******************************************************************* @@ -684,9 +766,9 @@ 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. ********************************************************************/ -void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { - if (str2 == NULL) return; + if (str2 == NULL) return False; if (buffer) { @@ -713,12 +795,14 @@ void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, i depth++; bzero(str2, sizeof(*str2)); } + + return True; } /******************************************************************* creates a UNISTR2 structure. ********************************************************************/ -void make_unistr2(UNISTR2 *str, const char *buf, int len) +BOOL make_unistr2(UNISTR2 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -729,6 +813,8 @@ void make_unistr2(UNISTR2 *str, const char *buf, int len) /* store the string (wide chars) */ ascii_to_unistr(str->buffer, buf, len); + + return True; } /******************************************************************* @@ -737,9 +823,9 @@ XXXX NOTE: UNISTR2 structures need NOT be null-terminated. the uni_str_len member tells you how long the string is; the uni_max_len member tells you how large the buffer is. ********************************************************************/ -void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { - if (uni2 == NULL) return; + if (uni2 == NULL) return False; if (buffer) { @@ -766,24 +852,28 @@ void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, i depth++; bzero(uni2, sizeof(*uni2)); } + + return True; } /******************************************************************* creates a DOM_RID2 structure. ********************************************************************/ -void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) +BOOL make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) { rid2->type = type; rid2->rid = rid; rid2->rid_idx = idx; + + return True; } /******************************************************************* reads or writes a DOM_RID2 structure. ********************************************************************/ -void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) { - if (rid2 == NULL) return; + if (rid2 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_rid2"); depth++; @@ -794,26 +884,30 @@ void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) prs_align(ps); prs_uint32("rid ", ps, depth, &(rid2->rid )); prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx )); + + return True; } /******************************************************************* creates a DOM_RID3 structure. ********************************************************************/ -void make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) +BOOL make_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; + + return True; } /******************************************************************* reads or writes a DOM_RID3 structure. ********************************************************************/ -void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { - if (rid3 == NULL) return; + if (rid3 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_rid3"); depth++; @@ -825,14 +919,16 @@ void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type)); prs_uint32("type2 ", ps, depth, &(rid3->type2 )); prs_uint32("unk ", ps, depth, &(rid3->unk )); + + return True; } /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ -static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static BOOL make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) { - if (log == NULL) return; + if (log == NULL) return False; DEBUG(5,("make_clnt_srv: %d\n", __LINE__)); @@ -855,14 +951,16 @@ static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) { log->undoc_buffer2 = 0; } + + return True; } /******************************************************************* reads or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { - if (log == NULL) return; + if (log == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); depth++; @@ -882,16 +980,18 @@ static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int { smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth); } + + return True; } /******************************************************************* makes a DOM_LOG_INFO structure. ********************************************************************/ -void make_log_info(DOM_LOG_INFO *log, +BOOL make_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name) { - if (log == NULL) return; + if (log == NULL) return False; DEBUG(5,("make_log_info %d\n", __LINE__)); @@ -903,14 +1003,16 @@ void make_log_info(DOM_LOG_INFO *log, log->sec_chan = sec_chan; make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); + + return True; } /******************************************************************* reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) { - if (log == NULL) return; + if (log == NULL) return False; prs_debug(ps, depth, desc, "smb_io_log_info"); depth++; @@ -925,14 +1027,16 @@ void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) prs_uint16("sec_chan", ps, depth, &(log->sec_chan)); smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth); + + return True; } /******************************************************************* reads or writes a DOM_CHAL structure. ********************************************************************/ -void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { - if (chal == NULL) return; + if (chal == NULL) return False; prs_debug(ps, depth, desc, "smb_io_chal"); depth++; @@ -940,14 +1044,16 @@ void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, chal->data, 8); + + return True; } /******************************************************************* reads or writes a DOM_CRED structure. ********************************************************************/ -void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { - if (cred == NULL) return; + if (cred == NULL) return False; prs_debug(ps, depth, desc, "smb_io_cred"); depth++; @@ -956,16 +1062,18 @@ void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) smb_io_chal ("", &(cred->challenge), ps, depth); smb_io_utime("", &(cred->timestamp), ps, depth); + + return True; } /******************************************************************* makes a DOM_CLNT_INFO2 structure. ********************************************************************/ -void make_clnt_info2(DOM_CLNT_INFO2 *clnt, +BOOL make_clnt_info2(DOM_CLNT_INFO2 *clnt, char *logon_srv, char *comp_name, DOM_CRED *clnt_cred) { - if (clnt == NULL) return; + if (clnt == NULL) return False; DEBUG(5,("make_clnt_info: %d\n", __LINE__)); @@ -980,14 +1088,16 @@ void make_clnt_info2(DOM_CLNT_INFO2 *clnt, { clnt->ptr_cred = 0; } + + return True; } /******************************************************************* reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return; + if (clnt == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_info2"); depth++; @@ -1000,30 +1110,34 @@ void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int de prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred)); smb_io_cred ("", &(clnt->cred ), ps, depth); + + return True; } /******************************************************************* makes a DOM_CLNT_INFO structure. ********************************************************************/ -void make_clnt_info(DOM_CLNT_INFO *clnt, +BOOL make_clnt_info(DOM_CLNT_INFO *clnt, char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, DOM_CRED *cred) { - if (clnt == NULL || cred == NULL) return; + if (clnt == NULL || cred == NULL) return False; DEBUG(5,("make_clnt_info\n")); make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name); memcpy(&(clnt->cred), cred, sizeof(clnt->cred)); + + return True; } /******************************************************************* reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return; + if (clnt == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_info"); depth++; @@ -1032,14 +1146,16 @@ void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int dept smb_io_log_info("", &(clnt->login), ps, depth); smb_io_cred ("", &(clnt->cred ), ps, depth); + + return True; } /******************************************************************* makes an OWF_INFO structure. ********************************************************************/ -void make_owf_info(OWF_INFO *hash, uint8 data[16]) +BOOL make_owf_info(OWF_INFO *hash, uint8 data[16]) { - if (hash == NULL) return; + if (hash == NULL) return False; DEBUG(5,("make_owf_info: %d\n", __LINE__)); @@ -1051,14 +1167,16 @@ void make_owf_info(OWF_INFO *hash, uint8 data[16]) { bzero(hash->data, sizeof(hash->data)); } + + return True; } /******************************************************************* reads or writes an OWF_INFO structure. ********************************************************************/ -void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) +BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { - if (hash == NULL) return; + if (hash == NULL) return False; prs_debug(ps, depth, desc, "smb_io_owf_info"); depth++; @@ -1066,14 +1184,16 @@ void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, hash->data, 16); + + return True; } /******************************************************************* reads or writes a DOM_GID structure. ********************************************************************/ -void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) +BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) { - if (gid == NULL) return; + if (gid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_gid"); depth++; @@ -1082,14 +1202,16 @@ void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) prs_uint32("g_rid", ps, depth, &(gid->g_rid)); prs_uint32("attr ", ps, depth, &(gid->attr )); + + return True; } /******************************************************************* reads or writes an POLICY_HND structure. ********************************************************************/ -void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { - if (pol == NULL) return; + if (pol == NULL) return False; prs_debug(ps, depth, desc, "smb_io_pol_hnd"); depth++; @@ -1097,14 +1219,16 @@ void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE); + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +static BOOL smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { - if (d_q == NULL) return; + if (d_q == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_query"); depth++; @@ -1129,31 +1253,37 @@ static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int de { bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid)); } + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { smb_io_dom_query("", d_q, ps, depth); + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { smb_io_dom_query("", d_q, ps, depth); + + return True; } /******************************************************************* reads or writes a UNISTR3 structure. ********************************************************************/ -void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) +BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) { - if (name == NULL) return; + if (name == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unistr3"); depth++; @@ -1166,5 +1296,7 @@ void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) /* assume unicode string is unicode-null-terminated, instead */ prs_unistr3(True, "unistr", name, ps, depth); + + return True; } |