From ac5393fa25484d0b5495f4f61456c419aa1982a5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 21 May 2004 12:15:04 +0000 Subject: r806: Checkin of workarea - tridge gave me some good ideas today for a better way to do this. (This used to be commit c63cb50ca56cb69f7ef39f9828afa61f324f2832) --- source4/build/pidl/eparser.pm | 82 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) (limited to 'source4/build/pidl') diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index d3caef6b3c..4650778096 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -165,6 +165,16 @@ sub ParamStruct($) return $res; } +sub ParamDomSID($) +{ + my($p) = shift; + my($res); + + $res .= "\toffset = dissect_ndr_nt_SID(tvb, offset, pinfo, tree, drep);\n"; + + return $res; +} + # Index of NDR types and functions to generate code to dissect that type my %param_handlers = ( @@ -173,8 +183,69 @@ my %param_handlers = ( 'uint32' => \&ParamSimpleNdrType, 'policy_handle' => \&ParamPolicyHandle, 'string' => \&ParamString, + 'dom_sid2' => \&ParamDomSID, ); +sub PtrString($) +{ + my($p) = shift; + my($res) = ""; + + $res .= "/* pointer to string not supported */\n"; + + return $res; +} + +sub PtrSimpleNdrType($) +{ + my($p) = shift; + my($res) = ""; + + $res .= "/* pointer to $p->{TYPE} not supported */\n"; + + return $res; +} + +sub PtrDomSID($) +{ + my($p) = shift; + my($res) = ""; + + $res .= "/* pointer to dom_sid not supported */\n"; + + return $res; +} + +sub PtrSecurityDescriptor($) +{ + my($p) = shift; + my($res) = ""; + + $res .= "/* pointer to security descriptor not supported */\n"; + + return $res; +} + +sub PtrNotImplemented($) +{ + my($p) = shift; + my($res) = ""; + + $res .= "/* pointer to $p->{TYPE} not supported */\n"; + + return $res; +} + +my %ptr_handlers = ( + 'uint8' => \&PtrSimpleNdrType, + 'uint16' => \&PtrSimpleNdrType, + 'uint32' => \&PtrSimpleNdrType, + 'string' => \&PtrString, + 'dom_sid2' => \&PtrDomSID, + 'security_descriptor' => \&PtrSecurityDescriptor, + 'lsa_SidArray' => \&PtrNotImplemented, + ); + # Generate a parser for a NDR parameter sub ParseParameter($) @@ -184,6 +255,17 @@ sub ParseParameter($) # Call function registered for this type + if ($p->{POINTERS} == 1 && $p->{TYPE} ne "policy_handle") { + + if (defined($ptr_handlers{$p->{TYPE}})) { + $res .= &{$ptr_handlers{$p->{TYPE}}}($p); + } else { + $res .= "\toffset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep, dissect_$p->{TYPE}, NDR_POINTER_UNIQUE, \"$p->{TYPE} pointer\", -1);\n"; + } + + return $res; + } + if (defined($param_handlers{$p->{TYPE}})) { $res .= &{$param_handlers{$p->{TYPE}}}($p); return $res; -- cgit