From 011f103501e9465fbea56194910e082306bbf1f1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Aug 2009 15:33:37 +1000 Subject: [PATCH] when we get an NDR error in the logs, it is useful to know where it happened --- librpc/ndr/libndr.h | 2 +- pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 7109b73d2a9..53bed011e7c 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -215,7 +215,7 @@ enum ndr_compression_alg { #define NDR_PULL_NEED_BYTES(ndr, n) do { \ if ((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size) { \ - return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u", (unsigned)n); \ + return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u (%s)", (unsigned)n, __location__); \ } \ } while(0) diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 3e724c986da..cc8085a54fd 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -1669,7 +1669,7 @@ sub ParseUnionPushPrimitives($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); + $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); } $self->deindent; $self->pidl("}"); @@ -1705,7 +1705,7 @@ sub ParseUnionPushDeferred($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); + $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); } $self->deindent; $self->pidl("}"); @@ -1784,7 +1784,7 @@ sub ParseUnionPullPrimitives($$$$$) if (defined($switch_type)) { $self->pidl("NDR_CHECK(ndr_pull_$switch_type($ndr, NDR_SCALARS, &_level));"); $self->pidl("if (_level != level) {"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u for $varname\", _level);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u for $varname at \%s\", _level, __location__);"); $self->pidl("}"); } @@ -1814,7 +1814,7 @@ sub ParseUnionPullPrimitives($$$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); } $self->deindent; $self->pidl("}"); @@ -1848,7 +1848,7 @@ sub ParseUnionPullDeferred($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); } $self->deindent; $self->pidl("}"); -- 2.11.4.GIT