diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-10-02 14:29:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:17 -0500 |
commit | e264c8b6dd207862a618627ef288e3ca0a33fe0f (patch) | |
tree | b89a12bb85a61df2302965c3547cc7bb1f6dd706 /source4/lib | |
parent | 68c70ef396f84077dd08f97bf700f0c2963c8676 (diff) | |
download | samba-e264c8b6dd207862a618627ef288e3ca0a33fe0f.tar.gz samba-e264c8b6dd207862a618627ef288e3ca0a33fe0f.tar.bz2 samba-e264c8b6dd207862a618627ef288e3ca0a33fe0f.zip |
r10678: Add debug helper
Fix push for non-fixed length strings
(This used to be commit 821b0bb56f6d6b9df7bbdeeddc206505f3f0a7c2)
Diffstat (limited to 'source4/lib')
-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); +} |