summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-08-18 00:45:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:29 -0500
commita8d31eac00cf13c20343374f11224778e470e849 (patch)
treebcacf294fc1768135c60c1b42b7eb6e37308d277
parent810dffecc23a16dee1430a1fd6c833472835c013 (diff)
downloadsamba-a8d31eac00cf13c20343374f11224778e470e849.tar.gz
samba-a8d31eac00cf13c20343374f11224778e470e849.tar.bz2
samba-a8d31eac00cf13c20343374f11224778e470e849.zip
r9372: - make the subcontext handling autogenerated code look nicer,
- unify the handling of subcontext, compression and obfucation metze (This used to be commit 09de7e0af7f9f7539cf63791baf90ac202536176)
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm125
-rw-r--r--source4/librpc/ndr/ndr.c98
-rw-r--r--source4/librpc/ndr/ndr_compression.c54
-rw-r--r--source4/librpc/ndr/ndr_krb5pac.c14
-rw-r--r--source4/librpc/ndr/ndr_obfuscate.c14
5 files changed, 179 insertions, 126 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
index 4dd838bcb7..8692fbb0f4 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
@@ -367,30 +367,29 @@ sub compression_dlen($$$)
return ParseExpr($dlen, $env);
}
-sub ParseCompressionPushStart($$$)
+sub ParseCompressionPushStart($$$$)
{
- my ($e,$l,$ndr) = @_;
+ my ($e,$l,$ndr,$env) = @_;
my $comndr = "$ndr\_compressed";
+ my $alg = compression_alg($e, $l);
+ my $dlen = compression_dlen($e, $l, $env);
pidl "{";
indent;
pidl "struct ndr_push *$comndr;";
- pidl "";
- pidl "$comndr = ndr_push_init_ctx($ndr);";
- pidl "if (!$comndr) return NT_STATUS_NO_MEMORY;";
- pidl "$comndr->flags = $ndr->flags;";
- pidl "";
-
+ pidl "NDR_CHECK(ndr_push_compression_start($ndr, &$comndr, $alg, $dlen));";
+
return $comndr;
}
-sub ParseCompressionPushEnd($$$)
+sub ParseCompressionPushEnd($$$$)
{
- my ($e,$l,$ndr) = @_;
+ my ($e,$l,$ndr,$env) = @_;
my $comndr = "$ndr\_compressed";
my $alg = compression_alg($e, $l);
+ my $dlen = compression_dlen($e, $l, $env);
- pidl "NDR_CHECK(ndr_push_compression($ndr, $comndr, $alg));";
+ pidl "NDR_CHECK(ndr_push_compression_end($ndr, $comndr, $alg, $dlen));";
deindent;
pidl "}";
}
@@ -405,17 +404,19 @@ sub ParseCompressionPullStart($$$$)
pidl "{";
indent;
pidl "struct ndr_pull *$comndr;";
- pidl "NDR_ALLOC($ndr, $comndr);";
- pidl "NDR_CHECK(ndr_pull_compression($ndr, $comndr, $alg, $dlen));";
+ pidl "NDR_CHECK(ndr_pull_compression_start($ndr, &$comndr, $alg, $dlen));";
return $comndr;
}
-sub ParseCompressionPullEnd($$$)
+sub ParseCompressionPullEnd($$$$)
{
- my ($e,$l,$ndr) = @_;
+ my ($e,$l,$ndr,$env) = @_;
my $comndr = "$ndr\_compressed";
+ my $alg = compression_alg($e, $l);
+ my $dlen = compression_dlen($e, $l, $env);
+ pidl "NDR_CHECK(ndr_pull_compression_end($ndr, $comndr, $alg, $dlen));";
deindent;
pidl "}";
}
@@ -423,8 +424,9 @@ sub ParseCompressionPullEnd($$$)
sub ParseObfuscationPushStart($$)
{
my ($e,$ndr) = @_;
+ my $obfuscation = has_property($e, "obfuscation");
- # nothing to do here
+ pidl "NDR_CHECK(ndr_push_obfuscation_start($ndr, $obfuscation));";
return $ndr;
}
@@ -434,7 +436,7 @@ sub ParseObfuscationPushEnd($$)
my ($e,$ndr) = @_;
my $obfuscation = has_property($e, "obfuscation");
- pidl "NDR_CHECK(ndr_push_obfuscation($ndr, $obfuscation));";
+ pidl "NDR_CHECK(ndr_push_obfuscation_end($ndr, $obfuscation));";
}
sub ParseObfuscationPullStart($$)
@@ -442,7 +444,7 @@ sub ParseObfuscationPullStart($$)
my ($e,$ndr) = @_;
my $obfuscation = has_property($e, "obfuscation");
- pidl "NDR_CHECK(ndr_pull_obfuscation($ndr, $obfuscation));";
+ pidl "NDR_CHECK(ndr_pull_obfuscation_start($ndr, $obfuscation));";
return $ndr;
}
@@ -450,100 +452,89 @@ sub ParseObfuscationPullStart($$)
sub ParseObfuscationPullEnd($$)
{
my ($e,$ndr) = @_;
+ my $obfuscation = has_property($e, "obfuscation");
- # nothing to do here
+ pidl "NDR_CHECK(ndr_pull_obfuscation_end($ndr, $obfuscation));";
}
-sub ParseSubcontextPushStart($$$$$)
+sub ParseSubcontextPushStart($$$$)
{
- my ($e,$l,$ndr,$var_name,$ndr_flags) = @_;
- my $retndr = "_ndr_$e->{NAME}";
+ my ($e,$l,$ndr,$env) = @_;
+ my $subndr = "_ndr_$e->{NAME}";
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
pidl "{";
indent;
- pidl "struct ndr_push *$retndr;";
- pidl "";
- pidl "$retndr = ndr_push_init_ctx($ndr);";
- pidl "if (!$retndr) return NT_STATUS_NO_MEMORY;";
- pidl "$retndr->flags = $ndr->flags;";
- pidl "";
+ pidl "struct ndr_push *$subndr;";
+ pidl "NDR_CHECK(ndr_push_subcontext_start($ndr, &$subndr, $l->{HEADER_SIZE}, $subcontext_size));";
if (defined $l->{COMPRESSION}) {
- $retndr = ParseCompressionPushStart($e, $l, $retndr);
+ $subndr = ParseCompressionPushStart($e, $l, $subndr, $env);
}
if (defined $l->{OBFUSCATION}) {
- $retndr = ParseObfuscationPushStart($e, $retndr);
+ $subndr = ParseObfuscationPushStart($e, $subndr);
}
- return $retndr;
+ return $subndr;
}
sub ParseSubcontextPushEnd($$$$)
{
- my ($e,$l,$ndr_flags,$env) = @_;
- my $ndr = "_ndr_$e->{NAME}";
+ my ($e,$l,$ndr,$env) = @_;
+ my $subndr = "_ndr_$e->{NAME}";
my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
if (defined $l->{COMPRESSION}) {
- ParseCompressionPushEnd($e, $l, $ndr);
+ ParseCompressionPushEnd($e, $l, $subndr, $env);
}
if (defined $l->{OBFUSCATION}) {
- ParseObfuscationPushEnd($e, $ndr);
+ ParseObfuscationPushEnd($e, $subndr);
}
- pidl "NDR_CHECK(ndr_push_subcontext_header(ndr, $l->{HEADER_SIZE}, $subcontext_size, $ndr));";
- pidl "NDR_CHECK(ndr_push_bytes(ndr, $ndr->data, $ndr->offset));";
+ pidl "NDR_CHECK(ndr_push_subcontext_end($ndr, $subndr, $l->{HEADER_SIZE}, $subcontext_size));";
deindent;
pidl "}";
}
-sub ParseSubcontextPullStart($$$$$$)
+sub ParseSubcontextPullStart($$$$)
{
- my ($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $retndr = "_ndr_$e->{NAME}";
+ my ($e,$l,$ndr,$env) = @_;
+ my $subndr = "_ndr_$e->{NAME}";
my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
pidl "{";
indent;
- pidl "struct ndr_pull *$retndr;";
- pidl "NDR_ALLOC(ndr, $retndr);";
- pidl "NDR_CHECK(ndr_pull_subcontext_header($ndr, $l->{HEADER_SIZE}, $subcontext_size, $retndr));";
+ pidl "struct ndr_pull *$subndr;";
+ pidl "NDR_CHECK(ndr_pull_subcontext_start($ndr, &$subndr, $l->{HEADER_SIZE}, $subcontext_size));";
if (defined $l->{COMPRESSION}) {
- $retndr = ParseCompressionPullStart($e, $l, $retndr, $env);
+ $subndr = ParseCompressionPullStart($e, $l, $subndr, $env);
}
if (defined $l->{OBFUSCATION}) {
- $retndr = ParseObfuscationPullStart($e, $retndr);
+ $subndr = ParseObfuscationPullStart($e, $subndr);
}
- return ($retndr,$var_name);
+ return $subndr;
}
-sub ParseSubcontextPullEnd($$$)
+sub ParseSubcontextPullEnd($$$$)
{
- my ($e,$l,$env) = @_;
- my $ndr = "_ndr_$e->{NAME}";
+ my ($e,$l,$ndr,$env) = @_;
+ my $subndr = "_ndr_$e->{NAME}";
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
if (defined $l->{COMPRESSION}) {
- ParseCompressionPullEnd($e, $l, $ndr);
+ ParseCompressionPullEnd($e, $l, $subndr, $env);
}
if (defined $l->{OBFUSCATION}) {
- ParseObfuscationPullEnd($e, $ndr);
+ ParseObfuscationPullEnd($e, $subndr);
}
- my $advance;
- if (defined($l->{SUBCONTEXT_SIZE}) and ($l->{SUBCONTEXT_SIZE} ne "-1")) {
- $advance = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
- } elsif ($l->{HEADER_SIZE}) {
- $advance = "$ndr->data_size";
- } else {
- $advance = "$ndr->offset";
- }
- pidl "NDR_CHECK(ndr_pull_advance(ndr, $advance));";
+ pidl "NDR_CHECK(ndr_pull_subcontext_end($ndr, $subndr, $l->{HEADER_SIZE}, $subcontext_size));";
deindent;
pidl "}";
}
@@ -560,9 +551,9 @@ sub ParseElementPushLevel
if (defined($ndr_flags)) {
if ($l->{TYPE} eq "SUBCONTEXT") {
- $ndr = ParseSubcontextPushStart($e, $l, $ndr, $var_name, $ndr_flags);
- ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1);
- ParseSubcontextPushEnd($e, $l, $ndr_flags, $env);
+ my $subndr = ParseSubcontextPushStart($e, $l, $ndr, $env);
+ ParseElementPushLevel($e, GetNextLevel($e, $l), $subndr, $var_name, $env, 1, 1);
+ ParseSubcontextPushEnd($e, $l, $ndr, $env);
} elsif ($l->{TYPE} eq "POINTER") {
ParsePtrPush($e, $l, $var_name);
} elsif ($l->{TYPE} eq "ARRAY") {
@@ -858,11 +849,11 @@ sub ParseElementPullLevel
# Only pull something if there's actually something to be pulled
if (defined($ndr_flags)) {
if ($l->{TYPE} eq "SUBCONTEXT") {
- ($ndr,$var_name) = ParseSubcontextPullStart($e, $l, $ndr, $var_name, $ndr_flags, $env);
- ParseElementPullLevel($e, GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
- ParseSubcontextPullEnd($e, $l, $env);
+ my $subndr = ParseSubcontextPullStart($e, $l, $ndr, $env);
+ ParseElementPullLevel($e, GetNextLevel($e,$l), $subndr, $var_name, $env, 1, 1);
+ ParseSubcontextPullEnd($e, $l, $ndr, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
- my $length = ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
+ my $length = ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
my $nl = GetNextLevel($e, $l);
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 3a291c2cf8..a84049a3b0 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -58,22 +58,6 @@ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
}
/*
- create an ndr sub-context based on an existing context. The new context starts
- at the current offset, with the given size limit
-*/
-NTSTATUS ndr_pull_subcontext(struct ndr_pull *ndr, struct ndr_pull *ndr2, uint32_t size)
-{
- NDR_PULL_NEED_BYTES(ndr, size);
- *ndr2 = *ndr;
- ndr2->data += ndr2->offset;
- ndr2->offset = 0;
- ndr2->data_size = size;
- ndr2->flags = ndr->flags;
- return NT_STATUS_OK;
-}
-
-
-/*
advance by 'size' bytes
*/
NTSTATUS ndr_pull_advance(struct ndr_pull *ndr, uint32_t size)
@@ -322,17 +306,17 @@ NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char
return ndr_map_error(err);
}
-
/*
handle subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
-NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
- size_t header_size,
- ssize_t size_is,
- struct ndr_pull *ndr2)
+NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr,
+ struct ndr_pull **_subndr,
+ size_t header_size,
+ ssize_t size_is)
{
- ndr2->flags = ndr->flags;
+ struct ndr_pull *subndr;
+ uint32_t r_content_size;
switch (header_size) {
case 0: {
@@ -340,7 +324,7 @@ NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
if (size_is >= 0) {
content_size = size_is;
}
- NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, content_size));
+ r_content_size = content_size;
break;
}
@@ -351,7 +335,7 @@ NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
(int)size_is, (int)content_size);
}
- NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, content_size));
+ r_content_size = content_size;
break;
}
@@ -362,31 +346,75 @@ NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
(int)size_is, (int)content_size);
}
- NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, content_size));
+ r_content_size = content_size;
break;
}
default:
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d",
(int)header_size);
}
+
+ NDR_PULL_NEED_BYTES(ndr, r_content_size);
+
+ subndr = talloc_zero(ndr, struct ndr_pull);
+ NT_STATUS_HAVE_NO_MEMORY(subndr);
+ subndr->flags = ndr->flags;
+
+ subndr->data = ndr->data + ndr->offset;
+ subndr->offset = 0;
+ subndr->data_size = r_content_size;
+
+ *_subndr = subndr;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr,
+ struct ndr_pull *subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ uint32_t advance;
+ if (size_is >= 0) {
+ advance = size_is;
+ } else if (header_size > 0) {
+ advance = subndr->data_size;
+ } else {
+ advance = subndr->offset;
+ }
+ NDR_CHECK(ndr_pull_advance(ndr, advance));
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr,
+ struct ndr_push **_subndr,
+ size_t header_size,
+ ssize_t size_is)
+{
+ struct ndr_push *subndr;
+
+ subndr = ndr_push_init_ctx(ndr);
+ NT_STATUS_HAVE_NO_MEMORY(subndr);
+ subndr->flags = ndr->flags;
+
+ *_subndr = subndr;
return NT_STATUS_OK;
}
/*
push a subcontext header
*/
-NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr,
- size_t header_size,
- ssize_t size_is,
- struct ndr_push *ndr2)
+NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr,
+ struct ndr_push *subndr,
+ size_t header_size,
+ ssize_t size_is)
{
if (size_is >= 0) {
- ssize_t padding_len = size_is - ndr2->offset;
+ ssize_t padding_len = size_is - subndr->offset;
if (padding_len > 0) {
- NDR_CHECK(ndr_push_zero(ndr2, padding_len));
+ NDR_CHECK(ndr_push_zero(subndr, padding_len));
} else if (padding_len < 0) {
return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PUSH) content_size %d is larger than size_is(%d)",
- (int)ndr2->offset, (int)size_is);
+ (int)subndr->offset, (int)size_is);
}
}
@@ -395,17 +423,19 @@ NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr,
break;
case 2:
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr2->offset));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, subndr->offset));
break;
case 4:
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr2->offset));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, subndr->offset));
break;
default:
return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext header size %d",
(int)header_size);
}
+
+ NDR_CHECK(ndr_push_bytes(ndr, subndr->data, subndr->offset));
return NT_STATUS_OK;
}
diff --git a/source4/librpc/ndr/ndr_compression.c b/source4/librpc/ndr/ndr_compression.c
index cf3c3ae97b..097f76c90a 100644
--- a/source4/librpc/ndr/ndr_compression.c
+++ b/source4/librpc/ndr/ndr_compression.c
@@ -71,11 +71,12 @@ static NTSTATUS ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpull,
}
static NTSTATUS ndr_pull_compression_mszip(struct ndr_pull *subndr,
- struct ndr_pull *comndr,
+ struct ndr_pull **_comndr,
ssize_t decompressed_len)
{
NTSTATUS status = NT_STATUS_MORE_PROCESSING_REQUIRED;
struct ndr_push *ndrpush;
+ struct ndr_pull *comndr;
DATA_BLOB uncompressed;
uint32_t payload_header[4];
uint32_t payload_size;
@@ -101,7 +102,10 @@ static NTSTATUS ndr_pull_compression_mszip(struct ndr_pull *subndr,
(int)uncompressed.length, (int)decompressed_len);
}
- *comndr = *subndr;
+ comndr = talloc_zero(subndr, struct ndr_pull);
+ NT_STATUS_HAVE_NO_MEMORY(comndr);
+ comndr->flags = subndr->flags;
+
comndr->data = uncompressed.data;
comndr->data_size = uncompressed.length;
comndr->offset = 0;
@@ -127,6 +131,7 @@ static NTSTATUS ndr_pull_compression_mszip(struct ndr_pull *subndr,
comndr->data_size = payload_size;
comndr->offset = 0;
+ *_comndr = comndr;
return NT_STATUS_OK;
}
@@ -140,16 +145,14 @@ static NTSTATUS ndr_push_compression_mszip(struct ndr_push *subndr,
handle compressed subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
-NTSTATUS ndr_pull_compression(struct ndr_pull *subndr,
- struct ndr_pull *comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len)
+NTSTATUS ndr_pull_compression_start(struct ndr_pull *subndr,
+ struct ndr_pull **_comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
{
- comndr->flags = subndr->flags;
-
switch (compression_alg) {
case NDR_COMPRESSION_MSZIP:
- return ndr_pull_compression_mszip(subndr, comndr, decompressed_len);
+ return ndr_pull_compression_mszip(subndr, _comndr, decompressed_len);
default:
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PULL)",
compression_alg);
@@ -157,15 +160,40 @@ NTSTATUS ndr_pull_compression(struct ndr_pull *subndr,
return NT_STATUS_OK;
}
+NTSTATUS ndr_pull_compression_end(struct ndr_pull *subndr,
+ struct ndr_pull *comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
+{
+ return NT_STATUS_OK;
+}
+
/*
push a compressed subcontext
*/
-NTSTATUS ndr_push_compression(struct ndr_push *subndr,
- struct ndr_push *comndr,
- enum ndr_compression_alg compression_alg)
+NTSTATUS ndr_push_compression_start(struct ndr_push *subndr,
+ struct ndr_push **_comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
{
- comndr->flags = subndr->flags;
+ struct ndr_push *comndr;
+
+ comndr = ndr_push_init_ctx(subndr);
+ NT_STATUS_HAVE_NO_MEMORY(comndr);
+ comndr->flags = subndr->flags;
+ *_comndr = comndr;
+ return NT_STATUS_OK;
+}
+
+/*
+ push a compressed subcontext
+*/
+NTSTATUS ndr_push_compression_end(struct ndr_push *subndr,
+ struct ndr_push *comndr,
+ enum ndr_compression_alg compression_alg,
+ ssize_t decompressed_len)
+{
switch (compression_alg) {
case NDR_COMPRESSION_MSZIP:
return ndr_push_compression_mszip(subndr, comndr);
diff --git a/source4/librpc/ndr/ndr_krb5pac.c b/source4/librpc/ndr/ndr_krb5pac.c
index 3af3a185e5..7d7e105e3e 100644
--- a/source4/librpc/ndr/ndr_krb5pac.c
+++ b/source4/librpc/ndr/ndr_krb5pac.c
@@ -63,15 +63,10 @@ NTSTATUS ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct P
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->info));
{
struct ndr_push *_ndr_info;
-
- _ndr_info = ndr_push_init_ctx(ndr);
- if (!_ndr_info) return NT_STATUS_NO_MEMORY;
- _ndr_info->flags = ndr->flags;
-
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type));
NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
- NDR_CHECK(ndr_push_subcontext_header(ndr, 0, _subcontext_size_PAC_INFO(r->info,r->type,0), _ndr_info));
- NDR_CHECK(ndr_push_bytes(ndr, _ndr_info->data, _ndr_info->offset));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
}
}
ndr->flags = _flags_save_PAC_INFO;
@@ -111,11 +106,10 @@ NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUF
NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->info));
{
struct ndr_pull *_ndr_info;
- NDR_ALLOC(ndr, _ndr_info);
- NDR_CHECK(ndr_pull_subcontext_header(ndr, 0, r->_ndr_size, _ndr_info));
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 0, r->_ndr_size));
NDR_CHECK(ndr_pull_set_switch_value(_ndr_info, r->info, r->type));
NDR_CHECK(ndr_pull_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
- NDR_CHECK(ndr_pull_advance(ndr, r->_ndr_size));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 0, r->_ndr_size));
}
ndr_pull_restore(ndr, &_relative_save);
}
diff --git a/source4/librpc/ndr/ndr_obfuscate.c b/source4/librpc/ndr/ndr_obfuscate.c
index 4f875f19a7..3b10e172b7 100644
--- a/source4/librpc/ndr/ndr_obfuscate.c
+++ b/source4/librpc/ndr/ndr_obfuscate.c
@@ -26,7 +26,7 @@
handle obfuscated subcontext buffers, which in midl land are user-marshalled, but
we use magic in pidl to make them easier to cope with
*/
-NTSTATUS ndr_pull_obfuscation(struct ndr_pull *ndr, uint8_t salt)
+NTSTATUS ndr_pull_obfuscation_start(struct ndr_pull *ndr, uint8_t salt)
{
uint32_t i;
@@ -37,10 +37,20 @@ NTSTATUS ndr_pull_obfuscation(struct ndr_pull *ndr, uint8_t salt)
return NT_STATUS_OK;
}
+NTSTATUS ndr_pull_obfuscation_end(struct ndr_pull *ndr, uint8_t salt)
+{
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_obfuscation_start(struct ndr_push *ndr, uint8_t salt)
+{
+ return NT_STATUS_OK;
+}
+
/*
push a obfuscated subcontext
*/
-NTSTATUS ndr_push_obfuscation(struct ndr_push *ndr, uint8_t salt)
+NTSTATUS ndr_push_obfuscation_end(struct ndr_push *ndr, uint8_t salt)
{
uint32_t i;