diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/tdr/tdr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index 34611683e2..4a8d05a8ab 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -170,6 +170,10 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, { ssize_t ret, required; + if (length == -1) { + length = strlen(*v) + 1; /* Extra element for null character */ + } + required = el_size * length; TDR_PUSH_NEED_BYTES(tdr, required); @@ -392,3 +396,21 @@ NTSTATUS tdr_push_to_fd(int fd, tdr_push_fn_t push_fn, const void *p) return NT_STATUS_OK; } + +void tdr_print_debug_helper(struct tdr_print *tdr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) +{ + va_list ap; + char *s = NULL; + int i; + + va_start(ap, format); + vasprintf(&s, format, ap); + va_end(ap); + + for (i=0;i<tdr->level;i++) { + DEBUG(0,(" ")); + } + + DEBUG(0,("%s\n", s)); + free(s); +} |