summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/util.c13
-rw-r--r--source3/rpc_parse/parse_prs.c32
-rw-r--r--source3/rpc_parse/parse_srv.c12
3 files changed, 26 insertions, 31 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 73b035b22b..11c14ea538 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2227,17 +2227,12 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len)
#endif
}
-char *tab_depth(int depth)
+const char *tab_depth(int level, int depth)
{
- static fstring spaces;
- size_t len = depth * 4;
- if (len > sizeof(fstring)-1) {
- len = sizeof(fstring)-1;
+ if( DEBUGLVL(level) ) {
+ dbgtext("%*s", depth*4, "");
}
-
- memset(spaces, ' ', len);
- spaces[len] = 0;
- return spaces;
+ return "";
}
/*****************************************************************************
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 4abf63e71d..23dae9f3a1 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -85,7 +85,7 @@ void prs_dump_region(const char *name, int v, prs_struct *ps,
void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name)
{
- DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc));
+ DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(5+depth,depth), ps->data_offset, fn_name, desc));
}
/**
@@ -621,7 +621,7 @@ bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
else
SCVAL(q,0,*data8);
- DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8));
+ DEBUG(5,("%s%04x %s: %02x\n", tab_depth(5,depth), ps->data_offset, name, *data8));
ps->data_offset += 1;
@@ -686,7 +686,7 @@ bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16)
SSVAL(q,0,*data16);
}
- DEBUG(5,("%s%04x %s: %04x\n", tab_depth(depth), ps->data_offset, name, *data16));
+ DEBUG(5,("%s%04x %s: %04x\n", tab_depth(5,depth), ps->data_offset, name, *data16));
ps->data_offset += sizeof(uint16);
@@ -715,7 +715,7 @@ bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
SIVAL(q,0,*data32);
}
- DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32));
+ DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
ps->data_offset += sizeof(uint32);
@@ -744,7 +744,7 @@ bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
SIVALS(q,0,*data32);
}
- DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32));
+ DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
ps->data_offset += sizeof(int32);
@@ -773,7 +773,7 @@ bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
SIVAL(q,0,NT_STATUS_V(*status));
}
- DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name,
+ DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
nt_errstr(*status)));
ps->data_offset += sizeof(uint32);
@@ -803,7 +803,7 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st
SIVAL(q,0,NT_STATUS_V(*status));
}
- DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name,
+ DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
dcerpc_errstr(NT_STATUS_V(*status))));
ps->data_offset += sizeof(uint32);
@@ -834,7 +834,7 @@ bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status)
SIVAL(q,0,W_ERROR_V(*status));
}
- DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name,
+ DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name,
dos_errstr(*status)));
ps->data_offset += sizeof(uint32);
@@ -862,7 +862,7 @@ bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint
SCVAL(q, i, data8s[i]);
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset ,name));
if (charmode)
print_asc(5, (unsigned char*)data8s, len);
else {
@@ -905,7 +905,7 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin
}
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
if (charmode)
print_asc(5, (unsigned char*)data16s, 2*len);
else {
@@ -947,7 +947,7 @@ static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struc
}
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
if (charmode)
print_asc(5, (unsigned char*)out_buf, 2*len);
else {
@@ -1002,7 +1002,7 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin
}
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
if (charmode)
print_asc(5, (unsigned char*)data32s, 4*len);
else {
@@ -1103,7 +1103,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR
} else {
str->buffer = NULL;
/* Return early to ensure Coverity isn't confused. */
- DEBUG(5,("%s%04x %s: \n", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: \n", tab_depth(5,depth), ps->data_offset, name));
return True;
}
}
@@ -1116,7 +1116,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR
SCVAL(q, i, str->buffer[i]);
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
if (charmode)
print_asc(5, (unsigned char*)str->buffer, str->str_str_len);
else {
@@ -1252,7 +1252,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str)
len++;
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
print_asc(5, (unsigned char*)start, 2*len);
DEBUG(5, ("\n"));
}
@@ -1309,7 +1309,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str)
str->buffer[len++] = '\0';
}
- DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+ DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
print_asc(5, (unsigned char*)str->buffer, 2*len);
DEBUG(5, ("\n"));
}
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c
index e7a73183f5..6337c53fc1 100644
--- a/source3/rpc_parse/parse_srv.c
+++ b/source3/rpc_parse/parse_srv.c
@@ -1018,7 +1018,7 @@ static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_
default:
DEBUG(5,("%s no share info at switch_value %d\n",
- tab_depth(depth), ctr->switch_value));
+ tab_depth(5,depth), ctr->switch_value));
break;
}
@@ -1267,7 +1267,7 @@ static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, S
return False;
default:
DEBUG(5,("%s no share info at switch_value %d\n",
- tab_depth(depth), r_n->switch_value));
+ tab_depth(5,depth), r_n->switch_value));
break;
}
}
@@ -1796,7 +1796,7 @@ static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr
break;
default:
DEBUG(5,("%s no session info at switch_value %d\n",
- tab_depth(depth), ctr->switch_value));
+ tab_depth(5,depth), ctr->switch_value));
break;
}
}
@@ -2216,7 +2216,7 @@ static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, pr
break;
default:
DEBUG(5,("%s no connection info at switch_value %d\n",
- tab_depth(depth), ctr->switch_value));
+ tab_depth(5,depth), ctr->switch_value));
break;
}
}
@@ -2486,7 +2486,7 @@ static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st
break;
}
default:
- DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level));
+ DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level));
break;
}
@@ -2839,7 +2839,7 @@ static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps,
break;
default:
DEBUG(5,("%s no server info at switch_value %d\n",
- tab_depth(depth), ctr->switch_value));
+ tab_depth(5,depth), ctr->switch_value));
break;
}
if(!prs_align(ps))