summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-21 12:58:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:18 -0500
commit9727b061f330ba8f500a29bf4b94992e2bceffbc (patch)
treeecc3bcd73ce3efe84c78d62f763d4eb4dd944c85 /source4
parent39fd6db42b4186f573ab4728509d6b8a7c8a6973 (diff)
downloadsamba-9727b061f330ba8f500a29bf4b94992e2bceffbc.tar.gz
samba-9727b061f330ba8f500a29bf4b94992e2bceffbc.tar.bz2
samba-9727b061f330ba8f500a29bf4b94992e2bceffbc.zip
r15776: Don't generate ref pointers in Samba4-generated code. There is no point
in having pointers for outgoing data when you can already modify the top-level element. This can be overridden (temporarily) by specifying the new "keepref" attribute. Once we've removed keepref from all IDL files, I'll remove this attribute as well. (This used to be commit bdc6dd37503ced8322a671d225122ccffbb8bfec)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/reg_backend_rpc.c2
-rw-r--r--source4/librpc/idl/atsvc.idl5
-rw-r--r--source4/librpc/idl/dcom.idl23
-rw-r--r--source4/librpc/idl/dfs.idl3
-rw-r--r--source4/librpc/idl/drsuapi.idl3
-rw-r--r--source4/librpc/idl/echo.idl3
-rw-r--r--source4/librpc/idl/efs.idl3
-rw-r--r--source4/librpc/idl/epmapper.idl3
-rw-r--r--source4/librpc/idl/eventlog.idl3
-rw-r--r--source4/librpc/idl/initshutdown.idl3
-rw-r--r--source4/librpc/idl/irpc.idl3
-rw-r--r--source4/librpc/idl/lsa.idl3
-rw-r--r--source4/librpc/idl/netlogon.idl3
-rw-r--r--source4/librpc/idl/orpc.idl3
-rw-r--r--source4/librpc/idl/oxidresolver.idl3
-rw-r--r--source4/librpc/idl/remact.idl3
-rw-r--r--source4/librpc/idl/rot.idl3
-rw-r--r--source4/librpc/idl/samr.idl3
-rw-r--r--source4/librpc/idl/spoolss.idl3
-rw-r--r--source4/librpc/idl/srvsvc.idl3
-rw-r--r--source4/librpc/idl/svcctl.idl3
-rw-r--r--source4/librpc/idl/unixinfo.idl3
-rw-r--r--source4/librpc/idl/winreg.idl7
-rw-r--r--source4/librpc/idl/wkssvc.idl3
-rw-r--r--source4/librpc/ndr/ndr_basic.c5
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm26
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm30
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm21
-rw-r--r--source4/torture/rpc/winreg.c2
30 files changed, 112 insertions, 75 deletions
diff --git a/source4/lib/registry/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc.c
index 79adad1356..8e70998778 100644
--- a/source4/lib/registry/reg_backend_rpc.c
+++ b/source4/lib/registry/reg_backend_rpc.c
@@ -280,7 +280,7 @@ static WERROR rpc_query_key(const struct registry_key *k)
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);
diff --git a/source4/librpc/idl/atsvc.idl b/source4/librpc/idl/atsvc.idl
index d58a719651..3dd5cb6805 100644
--- a/source4/librpc/idl/atsvc.idl
+++ b/source4/librpc/idl/atsvc.idl
@@ -6,7 +6,8 @@
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 {
@@ -73,7 +74,7 @@
/* 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
);
diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl
index ce10c98c0a..2a2b9ad8b1 100644
--- a/source4/librpc/idl/dcom.idl
+++ b/source4/librpc/idl/dcom.idl
@@ -18,7 +18,8 @@
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
{
@@ -42,7 +43,8 @@ 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,
@@ -69,7 +71,8 @@ interface IUnknown
uuid("00000131-0000-0000-C000-000000000046"),
object,
pointer_default(unique),
- helpstring("Remote version of IUnknown")
+ helpstring("Remote version of IUnknown"),
+ keepref
]
interface IRemUnknown : IUnknown
{
@@ -169,7 +172,8 @@ interface IRemUnknown : IUnknown
[
object,
pointer_default(unique),
- uuid("00000143-0000-0000-C000-000000000046")
+ uuid("00000143-0000-0000-C000-000000000046"),
+ keepref
]
interface IRemUnknown2 : IRemUnknown
@@ -186,8 +190,9 @@ 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 */
@@ -254,7 +259,8 @@ interface IRemUnknown2 : IRemUnknown
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);
@@ -272,7 +278,8 @@ interface IRemUnknown2 : IRemUnknown
object,
pointer_default(unique),
uuid("0000000C-0000-0000-C000-000000000046"),
- helpstring("Stream")
+ helpstring("Stream"),
+ keepref
]
interface IStream : IUnknown
{
diff --git a/source4/librpc/idl/dfs.idl b/source4/librpc/idl/dfs.idl
index ef3d2ca604..a39bfe6aa0 100644
--- a/source4/librpc/idl/dfs.idl
+++ b/source4/librpc/idl/dfs.idl
@@ -5,7 +5,8 @@
[ 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
{
/******************/
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl
index 3668ddab7e..f106c4ce3a 100644
--- a/source4/librpc/idl/drsuapi.idl
+++ b/source4/librpc/idl/drsuapi.idl
@@ -7,7 +7,8 @@
authservice("ldap"),
helpstring("Active Directory Replication"),
pointer_default(unique),
- depends(security,misc)
+ depends(security,misc),
+ keepref
]
interface drsuapi
{
diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl
index 7b80e3e296..cda29685a1 100644
--- a/source4/librpc/idl/echo.idl
+++ b/source4/librpc/idl/echo.idl
@@ -4,7 +4,8 @@
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
{
diff --git a/source4/librpc/idl/efs.idl b/source4/librpc/idl/efs.idl
index 75d997a018..83c6cad19f 100644
--- a/source4/librpc/idl/efs.idl
+++ b/source4/librpc/idl/efs.idl
@@ -7,7 +7,8 @@
uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
version(1.0),
depends(security),
- pointer_default(unique)
+ pointer_default(unique),
+ keepref
] interface efs
{
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index 223883c366..e913209cf1 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -15,7 +15,8 @@ http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: bindin
"ncalrpc:[EPMAPPER]"),
helpstring("EndPoint Mapper"),
pointer_default_top(sptr),
- pointer_default(sptr)
+ pointer_default(sptr),
+ keepref
]
interface epmapper
{
diff --git a/source4/librpc/idl/eventlog.idl b/source4/librpc/idl/eventlog.idl
index 38f4a88e28..c8a146b272 100644
--- a/source4/librpc/idl/eventlog.idl
+++ b/source4/librpc/idl/eventlog.idl
@@ -7,7 +7,8 @@
version(0.0),
depends(lsa,security),
pointer_default(unique),
- helpstring("Event Logger")
+ helpstring("Event Logger"),
+ keepref
] interface eventlog
{
typedef bitmap {
diff --git a/source4/librpc/idl/initshutdown.idl b/source4/librpc/idl/initshutdown.idl
index 50d49637c2..8555ed0c5c 100644
--- a/source4/librpc/idl/initshutdown.idl
+++ b/source4/librpc/idl/initshutdown.idl
@@ -9,7 +9,8 @@
version(1.0),
endpoint("ncacn_np:[\\pipe\\InitShutdown]"),
pointer_default(unique),
- helpstring("Init shutdown service")
+ helpstring("Init shutdown service"),
+ keepref
] interface initshutdown
{
typedef struct {
diff --git a/source4/librpc/idl/irpc.idl b/source4/librpc/idl/irpc.idl
index 5614608bd7..a566a99bfc 100644
--- a/source4/librpc/idl/irpc.idl
+++ b/source4/librpc/idl/irpc.idl
@@ -6,7 +6,8 @@
[ uuid("e770c620-0b06-4b5e-8d87-a26e20f28340"),
version(1.0),
pointer_default(unique),
- depends(security,nbt)
+ depends(security,nbt),
+ keepref
] interface irpc
{
typedef bitmap {
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl
index 454f73afeb..0953c6d025 100644
--- a/source4/librpc/idl/lsa.idl
+++ b/source4/librpc/idl/lsa.idl
@@ -9,7 +9,8 @@
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;
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index c4a0f97613..95289b7ea9 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -12,7 +12,8 @@
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
diff --git a/source4/librpc/idl/orpc.idl b/source4/librpc/idl/orpc.idl
index c1faefd3b1..c59cc9d3cb 100644
--- a/source4/librpc/idl/orpc.idl
+++ b/source4/librpc/idl/orpc.idl
@@ -6,7 +6,8 @@
*/
[
- pointer_default(unique)
+ pointer_default(unique),
+ keepref
]
interface ObjectRpcBaseTypes
{
diff --git a/source4/librpc/idl/oxidresolver.idl b/source4/librpc/idl/oxidresolver.idl
index d3f3078a0d..835b848a45 100644
--- a/source4/librpc/idl/oxidresolver.idl
+++ b/source4/librpc/idl/oxidresolver.idl
@@ -16,7 +16,8 @@
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
{
diff --git a/source4/librpc/idl/remact.idl b/source4/librpc/idl/remact.idl
index a54ca7781d..2f8baf926a 100644
--- a/source4/librpc/idl/remact.idl
+++ b/source4/librpc/idl/remact.idl
@@ -8,7 +8,8 @@
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
{
diff --git a/source4/librpc/idl/rot.idl b/source4/librpc/idl/rot.idl
index 5851466c79..27c7836635 100644
--- a/source4/librpc/idl/rot.idl
+++ b/source4/librpc/idl/rot.idl
@@ -5,7 +5,8 @@
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 (
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index c9d21dba08..370eb728bd 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -13,7 +13,8 @@
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;
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 93ce3c3f36..b09690b278 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -11,7 +11,8 @@
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 {
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index 6405736c9f..845969a027 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -10,7 +10,8 @@
pointer_default(unique),
pointer_default_top(unique),
helpstring("Server Service"),
- depends(security,svcctl)
+ depends(security,svcctl),
+ keepref
] interface srvsvc
{
declare bitmap svcctl_ServerType;
diff --git a/source4/librpc/idl/svcctl.idl b/source4/librpc/idl/svcctl.idl
index 27172f85df..f77e4d4276 100644
--- a/source4/librpc/idl/svcctl.idl
+++ b/source4/librpc/idl/svcctl.idl
@@ -9,7 +9,8 @@
pointer_default(unique),
pointer_default_top(unique),
endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
- helpstring("Service Control")
+ helpstring("Service Control"),
+ keepref
] interface svcctl
{
typedef struct {
diff --git a/source4/librpc/idl/unixinfo.idl b/source4/librpc/idl/unixinfo.idl
index 078862f444..2b5b60908f 100644
--- a/source4/librpc/idl/unixinfo.idl
+++ b/source4/librpc/idl/unixinfo.idl
@@ -7,7 +7,8 @@
endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique),
helpstring("Unixinfo specific stuff"),
- depends(security)
+ depends(security),
+ keepref
] interface unixinfo
{
/******************/
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl
index 1ecb98d3b0..93c3c12db5 100644
--- a/source4/librpc/idl/winreg.idl
+++ b/source4/librpc/idl/winreg.idl
@@ -9,7 +9,8 @@
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;
@@ -205,8 +206,8 @@
/* 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,
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index d658091c47..a085265a41 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -7,7 +7,8 @@
pointer_default(unique),
pointer_default_top(unique),
helpstring("Workstation Service"),
- depends(srvsvc)
+ depends(srvsvc),
+ keepref
] interface wkssvc
{
declare [v1_enum] enum srvsvc_PlatformId;
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 197fd44895..f4ba786865 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -494,11 +494,8 @@ _PUBLIC_ NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p)
/*
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);
}
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 5839b042d3..21875a1297 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -571,8 +571,7 @@ sub ParseFunction($$$)
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))) {
@@ -581,6 +580,23 @@ sub CheckPointerTypes($$)
}
}
+#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;
@@ -606,10 +622,12 @@ sub ParseInterface($)
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));
}
}
@@ -831,6 +849,10 @@ my %property_list = (
"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"],
);
#####################################################################
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 6fb3ee2eec..c9487115f5 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -60,7 +60,11 @@ sub HeaderElement($)
} 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});
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index b7ae526e68..5a8ef53e14 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -582,7 +582,9 @@ sub ParseElementPushLevel
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") {
@@ -662,11 +664,12 @@ sub ParsePtrPush($$$)
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") {
@@ -872,7 +875,7 @@ sub ParseMemCtxPullStart($$$)
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";
@@ -898,7 +901,7 @@ sub ParseMemCtxPullEnd($$)
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";
@@ -975,7 +978,9 @@ sub ParseElementPullLevel
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);
@@ -1075,11 +1080,12 @@ sub ParsePtrPull($$$$)
($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 "}";
@@ -1413,8 +1419,7 @@ sub DeclareArrayVariables($)
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);
@@ -1425,7 +1430,7 @@ sub need_decl_mem_ctx($$)
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");
@@ -2091,6 +2096,7 @@ sub ParseFunctionPull($)
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")
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index 10a1e8136f..66d5e59e7c 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -23,50 +23,29 @@ my @reference_scalars = (
# 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 *",
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index a03da8002a..35f9b20181 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -376,7 +376,7 @@ static BOOL test_QueryInfoKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
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);