summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-04-11 13:25:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:30 -0500
commit5eff721651a7d8a56891319dbcf3616a2a09be19 (patch)
tree2b82520e6b308b0a17fe33cb1315377f060ce241 /source4/build/pidl
parent0af9ba91794468d23eee47eb6e3092251df03adb (diff)
downloadsamba-5eff721651a7d8a56891319dbcf3616a2a09be19.tar.gz
samba-5eff721651a7d8a56891319dbcf3616a2a09be19.tar.bz2
samba-5eff721651a7d8a56891319dbcf3616a2a09be19.zip
r6294: - add obfuscate support, which is used in MAPI rpc's, (the ^= 0xA5 stuff),
based on a patch from j.kerihuel@openchange.org - remove unused $ndr_flags argument for the ParseCompression*Start() function's metze (This used to be commit 27ccdd61822ba1a24244086522b9f8fe97fe0a78)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/ndr_parser.pm98
-rw-r--r--source4/build/pidl/validator.pm5
2 files changed, 81 insertions, 22 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm
index 842402f430..6601dc10ff 100644
--- a/source4/build/pidl/ndr_parser.pm
+++ b/source4/build/pidl/ndr_parser.pm
@@ -421,11 +421,10 @@ sub compression_dlen($)
return ParseExpr($e, $dlen, "r->");
}
-sub ParseCompressionPushStart($$$)
+sub ParseCompressionPushStart($$)
{
my $e = shift;
my $subndr = shift;
- my $ndr_flags = shift;
my $comndr = $subndr."_compressed";
pidl "{";
@@ -452,11 +451,10 @@ sub ParseCompressionPushEnd($$)
pidl "}";
}
-sub ParseCompressionPullStart($$$)
+sub ParseCompressionPullStart($$)
{
my $e = shift;
my $subndr = shift;
- my $ndr_flags = shift;
my $comndr = $subndr."_compressed";
my $alg = compression_alg($e);
my $dlen = compression_dlen($e);
@@ -480,28 +478,69 @@ sub ParseCompressionPullEnd($$)
pidl "}";
}
+sub ParseObfuscationPushStart($$)
+{
+ my $e = shift;
+ my $ndr = shift;
+
+ # nothing to do here
+
+ return $ndr;
+}
+
+sub ParseObfuscationPushEnd($$)
+{
+ my $e = shift;
+ my $ndr = shift;
+ my $obfuscation = util::has_property($e, "obfuscation");
+
+ pidl "NDR_CHECK(ndr_push_obfuscation($ndr, $obfuscation));";
+}
+
+sub ParseObfuscationPullStart($$)
+{
+ my $e = shift;
+ my $ndr = shift;
+ my $obfuscation = util::has_property($e, "obfuscation");
+
+ pidl "NDR_CHECK(ndr_pull_obfuscation($ndr, $obfuscation));";
+
+ return $ndr;
+}
+
+sub ParseObfuscationPullEnd($$)
+{
+ my $e = shift;
+ my $ndr = shift;
+
+ # nothing to do here
+}
+
sub ParseSubcontextPushStart($$)
{
my $e = shift;
my $ndr_flags = shift;
my $compression = util::has_property($e, "compression");
- my $retndr;
+ my $obfuscation = util::has_property($e, "obfuscation");
+ my $retndr = "_ndr_$e->{NAME}";
pidl "if (($ndr_flags) & NDR_SCALARS) {";
indent;
- pidl "struct ndr_push *_ndr_$e->{NAME};";
+ pidl "struct ndr_push *$retndr;";
pidl "";
- pidl "_ndr_$e->{NAME} = ndr_push_init_ctx(ndr);";
- pidl "if (!_ndr_$e->{NAME}) return NT_STATUS_NO_MEMORY;";
- pidl "_ndr_$e->{NAME}->flags = ndr->flags;";
+ pidl "$retndr = ndr_push_init_ctx(ndr);";
+ pidl "if (!$retndr) return NT_STATUS_NO_MEMORY;";
+ pidl "$retndr->flags = ndr->flags;";
pidl "";
-
- $retndr = "_ndr_$e->{NAME}";
if (defined $compression) {
- $retndr = ParseCompressionPushStart($e, $retndr, "NDR_SCALARS");
+ $retndr = ParseCompressionPushStart($e, $retndr);
}
-
+
+ if (defined $obfuscation) {
+ $retndr = ParseObfuscationPushStart($e, $retndr);
+ }
+
return $retndr
}
@@ -511,8 +550,13 @@ sub ParseSubcontextPushEnd($)
my $header_size = util::has_property($e, "subcontext");
my $size_is = util::has_property($e, "subcontext_size");
my $compression = util::has_property($e, "compression");
+ my $obfuscation = util::has_property($e, "obfuscation");
my $ndr = "_ndr_$e->{NAME}";
+ if (defined $obfuscation) {
+ ParseObfuscationPushEnd($e, $ndr);
+ }
+
if (defined $compression) {
ParseCompressionPushEnd($e, $ndr);
}
@@ -530,11 +574,12 @@ sub ParseSubcontextPushEnd($)
sub ParseSubcontextPullStart($$)
{
my $e = shift;
- my $ndr_flags = shift;
+ my $ndr_flags = shift;
my $header_size = util::has_property($e, "subcontext");
my $size_is = util::has_property($e, "subcontext_size");
- my $retndr = "_ndr_$e->{NAME}";
my $compression = util::has_property($e, "compression");
+ my $obfuscation = util::has_property($e, "obfuscation");
+ my $retndr = "_ndr_$e->{NAME}";
if (not defined($size_is)) {
$size_is = "-1";
@@ -544,10 +589,14 @@ sub ParseSubcontextPullStart($$)
indent;
pidl "struct ndr_pull *$retndr;";
pidl "NDR_ALLOC(ndr, $retndr);";
- pidl "NDR_CHECK(ndr_pull_subcontext_header(ndr, $header_size, $size_is, $retndr));";
+ pidl "NDR_CHECK(ndr_pull_subcontext_header(ndr, $header_size, $size_is, $retndr));";
if (defined $compression) {
- $retndr = ParseCompressionPullStart($e, $retndr, $ndr_flags);
+ $retndr = ParseCompressionPullStart($e, $retndr);
+ }
+
+ if (defined $obfuscation) {
+ $retndr = ParseObfuscationPullStart($e, $retndr);
}
return $retndr;
@@ -558,20 +607,25 @@ sub ParseSubcontextPullEnd($)
my $e = shift;
my $header_size = util::has_property($e, "subcontext");
my $size_is = util::has_property($e, "subcontext_size");
- my $subndr = "_ndr_$e->{NAME}";
my $compression = util::has_property($e, "compression");
+ my $obfuscation = util::has_property($e, "obfuscation");
+ my $ndr = "_ndr_$e->{NAME}";
+
+ if (defined $obfuscation) {
+ ParseObfuscationPullEnd($e, $ndr);
+ }
if (defined $compression) {
- ParseCompressionPullEnd($e, $subndr);
+ ParseCompressionPullEnd($e, $ndr);
}
my $advance;
if (defined ($size_is)) {
- $advance = "$size_is";
+ $advance = "$size_is";
} elsif ($header_size) {
- $advance = "$subndr->data_size";
+ $advance = "$ndr->data_size";
} else {
- $advance = "$subndr->offset";
+ $advance = "$ndr->offset";
}
pidl "NDR_CHECK(ndr_pull_advance(ndr, $advance));";
deindent;
diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm
index 7bd82f1506..42e9f699dc 100644
--- a/source4/build/pidl/validator.pm
+++ b/source4/build/pidl/validator.pm
@@ -86,6 +86,7 @@ my %property_list = (
"subcontext" => {},
"subcontext_size" => {},
"compression" => {},
+ "obfuscation" => {},
# enum
"enum8bit" => {},
@@ -167,6 +168,10 @@ sub ValidElement($)
fatal(el_name($e) . " : compression() on non-subcontext element");
}
+ if (defined (util::has_property($e, "obfuscation")) and not defined(util::has_property($e, "subcontext"))) {
+ fatal(el_name($e) . " : obfuscation() on non-subcontext element");
+ }
+
if (!$e->{POINTERS} && (
util::has_property($e, "ptr") or
util::has_property($e, "unique") or