summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-10-27 09:57:09 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:40 +0100
commite63df41e743ba9323ad2a563f042d227a0f55b8f (patch)
treea6f6b13aee1b91e8bbdd121aa6e483e3ed35a76e /source4/pidl
parent7d72ade608a8bb8f7b53cbd2d5420accb7df62ba (diff)
downloadsamba-e63df41e743ba9323ad2a563f042d227a0f55b8f.tar.gz
samba-e63df41e743ba9323ad2a563f042d227a0f55b8f.tar.bz2
samba-e63df41e743ba9323ad2a563f042d227a0f55b8f.zip
r25745: [pidl] ndr_pull/push_error(ndr, NDR_ERR_INVALID_POINTER,..)
instead NT_STATUS_INVALID_PARAMETER_MIX metze (This used to be commit 76b628df53d6cf028fb9f22df003ac87fe3b3c56)
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm33
1 files changed, 24 insertions, 9 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index cd3981bb28..002e49c8b1 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -423,8 +423,10 @@ sub ParseArrayPullHeader($$$$$$)
} elsif ($l->{IS_ZERO_TERMINATED}) { # Noheader arrays
$length = $size = "ndr_get_string_size($ndr, sizeof(*$var_name))";
} else {
- $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL},
- check_null_pointer($e, $env, sub { $self->pidl(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
+ $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, sub { $self->pidl(shift); },
+ "return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for size_is()\");"),
+ check_fully_dereferenced($e, $env));
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
@@ -447,7 +449,10 @@ sub ParseArrayPullHeader($$$$$$)
if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) {
$self->defer("if ($var_name) {");
$self->defer_indent;
- my $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, sub { $self->defer(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
+ my $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, sub { $self->defer(shift); },
+ "return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for size_is()\");"),
+ check_fully_dereferenced($e, $env));
$self->defer("NDR_CHECK(ndr_check_array_size(ndr, (void*)" . get_pointer_to($var_name) . ", $size));");
$self->defer_deindent;
$self->defer("}");
@@ -457,7 +462,8 @@ sub ParseArrayPullHeader($$$$$$)
$self->defer("if ($var_name) {");
$self->defer_indent;
my $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL},
- check_null_pointer($e, $env, sub { $self->defer(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"),
+ check_null_pointer($e, $env, sub { $self->defer(shift); },
+ "return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for length_is()\");"),
check_fully_dereferenced($e, $env));
$self->defer("NDR_CHECK(ndr_check_array_length(ndr, (void*)" . get_pointer_to($var_name) . ", $length));");
$self->defer_deindent;
@@ -740,7 +746,11 @@ sub ParsePtrPush($$$$)
my ($self,$e,$l,$var_name) = @_;
if ($l->{POINTER_TYPE} eq "ref") {
- $self->pidl("if ($var_name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;");
+ $self->pidl("if ($var_name == NULL) {");
+ $self->indent;
+ $self->pidl("return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL [ref] pointer\");");
+ $self->deindent;
+ $self->pidl("}");
if ($l->{LEVEL} eq "EMBEDDED") {
$self->pidl("NDR_CHECK(ndr_push_ref_ptr(ndr));");
}
@@ -875,7 +885,9 @@ sub ParseSwitchPull($$$$$$)
{
my($self,$e,$l,$ndr,$var_name,$env) = @_;
my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
- check_null_pointer($e, $env, sub { $self->pidl(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
+ check_null_pointer($e, $env, sub { $self->pidl(shift); },
+ "return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for switch_is()\");"),
+ check_fully_dereferenced($e, $env));
$var_name = get_pointer_to($var_name);
$self->pidl("NDR_CHECK(ndr_pull_set_switch_value($ndr, $var_name, $switch_var));");
@@ -887,7 +899,9 @@ sub ParseSwitchPush($$$$$$)
{
my($self,$e,$l,$ndr,$var_name,$env) = @_;
my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
- check_null_pointer($e, $env, sub { $self->pidl(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
+ check_null_pointer($e, $env, sub { $self->pidl(shift); },
+ "return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for switch_is()\");"),
+ check_fully_dereferenced($e, $env));
$var_name = get_pointer_to($var_name);
$self->pidl("NDR_CHECK(ndr_push_set_switch_value($ndr, $var_name, $switch_var));");
@@ -2222,9 +2236,10 @@ sub ParseFunctionPull($$)
and $e->{LEVELS}[1]->{IS_ZERO_TERMINATED});
if ($e->{LEVELS}[1]->{TYPE} eq "ARRAY") {
- my $size = ParseExprExt($e->{LEVELS}[1]->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, sub { $self->pidl(shift); }, "return NT_STATUS_INVALID_PARAMETER_MIX;"),
+ my $size = ParseExprExt($e->{LEVELS}[1]->{SIZE_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, sub { $self->pidl(shift); },
+ "return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, \"NULL Pointer for size_is()\");"),
check_fully_dereferenced($e, $env));
-
$self->pidl("NDR_PULL_ALLOC_N(ndr, r->out.$e->{NAME}, $size);");
if (grep(/in/, @{$e->{DIRECTION}})) {