struct rpc_key_data *mykeydata = k->backend_data;
TALLOC_CTX *mem_ctx = talloc_init("query_key");
- init_winreg_String(&r.in.class, NULL);
+ init_winreg_String(&r.in.class_in, NULL);
r.in.handle = &mykeydata->pol;
status = dcerpc_winreg_QueryInfoKey((struct dcerpc_pipe *)(k->hive->backend_data), mem_ctx, &r);
version(1.0),
pointer_default(unique),
helpstring("Microsoft AT-Scheduler Service"),
- endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:")
+ endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:"),
+ keepref
] interface atsvc
{
typedef [bitmap32bit] bitmap {
/* Function: 0x00 */
NTSTATUS atsvc_JobAdd(
[in,unique,string,charset(UTF16)] uint16 *servername,
- [in] atsvc_JobInfo *job_info,
+ [in,keepref] atsvc_JobInfo *job_info,
[out] uint32 job_id
);
object,
uuid("00000000-0000-0000-C000-000000000046"),
pointer_default(unique),
- helpstring("Base interface for all COM interfaces")
+ helpstring("Base interface for all COM interfaces"),
+ keepref
]
interface IUnknown
{
[
object,
uuid("00000001-0000-0000-C000-000000000046"),
- pointer_default(unique)
+ pointer_default(unique),
+ keepref
] interface IClassFactory : IUnknown
{
[local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown,
uuid("00000131-0000-0000-C000-000000000046"),
object,
pointer_default(unique),
- helpstring("Remote version of IUnknown")
+ helpstring("Remote version of IUnknown"),
+ keepref
]
interface IRemUnknown : IUnknown
{
[
object,
pointer_default(unique),
- uuid("00000143-0000-0000-C000-000000000046")
+ uuid("00000143-0000-0000-C000-000000000046"),
+ keepref
]
interface IRemUnknown2 : IRemUnknown
[
object,
pointer_default(unique),
- uuid("00020400-0000-0000-C000-000000000046")
- ] interface IDispatch : IUnknown
+ uuid("00020400-0000-0000-C000-000000000046"),
+ keepref
+] interface IDispatch : IUnknown
{
/*****************/
/* Function 0x03 */
uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78),
helpstring("ICoffeeMachine Interface"),
pointer_default(unique),
- object
+ object,
+ keepref
] interface ICoffeeMachine : IUnknown
{
WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor);
object,
pointer_default(unique),
uuid("0000000C-0000-0000-C000-000000000046"),
- helpstring("Stream")
+ helpstring("Stream"),
+ keepref
]
interface IStream : IUnknown
{
[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
version(3.0),
pointer_default(unique),
- helpstring("Settings for Microsoft Distributed File System")
+ helpstring("Settings for Microsoft Distributed File System"),
+ keepref
] interface netdfs
{
/******************/
authservice("ldap"),
helpstring("Active Directory Replication"),
pointer_default(unique),
- depends(security,misc)
+ depends(security,misc),
+ keepref
]
interface drsuapi
{
endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
version(1.0),
- helpstring("Simple echo pipe")
+ helpstring("Simple echo pipe"),
+ keepref
]
interface rpcecho
{
uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
version(1.0),
depends(security),
- pointer_default(unique)
+ pointer_default(unique),
+ keepref
] interface efs
{
"ncalrpc:[EPMAPPER]"),
helpstring("EndPoint Mapper"),
pointer_default_top(sptr),
- pointer_default(sptr)
+ pointer_default(sptr),
+ keepref
]
interface epmapper
{
version(0.0),
depends(lsa,security),
pointer_default(unique),
- helpstring("Event Logger")
+ helpstring("Event Logger"),
+ keepref
] interface eventlog
{
typedef bitmap {
version(1.0),
endpoint("ncacn_np:[\\pipe\\InitShutdown]"),
pointer_default(unique),
- helpstring("Init shutdown service")
+ helpstring("Init shutdown service"),
+ keepref
] interface initshutdown
{
typedef struct {
[ uuid("e770c620-0b06-4b5e-8d87-a26e20f28340"),
version(1.0),
pointer_default(unique),
- depends(security,nbt)
+ depends(security,nbt),
+ keepref
] interface irpc
{
typedef bitmap {
endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Local Security Authority"),
- depends(security)
+ depends(security),
+ keepref
] interface lsarpc
{
declare bitmap security_secinfo;
endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
pointer_default(unique),
pointer_default_top(unique),
- depends(lsa,samr,security)
+ depends(lsa,samr,security),
+ keepref
]
interface netlogon
*/
[
- pointer_default(unique)
+ pointer_default(unique),
+ keepref
]
interface ObjectRpcBaseTypes
{
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", "ncalrpc:"),
pointer_default(unique),
pointer_default_top(unique),
- depends(dcom, orpc)
+ depends(dcom, orpc),
+ keepref
]
interface IOXIDResolver
{
pointer_default(unique),
pointer_default_top(unique),
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
- depends(dcom,orpc)
+ depends(dcom,orpc),
+ keepref
]
interface IRemoteActivation
{
pointer_default_top(unique),
depends(orpc),
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
- "ncalrpc:[EPMAPPER]")
+ "ncalrpc:[EPMAPPER]"),
+ keepref
] interface rot
{
WERROR rot_add (
endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
pointer_default_top(unique),
- depends(misc,lsa,security)
+ depends(misc,lsa,security),
+ keepref
] interface samr
{
declare bitmap security_secinfo;
pointer_default_top(unique),
helpstring("Spooler SubSystem"),
depends(security),
- helper("librpc/ndr/ndr_spoolss_buf.h")
+ helper("librpc/ndr/ndr_spoolss_buf.h"),
+ keepref
] interface spoolss
{
typedef struct {
pointer_default(unique),
pointer_default_top(unique),
helpstring("Server Service"),
- depends(security,svcctl)
+ depends(security,svcctl),
+ keepref
] interface srvsvc
{
declare bitmap svcctl_ServerType;
pointer_default(unique),
pointer_default_top(unique),
endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
- helpstring("Service Control")
+ helpstring("Service Control"),
+ keepref
] interface svcctl
{
typedef struct {
endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Unixinfo specific stuff"),
- depends(security)
+ depends(security),
+ keepref
] interface unixinfo
{
/******************/
pointer_default(unique),
pointer_default_top(unique),
helpstring("Remote Registry Service"),
- depends(lsa,initshutdown,security)
+ depends(lsa,initshutdown,security),
+ keepref
] interface winreg
{
declare bitmap security_secinfo;
/* Function: 0x10 */
WERROR winreg_QueryInfoKey(
[in,ref] policy_handle *handle,
- [in] winreg_String class,
- [out] winreg_String class,
+ [in] winreg_String class_in,
+ [out] winreg_String *class_out,
[out] uint32 num_subkeys,
[out] uint32 max_subkeylen,
[out] uint32 max_subkeysize,
pointer_default(unique),
pointer_default_top(unique),
helpstring("Workstation Service"),
- depends(srvsvc)
+ depends(srvsvc),
+ keepref
] interface wkssvc
{
declare [v1_enum] enum srvsvc_PlatformId;
/*
push always a 0, if a pointer is NULL it's a fatal error
*/
-_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
+_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr)
{
- if (p == NULL) {
- return NT_STATUS_INVALID_PARAMETER_MIX;
- }
return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1);
}
sub CheckPointerTypes($$)
{
- my $s = shift;
- my $default = shift;
+ my ($s,$default) = @_;
foreach my $e (@{$s->{ELEMENTS}}) {
if ($e->{POINTERS} and not defined(pointer_type($e))) {
}
}
+#FIXME: Remove when ref handling in Samba4 is fixed
+sub AddKeepRef($)
+{
+ my $d = shift;
+
+ if ($d->{TYPE} eq "FUNCTION") {
+ foreach (@{$d->{ELEMENTS}}) {
+ $_->{PROPERTIES}->{keepref} = 1;
+ }
+ } elsif ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "STRUCT"
+ or $d->{DATA}->{TYPE} eq "UNION")) {
+ foreach (@{$d->{DATA}->{ELEMENTS}}) {
+ $_->{PROPERTIES}->{keepref} = 1;
+ }
+ }
+}
+
sub ParseInterface($)
{
my $idl = shift;
if ($d->{TYPE} eq "DECLARE") {
push (@declares, $d);
} elsif ($d->{TYPE} eq "FUNCTION") {
+ AddKeepRef($d) if (has_property($idl, "keepref"));
push (@functions, ParseFunction($idl, $d, \$opnum));
} elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d));
} else {
+ AddKeepRef($d) if (has_property($idl, "keepref"));
push (@types, ParseType($idl, $d));
}
}
"noheader" => ["ELEMENT"],
"charset" => ["ELEMENT"],
"length_is" => ["ELEMENT"],
+
+ # temporary (should be removed once we've migrated away from
+ # relying on ref pointers being there in Samba4's code)
+ "keepref" => ["ELEMENT","INTERFACE"],
);
#####################################################################
} else {
HeaderType($element, $element->{TYPE}, "");
pidl " ";
- my $numstar = $element->{POINTERS};
+ my $numstar = 0;
+ if (!has_property($element, "ref") or
+ has_property($element, "keepref")) {
+ $numstar += $element->{POINTERS};
+ }
if ($numstar >= 1) {
$numstar-- if Parse::Pidl::Typelist::scalar_is_reference($element->{TYPE});
}
pidl "NDR_CHECK(ndr_push_relative_ptr2(ndr, $var_name));";
}
}
- $var_name = get_value_of($var_name);
+ if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
+ $var_name = get_value_of($var_name);
+ }
ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1);
if ($l->{POINTER_TYPE} ne "ref") {
my ($e,$l,$var_name) = @_;
if ($l->{POINTER_TYPE} eq "ref") {
- if ($l->{LEVEL} eq "EMBEDDED") {
- pidl "NDR_CHECK(ndr_push_ref_ptr(ndr, $var_name));";
- } else {
+ if (has_property($e, "keepref")) {
check_null_pointer(get_value_of($var_name));
}
+ if ($l->{LEVEL} eq "EMBEDDED") {
+ pidl "NDR_CHECK(ndr_push_ref_ptr(ndr));";
+ }
} elsif ($l->{POINTER_TYPE} eq "relative") {
pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_name));";
} elsif ($l->{POINTER_TYPE} eq "unique") {
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- if ($next_is_array or $next_is_string) {
+ if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return;
} else {
$mem_c_flags = "LIBNDR_FLAG_REF_ALLOC";
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- if ($next_is_array or $next_is_string) {
+ if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return;
} else {
$mem_r_flags = "LIBNDR_FLAG_REF_ALLOC";
ParseMemCtxPullStart($e,$l, $var_name);
- $var_name = get_value_of($var_name);
+ if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
+ $var_name = get_value_of($var_name);
+ }
ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
ParseMemCtxPullEnd($e,$l);
($nl->{DATA_TYPE} eq "string"));
if ($l->{POINTER_TYPE} eq "ref") {
- unless ($l->{LEVEL} eq "TOP") {
+ if ($l->{LEVEL} eq "EMBEDDED") {
pidl "NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));";
}
- unless ($next_is_array or $next_is_string) {
+ if (!$next_is_array and !$next_is_string and
+ has_property($e, "keepref")) {
pidl "if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {";
pidl "\tNDR_PULL_ALLOC($ndr, $var_name);";
pidl "}";
sub need_decl_mem_ctx($$)
{
- my $e = shift;
- my $l = shift;
+ my ($e,$l) = @_;
return 0 if has_fast_array($e,$l);
return 0 if is_charset_array($e,$l);
my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- return 0 if ($next_is_array or $next_is_string);
+ return 0 if ($next_is_array or $next_is_string or not has_property($e, "keepref"));
}
return 1 if ($l->{TYPE} eq "POINTER");
next unless (grep(/out/, @{$e->{DIRECTION}}));
next unless ($e->{LEVELS}[0]->{TYPE} eq "POINTER" and
$e->{LEVELS}[0]->{POINTER_TYPE} eq "ref");
+ next unless has_property($e, "keepref");
next if (($e->{LEVELS}[1]->{TYPE} eq "DATA") and
($e->{LEVELS}[1]->{DATA_TYPE} eq "string"));
next if (($e->{LEVELS}[1]->{TYPE} eq "ARRAY")
# a list of known scalar types
my %scalars = (
- # 0 byte types
"void" => "void",
-
- # 1 byte types
"char" => "char",
"int8" => "int8_t",
"uint8" => "uint8_t",
-
- # 2 byte types
"int16" => "int16_t",
"uint16" => "uint16_t",
-
- # 4 byte types
"int32" => "int32_t",
"uint32" => "uint32_t",
-
- # 8 byte types
"hyper" => "uint64_t",
"dlong" => "int64_t",
"udlong" => "uint64_t",
"udlongr" => "uint64_t",
-
- # assume its a 8 byte type, but cope with either
"pointer" => "void*",
-
- # DATA_BLOB types
"DATA_BLOB" => "DATA_BLOB",
-
- # string types
"string" => "const char *",
"string_array" => "const char **",
-
- # time types
"time_t" => "time_t",
"NTTIME" => "NTTIME",
"NTTIME_1sec" => "NTTIME",
"NTTIME_hyper" => "NTTIME",
-
- # error code types
"WERROR" => "WERROR",
"NTSTATUS" => "NTSTATUS",
"COMRESULT" => "COMRESULT",
-
- # special types
"nbt_string" => "const char *",
"wrepl_nbt_name"=> "struct nbt_name *",
"ipv4address" => "const char *",
printf("\ntesting QueryInfoKey\n");
r.in.handle = handle;
- init_winreg_String(&r.in.class, class);
+ init_winreg_String(&r.in.class_in, class);
status = dcerpc_winreg_QueryInfoKey(p, mem_ctx, &r);