mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
better [relative] handling, allowing for nested relative structures
and arrays of relative structures
(This used to be commit eb887f883a
)
This commit is contained in:
parent
ae4cb40100
commit
cc5f231e95
@ -107,7 +107,8 @@ property: 'unique'
|
||||
| 'context_handle'
|
||||
| 'string'
|
||||
| 'public'
|
||||
| 'relative'
|
||||
| 'relative'
|
||||
| 'nodiscriminant'
|
||||
| 'subcontext'
|
||||
| 'byte_count_pointer' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
|
||||
| 'size_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
|
||||
|
@ -475,6 +475,8 @@ sub ParseStructPush($)
|
||||
|
||||
$res .= "\tif (!(ndr_flags & NDR_SCALARS)) goto buffers;\n";
|
||||
|
||||
$res .= "\tNDR_CHECK(ndr_push_struct_start(ndr));\n";
|
||||
|
||||
my $align = struct_alignment($struct);
|
||||
$res .= "\tNDR_CHECK(ndr_push_align(ndr, $align));\n";
|
||||
|
||||
@ -483,6 +485,8 @@ sub ParseStructPush($)
|
||||
ParseElementPushScalar($e, "r->", "NDR_SCALARS");
|
||||
}
|
||||
|
||||
$res .= "\tndr_push_struct_end(ndr);\n";
|
||||
|
||||
$res .= "buffers:\n";
|
||||
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||
foreach my $e (@{$struct->{ELEMENTS}}) {
|
||||
@ -540,6 +544,7 @@ sub ParseStructPull($)
|
||||
}
|
||||
}
|
||||
|
||||
$res .= "\tNDR_CHECK(ndr_pull_struct_start(ndr));\n";
|
||||
|
||||
if (defined $conform_e) {
|
||||
$res .= "\tNDR_CHECK(ndr_pull_uint32(ndr, &$conform_e->{CONFORMANT_SIZE}));\n";
|
||||
@ -554,6 +559,8 @@ sub ParseStructPull($)
|
||||
ParseElementPullScalar($e, "r->", "NDR_SCALARS");
|
||||
}
|
||||
|
||||
$res .= "\tndr_pull_struct_end(ndr);\n";
|
||||
|
||||
$res .= "buffers:\n";
|
||||
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||
foreach my $e (@{$struct->{ELEMENTS}}) {
|
||||
@ -570,7 +577,12 @@ sub ParseUnionPush($)
|
||||
{
|
||||
my $e = shift;
|
||||
$res .= "\tif (!(ndr_flags & NDR_SCALARS)) goto buffers;\n";
|
||||
$res .= "\tNDR_CHECK(ndr_push_uint16(ndr, level));\n";
|
||||
|
||||
$res .= "\tNDR_CHECK(ndr_push_struct_start(ndr));\n";
|
||||
|
||||
if (!util::has_property($e, "nodiscriminant")) {
|
||||
$res .= "\tNDR_CHECK(ndr_push_uint16(ndr, level));\n";
|
||||
}
|
||||
$res .= "\tswitch (level) {\n";
|
||||
foreach my $el (@{$e->{DATA}}) {
|
||||
$res .= "\tcase $el->{CASE}:\n";
|
||||
@ -580,6 +592,7 @@ sub ParseUnionPush($)
|
||||
$res .= "\tdefault:\n";
|
||||
$res .= "\t\treturn ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);\n";
|
||||
$res .= "\t}\n";
|
||||
$res .= "\tndr_push_struct_end(ndr);\n";
|
||||
$res .= "buffers:\n";
|
||||
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||
$res .= "\tswitch (level) {\n";
|
||||
@ -617,7 +630,12 @@ sub ParseUnionPull($)
|
||||
my $e = shift;
|
||||
|
||||
$res .= "\tif (!(ndr_flags & NDR_SCALARS)) goto buffers;\n";
|
||||
$res .= "\tNDR_CHECK(ndr_pull_uint16(ndr, level));\n";
|
||||
|
||||
$res .= "\tNDR_CHECK(ndr_pull_struct_start(ndr));\n";
|
||||
|
||||
if (!util::has_property($e, "nodiscriminant")) {
|
||||
$res .= "\tNDR_CHECK(ndr_pull_uint16(ndr, level));\n";
|
||||
}
|
||||
$res .= "\tswitch (*level) {\n";
|
||||
foreach my $el (@{$e->{DATA}}) {
|
||||
$res .= "\tcase $el->{CASE}: {\n";
|
||||
@ -631,6 +649,7 @@ sub ParseUnionPull($)
|
||||
$res .= "\tdefault:\n";
|
||||
$res .= "\t\treturn ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", *level);\n";
|
||||
$res .= "\t}\n";
|
||||
$res .= "\tndr_pull_struct_end(ndr);\n";
|
||||
$res .= "buffers:\n";
|
||||
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||
$res .= "\tswitch (*level) {\n";
|
||||
|
@ -183,6 +183,7 @@ sub is_scalar_type($)
|
||||
return 1, if ($type eq "NTTIME");
|
||||
return 1, if ($type eq "HYPER_T");
|
||||
return 1, if ($type eq "wchar_t");
|
||||
return 1, if ($type eq "DATA_BLOB");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -207,6 +208,7 @@ sub type_align($)
|
||||
return 4, if ($type eq "NTTIME");
|
||||
return 8, if ($type eq "HYPER_T");
|
||||
return 2, if ($type eq "wchar_t");
|
||||
return 4, if ($type eq "DATA_BLOB");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user