mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
r1736: - Pidl updates:
- Support for "object oriented" interfaces in pidl - Support for inherited interfaces in pidl - Simplification of the support for properties on an interface - Start on dcom rpc torture tests (This used to be commit 45c3d0036b8510102816f9cdff9210098259cc5f)
This commit is contained in:
parent
ca72bdfecb
commit
1d3b81e6c0
@ -2,6 +2,13 @@
|
||||
- ServerAlive2()
|
||||
- Bind to ISystemActivator
|
||||
|
||||
with dcom, there is a new attribute for interfaces, 'object'. these
|
||||
object-oriented interfaces support inheritance. Everything that has the
|
||||
attribute 'object' has ([in] ORPCTHIS *this, [out] ORPCTHAT *that) as first
|
||||
arguments.
|
||||
|
||||
OXID = Object Exporter ID
|
||||
|
||||
Everything based on IDispatch implements:
|
||||
|
||||
/*****************/
|
||||
@ -9,7 +16,7 @@ Everything based on IDispatch implements:
|
||||
HRESULT QueryInterface(
|
||||
[in] ORPCTHIS *this,
|
||||
[out] ORPCTHAT *that,
|
||||
[in] REFIID riid,
|
||||
[in] IID *riid,
|
||||
[out] /* [iid_is] */ void **ppvObject);
|
||||
|
||||
/*****************/
|
||||
@ -47,7 +54,7 @@ HRESULT GetTypeInfo (
|
||||
HRESULT GetIDsOfNames(
|
||||
[in] ORPCTHIS *this,
|
||||
[out] ORPCTHAT *that,
|
||||
[in] REFIID riid,
|
||||
[in] IID *riid,
|
||||
[size_is][in] LPOLESTR *rgszNames,
|
||||
[in] UINT cNames,
|
||||
[in] LCID lcid,
|
||||
@ -59,11 +66,10 @@ HRESULT Invoke(
|
||||
[in] ORPCTHIS *this,
|
||||
[out] ORPCTHAT *that,
|
||||
[in] DISPID dispIdMember,
|
||||
[in] REFIID riid,
|
||||
[in] IID *riid,
|
||||
[in] LCID lcid,
|
||||
[in] WORD wFlags,
|
||||
[out][in] DISPPARAMS *pDispParams,
|
||||
[out] VARIANT *pVarResult,
|
||||
[out] EXCEPINFO *pExcepInfo,
|
||||
[out] UINT *puArgErr);
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
all: idl.pm
|
||||
|
||||
idl.pm: idl.yp
|
||||
yapp -s idl.yp
|
||||
|
||||
|
@ -183,7 +183,7 @@ sub DumpFunction($)
|
||||
|
||||
#####################################################################
|
||||
# dump a module header
|
||||
sub DumpModuleHeader($)
|
||||
sub DumpInterfaceProperties($)
|
||||
{
|
||||
my($header) = shift;
|
||||
my($data) = $header->{DATA};
|
||||
@ -208,6 +208,8 @@ sub DumpInterface($)
|
||||
my($data) = $interface->{DATA};
|
||||
my($res);
|
||||
|
||||
$res .= DumpInterfaceProperties($interface->{PROPERTIES});
|
||||
|
||||
$res .= "interface $interface->{NAME}\n{\n";
|
||||
foreach my $d (@{$data}) {
|
||||
($d->{TYPE} eq "TYPEDEF") &&
|
||||
@ -230,8 +232,6 @@ sub Dump($)
|
||||
|
||||
$res = "/* Dumped by pidl */\n\n";
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "MODULEHEADER") &&
|
||||
($res .= DumpModuleHeader($x));
|
||||
($x->{TYPE} eq "INTERFACE") &&
|
||||
($res .= DumpInterface($x));
|
||||
}
|
||||
|
@ -14,9 +14,6 @@ my %needed;
|
||||
my %structs;
|
||||
|
||||
my $module;
|
||||
my $if_uuid;
|
||||
my $if_version;
|
||||
my $if_endpoints;
|
||||
|
||||
sub pidl($)
|
||||
{
|
||||
@ -933,17 +930,6 @@ sub BuildNeeded($)
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse the interface definitions
|
||||
sub ModuleHeader($)
|
||||
{
|
||||
my($h) = shift;
|
||||
|
||||
$if_uuid = $h->{PROPERTIES}->{uuid};
|
||||
$if_version = $h->{PROPERTIES}->{version};
|
||||
$if_endpoints = $h->{PROPERTIES}->{endpoints};
|
||||
}
|
||||
|
||||
sub ParseHeader($$)
|
||||
{
|
||||
my($idl) = shift;
|
||||
@ -989,9 +975,6 @@ sub Parse($$)
|
||||
open(OUT, ">$filename") || die "can't open $filename";
|
||||
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "MODULEHEADER") &&
|
||||
ModuleHeader($x);
|
||||
|
||||
if ($x->{TYPE} eq "INTERFACE") {
|
||||
$module = $x->{NAME};
|
||||
BuildNeeded($x);
|
||||
@ -1001,16 +984,14 @@ sub Parse($$)
|
||||
pidl "/* parser auto-generated by pidl */\n\n";
|
||||
pidl "#ifdef HAVE_CONFIG_H\n";
|
||||
pidl "#include \"config.h\"\n";
|
||||
pidl "#endif\n\n";
|
||||
pidl "#endif\n\n";
|
||||
|
||||
pidl "#include \"packet-dcerpc.h\"\n";
|
||||
pidl "#include \"packet-dcerpc-nt.h\"\n\n";
|
||||
pidl "#include \"packet-dcerpc-eparser.h\"\n\n";
|
||||
pidl "#include \"packet-dcerpc.h\"\n";
|
||||
pidl "#include \"packet-dcerpc-nt.h\"\n\n";
|
||||
pidl "#include \"packet-dcerpc-eparser.h\"\n\n";
|
||||
|
||||
pidl "extern const value_string NT_errors[];\n\n";
|
||||
|
||||
pidl "static int proto_dcerpc_$module = -1;\n\n";
|
||||
|
||||
pidl "static gint ett_dcerpc_$module = -1;\n\n";
|
||||
|
||||
pidl "static int hf_opnum = -1;\n";
|
||||
@ -1033,6 +1014,7 @@ sub Parse($$)
|
||||
# Declarations for ett variables
|
||||
|
||||
foreach my $y (keys(%needed)) {
|
||||
|
||||
pidl "static gint $y = -1;\n", if $y =~ /^ett_/;
|
||||
}
|
||||
|
||||
@ -1043,24 +1025,26 @@ sub Parse($$)
|
||||
}
|
||||
|
||||
# Only perform module initialisation if we found a uuid
|
||||
|
||||
for my $x (@{$idl}) {
|
||||
pidl "static int proto_dcerpc_" . $x->{NAME} ." = -1;\n\n";
|
||||
if ((my $if_uuid = $x->{PROPERTIES}->{uuid})) {
|
||||
pidl "static e_uuid_t uuid_dcerpc_" . $x->{NAME} ." = {\n";
|
||||
pidl "\t0x" . substr($if_uuid, 0, 8);
|
||||
pidl ", 0x" . substr($if_uuid, 9, 4);
|
||||
pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
|
||||
pidl "\t{ 0x" . substr($if_uuid, 19, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 21, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 24, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 26, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 28, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 30, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 32, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
|
||||
pidl "};\n\n";
|
||||
|
||||
if (defined($if_uuid)) {
|
||||
|
||||
pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
|
||||
pidl "\t0x" . substr($if_uuid, 0, 8);
|
||||
pidl ", 0x" . substr($if_uuid, 9, 4);
|
||||
pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
|
||||
pidl "\t{ 0x" . substr($if_uuid, 19, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 21, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 24, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 26, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 28, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 30, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 32, 2);
|
||||
pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
|
||||
pidl "};\n\n";
|
||||
|
||||
pidl "static guint16 ver_dcerpc_$module = " . $if_version . ";\n\n";
|
||||
pidl "static guint16 ver_dcerpc_" . $x->{NAME} . " = " . $x->{PROPERTIES}->{version}. ";\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
pidl "void proto_register_dcerpc_$module(void)\n";
|
||||
@ -1092,31 +1076,33 @@ sub Parse($$)
|
||||
}
|
||||
pidl "\t};\n\n";
|
||||
|
||||
if (defined($if_uuid)) {
|
||||
for my $x (@{$idl}) {
|
||||
if (defined($x->{PROPERTIES}->{uuid})) {
|
||||
$module = $x->{NAME};
|
||||
|
||||
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
|
||||
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
|
||||
|
||||
pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
|
||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
|
||||
pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
|
||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
|
||||
|
||||
pidl "}\n\n";
|
||||
pidl "}\n\n";
|
||||
|
||||
pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
|
||||
pidl "{\n";
|
||||
pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
|
||||
pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
|
||||
pidl "\t\tdcerpc_" . $module . "_dissectors, hf_opnum);\n";
|
||||
pidl "}\n";
|
||||
pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
|
||||
pidl "{\n";
|
||||
pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
|
||||
pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
|
||||
pidl "\t\tdcerpc_" . $module . "_dissectors, hf_opnum);\n";
|
||||
pidl "}\n";
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
pidl "\tint proto_dcerpc;\n\n";
|
||||
pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
|
||||
pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
|
||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
|
||||
|
||||
pidl "}\n";
|
||||
pidl "\tint proto_dcerpc;\n\n";
|
||||
pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
|
||||
pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
|
||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
|
||||
|
||||
pidl "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
|
@ -9,8 +9,6 @@ use strict;
|
||||
|
||||
my($res);
|
||||
my($tab_depth);
|
||||
my $if_uuid;
|
||||
my $if_version;
|
||||
|
||||
sub tabs()
|
||||
{
|
||||
@ -187,6 +185,7 @@ sub HeaderFunctionInOut($$)
|
||||
{
|
||||
my($fn) = shift;
|
||||
my($prop) = shift;
|
||||
|
||||
foreach my $e (@{$fn->{DATA}}) {
|
||||
if (util::has_property($e, $prop)) {
|
||||
HeaderElement($e);
|
||||
@ -220,6 +219,7 @@ sub HeaderFunctionInOut_needed($$)
|
||||
sub HeaderFunction($)
|
||||
{
|
||||
my($fn) = shift;
|
||||
|
||||
$res .= "\nstruct $fn->{NAME} {\n";
|
||||
$tab_depth++;
|
||||
my $needed = 0;
|
||||
@ -272,12 +272,12 @@ sub HeaderInterface($)
|
||||
$res .= "#ifndef _HEADER_NDR_$interface->{NAME}\n";
|
||||
$res .= "#define _HEADER_NDR_$interface->{NAME}\n\n";
|
||||
|
||||
if (defined $if_uuid) {
|
||||
if (defined $interface->{PROPERTIES}->{uuid}) {
|
||||
my $name = uc $interface->{NAME};
|
||||
$res .= "#define DCERPC_$name\_UUID \"$if_uuid\"\n";
|
||||
$res .= "#define DCERPC_$name\_UUID \"$interface->{PROPERTIES}->{uuid}\"\n";
|
||||
|
||||
if(!defined $if_version) { $if_version = "0.0"; }
|
||||
$res .= "#define DCERPC_$name\_VERSION $if_version\n";
|
||||
if(!defined $interface->{PROPERTIES}->{version}) { $interface->{PROPERTIES}->{version} = "0.0"; }
|
||||
$res .= "#define DCERPC_$name\_VERSION $interface->{PROPERTIES}->{version}\n";
|
||||
$res .= "#define DCERPC_$name\_NAME \"$interface->{NAME}\"\n\n";
|
||||
$res .= "extern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};\n";
|
||||
$res .= "NTSTATUS dcerpc_$interface->{NAME}_init(void);\n\n";
|
||||
@ -305,17 +305,6 @@ sub HeaderInterface($)
|
||||
$res .= "#endif /* _HEADER_NDR_$interface->{NAME} */\n";
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse the interface definitions
|
||||
sub ModuleHeader($)
|
||||
{
|
||||
my($h) = shift;
|
||||
|
||||
$if_uuid = $h->{PROPERTIES}->{uuid};
|
||||
$if_version = $h->{PROPERTIES}->{version};
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
# parse a parsed IDL into a C header
|
||||
sub Parse($)
|
||||
@ -325,9 +314,6 @@ sub Parse($)
|
||||
|
||||
$res = "/* header auto-generated by pidl */\n\n";
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "MODULEHEADER") &&
|
||||
ModuleHeader($x);
|
||||
|
||||
($x->{TYPE} eq "INTERFACE") &&
|
||||
HeaderInterface($x);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,36 +14,26 @@
|
||||
################
|
||||
# grammer
|
||||
%%
|
||||
idl: idl_interface
|
||||
| idl idl_interface { util::FlattenArray([$_[1],$_[2]]) }
|
||||
idl:
|
||||
#empty { {} }
|
||||
| idl interface {
|
||||
push(@{$_[1]}, $_[2]); $_[1]
|
||||
}
|
||||
;
|
||||
|
||||
idl_interface: module_header interface { [ $_[1], $_[2] ] }
|
||||
;
|
||||
|
||||
module_header: '[' module_params ']'
|
||||
{{
|
||||
"TYPE" => "MODULEHEADER",
|
||||
"PROPERTIES" => util::FlattenHash($_[2])
|
||||
interface: property_list 'interface' identifier base_interface '{' definitions '}'
|
||||
{$_[3] => {
|
||||
"TYPE" => "INTERFACE",
|
||||
"PROPERTIES" => $_[1],
|
||||
"NAME" => $_[3],
|
||||
"BASE" => $_[4],
|
||||
"DATA" => $_[6],
|
||||
}}
|
||||
;
|
||||
|
||||
module_params:
|
||||
#empty
|
||||
| module_param { [ $_[1] ] }
|
||||
| module_params ',' module_param { push(@{$_[1]}, $_[3]); $_[1] }
|
||||
;
|
||||
|
||||
module_param: identifier '(' listtext ')'
|
||||
{ { "$_[1]" => "$_[3]" } }
|
||||
;
|
||||
|
||||
interface: 'interface' identifier '{' definitions '}'
|
||||
{{
|
||||
"TYPE" => "INTERFACE",
|
||||
"NAME" => $_[2],
|
||||
"DATA" => $_[4]
|
||||
}}
|
||||
base_interface:
|
||||
#empty
|
||||
| ':' identifier { $_[2] }
|
||||
;
|
||||
|
||||
definitions:
|
||||
@ -199,7 +189,7 @@ properties: property { $_[1] }
|
||||
;
|
||||
|
||||
property: identifier {{ "$_[1]" => "1" }}
|
||||
| identifier '(' anytext ')' {{ "$_[1]" => "$_[3]" }}
|
||||
| identifier '(' listtext ')' {{ "$_[1]" => "$_[3]" }}
|
||||
;
|
||||
|
||||
listtext:
|
||||
@ -318,8 +308,47 @@ sub parse_idl($$)
|
||||
my $data = `$cpp -xc $filename`;
|
||||
$/ = $saved_delim;
|
||||
|
||||
$self->YYData->{INPUT} = $data;
|
||||
$self->YYData->{LINE} = 0;
|
||||
$self->YYData->{LAST_TOKEN} = "NONE";
|
||||
return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
|
||||
$self->YYData->{INPUT} = $data;
|
||||
$self->YYData->{LINE} = 0;
|
||||
$self->YYData->{LAST_TOKEN} = "NONE";
|
||||
|
||||
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
|
||||
|
||||
foreach my $x (@{$idl}) {
|
||||
# Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
|
||||
# for 'object' interfaces
|
||||
if (defined($x->{PROPERTIES}->{object})) {
|
||||
foreach my $e (@{$x->{DATA}}) {
|
||||
if($e->{TYPE} eq "FUNCTION") {
|
||||
unshift(@{$e->{DATA}},
|
||||
{ 'NAME' => 'ORPCthis',
|
||||
'POINTERS' => 1,
|
||||
'PROPERTIES' => { 'in' => '1' },
|
||||
'TYPE' => 'ORPCTHIS'
|
||||
});
|
||||
unshift(@{$e->{DATA}},
|
||||
{ 'NAME' => 'ORPCthat',
|
||||
'POINTERS' => 1,
|
||||
'PROPERTIES' => { 'out' => '1' },
|
||||
'TYPE' => 'ORPCTHAT'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Do the inheritance
|
||||
if (defined($x->{BASE}) and $x->{BASE} ne "") {
|
||||
my $parent = util::get_interface($idl, $x->{BASE});
|
||||
|
||||
if(not defined($parent)) {
|
||||
die("No such parent interface " . $x->{BASE});
|
||||
}
|
||||
|
||||
@{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}});
|
||||
} else {
|
||||
$x->{INHERITED_DATA} = $x->{DATA};
|
||||
}
|
||||
}
|
||||
|
||||
return $idl;
|
||||
}
|
||||
|
@ -13,10 +13,6 @@ use client;
|
||||
my %needed;
|
||||
my %structs;
|
||||
|
||||
my $if_uuid;
|
||||
my $if_version;
|
||||
my $if_endpoints;
|
||||
|
||||
sub pidl($)
|
||||
{
|
||||
print OUT shift;
|
||||
@ -622,7 +618,7 @@ sub ParseElementPrintBuffer($$)
|
||||
}
|
||||
|
||||
if (util::array_size($e)) {
|
||||
ParseArrayPrint($e, $var_prefix);
|
||||
ParseArrayPrint($e, $var_prefix)
|
||||
} elsif (my $switch = util::has_property($e, "switch_is")) {
|
||||
ParseElementPrintSwitch($e, $var_prefix, $switch);
|
||||
} else {
|
||||
@ -1340,7 +1336,7 @@ sub ParseFunctionPull($)
|
||||
sub FunctionTable($)
|
||||
{
|
||||
my($interface) = shift;
|
||||
my($data) = $interface->{DATA};
|
||||
my($data) = $interface->{INHERITED_DATA};
|
||||
my $count = 0;
|
||||
my $uname = uc $interface->{NAME};
|
||||
|
||||
@ -1368,11 +1364,11 @@ sub FunctionTable($)
|
||||
|
||||
my $endpoints;
|
||||
|
||||
if (! defined $if_endpoints) {
|
||||
$if_endpoints = $interface->{NAME};
|
||||
if (! defined $interface->{PROPERTIES}->{endpoints}) {
|
||||
$interface->{PROPERTIES}->{endpoints} = $interface->{NAME};
|
||||
}
|
||||
|
||||
my @e = split / /, $if_endpoints;
|
||||
my @e = split / /, $interface->{PROPERTIES}->{endpoints};
|
||||
my $endpoint_count = $#e + 1;
|
||||
|
||||
pidl "static const char * const $interface->{NAME}\_endpoint_strings[] = {\n\t";
|
||||
@ -1500,17 +1496,6 @@ sub BuildNeeded($)
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse the interface definitions
|
||||
sub ModuleHeader($)
|
||||
{
|
||||
my($h) = shift;
|
||||
|
||||
$if_uuid = $h->{PROPERTIES}->{uuid};
|
||||
$if_version = $h->{PROPERTIES}->{version};
|
||||
$if_endpoints = $h->{PROPERTIES}->{endpoints};
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse a parsed IDL structure back into an IDL file
|
||||
sub Parse($$)
|
||||
@ -1523,9 +1508,6 @@ sub Parse($$)
|
||||
pidl "/* parser auto-generated by pidl */\n\n";
|
||||
pidl "#include \"includes.h\"\n\n";
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "MODULEHEADER") &&
|
||||
ModuleHeader($x);
|
||||
|
||||
if ($x->{TYPE} eq "INTERFACE") {
|
||||
BuildNeeded($x);
|
||||
ParseInterface($x);
|
||||
|
@ -115,7 +115,7 @@ sub process_file($)
|
||||
if ($opt_parse) {
|
||||
$pidl = IdlParse($idl_file);
|
||||
defined $pidl || die "Failed to parse $idl_file";
|
||||
IdlValidator::Validate($pidl);
|
||||
# IdlValidator::Validate($pidl);
|
||||
if ($opt_keep && !util::SaveStructure($pidl_file, $pidl)) {
|
||||
die "Failed to save $pidl_file\n";
|
||||
}
|
||||
|
@ -153,6 +153,20 @@ sub SaveStructure($$)
|
||||
FileSave($filename, MyDumper($v));
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# find an interface in an array of interfaces
|
||||
sub get_interface($$)
|
||||
{
|
||||
my($if) = shift;
|
||||
my($n) = shift;
|
||||
|
||||
foreach(@{$if}) {
|
||||
if($_->{NAME} eq $n) { return $_; }
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# see if a pidl property list contains a give property
|
||||
sub has_property($$)
|
||||
|
@ -8,7 +8,6 @@
|
||||
see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet
|
||||
layouts
|
||||
*/
|
||||
[]
|
||||
interface dcerpc
|
||||
{
|
||||
typedef [public] struct {
|
||||
|
@ -10,27 +10,22 @@ interface ObjectRpcBaseTypes
|
||||
{
|
||||
WERROR stub();
|
||||
|
||||
typedef [public] struct {
|
||||
uint32 upper;
|
||||
uint32 lower;
|
||||
} hyper;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Identifier Definitions
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// Machine Identifier
|
||||
#define MID hyper
|
||||
#define MID HYPER_T
|
||||
|
||||
|
||||
// Object Exporter Identifier
|
||||
#define OXID hyper
|
||||
#define OXID HYPER_T
|
||||
|
||||
// Object Identifer
|
||||
#define OID hyper
|
||||
#define OID HYPER_T
|
||||
|
||||
// Ping Set Identifier
|
||||
#define SETID hyper
|
||||
#define SETID HYPER_T
|
||||
|
||||
// Interface Pointer Identifier
|
||||
#define IPID GUID
|
||||
@ -186,7 +181,7 @@ interface ObjectRpcBaseTypes
|
||||
const uint32 SORF_NULL = 0x0; // convenient for initializing SORF
|
||||
const uint32 SORF_NOPING = 0x1000;// Pinging is not required
|
||||
// standard object reference
|
||||
typedef struct
|
||||
typedef [public] struct
|
||||
{
|
||||
uint32 flags; // STDOBJREF flags (see above)
|
||||
uint32 cPublicRefs; // count of references passed
|
||||
@ -241,6 +236,26 @@ interface ObjectRpcBaseTypes
|
||||
} MInterfacePointer;
|
||||
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(00000000-0000-0000-C000-000000000046)
|
||||
]
|
||||
interface IUnknown
|
||||
{
|
||||
/*****************/
|
||||
/* Function 0x00 */
|
||||
HRESULT QueryInterface();
|
||||
|
||||
/*****************/
|
||||
/* Function 0x01 */
|
||||
uint32 AddRef();
|
||||
|
||||
/*****************/
|
||||
/* Function 0x02 */
|
||||
uint32 Release();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// The remote version of Iunknown. This interface exists on every
|
||||
@ -252,9 +267,10 @@ interface ObjectRpcBaseTypes
|
||||
//
|
||||
[
|
||||
uuid(00000131-0000-0000-C000-000000000046),
|
||||
object,
|
||||
version(0.0)
|
||||
]
|
||||
interface IRemUnknown // : IUnknown
|
||||
interface IRemUnknown : IUnknown
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
@ -262,7 +278,7 @@ interface IRemUnknown // : IUnknown
|
||||
STDOBJREF std; // data for returned interface
|
||||
}
|
||||
REMQIRESULT;
|
||||
|
||||
|
||||
HRESULT RemQueryInterface (
|
||||
[in] IPID *ripid, // interface to QI on
|
||||
[in] uint32 cRefs, // count of AddRefs requested
|
||||
@ -291,15 +307,18 @@ interface IRemUnknown // : IUnknown
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Derived from IRemUnknown, this interface supports Remote Query interface
|
||||
// for objects that supply additional data beyond the STDOBJREF in their
|
||||
// marshaled interface packets.
|
||||
[
|
||||
object,
|
||||
uuid(00000143-0000-0000-C000-000000000046),
|
||||
version(0.0)
|
||||
]
|
||||
|
||||
interface IRemUnknown2 //: IRemUnknown
|
||||
interface IRemUnknown2 : IRemUnknown
|
||||
{
|
||||
HRESULT RemQueryInterface2 (
|
||||
[in] IPID *ripid,
|
||||
@ -308,7 +327,6 @@ interface IRemUnknown2 //: IRemUnknown
|
||||
[out, size_is(cIids)] HRESULT *phr
|
||||
//FIXME [out, size_is(cIids)] MInterfacePointer **ppMIF
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
[ uuid(99fcfec4-5260-101b-bbcb-00aa0021347a),
|
||||
@ -339,7 +357,7 @@ interface IOXIDResolver
|
||||
// Returns S_TRUE if the SetId is known by the object exporter,
|
||||
// S_FALSE if not.
|
||||
[idempotent] WERROR SimplePing (
|
||||
[in] policy_handle hRpc,
|
||||
[in,ref] policy_handle *hRpc,
|
||||
[in] SETID *pSetId // Must not be zero
|
||||
);
|
||||
|
||||
@ -364,13 +382,13 @@ interface IOXIDResolver
|
||||
// can be used to validate the binding
|
||||
// from the client.
|
||||
[idempotent] WERROR ServerAlive (
|
||||
[in] policy_handle hRpc
|
||||
[in,ref] policy_handle *hRpc
|
||||
);
|
||||
// Method to get the protocol sequences, string bindings,
|
||||
// RemoteUnknown IPID and COM version for an object server
|
||||
// given its OXID. Supported by DCOM
|
||||
// version 5.2 and above.
|
||||
[idempotent] error_status_t ResolveOxid2 (
|
||||
[idempotent] WERROR ResolveOxid2 (
|
||||
[in] policy_handle hRpc,
|
||||
[in] OXID *pOxid,
|
||||
[in] uint16 cRequestedProtseqs,
|
||||
@ -452,13 +470,10 @@ interface ISystemActivator
|
||||
/* Function 0x03 */
|
||||
NTSTATUS isa_Unknown3();
|
||||
|
||||
|
||||
// Binding strings and the OBJREF_SIGNATURE in this call
|
||||
/*****************/
|
||||
/* Function 0x04 */
|
||||
NTSTATUS isa_Unknown4();
|
||||
|
||||
|
||||
}
|
||||
|
||||
[
|
||||
|
@ -4,7 +4,6 @@
|
||||
miscellaneous IDL structures
|
||||
*/
|
||||
|
||||
[]
|
||||
interface misc
|
||||
{
|
||||
/* a NULL sid */
|
||||
|
@ -4,7 +4,6 @@
|
||||
schannel structures
|
||||
*/
|
||||
|
||||
[]
|
||||
interface schannel
|
||||
{
|
||||
/*
|
||||
|
@ -206,6 +206,21 @@ NTSTATUS ndr_pull_array_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *da
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
pull a const array of HYPER_T
|
||||
*/
|
||||
NTSTATUS ndr_pull_array_HYPER_T(struct ndr_pull *ndr, int ndr_flags, HYPER_T *data, uint32_t n)
|
||||
{
|
||||
uint32_t i;
|
||||
if (!(ndr_flags & NDR_SCALARS)) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
for (i=0;i<n;i++) {
|
||||
NDR_CHECK(ndr_pull_HYPER_T(ndr, &data[i]));
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
push a uint8
|
||||
*/
|
||||
@ -346,6 +361,21 @@ NTSTATUS ndr_push_array_uint32(struct ndr_push *ndr, int ndr_flags, const uint32
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
push an array of HYPER_T
|
||||
*/
|
||||
NTSTATUS ndr_push_array_HYPER_T(struct ndr_push *ndr, int ndr_flags, const HYPER_T *data, uint32_t n)
|
||||
{
|
||||
int i;
|
||||
if (!(ndr_flags & NDR_SCALARS)) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
for (i=0;i<n;i++) {
|
||||
NDR_CHECK(ndr_push_HYPER_T(ndr, data[i]));
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
save the current position
|
||||
*/
|
||||
@ -798,6 +828,24 @@ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level
|
||||
ndr->print(ndr, "UNKNOWN LEVEL %u", level);
|
||||
}
|
||||
|
||||
void ndr_print_array_HYPER_T(struct ndr_print *ndr, const char *name,
|
||||
const HYPER_T *data, uint32_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
ndr->print(ndr, "%s: ARRAY(%d)", name, count);
|
||||
ndr->depth++;
|
||||
for (i=0;i<count;i++) {
|
||||
char *idx=NULL;
|
||||
asprintf(&idx, "[%d]", i);
|
||||
if (idx) {
|
||||
ndr_print_HYPER_T(ndr, idx, data[i]);
|
||||
free(idx);
|
||||
}
|
||||
}
|
||||
ndr->depth--;
|
||||
}
|
||||
|
||||
void ndr_print_array_uint32(struct ndr_print *ndr, const char *name,
|
||||
const uint32_t *data, uint32_t count)
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ REQUIRED_SUBSYSTEMS = \
|
||||
ADD_OBJ_FILES = \
|
||||
torture/rpc/lsa.o \
|
||||
torture/rpc/echo.o \
|
||||
torture/rpc/dcom.o \
|
||||
torture/rpc/dfs.o \
|
||||
torture/rpc/drsuapi.o \
|
||||
torture/rpc/spoolss.o \
|
||||
|
47
source4/torture/rpc/dcom.c
Normal file
47
source4/torture/rpc/dcom.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
test suite for dcom rpc operations
|
||||
|
||||
Copyright (C) Jelmer Vernooij 2004
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
BOOL torture_rpc_dcom(int dummy)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct dcerpc_pipe *p;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
BOOL ret = True;
|
||||
|
||||
mem_ctx = talloc_init("torture_rpc_dcom");
|
||||
|
||||
status = torture_rpc_connection(&p,
|
||||
DCERPC_IOXIDRESOLVER_NAME,
|
||||
DCERPC_IOXIDRESOLVER_UUID,
|
||||
DCERPC_IOXIDRESOLVER_VERSION);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
talloc_destroy(mem_ctx);
|
||||
|
||||
torture_rpc_close(p);
|
||||
return ret;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user