summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-02-09 21:10:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:36 -0500
commit632acd9bc7704ac3d326354808c3d12f4f0a9f8f (patch)
treeb801c24612751b65c3af360e6842396f0e96d85b /source4
parent73d317e0dae5d9dd30300da9dd19abaaef5db03f (diff)
downloadsamba-632acd9bc7704ac3d326354808c3d12f4f0a9f8f.tar.gz
samba-632acd9bc7704ac3d326354808c3d12f4f0a9f8f.tar.bz2
samba-632acd9bc7704ac3d326354808c3d12f4f0a9f8f.zip
r5286: Some first steps in making the pidl code somewhat more generic for the
various data types: Add ndr_flags argument to all ndr push/pull scalar functions (This used to be commit ab490c0c882bb13de190546c50a0631ecb8255ad)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/header.pm8
-rw-r--r--source4/build/pidl/parser.pm76
-rw-r--r--source4/build/pidl/util.pm11
-rw-r--r--source4/libcli/nbt/nbtname.c4
-rw-r--r--source4/librpc/ndr/libndr.h2
-rw-r--r--source4/librpc/ndr/ndr.c22
-rw-r--r--source4/librpc/ndr/ndr_basic.c158
-rw-r--r--source4/librpc/ndr/ndr_dcom.c14
-rw-r--r--source4/librpc/ndr/ndr_sec.c4
-rw-r--r--source4/librpc/rpc/dcerpc_util.c4
-rw-r--r--source4/ntvfs/ipc/ipc_rap.c34
-rw-r--r--source4/torture/rap/rap.c32
12 files changed, 166 insertions, 203 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index c1fb5e6619..21c86bd8b0 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -257,8 +257,8 @@ sub HeaderTypedefProto($)
}
if ($d->{DATA}{TYPE} eq "ENUM") {
- $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, enum $d->{NAME} r);\n";
- $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, enum $d->{NAME} *r);\n";
+ $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, enum $d->{NAME} r);\n";
+ $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, enum $d->{NAME} *r);\n";
if (!util::has_property($d, "noprint")) {
$res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, enum $d->{NAME} r);\n";
}
@@ -266,8 +266,8 @@ sub HeaderTypedefProto($)
if ($d->{DATA}{TYPE} eq "BITMAP") {
my $type_decl = util::bitmap_type_decl($d->{DATA});
- $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, $type_decl r);\n";
- $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, $type_decl *r);\n";
+ $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, $type_decl r);\n";
+ $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, $type_decl *r);\n";
if (!util::has_property($d, "noprint")) {
$res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, $type_decl r);\n";
}
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 092ac0b297..f1942cef73 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -256,13 +256,13 @@ sub ParseArrayPush($$$)
# the conformant size has already been pushed
} elsif (!util::is_inline_array($e)) {
# we need to emit the array size
- pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, $size));\n";
+ pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));\n";
}
if (my $length = util::has_property($e, "length_is")) {
$length = find_size_var($e, $length, $var_prefix);
- pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, 0));\n";
- pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, $length));\n";
+ pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));\n";
+ pidl "\t\tNDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $length));\n";
$size = $length;
}
@@ -405,13 +405,7 @@ sub ParseElementPushScalar($$$)
} elsif (my $switch = util::has_property($e, "switch_is")) {
ParseElementPushSwitch($e, $var_prefix, $ndr_flags, $switch);
} elsif (defined $sub_size) {
- if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_push_subcontext_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_fn_t) ndr_push_$e->{TYPE}));\n";
- } else {
- pidl "\tNDR_CHECK(ndr_push_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_flags_fn_t) ndr_push_$e->{TYPE}));\n";
- }
- } elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $cprefix$var_prefix$e->{NAME}));\n";
+ pidl "\tNDR_CHECK(ndr_push_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_flags_fn_t) ndr_push_$e->{TYPE}));\n";
} else {
pidl "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $ndr_flags, $cprefix$var_prefix$e->{NAME}));\n";
}
@@ -478,7 +472,7 @@ sub ParseElementPullSwitch($$$$)
$type_decl = util::bitmap_type_decl($e2);
}
pidl "\t\t$type_decl _level;\n";
- pidl "\t\tNDR_CHECK(ndr_pull_$e2->{TYPE}(ndr, &_level));\n";
+ pidl "\t\tNDR_CHECK(ndr_pull_$e2->{TYPE}(ndr, NDR_SCALARS, &_level));\n";
if ($switch_var =~ /r->in/) {
pidl "\t\tif (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _level != $switch_var) {\n";
} else {
@@ -522,7 +516,7 @@ sub ParseElementPushSwitch($$$$)
!util::has_property($utype, "nodiscriminant")) {
my $e2 = find_sibling($e, $switch);
pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n";
- pidl "\t\tNDR_CHECK(ndr_push_$e2->{TYPE}(ndr, $switch_var));\n";
+ pidl "\t\tNDR_CHECK(ndr_push_$e2->{TYPE}(ndr, NDR_SCALARS, $switch_var));\n";
pidl "\t}\n";
}
@@ -581,13 +575,7 @@ sub ParseElementPullScalar($$$)
} elsif (my $switch = util::has_property($e, "switch_is")) {
ParseElementPullSwitch($e, $var_prefix, $ndr_flags, $switch);
} elsif (defined $sub_size) {
- if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_pull_subcontext_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_fn_t) ndr_pull_$e->{TYPE}));\n";
- } else {
- pidl "\tNDR_CHECK(ndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE}));\n";
- }
- } elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $cprefix$var_prefix$e->{NAME}));\n";
+ pidl "\tNDR_CHECK(ndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE}));\n";
} else {
pidl "\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $ndr_flags, $cprefix$var_prefix$e->{NAME}));\n";
}
@@ -635,14 +623,8 @@ sub ParseElementPushBuffer($$$)
}
} elsif (defined $sub_size) {
if ($e->{POINTERS}) {
- if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_push_subcontext_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_fn_t) ndr_push_$e->{TYPE}));\n";
- } else {
- pidl "\tNDR_CHECK(ndr_push_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_flags_fn_t) ndr_push_$e->{TYPE}));\n";
- }
+ pidl "\tNDR_CHECK(ndr_push_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_push_flags_fn_t) ndr_push_$e->{TYPE}));\n";
}
- } elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $cprefix$var_prefix$e->{NAME}));\n";
} elsif ($e->{POINTERS}) {
pidl "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, $cprefix$var_prefix$e->{NAME}));\n";
} else {
@@ -719,14 +701,8 @@ sub ParseElementPullBuffer($$$)
}
} elsif (defined $sub_size) {
if ($e->{POINTERS}) {
- if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tNDR_CHECK(ndr_pull_subcontext_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_fn_t) ndr_pull_$e->{TYPE}));\n";
- } else {
- pidl "\tNDR_CHECK(ndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE}));\n";
- }
+ pidl "\tNDR_CHECK(ndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE}));\n";
}
- } elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\t\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $cprefix$var_prefix$e->{NAME}));\n";
} elsif ($e->{POINTERS}) {
pidl "\t\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, $cprefix$var_prefix$e->{NAME}));\n";
} else {
@@ -765,12 +741,12 @@ sub ParseStructPush($)
my $size = find_size_var($e, util::array_size($e), "r->");
$e->{CONFORMANT_SIZE} = $size;
check_null_pointer($size);
- pidl "\tNDR_CHECK(ndr_push_uint32(ndr, $size));\n";
+ pidl "\tNDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));\n";
}
if (defined $e->{TYPE} && $e->{TYPE} eq "string"
&& util::property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
- pidl "\tNDR_CHECK(ndr_push_uint32(ndr, ndr_string_array_size(ndr, r->$e->{NAME})));\n";
+ pidl "\tNDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_string_array_size(ndr, r->$e->{NAME})));\n";
}
pidl "\tif (!(ndr_flags & NDR_SCALARS)) goto buffers;\n";
@@ -807,7 +783,7 @@ sub ParseEnumPush($)
start_flags($enum);
- pidl "\tNDR_CHECK(ndr_push_$type_fn(ndr, r));\n";
+ pidl "\tNDR_CHECK(ndr_push_$type_fn(ndr, NDR_SCALARS, r));\n";
end_flags($enum);
}
@@ -822,7 +798,7 @@ sub ParseEnumPull($)
pidl "\t$type_v_decl v;\n";
start_flags($enum);
- pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, &v));\n";
+ pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, NDR_SCALARS, &v));\n";
pidl "\t*r = v;\n";
end_flags($enum);
@@ -864,7 +840,7 @@ sub ParseBitmapPush($)
start_flags($bitmap);
- pidl "\tNDR_CHECK(ndr_push_$type_fn(ndr, r));\n";
+ pidl "\tNDR_CHECK(ndr_push_$type_fn(ndr, NDR_SCALARS, r));\n";
end_flags($bitmap);
}
@@ -879,7 +855,7 @@ sub ParseBitmapPull($)
pidl "\t$type_decl v;\n";
start_flags($bitmap);
- pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, &v));\n";
+ pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, NDR_SCALARS, &v));\n";
pidl "\t*r = v;\n";
end_flags($bitmap);
@@ -993,7 +969,7 @@ sub ParseStructPull($)
pidl "\tNDR_CHECK(ndr_pull_struct_start(ndr));\n";
if (defined $conform_e) {
- pidl "\tNDR_CHECK(ndr_pull_uint32(ndr, &$conform_e->{CONFORMANT_SIZE}));\n";
+ pidl "\tNDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &$conform_e->{CONFORMANT_SIZE}));\n";
}
my $align = struct_alignment($struct);
@@ -1292,7 +1268,7 @@ sub ParseTypedefPush($)
}
if ($e->{DATA}->{TYPE} eq "ENUM") {
- pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, enum $e->{NAME} r)";
+ pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, enum $e->{NAME} r)";
pidl "\n{\n";
ParseTypePush($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1301,7 +1277,7 @@ sub ParseTypedefPush($)
if ($e->{DATA}->{TYPE} eq "BITMAP") {
my $type_decl = util::bitmap_type_decl($e->{DATA});
- pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, $type_decl r)";
+ pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $type_decl r)";
pidl "\n{\n";
ParseTypePush($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1343,7 +1319,7 @@ sub ParseTypedefPull($)
}
if ($e->{DATA}->{TYPE} eq "ENUM") {
- pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, enum $e->{NAME} *r)";
+ pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, enum $e->{NAME} *r)";
pidl "\n{\n";
ParseTypePull($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1352,7 +1328,7 @@ sub ParseTypedefPull($)
if ($e->{DATA}->{TYPE} eq "BITMAP") {
my $type_decl = util::bitmap_type_decl($e->{DATA});
- pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, $type_decl *r)";
+ pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $type_decl *r)";
pidl "\n{\n";
ParseTypePull($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1454,11 +1430,9 @@ sub ParseFunctionPrint($)
}
}
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
- if (util::is_scalar_type($fn->{RETURN_TYPE})) {
- pidl "\tndr_print_$fn->{RETURN_TYPE}(ndr, \"result\", r->out.result);\n";
- } else {
- pidl "\tndr_print_$fn->{RETURN_TYPE}(ndr, \"result\", &r->out.result);\n";
- }
+ my $cprefix = "&";
+ $cprefix = "" if (util::is_scalar_type($fn->{RETURN_TYPE})) ; # FIXME: Should really use util::c_push_prefix here
+ pidl "\tndr_print_$fn->{RETURN_TYPE}(ndr, \"result\", $cprefix"."r->out.result);\n";
}
pidl "\tndr->depth--;\n";
pidl "\t}\n";
@@ -1519,7 +1493,7 @@ sub ParseFunctionPush($)
}
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
- pidl "\tNDR_CHECK(ndr_push_$fn->{RETURN_TYPE}(ndr, r->out.result));\n";
+ pidl "\tNDR_CHECK(ndr_push_$fn->{RETURN_TYPE}(ndr, NDR_SCALARS, r->out.result));\n";
}
pidl "\ndone:\n";
@@ -1660,7 +1634,7 @@ sub ParseFunctionPull($)
}
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
- pidl "\tNDR_CHECK(ndr_pull_$fn->{RETURN_TYPE}(ndr, &r->out.result));\n";
+ pidl "\tNDR_CHECK(ndr_pull_$fn->{RETURN_TYPE}(ndr, NDR_SCALARS, &r->out.result));\n";
}
pidl "\ndone:\n";
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 112b617806..bb5de2a8ed 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -346,17 +346,6 @@ sub type_align($)
return 4;
}
-# this is used to determine if the ndr push/pull functions will need
-# a ndr_flags field to split by buffers/scalars
-sub is_builtin_type($)
-{
- my($type) = shift;
-
- return 1, if (is_scalar_type($type));
-
- return 0;
-}
-
# determine if an element needs a reference pointer on the wire
# in its NDR representation
sub need_wire_pointer($)
diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c
index 0584f55fb1..7eb48e5b9e 100644
--- a/source4/libcli/nbt/nbtname.c
+++ b/source4/libcli/nbt/nbtname.c
@@ -276,10 +276,10 @@ NTSTATUS ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, struct nbt_name
/* push the components */
for (i=0;i<num_components;i++) {
uint8_t len = strlen(components[i]);
- NDR_CHECK(ndr_push_uint8(ndr, len));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, len));
NDR_CHECK(ndr_push_bytes(ndr, components[i], len));
}
- NDR_CHECK(ndr_push_uint8(ndr, 0));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0));
return NT_STATUS_OK;
}
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 5485c232b4..08bb5b3a36 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -195,7 +195,7 @@ enum ndr_err_code {
#define NDR_PUSH_ALIGN(ndr, n) do { \
if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { \
uint32_t _pad = ((ndr->offset + (n-1)) & ~(n-1)) - ndr->offset; \
- while (_pad--) NDR_CHECK(ndr_push_uint8(ndr, 0)); \
+ while (_pad--) NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0)); \
} \
} while(0)
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index f76bb7c48c..6e0300146a 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -447,14 +447,14 @@ static NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
case 2: {
uint16_t size;
- NDR_CHECK(ndr_pull_uint16(ndr, &size));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &size));
NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, size));
break;
}
case 4: {
uint32_t size;
- NDR_CHECK(ndr_pull_uint32(ndr, &size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size));
NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, size));
break;
}
@@ -529,11 +529,11 @@ static NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr,
break;
case 2:
- NDR_CHECK(ndr_push_uint16(ndr, ndr2->offset));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr2->offset));
break;
case 4:
- NDR_CHECK(ndr_push_uint32(ndr, ndr2->offset));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr2->offset));
break;
default:
@@ -684,7 +684,7 @@ static uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key)
NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p)
{
uint32_t size;
- NDR_CHECK(ndr_pull_uint32(ndr, &size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size));
return ndr_token_store(ndr, &ndr->array_size_list, p, size);
}
@@ -717,12 +717,12 @@ NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size)
NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p)
{
uint32_t length, offset;
- NDR_CHECK(ndr_pull_uint32(ndr, &offset));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &offset));
if (offset != 0) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
"non-zero array offset %u\n", offset);
}
- NDR_CHECK(ndr_pull_uint32(ndr, &length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
return ndr_token_store(ndr, &ndr->array_length_list, p, length);
}
@@ -781,12 +781,12 @@ NTSTATUS ndr_pull_relative2(struct ndr_pull *ndr, const void *p)
NTSTATUS ndr_push_relative1(struct ndr_push *ndr, const void *p)
{
if (p == NULL) {
- NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
return NT_STATUS_OK;
}
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_token_store(ndr, &ndr->relative_list, p, ndr->offset));
- return ndr_push_uint32(ndr, 0xFFFFFFFF);
+ return ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF);
}
/*
@@ -803,9 +803,9 @@ NTSTATUS ndr_push_relative2(struct ndr_push *ndr, const void *p)
ndr_push_save(ndr, &save);
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ndr->offset));
if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) {
- NDR_CHECK(ndr_push_uint32(ndr, save.offset - ndr->offset));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save.offset - ndr->offset));
} else {
- NDR_CHECK(ndr_push_uint32(ndr, save.offset));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save.offset));
}
ndr_push_restore(ndr, &save);
return NT_STATUS_OK;
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 507ee1594b..5f61a59a07 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -59,7 +59,7 @@ void ndr_check_padding(struct ndr_pull *ndr, size_t n)
/*
parse a uint8
*/
-NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, uint8_t *v)
+NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
{
NDR_PULL_NEED_BYTES(ndr, 1);
*v = CVAL(ndr->data, ndr->offset);
@@ -71,7 +71,7 @@ NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, uint8_t *v)
/*
parse a uint16
*/
-NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, uint16_t *v)
+NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
{
NDR_PULL_ALIGN(ndr, 2);
NDR_PULL_NEED_BYTES(ndr, 2);
@@ -84,7 +84,7 @@ NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, uint16_t *v)
/*
parse a uint32_t
*/
-NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, uint32_t *v)
+NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 4);
@@ -96,7 +96,7 @@ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, uint32_t *v)
/*
parse a int32_t
*/
-NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int32_t *v)
+NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 4);
@@ -111,7 +111,7 @@ NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int32_t *v)
NTSTATUS ndr_pull_ptr(struct ndr_pull *ndr, uint32_t *v)
{
NTSTATUS status;
- status = ndr_pull_uint32(ndr, v);
+ status = ndr_pull_uint32(ndr, NDR_SCALARS, v);
if (*v != 0) {
ndr->ptr_count++;
}
@@ -121,7 +121,7 @@ NTSTATUS ndr_pull_ptr(struct ndr_pull *ndr, uint32_t *v)
/*
parse a udlong
*/
-NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, uint64_t *v)
+NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
{
NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 8);
@@ -134,27 +134,27 @@ NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, uint64_t *v)
/*
parse a dlong
*/
-NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int64_t *v)
+NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v)
{
- return ndr_pull_udlong(ndr, (uint64_t *)v);
+ return ndr_pull_udlong(ndr, ndr_flags, (uint64_t *)v);
}
/*
parse a hyper
*/
-NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, uint64_t *v)
+NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
{
NDR_PULL_ALIGN(ndr, 8);
- return ndr_pull_udlong(ndr, v);
+ return ndr_pull_udlong(ndr, ndr_flags, v);
}
/*
pull a NTSTATUS
*/
-NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, NTSTATUS *status)
+NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
{
uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, &v));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*status = NT_STATUS(v);
return NT_STATUS_OK;
}
@@ -162,9 +162,9 @@ NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, NTSTATUS *status)
/*
push a NTSTATUS
*/
-NTSTATUS ndr_push_NTSTATUS(struct ndr_push *ndr, NTSTATUS status)
+NTSTATUS ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status)
{
- return ndr_push_uint32(ndr, NT_STATUS_V(status));
+ return ndr_push_uint32(ndr, ndr_flags, NT_STATUS_V(status));
}
void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS *r)
@@ -175,10 +175,10 @@ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS *r)
/*
pull a WERROR
*/
-NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, WERROR *status)
+NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status)
{
uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, &v));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*status = W_ERROR(v);
return NT_STATUS_OK;
}
@@ -186,9 +186,9 @@ NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, WERROR *status)
/*
push a WERROR
*/
-NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, WERROR status)
+NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status)
{
- return ndr_push_uint32(ndr, W_ERROR_V(status));
+ return ndr_push_uint32(ndr, NDR_SCALARS, W_ERROR_V(status));
}
void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r)
@@ -229,7 +229,7 @@ NTSTATUS ndr_pull_array_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *da
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_pull_uint16(ndr, &data[i]));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &data[i]));
}
return NT_STATUS_OK;
}
@@ -244,7 +244,7 @@ NTSTATUS ndr_pull_array_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *da
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_pull_uint32(ndr, &data[i]));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &data[i]));
}
return NT_STATUS_OK;
}
@@ -259,7 +259,7 @@ NTSTATUS ndr_pull_array_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *dat
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_pull_hyper(ndr, &data[i]));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &data[i]));
}
return NT_STATUS_OK;
}
@@ -274,7 +274,7 @@ NTSTATUS ndr_pull_array_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *data
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_pull_WERROR(ndr, &data[i]));
+ NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &data[i]));
}
return NT_STATUS_OK;
}
@@ -284,7 +284,7 @@ NTSTATUS ndr_pull_array_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *data
/*
push a uint8
*/
-NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8_t v)
+NTSTATUS ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
{
NDR_PUSH_NEED_BYTES(ndr, 1);
SCVAL(ndr->data, ndr->offset, v);
@@ -295,7 +295,7 @@ NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8_t v)
/*
push a uint16
*/
-NTSTATUS ndr_push_uint16(struct ndr_push *ndr, uint16_t v)
+NTSTATUS ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
{
NDR_PUSH_ALIGN(ndr, 2);
NDR_PUSH_NEED_BYTES(ndr, 2);
@@ -307,7 +307,7 @@ NTSTATUS ndr_push_uint16(struct ndr_push *ndr, uint16_t v)
/*
push a uint32_t
*/
-NTSTATUS ndr_push_uint32(struct ndr_push *ndr, uint32_t v)
+NTSTATUS ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 4);
@@ -319,7 +319,7 @@ NTSTATUS ndr_push_uint32(struct ndr_push *ndr, uint32_t v)
/*
push a int32_t
*/
-NTSTATUS ndr_push_int32(struct ndr_push *ndr, int32_t v)
+NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 4);
@@ -331,7 +331,7 @@ NTSTATUS ndr_push_int32(struct ndr_push *ndr, int32_t v)
/*
push a uint64
*/
-NTSTATUS ndr_push_udlong(struct ndr_push *ndr, uint64_t v)
+NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v)
{
NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 8);
@@ -344,18 +344,18 @@ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, uint64_t v)
/*
push a int64
*/
-NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int64_t v)
+NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v)
{
- return ndr_push_udlong(ndr, (uint64_t)v);
+ return ndr_push_udlong(ndr, NDR_SCALARS, (uint64_t)v);
}
/*
push a hyper
*/
-NTSTATUS ndr_push_hyper(struct ndr_push *ndr, uint64_t v)
+NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v)
{
NDR_PUSH_ALIGN(ndr, 8);
- return ndr_push_udlong(ndr, v);
+ return ndr_push_udlong(ndr, NDR_SCALARS, v);
}
NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size)
@@ -413,7 +413,7 @@ NTSTATUS ndr_push_array_uint16(struct ndr_push *ndr, int ndr_flags, const uint16
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_push_uint16(ndr, data[i]));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, data[i]));
}
return NT_STATUS_OK;
}
@@ -428,7 +428,7 @@ NTSTATUS ndr_push_array_uint32(struct ndr_push *ndr, int ndr_flags, const uint32
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_push_uint32(ndr, data[i]));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, data[i]));
}
return NT_STATUS_OK;
}
@@ -443,7 +443,7 @@ NTSTATUS ndr_push_array_hyper(struct ndr_push *ndr, int ndr_flags, const uint64_
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_push_hyper(ndr, data[i]));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, data[i]));
}
return NT_STATUS_OK;
}
@@ -458,7 +458,7 @@ NTSTATUS ndr_push_array_WERROR(struct ndr_push *ndr, int ndr_flags, const WERROR
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
- NDR_CHECK(ndr_push_WERROR(ndr, data[i]));
+ NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, data[i]));
}
return NT_STATUS_OK;
}
@@ -492,7 +492,7 @@ NTSTATUS ndr_push_ptr(struct ndr_push *ndr, const void *p)
ndr->ptr_count++;
ptr = ndr->ptr_count;
}
- return ndr_push_uint32(ndr, ptr);
+ return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}
@@ -539,13 +539,13 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
switch (flags & LIBNDR_STRING_FLAGS) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
- NDR_CHECK(ndr_pull_uint32(ndr, &len1));
- NDR_CHECK(ndr_pull_uint32(ndr, &ofs));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
- NDR_CHECK(ndr_pull_uint32(ndr, &len2));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len2));
if (len2 > len1) {
return ndr_pull_error(ndr, NDR_ERR_STRING,
"Bad string lengths len1=%u ofs=%u len2=%u\n",
@@ -582,7 +582,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
case LIBNDR_FLAG_STR_SIZE4:
case LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
- NDR_CHECK(ndr_pull_uint32(ndr, &len1));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
NDR_PULL_NEED_BYTES(ndr, (len1 + c_len_term)*byte_mul);
if (len1 == 0) {
*s = talloc_strdup(ndr, "");
@@ -614,12 +614,12 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
case LIBNDR_FLAG_STR_LEN4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM:
- NDR_CHECK(ndr_pull_uint32(ndr, &ofs));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
- NDR_CHECK(ndr_pull_uint32(ndr, &len1));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
NDR_PULL_NEED_BYTES(ndr, (len1 + c_len_term)*byte_mul);
if (len1 == 0) {
*s = talloc_strdup(ndr, "");
@@ -652,7 +652,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
case LIBNDR_FLAG_STR_SIZE2:
case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM:
- NDR_CHECK(ndr_pull_uint16(ndr, &len3));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3));
NDR_PULL_NEED_BYTES(ndr, (len3 + c_len_term)*byte_mul);
if (len3 == 0) {
*s = talloc_strdup(ndr, "");
@@ -683,7 +683,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
break;
case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_BYTESIZE:
- NDR_CHECK(ndr_pull_uint16(ndr, &len3));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &len3));
NDR_PULL_NEED_BYTES(ndr, len3);
if (len3 == 0) {
*s = talloc_strdup(ndr, "");
@@ -788,9 +788,9 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
switch (flags & LIBNDR_STRING_FLAGS) {
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
- NDR_CHECK(ndr_push_uint32(ndr, c_len+c_len_term));
- NDR_CHECK(ndr_push_uint32(ndr, 0));
- NDR_CHECK(ndr_push_uint32(ndr, c_len+c_len_term));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len+c_len_term));
NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
ret = convert_string(CH_UNIX, chset,
s, s_len+1,
@@ -804,9 +804,9 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
break;
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
- NDR_CHECK(ndr_push_uint32(ndr, c_len));
- NDR_CHECK(ndr_push_uint32(ndr, 0));
- NDR_CHECK(ndr_push_uint32(ndr, c_len));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len));
NDR_PUSH_NEED_BYTES(ndr, c_len*byte_mul);
ret = convert_string(CH_UNIX, chset,
s, s_len,
@@ -819,8 +819,8 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
break;
case LIBNDR_FLAG_STR_LEN4:
- NDR_CHECK(ndr_push_uint32(ndr, 0));
- NDR_CHECK(ndr_push_uint32(ndr, c_len + c_len_term));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len + c_len_term));
NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
ret = convert_string(CH_UNIX, chset,
s, s_len + 1,
@@ -833,7 +833,7 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
break;
case LIBNDR_FLAG_STR_SIZE4:
- NDR_CHECK(ndr_push_uint32(ndr, c_len + c_len_term));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, c_len + c_len_term));
NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
ret = convert_string(CH_UNIX, chset,
s, s_len + 1,
@@ -846,7 +846,7 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
break;
case LIBNDR_FLAG_STR_SIZE2:
- NDR_CHECK(ndr_push_uint16(ndr, c_len + c_len_term));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, c_len + c_len_term));
NDR_PUSH_NEED_BYTES(ndr, byte_mul*(c_len+1));
ret = convert_string(CH_UNIX, chset,
s, s_len + 1,
@@ -871,7 +871,7 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
break;
case LIBNDR_FLAG_STR_SIZE2|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_STR_BYTESIZE:
- NDR_CHECK(ndr_push_uint16(ndr, c_len*byte_mul));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, c_len*byte_mul));
NDR_PUSH_NEED_BYTES(ndr, c_len*byte_mul);
ret = convert_string(CH_UNIX, chset,
s, s_len,
@@ -945,37 +945,37 @@ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s)
/*
push a NTTIME
*/
-NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, NTTIME t)
+NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- NDR_CHECK(ndr_push_udlong(ndr, t));
+ NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
pull a NTTIME
*/
-NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, NTTIME *t)
+NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- NDR_CHECK(ndr_pull_udlong(ndr, t));
+ NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a NTTIME
*/
-NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, NTTIME t)
+NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
t /= 10000000;
- NDR_CHECK(ndr_push_hyper(ndr, t));
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
pull a NTTIME_1sec
*/
-NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, NTTIME *t)
+NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- NDR_CHECK(ndr_pull_hyper(ndr, t));
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
(*t) *= 10000000;
return NT_STATUS_OK;
}
@@ -983,36 +983,36 @@ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, NTTIME *t)
/*
pull a NTTIME_hyper
*/
-NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, NTTIME *t)
+NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- NDR_CHECK(ndr_pull_hyper(ndr, t));
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a NTTIME_hyper
*/
-NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, NTTIME t)
+NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- NDR_CHECK(ndr_push_hyper(ndr, t));
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
/*
push a time_t
*/
-NTSTATUS ndr_push_time_t(struct ndr_push *ndr, time_t t)
+NTSTATUS ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t)
{
- return ndr_push_uint32(ndr, t);
+ return ndr_push_uint32(ndr, ndr_flags, t);
}
/*
pull a time_t
*/
-NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, time_t *t)
+NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t)
{
uint32_t tt;
- NDR_CHECK(ndr_pull_uint32(ndr, &tt));
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &tt));
*t = tt;
return NT_STATUS_OK;
}
@@ -1021,10 +1021,10 @@ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, time_t *t)
/*
pull a ipv4address
*/
-NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, const char **address)
+NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
{
struct ipv4_addr in;
- NDR_CHECK(ndr_pull_uint32(ndr, &in.addr));
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.addr));
in.addr = htonl(in.addr);
*address = talloc_strdup(ndr, sys_inet_ntoa(in));
NT_STATUS_HAVE_NO_MEMORY(*address);
@@ -1034,10 +1034,10 @@ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, const char **address)
/*
push a ipv4address
*/
-NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, const char *address)
+NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address)
{
uint32_t addr = interpret_addr(address);
- NDR_CHECK(ndr_push_uint32(ndr, htonl(addr)));
+ NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, htonl(addr)));
return NT_STATUS_OK;
}
@@ -1290,7 +1290,7 @@ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
/*
push a DATA_BLOB onto the wire.
*/
-NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, DATA_BLOB blob)
+NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
{
if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
@@ -1303,7 +1303,7 @@ NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, DATA_BLOB blob)
NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length);
data_blob_clear(&blob);
} else if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
- NDR_CHECK(ndr_push_uint32(ndr, blob.length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
}
NDR_CHECK(ndr_push_bytes(ndr, blob.data, blob.length));
return NT_STATUS_OK;
@@ -1312,7 +1312,7 @@ NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, DATA_BLOB blob)
/*
pull a DATA_BLOB from the wire.
*/
-NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, DATA_BLOB *blob)
+NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob)
{
uint32_t length;
@@ -1330,7 +1330,7 @@ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, DATA_BLOB *blob)
} else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
length = ndr->data_size - ndr->offset;
} else {
- NDR_CHECK(ndr_pull_uint32(ndr, &length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
}
NDR_PULL_NEED_BYTES(ndr, length);
*blob = data_blob_talloc(ndr, ndr->data+ndr->offset, length);
diff --git a/source4/librpc/ndr/ndr_dcom.c b/source4/librpc/ndr/ndr_dcom.c
index 71a43a8fff..2a28db4178 100644
--- a/source4/librpc/ndr/ndr_dcom.c
+++ b/source4/librpc/ndr/ndr_dcom.c
@@ -33,16 +33,16 @@ NTSTATUS ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DU
return NT_STATUS_OK;
}
- NDR_CHECK(ndr_pull_uint32(ndr, &conformant_size));
- NDR_CHECK(ndr_pull_uint16(ndr, &num_entries));
- NDR_CHECK(ndr_pull_uint16(ndr, &security_offset));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &conformant_size));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &security_offset));
ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, num_entries);
ar->stringbindings[0] = NULL;
do {
/* 'Peek' */
- NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
if (towerid > 0) {
ndr->offset -= 2;
@@ -61,7 +61,7 @@ NTSTATUS ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DU
do {
/* 'Peek' */
- NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
if (towerid > 0) {
ndr->offset -= 2;
@@ -124,14 +124,14 @@ NTSTATUS ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRING
return NT_STATUS_OK;
}
- NDR_CHECK(ndr_pull_uint16(ndr, &num_entries));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
ar->stringbindings[0] = NULL;
do {
/* 'Peek' */
- NDR_CHECK(ndr_pull_uint16(ndr, &towerid));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
if (towerid > 0) {
ndr->offset -= 2;
diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c
index 5adff6b0ce..162d684b03 100644
--- a/source4/librpc/ndr/ndr_sec.c
+++ b/source4/librpc/ndr/ndr_sec.c
@@ -34,7 +34,7 @@ NTSTATUS ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
- NDR_CHECK(ndr_pull_uint32(ndr, &num_auths));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &num_auths));
NDR_CHECK(ndr_pull_dom_sid(ndr, ndr_flags, sid));
if (sid->num_auths != num_auths) {
return ndr_pull_error(ndr, NDR_ERR_CONFORMANT_SIZE,
@@ -52,7 +52,7 @@ NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, struct dom_sid *
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
- NDR_CHECK(ndr_push_uint32(ndr, sid->num_auths));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, sid->num_auths));
return ndr_push_dom_sid(ndr, ndr_flags, sid);
}
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 2dc9d712b4..22ff5d0362 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -458,7 +458,7 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *floor, struct GUID *uuid, u
return status;
}
- status = ndr_pull_uint16(ndr, if_version);
+ status = ndr_pull_uint16(ndr, NDR_SCALARS, if_version);
talloc_free(mem_ctx);
@@ -472,7 +472,7 @@ DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, struct GUID *uuid, uin
ndr->flags |= LIBNDR_FLAG_NOALIGN;
ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, uuid);
- ndr_push_uint16(ndr, if_version);
+ ndr_push_uint16(ndr, NDR_SCALARS, if_version);
return ndr_push_blob(ndr);
}
diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c
index a61dbcb852..7ee7d26e35 100644
--- a/source4/ntvfs/ipc/ipc_rap.c
+++ b/source4/ntvfs/ipc/ipc_rap.c
@@ -109,7 +109,7 @@ static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16 *result)
if (*call->paramdesc++ != 'W')
return NT_STATUS_INVALID_PARAMETER;
- return ndr_pull_uint16(call->ndr_pull_param, result);
+ return ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result);
}
static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result)
@@ -117,7 +117,7 @@ static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32 *result)
if (*call->paramdesc++ != 'D')
return NT_STATUS_INVALID_PARAMETER;
- return ndr_pull_uint32(call->ndr_pull_param, result);
+ return ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result);
}
static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result)
@@ -142,7 +142,7 @@ static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16 *bufsize)
if ( (*call->paramdesc++ != 'r') || (*call->paramdesc++ != 'L') )
return NT_STATUS_INVALID_PARAMETER;
- result = ndr_pull_uint16(call->ndr_pull_param, bufsize);
+ result = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize);
if (!NT_STATUS_IS_OK(result))
return result;
@@ -176,8 +176,8 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push,
heap->offset -= space;
- NDR_CHECK(ndr_push_uint16(data_push, heap->offset));
- NDR_CHECK(ndr_push_uint16(data_push, 0));
+ NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset));
+ NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, 0));
heap->strings = talloc_realloc(heap->mem_ctx,
heap->strings,
@@ -249,9 +249,9 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req,
(const uint8_t *)r.out.info[i].info1.name,
sizeof(r.out.info[i].info1.name)));
NDR_OK(ndr_push_uint8(call->ndr_push_data,
- r.out.info[i].info1.pad));
+ NDR_SCALARS, r.out.info[i].info1.pad));
NDR_OK(ndr_push_uint16(call->ndr_push_data,
- r.out.info[i].info1.type));
+ NDR_SCALARS, r.out.info[i].info1.type));
NDR_OK(rap_push_string(call->ndr_push_data,
call->heap,
@@ -272,8 +272,8 @@ static NTSTATUS _rap_netshareenum(struct smbsrv_request *req,
call->status = r.out.status;
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count));
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available));
+ NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
+ NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
result = NT_STATUS_OK;
@@ -332,11 +332,11 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req,
(const uint8_t *)r.out.info[i].info1.name,
sizeof(r.out.info[i].info1.name)));
NDR_OK(ndr_push_uint8(call->ndr_push_data,
- r.out.info[i].info1.version_major));
+ NDR_SCALARS, r.out.info[i].info1.version_major));
NDR_OK(ndr_push_uint8(call->ndr_push_data,
- r.out.info[i].info1.version_minor));
+ NDR_SCALARS, r.out.info[i].info1.version_minor));
NDR_OK(ndr_push_uint32(call->ndr_push_data,
- r.out.info[i].info1.servertype));
+ NDR_SCALARS, r.out.info[i].info1.servertype));
NDR_OK(rap_push_string(call->ndr_push_data,
call->heap,
@@ -357,8 +357,8 @@ static NTSTATUS _rap_netserverenum2(struct smbsrv_request *req,
call->status = r.out.status;
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.count));
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, r.out.available));
+ NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
+ NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
result = NT_STATUS_OK;
@@ -399,7 +399,7 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans)
if (call == NULL)
return NT_STATUS_NO_MEMORY;
- NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, &call->callno));
+ NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno));
NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
&call->paramdesc));
NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
@@ -440,9 +440,9 @@ NTSTATUS ipc_rap_call(struct smbsrv_request *req, struct smb_trans2 *trans)
final_param->flags = RAPNDR_FLAGS;
final_data->flags = RAPNDR_FLAGS;
- NDR_CHECK(ndr_push_uint16(final_param, call->status));
+ NDR_CHECK(ndr_push_uint16(final_param, NDR_SCALARS, call->status));
NDR_CHECK(ndr_push_uint16(final_param,
- call->heap->offset - result_data.length));
+ NDR_SCALARS, call->heap->offset - result_data.length));
NDR_CHECK(ndr_push_bytes(final_param, result_param.data,
result_param.length));
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index b68564aa2e..f46c00eaea 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -83,20 +83,20 @@ static void rap_cli_push_paramdesc(struct rap_call *call, char desc)
static void rap_cli_push_word(struct rap_call *call, uint16 val)
{
rap_cli_push_paramdesc(call, 'W');
- ndr_push_uint16(call->ndr_push_param, val);
+ ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, val);
}
static void rap_cli_push_dword(struct rap_call *call, uint32 val)
{
rap_cli_push_paramdesc(call, 'D');
- ndr_push_uint32(call->ndr_push_param, val);
+ ndr_push_uint32(call->ndr_push_param, NDR_SCALARS, val);
}
static void rap_cli_push_rcvbuf(struct rap_call *call, int len)
{
rap_cli_push_paramdesc(call, 'r');
rap_cli_push_paramdesc(call, 'L');
- ndr_push_uint16(call->ndr_push_param, len);
+ ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, len);
call->rcv_datalen = len;
}
@@ -130,8 +130,8 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
const char *p;
size_t len;
- NDR_CHECK(ndr_pull_uint16(ndr, &string_offset));
- NDR_CHECK(ndr_pull_uint16(ndr, &ignore));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &string_offset));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &ignore));
string_offset -= convert;
@@ -173,7 +173,7 @@ static NTSTATUS rap_cli_do_call(struct smbcli_state *cli, struct rap_call *call)
trans.in.setup = NULL;
trans.in.trans_name = "\\PIPE\\LANMAN";
- NDR_CHECK(ndr_push_uint16(params, call->callno));
+ NDR_CHECK(ndr_push_uint16(params, NDR_SCALARS, call->callno));
if (call->paramdesc)
NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
if (call->datadesc)
@@ -236,10 +236,10 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_state *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.available));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(call, union rap_shareenum_info,
r->out.count);
@@ -261,7 +261,7 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_state *cli,
NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)&r->out.info[i].info1.pad, 1));
NDR_OK(ndr_pull_uint16(call->ndr_pull_data,
- &r->out.info[i].info1.type));
+ NDR_SCALARS, &r->out.info[i].info1.type));
NDR_OK(rap_pull_string(call, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));
@@ -330,10 +330,10 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_state *cli,
result = NT_STATUS_INVALID_PARAMETER;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, &r->out.available));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(call, union rap_server_info,
r->out.count);
@@ -357,7 +357,7 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_state *cli,
NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info[i].info1.version_minor, 1));
NDR_OK(ndr_pull_uint32(call->ndr_pull_data,
- &r->out.info[i].info1.servertype));
+ NDR_SCALARS, &r->out.info[i].info1.servertype));
NDR_OK(rap_pull_string(call, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));