From db20ab9bbdcc8fbfa81883c2d0c952386820de4c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Oct 1997 19:02:55 +0000 Subject: getting somewhere. ipc.c : removed srvsvc pipe reference: have to do that. pipes.c lsaparse.c smbparse.c : more debugging info. looks a bit like netmon output. (This used to be commit e02aa88e25ae6d4da7953aaff04ff2ae9a656d05) --- source3/include/byteorder.h | 6 +- source3/include/proto.h | 50 ++++---- source3/lsaparse.c | 100 +++++++-------- source3/smbd/ipc.c | 7 +- source3/smbd/pipes.c | 109 +++++++++------- source3/smbparse.c | 300 +++++++++++++++++++++++++++----------------- 6 files changed, 330 insertions(+), 242 deletions(-) (limited to 'source3') diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h index e8989ee7e4..c0e38adc2b 100644 --- a/source3/include/byteorder.h +++ b/source3/include/byteorder.h @@ -215,15 +215,15 @@ it also defines lots of intermediate macros, just ignore those :-) #define DBG_RW_CVAL(string,depth,base,read,inbuf,outbuf) \ RW_CVAL(read,inbuf,outbuf,0) \ DEBUG(5,("%s %04x %s: %02x\n", \ - tab_depth(depth), PTR_DIFF(inbuf,base),string, (unsigned int)*(inbuf))); + tab_depth(depth), PTR_DIFF(inbuf,base),string, *(inbuf))); #define DBG_RW_SVAL(string,depth,base,read,inbuf,outbuf) \ RW_SVAL(read,inbuf,outbuf,0) \ DEBUG(5,("%s %04x %s: %04x\n", \ - tab_depth(depth), PTR_DIFF(inbuf,base),string, (unsigned int)*(inbuf))); + tab_depth(depth), PTR_DIFF(inbuf,base),string, *(inbuf))); #define DBG_RW_IVAL(string,depth,base,read,inbuf,outbuf) \ RW_IVAL(read,inbuf,outbuf,0) \ DEBUG(5,("%s %04x %s: %08x\n", \ - tab_depth(depth), PTR_DIFF(inbuf,base),string, (unsigned int)*(inbuf))); + tab_depth(depth), PTR_DIFF(inbuf,base),string, *(inbuf))); diff --git a/source3/include/proto.h b/source3/include/proto.h index 1ac4132807..72b15173ec 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -818,32 +818,32 @@ void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24); /*The following definitions come from smbparse.c */ -char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align); -char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align); -char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align); -char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align); -char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align); -char* smb_io_unistr(BOOL io, UNISTR *uni, char *q, char *base, int align); -char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align); -char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align); -char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align); -char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align); -char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align); -char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align); -char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align); -char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align); -char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align); -char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align); -char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align); -char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align); -char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align); +char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align, int depth); +char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align, int depth); +char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align, int depth); +char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align, int depth); +char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align, int depth); +char* smb_io_unistr(BOOL io, UNISTR *uni, char *q, char *base, int align, int depth); +char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align, int depth); +char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align, int depth); +char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, int depth); +char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align, int depth); +char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align, int depth); +char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align, int depth); +char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align, int depth); +char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align, int depth); +char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, int depth); +char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align, int depth); +char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align, int depth); +char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align, int depth); +char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align, int depth); char* smb_io_pol_hnd(BOOL io, LSA_POL_HND *pol, char *q, char *base, int align, int depth); -char* smb_io_dom_query_3(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align); -char* smb_io_dom_query_5(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align); -char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align); -char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align); -char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align); -char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align); +char* smb_io_dom_query_3(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth); +char* smb_io_dom_query_5(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth); +char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align, int depth); +char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align, int depth); +char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align, int depth); +char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align, int depth); /*The following definitions come from smbpass.c */ diff --git a/source3/lsaparse.c b/source3/lsaparse.c index ee73dd9a05..34f4cb4048 100644 --- a/source3/lsaparse.c +++ b/source3/lsaparse.c @@ -31,7 +31,7 @@ char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int a { if (r_p == NULL) return NULL; - DEBUG(5,("%slsa_io_r_open_pol\n", tab_depth(depth))); + DEBUG(5,("%s%04x lsa_io_r_open_pol\n", tab_depth(depth), PTR_DIFF(q, base))); depth++; q = smb_io_pol_hnd(io, &(r_p->pol), q, base, align, depth); @@ -78,12 +78,12 @@ char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int al { case 3: { - q = smb_io_dom_query_3(io, &(r_q->dom.id3), q, base, align); + q = smb_io_dom_query_3(io, &(r_q->dom.id3), q, base, align, depth); break; } case 5: { - q = smb_io_dom_query_5(io, &(r_q->dom.id3), q, base, align); + q = smb_io_dom_query_5(io, &(r_q->dom.id3), q, base, align, depth); break; } default: @@ -128,7 +128,7 @@ char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base, for (i = 0; i < q_s->num_entries; i++) { - q = smb_io_dom_sid(io, &(q_s->dom_sids[i]), q, base, align); /* domain SIDs to be looked up. */ + q = smb_io_dom_sid(io, &(q_s->dom_sids[i]), q, base, align, depth); /* domain SIDs to be looked up. */ } DBG_RW_PCVAL("undoc", depth, base, io, q, q_s->undoc, 16); q += 16; /* completely undocumented 16 bytes */ @@ -150,7 +150,7 @@ char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, q = align_offset(q, base, align); - q = smb_io_dom_r_ref(io, &(r_s->dom_ref), q, base, align); /* domain reference info */ + q = smb_io_dom_r_ref(io, &(r_s->dom_ref), q, base, align, depth); /* domain reference info */ DBG_RW_IVAL("num_entries", depth, base, io, q, r_s->num_entries); q += 4; DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_s->undoc_buffer); q += 4; @@ -158,7 +158,7 @@ char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, for (i = 0; i < r_s->num_entries2; i++) { - q = smb_io_dom_sid2(io, &(r_s->dom_sid[i]), q, base, align); /* domain SIDs being looked up */ + q = smb_io_dom_sid2(io, &(r_s->dom_sid[i]), q, base, align, depth); /* domain SIDs being looked up */ } DBG_RW_IVAL("num_entries3", depth, base, io, q, r_s->num_entries3); q += 4; @@ -191,7 +191,7 @@ char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base, for (i = 0; i < q_r->num_entries; i++) { - q = smb_io_dom_name(io, &(q_r->lookup_name[i]), q, base, 0); /* names to be looked up */ + q = smb_io_dom_name(io, &(q_r->lookup_name[i]), q, base, align, depth); /* names to be looked up */ } DBG_RW_PCVAL("undoc", depth, base, io, q, q_r->undoc, UNKNOWN_LEN); q += UNKNOWN_LEN; /* completely undocumented bytes of unknown length */ @@ -213,7 +213,7 @@ char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, q = align_offset(q, base, align); - q = smb_io_dom_r_ref(io, &(r_r->dom_ref), q, base, align); /* domain reference info */ + q = smb_io_dom_r_ref(io, &(r_r->dom_ref), q, base, align, depth); /* domain reference info */ DBG_RW_IVAL("num_entries", depth, base, io, q, r_r->num_entries); q += 4; DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_r->undoc_buffer); q += 4; @@ -221,7 +221,7 @@ char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, for (i = 0; i < r_r->num_entries2; i++) { - q = smb_io_dom_rid2(io, &(r_r->dom_rid[i]), q, base, align); /* domain RIDs being looked up */ + q = smb_io_dom_rid2(io, &(r_r->dom_rid[i]), q, base, align, depth); /* domain RIDs being looked up */ } DBG_RW_IVAL("num_entries3", depth, base, io, q, r_r->num_entries3); q += 4; @@ -243,9 +243,11 @@ char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int a q = align_offset(q, base, align); - q = smb_io_unistr2(io, &(q_c->uni_logon_srv), q, base, align); /* logon server unicode string */ - q = smb_io_unistr2(io, &(q_c->uni_logon_clnt), q, base, align); /* logon client unicode string */ - q = smb_io_chal(io, &(q_c->clnt_chal), q, base, align); /* client challenge */ + DBG_RW_IVAL("undoc_buffer", depth, base, io, q, q_c->undoc_buffer); q += 4; + + q = smb_io_unistr2(io, &(q_c->uni_logon_srv), q, base, align, depth); /* logon server unicode string */ + q = smb_io_unistr2(io, &(q_c->uni_logon_clnt), q, base, align, depth); /* logon client unicode string */ + q = smb_io_chal(io, &(q_c->clnt_chal), q, base, align, depth); /* client challenge */ return q; } @@ -262,7 +264,7 @@ char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int a q = align_offset(q, base, align); - q = smb_io_chal(io, &(r_c->srv_chal), q, base, align); /* server challenge */ + q = smb_io_chal(io, &(r_c->srv_chal), q, base, align, depth); /* server challenge */ DBG_RW_IVAL("status", depth, base, io, q, r_c->status); q += 4; @@ -282,9 +284,9 @@ char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align q = align_offset(q, base, align); - q = smb_io_log_info (io, &(q_a->clnt_id), q, base, align); /* client identification info */ - q = smb_io_chal (io, &(q_a->clnt_chal), q, base, align); /* client-calculated credentials */ - q = smb_io_neg_flags(io, &(q_a->clnt_flgs), q, base, align); + q = smb_io_log_info (io, &(q_a->clnt_id), q, base, align, depth); /* client identification info */ + q = smb_io_chal (io, &(q_a->clnt_chal), q, base, align, depth); /* client-calculated credentials */ + q = smb_io_neg_flags(io, &(q_a->clnt_flgs), q, base, align, depth); return q; } @@ -301,8 +303,8 @@ char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align q = align_offset(q, base, align); - q = smb_io_chal (io, &(r_a->srv_chal), q, base, align); /* server challenge */ - q = smb_io_neg_flags(io, &(r_a->srv_flgs), q, base, align); + q = smb_io_chal (io, &(r_a->srv_chal), q, base, align, depth); /* server challenge */ + q = smb_io_neg_flags(io, &(r_a->srv_flgs), q, base, align, depth); DBG_RW_IVAL("status", depth, base, io, q, r_a->status); q += 4; @@ -322,7 +324,7 @@ char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int q = align_offset(q, base, align); - q = smb_io_clnt_info(io, &(q_s->clnt_id), q, base, align); /* client identification/authentication info */ + q = smb_io_clnt_info(io, &(q_s->clnt_id), q, base, align, depth); /* client identification/authentication info */ DBG_RW_PCVAL("pwd", depth, base, io, q, q_s->pwd, 16); q += 16; /* new password - undocumented */ return q; @@ -340,7 +342,7 @@ char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int q = align_offset(q, base, align); - q = smb_io_cred(io, &(r_s->srv_cred), q, base, align); /* server challenge */ + q = smb_io_cred(io, &(r_s->srv_cred), q, base, align, depth); /* server challenge */ DBG_RW_IVAL("status", depth, base, io, q, r_s->status); q += 4; @@ -365,19 +367,19 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali DBG_RW_IVAL("", depth, base, io, q, usr->undoc_buffer); q += 4; - q = smb_io_time(io, &(usr->logon_time) , q, base, align); /* logon time */ - q = smb_io_time(io, &(usr->logoff_time) , q, base, align); /* logoff time */ - q = smb_io_time(io, &(usr->kickoff_time) , q, base, align); /* kickoff time */ - q = smb_io_time(io, &(usr->pass_last_set_time) , q, base, align); /* password last set time */ - q = smb_io_time(io, &(usr->pass_can_change_time) , q, base, align); /* password can change time */ - q = smb_io_time(io, &(usr->pass_must_change_time), q, base, align); /* password must change time */ + q = smb_io_time(io, &(usr->logon_time) , q, base, align, depth); /* logon time */ + q = smb_io_time(io, &(usr->logoff_time) , q, base, align, depth); /* logoff time */ + q = smb_io_time(io, &(usr->kickoff_time) , q, base, align, depth); /* kickoff time */ + q = smb_io_time(io, &(usr->pass_last_set_time) , q, base, align, depth); /* password last set time */ + q = smb_io_time(io, &(usr->pass_can_change_time) , q, base, align, depth); /* password can change time */ + q = smb_io_time(io, &(usr->pass_must_change_time), q, base, align, depth); /* password must change time */ - q = smb_io_unihdr(io, &(usr->hdr_user_name) , q, base, align); /* username unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_full_name) , q, base, align); /* user's full name unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_logon_script), q, base, align); /* logon script unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_profile_path), q, base, align); /* profile path unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_home_dir) , q, base, align); /* home directory unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_dir_drive) , q, base, align); /* home directory drive unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_user_name) , q, base, align, depth); /* username unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_full_name) , q, base, align, depth); /* user's full name unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_logon_script), q, base, align, depth); /* logon script unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_profile_path), q, base, align, depth); /* profile path unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_home_dir) , q, base, align, depth); /* home directory unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_dir_drive) , q, base, align, depth); /* home directory drive unicode string header */ DBG_RW_SVAL("logon_count", depth, base, io, q, usr->logon_count ); q += 2; /* logon count */ DBG_RW_SVAL("bad_pw_count", depth, base, io, q, usr->bad_pw_count); q += 2; /* bad password count */ @@ -390,8 +392,8 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali DBG_RW_PCVAL("", depth, base, io, q, usr->sess_key, 16); q += 16; /* unused user session key */ - q = smb_io_unihdr(io, &(usr->hdr_logon_srv), q, base, align); /* logon server unicode string header */ - q = smb_io_unihdr(io, &(usr->hdr_logon_dom), q, base, align); /* logon domain unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_logon_srv), q, base, align, depth); /* logon server unicode string header */ + q = smb_io_unihdr(io, &(usr->hdr_logon_dom), q, base, align, depth); /* logon domain unicode string header */ DBG_RW_IVAL("buffer_dom_id", depth, base, io, q, usr->buffer_dom_id); q += 4; /* undocumented logon domain id pointer */ DBG_RW_PCVAL("padding", depth, base, io, q, usr->padding, 40); q += 40; /* unused padding bytes? */ @@ -399,27 +401,27 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali DBG_RW_IVAL("num_other_sids", depth, base, io, q, usr->num_other_sids); q += 4; /* 0 - num_sids */ DBG_RW_IVAL("buffer_other_sids", depth, base, io, q, usr->buffer_other_sids); q += 4; /* NULL - undocumented pointer to SIDs. */ - q = smb_io_unistr2(io, &(usr->uni_user_name) , q, base, align); /* username unicode string */ - q = smb_io_unistr2(io, &(usr->uni_full_name) , q, base, align); /* user's full name unicode string */ - q = smb_io_unistr2(io, &(usr->uni_logon_script), q, base, align); /* logon script unicode string */ - q = smb_io_unistr2(io, &(usr->uni_profile_path), q, base, align); /* profile path unicode string */ - q = smb_io_unistr2(io, &(usr->uni_home_dir) , q, base, align); /* home directory unicode string */ - q = smb_io_unistr2(io, &(usr->uni_dir_drive) , q, base, align); /* home directory drive unicode string */ + q = smb_io_unistr2(io, &(usr->uni_user_name) , q, base, align, depth); /* username unicode string */ + q = smb_io_unistr2(io, &(usr->uni_full_name) , q, base, align, depth); /* user's full name unicode string */ + q = smb_io_unistr2(io, &(usr->uni_logon_script), q, base, align, depth); /* logon script unicode string */ + q = smb_io_unistr2(io, &(usr->uni_profile_path), q, base, align, depth); /* profile path unicode string */ + q = smb_io_unistr2(io, &(usr->uni_home_dir) , q, base, align, depth); /* home directory unicode string */ + q = smb_io_unistr2(io, &(usr->uni_dir_drive) , q, base, align, depth); /* home directory drive unicode string */ DBG_RW_IVAL("num_groups2", depth, base, io, q, usr->num_groups2); q += 4; /* num groups */ for (i = 0; i < usr->num_groups2; i++) { - q = smb_io_gid(io, &(usr->gids[i]), q, base, align); /* group info */ + q = smb_io_gid(io, &(usr->gids[i]), q, base, align, depth); /* group info */ } - q = smb_io_unistr2(io, &( usr->uni_logon_srv), q, base, align); /* logon server unicode string */ - q = smb_io_unistr2(io, &( usr->uni_logon_dom), q, base, align); /* logon domain unicode string */ + q = smb_io_unistr2(io, &( usr->uni_logon_srv), q, base, align, depth); /* logon server unicode string */ + q = smb_io_unistr2(io, &( usr->uni_logon_dom), q, base, align, depth); /* logon domain unicode string */ - q = smb_io_dom_sid(io, &(usr->dom_sid), q, base, align); /* domain SID */ + q = smb_io_dom_sid(io, &(usr->dom_sid), q, base, align, depth); /* domain SID */ for (i = 0; i < usr->num_other_sids; i++) { - q = smb_io_dom_sid(io, &(usr->other_sids[i]), q, base, align); /* other domain SIDs */ + q = smb_io_dom_sid(io, &(usr->other_sids[i]), q, base, align, depth); /* other domain SIDs */ } return q; @@ -437,7 +439,7 @@ char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int q = align_offset(q, base, align); - q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align); /* domain SID */ + q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align, depth); /* domain SID */ return q; } @@ -455,7 +457,7 @@ char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int q = align_offset(q, base, align); DBG_RW_IVAL("buffer_creds", depth, base, io, q, r_l->buffer_creds); q += 4; /* undocumented buffer pointer */ - q = smb_io_cred(io, &(r_l->srv_creds), q, base, align); /* server credentials. server time stamp appears to be ignored. */ + q = smb_io_cred(io, &(r_l->srv_creds), q, base, align, depth); /* server credentials. server time stamp appears to be ignored. */ DBG_RW_IVAL("buffer_user", depth, base, io, q, r_l->buffer_user); q += 4; if (r_l->buffer_user != 0) @@ -482,7 +484,7 @@ char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, i q = align_offset(q, base, align); - q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align); /* domain SID */ + q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align, depth); /* domain SID */ return q; } @@ -500,7 +502,7 @@ char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, i q = align_offset(q, base, align); DBG_RW_IVAL("buffer_creds", depth, base, io, q, r_l->buffer_creds); q += 4; /* undocumented buffer pointer */ - q = smb_io_cred(io, &(r_l->srv_creds), q, base, align); /* server credentials. server time stamp appears to be ignored. */ + q = smb_io_cred(io, &(r_l->srv_creds), q, base, align, depth); /* server credentials. server time stamp appears to be ignored. */ DBG_RW_IVAL("status", depth, base, io, q, r_l->status); q += 4; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index b314d41679..468d34e157 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -2762,13 +2762,14 @@ struct BOOL (*fn) (); } api_fd_commands [] = { - { "SetNmdPpHndState", "lsarpc", 1, api_LsarpcSNPHS }, #ifdef NTDOMAIN + { "SetNmdPpHndState", "lsarpc", 1, api_LsarpcSNPHS }, + { "SetNmdPpHndState", "NETLOGON", 1, api_LsarpcSNPHS }, { "TransactNmPipe", "lsarpc", 0x26, api_ntLsarpcTNP }, { "TransactNmPipe", "NETLOGON", 0x26, api_netlogrpcTNP }, - { "SetNmdPpHndState", "NETLOGON", 1, api_netlogrpcTNP }, #else - { "TransactNmPipe", "lsarpc", 0x26, api_LsarpcTNP }, + { "SetNmdPpHndState", "lsarpc", 1, api_LsarpcSNPHS }, + { "TransactNmPipe" , "lsarpc", 0x26, api_LsarpcTNP }, #endif { NULL, NULL, -1, (BOOL (*)())api_Unsupported } }; diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 4f1d015216..eb8215b7a3 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -53,11 +53,10 @@ a packet to ensure chaining works correctly */ char * known_pipes [] = { + "lsarpc", #if NTDOMAIN "NETLOGON", - "srvsvc", #endif - "lsarpc", NULL }; @@ -483,7 +482,7 @@ static void create_rpc_reply(RPC_HDR *hdr, uint32 call_id, int data_len) hdr->minor = 0; /* minor version 0 */ hdr->pkt_type = 2; /* RPC response packet */ hdr->frag = 3; /* first frag + last frag */ - hdr->pack_type = 0x10; /* packed data representation */ + hdr->pack_type = 1; /* packed data representation */ hdr->frag_len = data_len; /* fragment length, fill in later */ hdr->auth_len = 0; /* authentication length */ hdr->call_id = call_id; /* call identifier - match incoming RPC */ @@ -495,32 +494,24 @@ static void create_rpc_reply(RPC_HDR *hdr, uint32 call_id, int data_len) static int make_rpc_reply(char *inbuf, char *q, int data_len) { - uint32 callid = IVAL(inbuf, 12); + uint32 callid = RIVAL(inbuf, 12); RPC_HDR hdr; - DEBUG(5,("make_rpc_reply. callid: %x\n", callid)); - create_rpc_reply(&hdr, callid, data_len); - return PTR_DIFF(smb_io_rpc_hdr(False, &hdr, q, q, 4), q); + return smb_io_rpc_hdr(False, &hdr, q, q, 4, 0) - q; } static int lsa_reply_open_policy(char *q, char *base) { int i; + char *start = q; LSA_R_OPEN_POL r_o; - static char handle[20] = - { 0x00, 0x00, 0x00, 0x00, - 0x2f, 0x79, 0x0a, 0x81, - 0xd5, 0x17, 0xd1, 0x11, - 0x80, 0xaf, 0x96, 0xcd, - 0x50, 0xf8, 0xbc, 0x6c - }; /* set up the LSA QUERY INFO response */ /* bzero(&(r_o.pol.data), POL_HND_SIZE); */ for (i = 0; i < POL_HND_SIZE; i++) { - r_o.pol.data[i] = handle[i]; + r_o.pol.data[i] = i; } r_o.status = 0x0; @@ -528,7 +519,7 @@ static int lsa_reply_open_policy(char *q, char *base) q = lsa_io_r_open_pol(False, &r_o, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint16 terminate) @@ -602,6 +593,7 @@ static void make_dom_query(DOM_QUERY *d_q, char *dom_name, char *dom_sid) static int lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, char *q, char *base, char *dom_name, char *dom_sid) { + char *start = q; LSA_R_QUERY_INFO r_q; /* set up the LSA QUERY INFO response */ @@ -617,7 +609,7 @@ static int lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, char *q, char *base, q = lsa_io_r_query(False, &r_q, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } /* pretty much hard-coded choice of "other" sids, unfortunately... */ @@ -701,6 +693,7 @@ static int lsa_reply_lookup_sids(char *q, char *base, char *dom_name, char *dom_sid, char *other_sid1, char *other_sid2, char *other_sid3) { + char *start = q; LSA_R_LOOKUP_SIDS r_l; /* set up the LSA Lookup SIDs response */ @@ -712,7 +705,7 @@ static int lsa_reply_lookup_sids(char *q, char *base, q = lsa_io_r_lookup_sids(False, &r_l, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static int lsa_reply_lookup_rids(char *q, char *base, @@ -720,6 +713,7 @@ static int lsa_reply_lookup_rids(char *q, char *base, char *dom_name, char *dom_sid, char *other_sid1, char *other_sid2, char *other_sid3) { + char *start = q; LSA_R_LOOKUP_RIDS r_l; /* set up the LSA Lookup RIDs response */ @@ -731,7 +725,7 @@ static int lsa_reply_lookup_rids(char *q, char *base, q = lsa_io_r_lookup_rids(False, &r_l, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void make_lsa_r_req_chal(LSA_R_REQ_CHAL *r_c, @@ -739,11 +733,16 @@ static void make_lsa_r_req_chal(LSA_R_REQ_CHAL *r_c, { memcpy(r_c->srv_chal.data, srv_chal->data, sizeof(r_c->srv_chal.data)); r_c->status = status; + + DEBUG(5,("make_lsa_r_req_chal srv_chal: %lx %lx\n", + *(uint32*)(&((r_c->srv_chal.data[0]))), + *(uint32*)(&((r_c->srv_chal.data[4]))) )); } static int lsa_reply_req_chal(LSA_Q_REQ_CHAL *q_c, char *q, char *base, DOM_CHAL *srv_chal) { + char *start = q; LSA_R_REQ_CHAL r_c; /* set up the LSA REQUEST CHALLENGE response */ @@ -754,7 +753,7 @@ static int lsa_reply_req_chal(LSA_Q_REQ_CHAL *q_c, char *q, char *base, q = lsa_io_r_req_chal(False, &r_c, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void make_lsa_r_auth_2(LSA_R_AUTH_2 *r_a, @@ -768,6 +767,7 @@ static void make_lsa_r_auth_2(LSA_R_AUTH_2 *r_a, static int lsa_reply_auth_2(LSA_Q_AUTH_2 *q_a, char *q, char *base, DOM_CHAL *resp_cred, int status) { + char *start = q; LSA_R_AUTH_2 r_a; /* set up the LSA AUTH 2 response */ @@ -778,7 +778,7 @@ static int lsa_reply_auth_2(LSA_Q_AUTH_2 *q_a, char *q, char *base, q = lsa_io_r_auth_2(False, &r_a, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void make_lsa_r_srv_pwset(LSA_R_SRV_PWSET *r_a, @@ -791,6 +791,7 @@ static void make_lsa_r_srv_pwset(LSA_R_SRV_PWSET *r_a, static int lsa_reply_srv_pwset(LSA_Q_SRV_PWSET *q_s, char *q, char *base, DOM_CRED *srv_cred, int status) { + char *start = q; LSA_R_SRV_PWSET r_s; /* set up the LSA Server Password Set response */ @@ -800,7 +801,7 @@ static int lsa_reply_srv_pwset(LSA_Q_SRV_PWSET *q_s, char *q, char *base, q = lsa_io_r_srv_pwset(False, &r_s, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void make_lsa_user_info(LSA_USER_INFO *usr, @@ -919,6 +920,7 @@ static void make_lsa_user_info(LSA_USER_INFO *usr, static int lsa_reply_sam_logon(LSA_Q_SAM_LOGON *q_s, char *q, char *base, DOM_CRED *srv_cred, LSA_USER_INFO *user_info) { + char *start = q; LSA_R_SAM_LOGON r_s; /* XXXX maybe we want to say 'no', reject the client's credentials */ @@ -934,7 +936,7 @@ static int lsa_reply_sam_logon(LSA_Q_SAM_LOGON *q_s, char *q, char *base, q = lsa_io_r_sam_logon(False, &r_s, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } @@ -942,6 +944,7 @@ static int lsa_reply_sam_logoff(LSA_Q_SAM_LOGOFF *q_s, char *q, char *base, DOM_CRED *srv_cred, uint32 status) { + char *start = q; LSA_R_SAM_LOGOFF r_s; /* XXXX maybe we want to say 'no', reject the client's credentials */ @@ -954,23 +957,31 @@ static int lsa_reply_sam_logoff(LSA_Q_SAM_LOGOFF *q_s, char *q, char *base, q = lsa_io_r_sam_logoff(False, &r_s, q, base, 4, 0); /* return length of SMB data stored */ - return PTR_DIFF(q, base); + return q - start; } static void api_lsa_open_policy( char *param, char *data, char **rdata, int *rdata_len ) { + int reply_len; + /* we might actually want to decode the query, but it's not necessary */ /* lsa_io_q_open_policy(...); */ - /* construct a 20 byte policy handle. return length*/ - *rdata_len = lsa_reply_open_policy(*rdata + 0x18, *rdata); + /* return a 20 byte policy handle */ + reply_len = lsa_reply_open_policy(*rdata + 0x18, *rdata + 0x18); + + /* construct header, now that we know the reply length */ + make_rpc_reply(data, *rdata, reply_len); + *rdata_len = reply_len + 0x18; } -static int api_lsa_query_info( char *param, char *data, +static void api_lsa_query_info( char *param, char *data, char **rdata, int *rdata_len ) { + int reply_len; + LSA_Q_QUERY_INFO q_i; pstring dom_name; pstring dom_sid; @@ -982,13 +993,19 @@ static int api_lsa_query_info( char *param, char *data, pstrcpy(dom_sid , lp_domainsid()); /* construct reply. return status is always 0x0 */ - return lsa_reply_query_info(&q_i, *rdata + 0x18, *rdata, + reply_len = lsa_reply_query_info(&q_i, *rdata + 0x18, *rdata + 0x18, dom_name, dom_sid); + + /* construct header, now that we know the reply length */ + make_rpc_reply(data, *rdata, reply_len); + *rdata_len = reply_len + 0x18; } static void api_lsa_lookup_sids( char *param, char *data, char **rdata, int *rdata_len ) { + int reply_len; + int i; LSA_Q_LOOKUP_SIDS q_l; pstring dom_name; @@ -1008,15 +1025,21 @@ static void api_lsa_lookup_sids( char *param, char *data, } /* construct reply. return status is always 0x0 */ - *rdata_len = lsa_reply_lookup_sids(*rdata + 0x18, *rdata, + reply_len = lsa_reply_lookup_sids(*rdata + 0x18, *rdata + 0x18, q_l.num_entries, dom_sids, /* text-converted SIDs */ dom_name, dom_sid, /* domain name, domain SID */ "S-1-1", "S-1-3", "S-1-5"); /* the three other SIDs */ + + /* construct header, now that we know the reply length */ + make_rpc_reply(data, *rdata, reply_len); + *rdata_len = reply_len + 0x18; } static void api_lsa_lookup_names( char *param, char *data, char **rdata, int *rdata_len ) { + int reply_len; + int i; LSA_Q_LOOKUP_RIDS q_l; pstring dom_name; @@ -1037,10 +1060,14 @@ static void api_lsa_lookup_names( char *param, char *data, } /* construct reply. return status is always 0x0 */ - *rdata_len = lsa_reply_lookup_rids(*rdata + 0x18, *rdata, + reply_len = lsa_reply_lookup_rids(*rdata + 0x18, *rdata + 0x18, q_l.num_entries, dom_rids, /* text-converted SIDs */ dom_name, dom_sid, /* domain name, domain SID */ "S-1-1", "S-1-3", "S-1-5"); /* the three other SIDs */ + + /* construct header, now that we know the reply length */ + make_rpc_reply(data, *rdata, reply_len); + *rdata_len = reply_len + 0x18; } BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data, @@ -1065,8 +1092,6 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data, { DEBUG(3,("LSA_OPENPOLICY\n")); api_lsa_open_policy(param, data, rdata, rdata_len); - make_rpc_reply(data, *rdata, *rdata_len); - break; } @@ -1075,8 +1100,6 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data, DEBUG(3,("LSA_QUERYINFOPOLICY\n")); api_lsa_query_info(param, data, rdata, rdata_len); - make_rpc_reply(data, *rdata, *rdata_len); - break; } @@ -1138,8 +1161,6 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data, { DEBUG(3,("LSA_OPENSECRET\n")); api_lsa_lookup_sids(param, data, rdata, rdata_len); - make_rpc_reply(data, *rdata, *rdata_len); - break; } @@ -1147,8 +1168,6 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data, { DEBUG(3,("LSA_LOOKUPNAMES\n")); api_lsa_lookup_names(param, data, rdata, rdata_len); - make_rpc_reply(data, *rdata, *rdata_len); - break; } @@ -1642,16 +1661,10 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data, char **rdata,char **rparam, int *rdata_len,int *rparam_len) { - uint16 opnum; - char pkttype; - user_struct *vuser; - - DEBUG(5,("api_netlogrpcTNP data:%x\n", data)); - - if (data == NULL) return False; + uint16 opnum = SVAL(data,22); + int pkttype = CVAL(data, 2); - opnum = SVAL(data,22); - pkttype = CVAL(data, 2); + user_struct *vuser; if (pkttype == 0x0b) /* RPC BIND */ { @@ -1660,7 +1673,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data, return True; } - DEBUG(4,("netlogon TransactNamedPipe op %x\n", opnum)); + DEBUG(4,("netlogon TransactNamedPipe op %x\n",opnum)); if ((vuser = get_valid_user_struct(uid)) == NULL) return False; diff --git a/source3/smbparse.c b/source3/smbparse.c index a0363c7108..d7fbf53020 100644 --- a/source3/smbparse.c +++ b/source3/smbparse.c @@ -27,13 +27,16 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a UTIME type. ********************************************************************/ -char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align) +char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align, int depth) { if (t == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_utime\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL (io, q, t->time, 0); q += 4; + DBG_RW_IVAL ("time", depth, base, io, q, t->time); q += 4; return q; } @@ -41,14 +44,17 @@ char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align) /******************************************************************* reads or writes an NTTIME structure. ********************************************************************/ -char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align) +char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align, int depth) { if (nttime == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_time\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, nttime->low , 0); q += 4; /* low part */ - RW_IVAL(io, q, nttime->high, 0); q += 4; /* high part */ + DBG_RW_IVAL("low", depth, base, io, q, nttime->low ); q += 4; /* low part */ + DBG_RW_IVAL("high", depth, base, io, q, nttime->high); q += 4; /* high part */ return q; } @@ -56,26 +62,31 @@ char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ -char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align) +char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align, int depth) { int i; if (sid == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_dom_sid\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_CVAL(io, q, sid->sid_no, 0); q++; - RW_CVAL(io, q, sid->num_auths, 0); q++; + DBG_RW_CVAL("sid_no", depth, base, io, q, sid->sid_no); q++; + DBG_RW_CVAL("num_auths", depth, base, io, q, sid->num_auths); q++; for (i = 0; i < 6; i++) { - RW_CVAL(io, q, sid->id_auth[i], 0); q++; + fstring tmp; + sprintf(tmp, "id_auth[%d] ", i); + DBG_RW_CVAL(tmp, depth, base, io, q, sid->id_auth[i]); q++; } /* oops! XXXX should really issue a warning here... */ if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; - RW_PSVAL(io, q, sid->sub_auths, sid->num_auths); q += sid->num_auths * 2; + DBG_RW_PSVAL("num_auths", depth, base, io, q, sid->sub_auths, sid->num_auths); q += sid->num_auths * 2; return q; } @@ -83,18 +94,21 @@ char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align) /******************************************************************* reads or writes a UNIHDR structure. ********************************************************************/ -char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align) +char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align, int depth) { if (hdr == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_unihdr\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + /* should be value 4, so enforce it. */ hdr->undoc = 4; q = align_offset(q, base, align); - RW_IVAL(io, q, hdr->uni_max_len, 0); q += 4; - RW_IVAL(io, q, hdr->uni_str_len, 0); q += 4; - RW_IVAL(io, q, hdr->undoc , 0); q += 4; + DBG_RW_IVAL("uni_max_len", depth, base, io, q, hdr->uni_max_len); q += 4; + DBG_RW_IVAL("uni_str_len", depth, base, io, q, hdr->uni_str_len); q += 4; + DBG_RW_IVAL("undoc", depth, base, io, q, hdr->undoc ); q += 4; return q; } @@ -102,14 +116,17 @@ char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align) /******************************************************************* reads or writes a UNIHDR2 structure. ********************************************************************/ -char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align) +char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align, int depth) { if (hdr2 == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_unihdr2\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - q = smb_io_unihdr(io, &(hdr2->unihdr), q, base, align); - RW_IVAL(io, q, hdr2->undoc_buffer, 0); q += 4; + q = smb_io_unihdr(io, &(hdr2->unihdr), q, base, align, depth); + DBG_RW_IVAL("undoc_buffer", depth, base, io, q, hdr2->undoc_buffer); q += 4; return q; } @@ -118,10 +135,13 @@ char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align) reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -char* smb_io_unistr(BOOL io, UNISTR *uni, char *q, char *base, int align) +char* smb_io_unistr(BOOL io, UNISTR *uni, char *q, char *base, int align, int depth) { if (uni == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_unistr\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); if (io) @@ -143,18 +163,21 @@ 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. ********************************************************************/ -char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align) +char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align, int depth) { if (uni2 == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_unistr2\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); /* should be value 0, so enforce it. */ uni2->undoc = 0; - RW_IVAL(io, q, uni2->uni_max_len, 0); q += 4; - RW_IVAL(io, q, uni2->undoc , 0); q += 4; - RW_IVAL(io, q, uni2->uni_str_len, 0); q += 4; + DBG_RW_IVAL("uni_max_len", depth, base, io, q, uni2->uni_max_len); q += 4; + DBG_RW_IVAL("undoc", depth, base, io, q, uni2->undoc ); q += 4; + DBG_RW_IVAL("uni_str_len", depth, base, io, q, uni2->uni_str_len); q += 4; /* oops! XXXX maybe issue a warning that this is happening... */ if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN; @@ -162,7 +185,7 @@ char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align) /* buffer advanced by indicated length of string NOT by searching for null-termination */ - RW_PSVAL(io, q, uni2->buffer, uni2->uni_max_len); q += uni2->uni_max_len * 2; + DBG_RW_PSVAL("", depth, base, io, q, uni2->buffer, uni2->uni_max_len); q += uni2->uni_max_len * 2; return q; } @@ -170,10 +193,13 @@ char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_SID2 structure. ********************************************************************/ -char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align) +char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align, int depth) { if (sid2 == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_dom_sid2\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); /* should be value 5, so enforce it */ @@ -182,11 +208,11 @@ char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align) /* should be value 0, so enforce it */ sid2->undoc = 0; - RW_IVAL(io, q, sid2->type , 0); q += 4; - RW_IVAL(io, q, sid2->undoc, 0); q += 4; + DBG_RW_IVAL("type", depth, base, io, q, sid2->type ); q += 4; + DBG_RW_IVAL("undoc", depth, base, io, q, sid2->undoc); q += 4; - q = smb_io_unihdr2(io, &(sid2->hdr), q, base, align); - q = smb_io_unistr (io, &(sid2->str), q, base, align); + q = smb_io_unihdr2(io, &(sid2->hdr), q, base, align, depth); + q = smb_io_unistr (io, &(sid2->str), q, base, align, depth); return q; } @@ -194,10 +220,13 @@ char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_RID2 structure. ********************************************************************/ -char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align) +char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, int depth) { if (rid2 == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_dom_rid2\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); /* should be value 5, so enforce it */ @@ -206,10 +235,10 @@ char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align) /* should be value 5, so enforce it */ rid2->undoc = 5; - RW_IVAL(io, q, rid2->type, 0); q += 4; - RW_IVAL(io, q, rid2->undoc , 0); q += 4; - RW_IVAL(io, q, rid2->rid , 0); q += 4; - RW_IVAL(io, q, rid2->rid_idx , 0); q += 4; + DBG_RW_IVAL("type", depth, base, io, q, rid2->type); q += 4; + DBG_RW_IVAL("undoc", depth, base, io, q, rid2->undoc ); q += 4; + DBG_RW_IVAL("rid", depth, base, io, q, rid2->rid ); q += 4; + DBG_RW_IVAL("rid_idx", depth, base, io, q, rid2->rid_idx ); q += 4; return q; } @@ -217,21 +246,24 @@ char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align) +char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align, int depth) { if (log == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_log_info\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, log->undoc_buffer, 0); q += 4; + DBG_RW_IVAL("undoc_buffer", depth, base, io, q, log->undoc_buffer); q += 4; - q = smb_io_unistr2(io, &(log->uni_logon_srv), q, base, align); - q = smb_io_unistr2(io, &(log->uni_acct_name), q, base, align); + q = smb_io_unistr2(io, &(log->uni_logon_srv), q, base, align, depth); + q = smb_io_unistr2(io, &(log->uni_acct_name), q, base, align, depth); - RW_SVAL(io, q, log->sec_chan, 0); q += 2; + DBG_RW_SVAL("sec_chan", depth, base, io, q, log->sec_chan); q += 2; /* XXXX no alignment required between sec_chan and uni_comp_name */ - q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, 0); + q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, 0, depth); return q; } @@ -239,13 +271,16 @@ char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align /******************************************************************* reads or writes a DOM_CHAL structure. ********************************************************************/ -char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align) +char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align, int depth) { if (chal == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_chal\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_PCVAL(io, q, chal->data, 8); q += 8; + DBG_RW_PCVAL("data", depth, base, io, q, chal->data, 8); q += 8; return q; } @@ -253,14 +288,17 @@ char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_CRED structure. ********************************************************************/ -char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align) +char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align, int depth) { if (cred == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_cred\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - q = smb_io_chal (io, &(cred->challenge), q, base, align); - q = smb_io_utime(io, &(cred->timestamp), q, base, align); + q = smb_io_chal (io, &(cred->challenge), q, base, align, depth); + q = smb_io_utime(io, &(cred->timestamp), q, base, align, depth); return q; } @@ -268,14 +306,17 @@ char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align) +char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align, int depth) { if (clnt == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_clnt_info\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - q = smb_io_log_info(io, &(clnt->login), q, base, align); - q = smb_io_cred (io, &(clnt->cred ), q, base, align); + q = smb_io_log_info(io, &(clnt->login), q, base, align, depth); + q = smb_io_cred (io, &(clnt->cred ), q, base, align, depth); return q; } @@ -283,14 +324,17 @@ char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int al /******************************************************************* reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align) +char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align, int depth) { if (log == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_logon_id\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, log->low , 0); q += 4; - RW_IVAL(io, q, log->high, 0); q += 4; + DBG_RW_IVAL("low", depth, base, io, q, log->low ); q += 4; + DBG_RW_IVAL("high", depth, base, io, q, log->high); q += 4; return q; } @@ -298,13 +342,16 @@ char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align /******************************************************************* reads or writes an ARC4_OWF structure. ********************************************************************/ -char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align) +char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, int depth) { if (hash == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_arc4_owf\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_PCVAL(io, q, hash->data, 16); q += 16; + DBG_RW_PCVAL("data", depth, base, io, q, hash->data, 16); q += 16; return q; } @@ -312,26 +359,29 @@ char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align) /******************************************************************* reads or writes an DOM_ID_INFO_1 structure. ********************************************************************/ -char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align) +char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align, int depth) { if (id == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_id_info1\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - q = smb_io_unihdr(io, &(id->hdr_domain_name ), q, base, align); + q = smb_io_unihdr(io, &(id->hdr_domain_name ), q, base, align, depth); - RW_IVAL(io, q, id->param, 0); q += 4; - q = smb_io_logon_id(io, &(id->logon_id), q, base, align); + DBG_RW_IVAL("param", depth, base, io, q, id->param); q += 4; + q = smb_io_logon_id(io, &(id->logon_id), q, base, align, depth); - q = smb_io_unihdr(io, &(id->hdr_user_name ), q, base, align); - q = smb_io_unihdr(io, &(id->hdr_workgroup_name), q, base, align); + q = smb_io_unihdr(io, &(id->hdr_user_name ), q, base, align, depth); + q = smb_io_unihdr(io, &(id->hdr_workgroup_name), q, base, align, depth); - q = smb_io_arc4_owf(io, &(id->arc4_lm_owf), q, base, align); - q = smb_io_arc4_owf(io, &(id->arc4_nt_owf), q, base, align); + q = smb_io_arc4_owf(io, &(id->arc4_lm_owf), q, base, align, depth); + q = smb_io_arc4_owf(io, &(id->arc4_nt_owf), q, base, align, depth); - q = smb_io_unistr2(io, &(id->uni_domain_name ), q, base, align); - q = smb_io_unistr2(io, &(id->uni_user_name ), q, base, align); - q = smb_io_unistr2(io, &(id->uni_workgroup_name), q, base, align); + q = smb_io_unistr2(io, &(id->uni_domain_name ), q, base, align, depth); + q = smb_io_unistr2(io, &(id->uni_user_name ), q, base, align, depth); + q = smb_io_unistr2(io, &(id->uni_workgroup_name), q, base, align, depth); return q; } @@ -339,23 +389,26 @@ char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align) +char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align, int depth) { if (sam == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_sam_info\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - q = smb_io_clnt_info(io, &(sam->client ), q, base, align); - q = smb_io_cred (io, &(sam->rtn_cred), q, base, align); + q = smb_io_clnt_info(io, &(sam->client ), q, base, align, depth); + q = smb_io_cred (io, &(sam->rtn_cred), q, base, align, depth); - RW_IVAL(io, q, sam->logon_level, 0); q += 4; - RW_SVAL(io, q, sam->auth_level , 0); q += 4; + DBG_RW_IVAL("logon_level", depth, base, io, q, sam->logon_level); q += 4; + DBG_RW_SVAL("auth_level", depth, base, io, q, sam->auth_level ); q += 4; switch (sam->auth_level) { case 1: { - q = smb_io_id_info1(io, &(sam->auth.id1), q, base, align); + q = smb_io_id_info1(io, &(sam->auth.id1), q, base, align, depth); break; } default: @@ -370,14 +423,17 @@ char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align /******************************************************************* reads or writes a DOM_GID structure. ********************************************************************/ -char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align) +char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align, int depth) { if (gid == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_gid\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, gid->gid , 0); q += 4; - RW_IVAL(io, q, gid->attr, 0); q += 4; + DBG_RW_IVAL("gid", depth, base, io, q, gid->gid ); q += 4; + DBG_RW_IVAL("attr", depth, base, io, q, gid->attr); q += 4; return q; } @@ -385,24 +441,27 @@ char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align) /******************************************************************* reads or writes an RPC_HDR structure. ********************************************************************/ -char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align) +char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align, int depth) { if (rpc == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_rpc_hdr\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + /* reserved should be zero: enforce it */ rpc->reserved = 0; - RW_CVAL(io, q, rpc->major, 0); q++; - RW_CVAL(io, q, rpc->minor, 0); q++; - RW_CVAL(io, q, rpc->pkt_type, 0); q++; - RW_CVAL(io, q, rpc->frag, 0); q++; - RW_IVAL(io, q, rpc->pack_type, 0); q += 4; - RW_SVAL(io, q, rpc->frag_len, 0); q += 2; - RW_SVAL(io, q, rpc->auth_len, 0); q += 2; - RW_IVAL(io, q, rpc->call_id, 0); q += 4; - RW_IVAL(io, q, rpc->alloc_hint, 0); q += 4; - RW_CVAL(io, q, rpc->context_id, 0); q++; - RW_CVAL(io, q, rpc->reserved, 0); q++; + DBG_RW_CVAL("major", depth, base, io, q, rpc->major); q++; + DBG_RW_CVAL("minor", depth, base, io, q, rpc->minor); q++; + DBG_RW_CVAL("pkt_type", depth, base, io, q, rpc->pkt_type); q++; + DBG_RW_CVAL("frag", depth, base, io, q, rpc->frag); q++; + DBG_RW_IVAL("pack_type", depth, base, io, q, rpc->pack_type); q += 4; + DBG_RW_SVAL("frag_len", depth, base, io, q, rpc->frag_len); q += 2; + DBG_RW_SVAL("auth_len", depth, base, io, q, rpc->auth_len); q += 2; + DBG_RW_IVAL("call_id", depth, base, io, q, rpc->call_id); q += 4; + DBG_RW_IVAL("alloc_hint", depth, base, io, q, rpc->alloc_hint); q += 4; + DBG_RW_CVAL("context_id", depth, base, io, q, rpc->context_id); q++; + DBG_RW_CVAL("reserved", depth, base, io, q, rpc->reserved); q++; return q; } @@ -414,7 +473,7 @@ char* smb_io_pol_hnd(BOOL io, LSA_POL_HND *pol, char *q, char *base, int align, { if (pol == NULL) return NULL; - DEBUG(5,("%ssmb_io_pol_hnd\n", tab_depth(depth))); + DEBUG(5,("%s%04x smb_io_pol_hnd\n", tab_depth(depth), PTR_DIFF(q, base))); depth++; q = align_offset(q, base, align); @@ -427,43 +486,46 @@ char* smb_io_pol_hnd(BOOL io, LSA_POL_HND *pol, char *q, char *base, int align, /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -char* smb_io_dom_query_3(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align) +char* smb_io_dom_query_3(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth) { - return smb_io_dom_query(io, d_q, q, base, align); + return smb_io_dom_query(io, d_q, q, base, align, depth); } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -char* smb_io_dom_query_5(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align) +char* smb_io_dom_query_5(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth) { - return smb_io_dom_query(io, d_q, q, base, align); + return smb_io_dom_query(io, d_q, q, base, align, depth); } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align) +char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align, int depth) { if (d_q == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_dom_query\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_SVAL(io, q, d_q->uni_dom_max_len, 0); q += 2; /* domain name string length * 2 */ - RW_SVAL(io, q, d_q->padding , 0); q += 2; /* 2 padding bytes */ - RW_SVAL(io, q, d_q->uni_dom_str_len, 0); q += 2; /* domain name string length * 2 */ + DBG_RW_SVAL("uni_dom_max_len", depth, base, io, q, d_q->uni_dom_max_len); q += 2; /* domain name string length * 2 */ + DBG_RW_SVAL("padding", depth, base, io, q, d_q->padding ); q += 2; /* 2 padding bytes */ + DBG_RW_SVAL("uni_dom_str_len", depth, base, io, q, d_q->uni_dom_str_len); q += 2; /* domain name string length * 2 */ - RW_IVAL(io, q, d_q->buffer_dom_name, 0); q += 4; /* undocumented domain name string buffer pointer */ - RW_IVAL(io, q, d_q->buffer_dom_sid , 0); q += 4; /* undocumented domain SID string buffer pointer */ + DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, d_q->buffer_dom_name); q += 4; /* undocumented domain name string buffer pointer */ + DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, d_q->buffer_dom_sid ); q += 4; /* undocumented domain SID string buffer pointer */ if (d_q->buffer_dom_name != 0) { - q = smb_io_unistr2(io, &(d_q->uni_domain_name), q, base, align); /* domain name (unicode string) */ + q = smb_io_unistr2(io, &(d_q->uni_domain_name), q, base, align, depth); /* domain name (unicode string) */ } if (d_q->buffer_dom_sid != 0) { - q = smb_io_dom_sid(io, &(d_q->dom_sid), q, base, align); /* domain SID */ + q = smb_io_dom_sid(io, &(d_q->dom_sid), q, base, align, depth); /* domain SID */ } return q; @@ -472,32 +534,35 @@ char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_R_REF structure. ********************************************************************/ -char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align) +char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align, int depth) { int i; + DEBUG(5,("%s%04x smb_io_dom_r_ref\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + if (r_r == NULL) return NULL; q = align_offset(q, base, align); - RW_IVAL(io, q, r_r->undoc_buffer, 0); q += 4; /* undocumented buffer pointer. */ - RW_IVAL(io, q, r_r->num_ref_doms_1, 0); q += 4; /* num referenced domains? */ - RW_IVAL(io, q, r_r->buffer_dom_name, 0); q += 4; /* undocumented domain name buffer pointer. */ - RW_IVAL(io, q, r_r->max_entries, 0); q += 4; /* 32 - max number of entries */ - RW_IVAL(io, q, r_r->num_ref_doms_2, 0); q += 4; /* 4 - num referenced domains? */ + DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_r->undoc_buffer); q += 4; /* undocumented buffer pointer. */ + DBG_RW_IVAL("num_ref_doms_1", depth, base, io, q, r_r->num_ref_doms_1); q += 4; /* num referenced domains? */ + DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, r_r->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer. */ + DBG_RW_IVAL("max_entries", depth, base, io, q, r_r->max_entries); q += 4; /* 32 - max number of entries */ + DBG_RW_IVAL("num_ref_doms_2", depth, base, io, q, r_r->num_ref_doms_2); q += 4; /* 4 - num referenced domains? */ - q = smb_io_unihdr2(io, &(r_r->hdr_dom_name), q, base, align); /* domain name unicode string header */ + q = smb_io_unihdr2(io, &(r_r->hdr_dom_name), q, base, align, depth); /* domain name unicode string header */ for (i = 0; i < r_r->num_ref_doms_1-1; i++) { - q = smb_io_unihdr2(io, &(r_r->hdr_ref_dom[i]), q, base, align); + q = smb_io_unihdr2(io, &(r_r->hdr_ref_dom[i]), q, base, align, depth); } - q = smb_io_unistr(io, &(r_r->uni_dom_name), q, base, align); /* domain name unicode string */ + q = smb_io_unistr(io, &(r_r->uni_dom_name), q, base, align, depth); /* domain name unicode string */ for (i = 0; i < r_r->num_ref_doms_2; i++) { - q = smb_io_dom_sid(io, &(r_r->ref_dom[i]), q, base, align); /* referenced domain SIDs */ + q = smb_io_dom_sid(io, &(r_r->ref_dom[i]), q, base, align, depth); /* referenced domain SIDs */ } return q; } @@ -505,18 +570,21 @@ char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align) /******************************************************************* reads or writes a DOM_NAME structure. ********************************************************************/ -char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align) +char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align, int depth) { if (name == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_dom_name\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, name->uni_str_len, 0); q += 4; + DBG_RW_IVAL("uni_str_len", depth, base, io, q, name->uni_str_len); q += 4; /* don't know if len is specified by uni_str_len member... */ /* assume unicode string is unicode-null-terminated, instead */ - q = smb_io_unistr(io, &(name->str), q, base, align); + q = smb_io_unistr(io, &(name->str), q, base, align, depth); return q; } @@ -525,13 +593,16 @@ char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align) /******************************************************************* reads or writes a structure. ********************************************************************/ -char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align) +char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align, int depth) { if (neg == NULL) return NULL; + DEBUG(5,("%s%04x smb_io_neg_flags\n", tab_depth(depth), PTR_DIFF(q, base))); + depth++; + q = align_offset(q, base, align); - RW_IVAL(io, q, neg->neg_flags, 0); q += 4; + DBG_RW_IVAL("neg_flags", depth, base, io, q, neg->neg_flags); q += 4; return q; } @@ -541,14 +612,15 @@ char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align) /******************************************************************* reads or writes a structure. ********************************************************************/ - char* smb_io_(BOOL io, *, char *q, char *base, int align) + char* smb_io_(BOOL io, *, char *q, char *base, int align, int depth) { if (== NULL) return NULL; q = align_offset(q, base, align); - RW_IVAL(io, q, , 0); q += 4; + DBG_RW_IVAL("", depth, base, io, q, ); q += 4; return q; } #endif + -- cgit