summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/byteorder.h29
-rw-r--r--source3/include/proto.h37
-rw-r--r--source3/lib/util.c8
-rw-r--r--source3/lsaparse.c198
-rw-r--r--source3/smbd/pipes.c45
5 files changed, 208 insertions, 109 deletions
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h
index 0664a33817..e8989ee7e4 100644
--- a/source3/include/byteorder.h
+++ b/source3/include/byteorder.h
@@ -198,3 +198,32 @@ it also defines lots of intermediate macros, just ignore those :-)
#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
+#define DBG_RW_PCVAL(string,depth,base,read,inbuf,outbuf,len) \
+ RW_PCVAL(read,inbuf,outbuf,len) \
+ DEBUG(5,("%s %04x %s: ", \
+ tab_depth(depth), PTR_DIFF(inbuf,base),string)); \
+ { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (inbuf)[idx])); } } \
+ DEBUG(5,("\n"));
+
+#define DBG_RW_PSVAL(string,depth,base,read,inbuf,outbuf,len) \
+ RW_PSVAL(read,inbuf,outbuf,len) \
+ DEBUG(5,("%s %04x %s: ", \
+ tab_depth(depth), PTR_DIFF(inbuf,base),string)); \
+ { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (inbuf)[idx])); } } \
+ DEBUG(5,("\n"));
+
+#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)));
+
+#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)));
+
+#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)));
+
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f859e9bfa2..d9b6ca157b 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -322,24 +322,24 @@ BOOL remove_share_oplock(int fnum, share_lock_token token);
/*The following definitions come from lsaparse.c */
-char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int align);
-char* lsa_io_q_query(BOOL io, LSA_Q_QUERY_INFO *q_q, char *q, char *base, int align);
-char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int align);
-char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base, int align);
-char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, int align);
-char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base, int align);
-char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, int align);
-char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int align);
-char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int align);
-char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align);
-char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align);
-char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int align);
-char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int align);
-char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int align);
-char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int align);
-char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int align);
-char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, int align);
-char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, int align);
+char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int align, int depth);
+char* lsa_io_q_query(BOOL io, LSA_Q_QUERY_INFO *q_q, char *q, char *base, int align, int depth);
+char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int align, int depth);
+char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base, int align, int depth);
+char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, int align, int depth);
+char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base, int align, int depth);
+char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, int align, int depth);
+char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int align, int depth);
+char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int align, int depth);
+char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align, int depth);
+char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align, int depth);
+char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int align, int depth);
+char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int align, int depth);
+char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int align, int depth);
+char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int align, int depth);
+char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int align, int depth);
+char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, int align, int depth);
+char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, int align, int depth);
/*The following definitions come from mangle.c */
@@ -1072,3 +1072,4 @@ char *align4(char *q, char *base);
char *align2(char *q, char *base);
char *align_offset(char *q, char *base, int align_offset_len);
void dump_data(int level,unsigned char *buf,int len);
+char *tab_depth(int depth);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 208f13aaf0..a68b8c2e6c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4428,3 +4428,11 @@ void dump_data(int level,unsigned char *buf,int len)
DEBUG(level,("\n"));
}
}
+
+char *tab_depth(int depth)
+{
+ static pstring spaces;
+ memset(spaces, ' ', depth * 4);
+ spaces[depth * 4] = 0;
+ return spaces;
+}
diff --git a/source3/lsaparse.c b/source3/lsaparse.c
index b515901ab5..462f621ece 100644
--- a/source3/lsaparse.c
+++ b/source3/lsaparse.c
@@ -27,13 +27,16 @@ extern int DEBUGLEVEL;
/*******************************************************************
reads or writes an LSA_R_OPEN_POL structure.
********************************************************************/
-char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int align)
+char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int align, int depth)
{
if (r_p == NULL) return NULL;
+ DEBUG(5,("%slsa_io_r_open_pol\n", tab_depth(depth)));
+ depth++;
+
q = smb_io_pol_hnd(io, &(r_p->pol), q, base, align);
- RW_IVAL(io, q, r_p->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_p->status); q += 4;
return q;
}
@@ -41,13 +44,16 @@ char* lsa_io_r_open_pol(BOOL io, LSA_R_OPEN_POL *r_p, char *q, char *base, int a
/*******************************************************************
reads or writes an LSA_Q_QUERY_INFO structure.
********************************************************************/
-char* lsa_io_q_query(BOOL io, LSA_Q_QUERY_INFO *q_q, char *q, char *base, int align)
+char* lsa_io_q_query(BOOL io, LSA_Q_QUERY_INFO *q_q, char *q, char *base, int align, int depth)
{
if (q_q == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_query\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = smb_io_pol_hnd(io, &(q_q->pol), q, base, align);
- RW_SVAL(io, q, q_q->info_class, 0); q += 2;
+ DBG_RW_SVAL("info_class", depth, base, io, q, q_q->info_class); q += 2;
return q;
}
@@ -55,15 +61,18 @@ char* lsa_io_q_query(BOOL io, LSA_Q_QUERY_INFO *q_q, char *q, char *base, int al
/*******************************************************************
reads or writes an LSA_Q_QUERY_INFO structure.
********************************************************************/
-char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int align)
+char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int align, int depth)
{
if (r_q == NULL) return NULL;
- RW_IVAL(io, q, r_q->undoc_buffer, 0); q += 4;
+ DEBUG(5,("%s%04x lsa_io_r_query\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
+ DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_q->undoc_buffer); q += 4;
if (r_q->undoc_buffer != 0)
{
- RW_SVAL(io, q, r_q->info_class, 0); q += 2;
+ DBG_RW_SVAL("info_class", depth, base, io, q, r_q->info_class); q += 2;
switch (r_q->info_class)
{
@@ -85,7 +94,7 @@ char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int al
}
}
- RW_IVAL(io, q, r_q->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_q->status); q += 4;
return q;
}
@@ -93,23 +102,28 @@ char* lsa_io_r_query(BOOL io, LSA_R_QUERY_INFO *r_q, char *q, char *base, int al
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base, int align)
+char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base, int align, int depth)
{
int i;
if (q_s == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_lookup_sids\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_pol_hnd(io, &(q_s->pol_hnd), q, base, align); /* policy handle */
- RW_IVAL(io, q, q_s->num_entries, 0); q += 4;
- RW_IVAL(io, q, q_s->buffer_dom_sid, 0); q += 4; /* undocumented domain SID buffer pointer */
- RW_IVAL(io, q, q_s->buffer_dom_name, 0); q += 4; /* undocumented domain name buffer pointer */
+ DBG_RW_IVAL("num_entries", depth, base, io, q, q_s->num_entries); q += 4;
+ DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, q_s->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
+ DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, q_s->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer */
for (i = 0; i < q_s->num_entries; i++)
- {
- RW_IVAL(io, q, q_s->buffer_lookup_sids[i], 0); q += 4; /* undocumented domain SID pointers to be looked up. */
+ {
+ fstring temp;
+ sprintf(temp, "buffer_lookup_sids[%d]", i);
+ DBG_RW_IVAL(temp, depth, base, io, q, q_s->buffer_lookup_sids[i]); q += 4; /* undocumented domain SID pointers to be looked up. */
}
for (i = 0; i < q_s->num_entries; i++)
@@ -117,7 +131,7 @@ char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base,
q = smb_io_dom_sid(io, &(q_s->dom_sids[i]), q, base, align); /* domain SIDs to be looked up. */
}
- RW_PCVAL(io, q, q_s->undoc, 16); q += 16; /* completely undocumented 16 bytes */
+ DBG_RW_PCVAL("undoc", depth, base, io, q, q_s->undoc, 16); q += 16; /* completely undocumented 16 bytes */
return q;
}
@@ -125,28 +139,31 @@ char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, int align)
+char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base, int align, int depth)
{
int i;
if (r_s == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_lookup_sids\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_dom_r_ref(io, &(r_s->dom_ref), q, base, align); /* domain reference info */
- RW_IVAL(io, q, r_s->num_entries, 0); q += 4;
- RW_IVAL(io, q, r_s->undoc_buffer, 0); q += 4;
- RW_IVAL(io, q, r_s->num_entries2, 0); q += 4;
+ 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;
+ DBG_RW_IVAL("num_entries2", depth, base, io, q, r_s->num_entries2); q += 4;
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 */
}
- RW_IVAL(io, q, r_s->num_entries3, 0); q += 4;
+ DBG_RW_IVAL("num_entries3", depth, base, io, q, r_s->num_entries3); q += 4;
- RW_IVAL(io, q, r_s->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_s->status); q += 4;
return q;
}
@@ -154,27 +171,30 @@ char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base, int align)
+char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base, int align, int depth)
{
int i;
if (q_r == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_lookup_rids\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_pol_hnd(io, &(q_r->pol_hnd), q, base, align); /* policy handle */
- RW_IVAL(io, q, q_r->num_entries, 0); q += 4;
- RW_IVAL(io, q, q_r->num_entries2, 0); q += 4;
- RW_IVAL(io, q, q_r->buffer_dom_sid, 0); q += 4; /* undocumented domain SID buffer pointer */
- RW_IVAL(io, q, q_r->buffer_dom_name, 0); q += 4; /* undocumented domain name buffer pointer */
+ DBG_RW_IVAL("num_entries", depth, base, io, q, q_r->num_entries); q += 4;
+ DBG_RW_IVAL("num_entries2", depth, base, io, q, q_r->num_entries2); q += 4;
+ DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, q_r->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
+ DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, q_r->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer */
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 */
}
- RW_PCVAL(io, q, q_r->undoc, UNKNOWN_LEN); q += UNKNOWN_LEN; /* completely undocumented bytes of unknown length */
+ DBG_RW_PCVAL("undoc", depth, base, io, q, q_r->undoc, UNKNOWN_LEN); q += UNKNOWN_LEN; /* completely undocumented bytes of unknown length */
return q;
}
@@ -182,28 +202,31 @@ char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, int align)
+char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base, int align, int depth)
{
int i;
if (r_r == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_lookup_rids\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_dom_r_ref(io, &(r_r->dom_ref), q, base, align); /* domain reference info */
- RW_IVAL(io, q, r_r->num_entries, 0); q += 4;
- RW_IVAL(io, q, r_r->undoc_buffer, 0); q += 4;
- RW_IVAL(io, q, r_r->num_entries2, 0); q += 4;
+ 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;
+ DBG_RW_IVAL("num_entries2", depth, base, io, q, r_r->num_entries2); q += 4;
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 */
}
- RW_IVAL(io, q, r_r->num_entries3, 0); q += 4;
+ DBG_RW_IVAL("num_entries3", depth, base, io, q, r_r->num_entries3); q += 4;
- RW_IVAL(io, q, r_r->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_r->status); q += 4;
return q;
}
@@ -211,10 +234,13 @@ char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int align)
+char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int align, int depth)
{
if (q_c == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_req_chal\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_unistr2(io, &(q_c->uni_logon_srv), q, base, align); /* logon server unicode string */
@@ -227,15 +253,18 @@ char* lsa_io_q_req_chal(BOOL io, LSA_Q_REQ_CHAL *q_c, char *q, char *base, int a
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int align)
+char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int align, int depth)
{
if (r_c == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_req_chal\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_chal(io, &(r_c->srv_chal), q, base, align); /* server challenge */
- RW_IVAL(io, q, r_c->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_c->status); q += 4;
return q;
}
@@ -244,10 +273,13 @@ char* lsa_io_r_req_chal(BOOL io, LSA_R_REQ_CHAL *r_c, char *q, char *base, int a
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align)
+char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align, int depth)
{
if (q_a == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_auth_2\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_log_info (io, &(q_a->clnt_id), q, base, align); /* client identification info */
@@ -260,16 +292,19 @@ char* lsa_io_q_auth_2(BOOL io, LSA_Q_AUTH_2 *q_a, char *q, char *base, int align
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align)
+char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align, int depth)
{
if (r_a == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_auth_2\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
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);
- RW_IVAL(io, q, r_a->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_a->status); q += 4;
return q;
}
@@ -278,14 +313,17 @@ char* lsa_io_r_auth_2(BOOL io, LSA_R_AUTH_2 *r_a, char *q, char *base, int align
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int align)
+char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int align, int depth)
{
if (q_s == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_srv_pwset\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_clnt_info(io, &(q_s->clnt_id), q, base, align); /* client identification/authentication info */
- RW_PCVAL(io, q, q_s->pwd, 16); q += 16; /* new password - undocumented */
+ DBG_RW_PCVAL("pwd", depth, base, io, q, q_s->pwd, 16); q += 16; /* new password - undocumented */
return q;
}
@@ -293,15 +331,18 @@ char* lsa_io_q_srv_pwset(BOOL io, LSA_Q_SRV_PWSET *q_s, char *q, char *base, int
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int align)
+char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int align, int depth)
{
if (r_s == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_srv_pwset\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_cred(io, &(r_s->srv_cred), q, base, align); /* server challenge */
- RW_IVAL(io, q, r_s->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_s->status); q += 4;
return q;
}
@@ -311,15 +352,18 @@ char* lsa_io_r_srv_pwset(BOOL io, LSA_R_SRV_PWSET *r_s, char *q, char *base, int
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int align)
+char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int align, int depth)
{
int i;
if (usr == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_user_info\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
- RW_IVAL(io, q, usr->undoc_buffer, 0); q += 4;
+ 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 */
@@ -335,25 +379,25 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
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 */
- RW_SVAL(io, q, usr->logon_count , 0); q += 2; /* logon count */
- RW_SVAL(io, q, usr->bad_pw_count, 0); q += 2; /* bad password count */
+ 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 */
- RW_IVAL(io, q, usr->user_id , 0); q += 4; /* User ID */
- RW_IVAL(io, q, usr->group_id , 0); q += 4; /* Group ID */
- RW_IVAL(io, q, usr->num_groups , 0); q += 4; /* num groups */
- RW_IVAL(io, q, usr->buffer_groups, 0); q += 4; /* undocumented buffer pointer to groups. */
- RW_IVAL(io, q, usr->user_flgs , 0); q += 4; /* user flags */
+ DBG_RW_IVAL("user_id", depth, base, io, q, usr->user_id ); q += 4; /* User ID */
+ DBG_RW_IVAL("group_id", depth, base, io, q, usr->group_id ); q += 4; /* Group ID */
+ DBG_RW_IVAL("num_groups", depth, base, io, q, usr->num_groups ); q += 4; /* num groups */
+ DBG_RW_IVAL("buffer_groups", depth, base, io, q, usr->buffer_groups); q += 4; /* undocumented buffer pointer to groups. */
+ DBG_RW_IVAL("user_flgs", depth, base, io, q, usr->user_flgs ); q += 4; /* user flags */
- RW_PCVAL(io, q, usr->sess_key, 16); q += 16; /* unused user session key */
+ 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 */
- RW_IVAL(io, q, usr->buffer_dom_id, 0); q += 4; /* undocumented logon domain id pointer */
- RW_PCVAL(io, q, usr->padding, 40); q += 40; /* unused padding bytes? */
+ 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? */
- RW_IVAL(io, q, usr->num_other_sids, 0); q += 4; /* 0 - num_sids */
- RW_IVAL(io, q, usr->buffer_other_sids, 0); q += 4; /* NULL - undocumented pointer to SIDs. */
+ 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 */
@@ -362,7 +406,7 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
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 */
- RW_IVAL(io, q, usr->num_groups2, 0); q += 4; /* num groups */
+ 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 */
@@ -384,10 +428,13 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int align)
+char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int align, int depth)
{
if (q_l == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_sam_logon\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align); /* domain SID */
@@ -398,24 +445,27 @@ char* lsa_io_q_sam_logon(BOOL io, LSA_Q_SAM_LOGON *q_l, char *q, char *base, int
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int align)
+char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int align, int depth)
{
if (r_l == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_sam_logon\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
- RW_IVAL(io, q, r_l->buffer_creds, 0); q += 4; /* undocumented buffer pointer */
+ 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. */
- RW_IVAL(io, q, r_l->buffer_user, 0); q += 4;
+ DBG_RW_IVAL("buffer_user", depth, base, io, q, r_l->buffer_user); q += 4;
if (r_l->buffer_user != 0)
{
- q = lsa_io_user_info(io, r_l->user, q, base, align);
+ q = lsa_io_user_info(io, r_l->user, q, base, align, depth);
}
- RW_IVAL(io, q, r_l->auth_resp, 0); q += 4; /* 1 - Authoritative response; 0 - Non-Auth? */
+ DBG_RW_IVAL("auth_resp", depth, base, io, q, r_l->auth_resp); q += 4; /* 1 - Authoritative response; 0 - Non-Auth? */
- RW_IVAL(io, q, r_l->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_l->status); q += 4;
return q;
}
@@ -423,10 +473,13 @@ char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, int align)
+char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, int align, int depth)
{
if (q_l == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_q_sam_logoff\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
q = smb_io_sam_info(io, &(q_l->sam_id), q, base, align); /* domain SID */
@@ -437,16 +490,19 @@ char* lsa_io_q_sam_logoff(BOOL io, LSA_Q_SAM_LOGOFF *q_l, char *q, char *base, i
/*******************************************************************
reads or writes a structure.
********************************************************************/
-char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, int align)
+char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, int align, int depth)
{
if (r_l == NULL) return NULL;
+ DEBUG(5,("%s%04x lsa_io_r_sam_logoff\n", tab_depth(depth), PTR_DIFF(q, base)));
+ depth++;
+
q = align_offset(q, base, align);
- RW_IVAL(io, q, r_l->buffer_creds, 0); q += 4; /* undocumented buffer pointer */
+ 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. */
- RW_IVAL(io, q, r_l->status, 0); q += 4;
+ DBG_RW_IVAL("status", depth, base, io, q, r_l->status); q += 4;
return q;
}
@@ -455,13 +511,13 @@ char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, i
/*******************************************************************
reads or writes a structure.
********************************************************************/
- char* lsa_io_(BOOL io, *, char *q, char *base, int align)
+ char* lsa_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;
}
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index e6c29fadf6..3bfee3e3cf 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -503,15 +503,20 @@ static int make_rpc_reply(char *inbuf, char *q, int data_len)
static int lsa_reply_open_policy(char *q, char *base)
{
+ int i;
char *start = q;
LSA_R_OPEN_POL r_o;
/* set up the LSA QUERY INFO response */
- bzero(&(r_o.pol.data), POL_HND_SIZE);
+ /* bzero(&(r_o.pol.data), POL_HND_SIZE); */
+ for (i = 0; i < POL_HND_SIZE; i++)
+ {
+ r_o.pol.data[i] = i;
+ }
r_o.status = 0x0;
/* store the response in the SMB stream */
- q = lsa_io_r_open_pol(False, &r_o, q, base, 4);
+ q = lsa_io_r_open_pol(False, &r_o, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -601,7 +606,7 @@ static int lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, char *q, char *base,
r_q.status = 0x0;
/* store the response in the SMB stream */
- q = lsa_io_r_query(False, &r_q, q, base, 4);
+ q = lsa_io_r_query(False, &r_q, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -697,7 +702,7 @@ static int lsa_reply_lookup_sids(char *q, char *base,
r_l.status = 0x0;
/* store the response in the SMB stream */
- q = lsa_io_r_lookup_sids(False, &r_l, q, base, 4);
+ q = lsa_io_r_lookup_sids(False, &r_l, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -717,7 +722,7 @@ static int lsa_reply_lookup_rids(char *q, char *base,
r_l.status = 0x0;
/* store the response in the SMB stream */
- q = lsa_io_r_lookup_rids(False, &r_l, q, base, 4);
+ q = lsa_io_r_lookup_rids(False, &r_l, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -741,7 +746,7 @@ static int lsa_reply_req_chal(LSA_Q_REQ_CHAL *q_c, char *q, char *base,
make_lsa_r_req_chal(&r_c, srv_chal, 0);
/* store the response in the SMB stream */
- q = lsa_io_r_req_chal(False, &r_c, q, base, 4);
+ q = lsa_io_r_req_chal(False, &r_c, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -766,7 +771,7 @@ static int lsa_reply_auth_2(LSA_Q_AUTH_2 *q_a, char *q, char *base,
make_lsa_r_auth_2(&r_a, resp_cred, &(q_a->clnt_flgs), status);
/* store the response in the SMB stream */
- q = lsa_io_r_auth_2(False, &r_a, q, base, 4);
+ q = lsa_io_r_auth_2(False, &r_a, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -789,7 +794,7 @@ static int lsa_reply_srv_pwset(LSA_Q_SRV_PWSET *q_s, char *q, char *base,
make_lsa_r_srv_pwset(&r_s, srv_cred, status);
/* store the response in the SMB stream */
- q = lsa_io_r_srv_pwset(False, &r_s, q, base, 4);
+ q = lsa_io_r_srv_pwset(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -924,7 +929,7 @@ static int lsa_reply_sam_logon(LSA_Q_SAM_LOGON *q_s, char *q, char *base,
r_s.status = user_info != NULL ? 0 : (0xC000000|NT_STATUS_NO_SUCH_USER);
/* store the response in the SMB stream */
- q = lsa_io_r_sam_logon(False, &r_s, q, base, 4);
+ q = lsa_io_r_sam_logon(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -945,7 +950,7 @@ static int lsa_reply_sam_logoff(LSA_Q_SAM_LOGOFF *q_s, char *q, char *base,
r_s.status = status;
/* store the response in the SMB stream */
- q = lsa_io_r_sam_logoff(False, &r_s, q, base, 4);
+ q = lsa_io_r_sam_logoff(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
return q - start;
@@ -978,7 +983,7 @@ static void api_lsa_query_info( char *param, char *data,
pstring dom_sid;
/* grab the info class and policy handle */
- lsa_io_q_query(True, &q_i, data + 0x18, data + 0x18, 4);
+ lsa_io_q_query(True, &q_i, data + 0x18, data + 0x18, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
@@ -1004,7 +1009,7 @@ static void api_lsa_lookup_sids( char *param, char *data,
fstring dom_sids[MAX_LOOKUP_SIDS];
/* grab the info class and policy handle */
- lsa_io_q_lookup_sids(True, &q_l, data + 0x18, data + 0x18, 4);
+ lsa_io_q_lookup_sids(True, &q_l, data + 0x18, data + 0x18, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
@@ -1038,7 +1043,7 @@ static void api_lsa_lookup_names( char *param, char *data,
uint32 dom_rids[MAX_LOOKUP_SIDS];
/* grab the info class and policy handle */
- lsa_io_q_lookup_rids(True, &q_l, data + 0x18, data + 0x18, 4);
+ lsa_io_q_lookup_rids(True, &q_l, data + 0x18, data + 0x18, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
@@ -1224,7 +1229,7 @@ static void api_lsa_req_chal( user_struct *vuser,
fstring mach_acct;
/* grab the challenge... */
- lsa_io_q_req_chal(True, &q_r, data + 0x18, data + 0x18, 4);
+ lsa_io_q_req_chal(True, &q_r, data + 0x18, data + 0x18, 4, 0);
fstrcpy(mach_acct, unistr2(q_r.uni_logon_clnt.buffer));
@@ -1255,7 +1260,7 @@ static void api_lsa_auth_2( user_struct *vuser,
srv_time.time = 0;
/* grab the challenge... */
- lsa_io_q_auth_2(True, &q_a, data + 0x18, data + 0x18, 4);
+ lsa_io_q_auth_2(True, &q_a, data + 0x18, data + 0x18, 4, 0);
/* check that the client credentials are valid */
cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key,
@@ -1313,7 +1318,7 @@ static void api_lsa_srv_pwset( user_struct *vuser,
DOM_CRED srv_cred;
/* grab the challenge and encrypted password ... */
- lsa_io_q_srv_pwset(True, &q_a, data + 0x18, data + 0x18, 4);
+ lsa_io_q_srv_pwset(True, &q_a, data + 0x18, data + 0x18, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_a.clnt_id.cred), &srv_cred);
@@ -1340,7 +1345,7 @@ static void api_lsa_sam_logoff( user_struct *vuser,
DOM_CRED srv_cred;
/* grab the challenge... */
- lsa_io_q_sam_logoff(True, &q_l, data + 0x18, data + 0x18, 4);
+ lsa_io_q_sam_logoff(True, &q_l, data + 0x18, data + 0x18, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_l.sam_id.client.cred), &srv_cred);
@@ -1368,7 +1373,7 @@ static void api_lsa_sam_logon( user_struct *vuser,
DOM_CRED srv_creds;
- lsa_io_q_sam_logon(True, &q_l, data + 0x18, data + 0x18, 4);
+ lsa_io_q_sam_logon(True, &q_l, data + 0x18, data + 0x18, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_l.sam_id.client.cred), &srv_creds);
@@ -1655,7 +1660,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
uint16 opnum = SVAL(data,22);
int pkttype = CVAL(data, 2);
- user_struct *vuser = get_valid_user_struct(uid);
+ user_struct *vuser;
if (pkttype == 0x0b) /* RPC BIND */
{
@@ -1666,7 +1671,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
DEBUG(4,("netlogon TransactNamedPipe op %x\n",opnum));
- if (vuser == NULL) return False;
+ if ((vuser = get_valid_user_struct(uid)) == NULL) return False;
DEBUG(3,("Username of UID %d is %s\n", vuser->uid, vuser->name));
#if defined(NETGROUP) && defined(AUTOMOUNT)