svn commit: samba r8167 - in branches/SAMBA_4_0/source: build/pidl librpc/idl librpc/ndr

metze at samba.org metze at samba.org
Tue Jul 5 12:09:33 GMT 2005


Author: metze
Date: 2005-07-05 12:09:33 +0000 (Tue, 05 Jul 2005)
New Revision: 8167

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8167

Log:
- use the same algorithm than w2k3 for 'unique' pointer values

- add a new 'sptr' (simple-full) pointer type to simulate what we need to support pipes
  like epmapper and mgmt that uses 'ptr' full pointer in their spec

- I runned make test and test_w2k3.sh with this, all fine

does we have any other pipe using 'unique' pointer where we need 'ptr'?

btw: jelmer, what does 'ignore' pointers do? they are allowed in pidl but not implemented!

metze
Modified:
   branches/SAMBA_4_0/source/build/pidl/ndr.pm
   branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm
   branches/SAMBA_4_0/source/build/pidl/validator.pm
   branches/SAMBA_4_0/source/librpc/idl/epmapper.idl
   branches/SAMBA_4_0/source/librpc/idl/mgmt.idl
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr_krb5pac.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/ndr.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-07-05 12:09:33 UTC (rev 8167)
@@ -232,6 +232,7 @@
 	
 	return "ref" if (util::has_property($e, "ref"));
 	return "ptr" if (util::has_property($e, "ptr"));
+	return "sptr" if (util::has_property($e, "sptr"));
 	return "unique" if (util::has_property($e, "unique"));
 	return "relative" if (util::has_property($e, "relative"));
 	return "ignore" if (util::has_property($e, "ignore"));

Modified: branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm	2005-07-05 12:09:33 UTC (rev 8167)
@@ -627,6 +627,8 @@
 		pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_name));";
 	} elsif ($l->{POINTER_TYPE} eq "unique") {
 		pidl "NDR_CHECK(ndr_push_unique_ptr(ndr, $var_name));";
+	} elsif ($l->{POINTER_TYPE} eq "sptr") {
+		pidl "NDR_CHECK(ndr_push_sptr_ptr(ndr, $var_name));";
 	} else {
 		die("Unhandled pointer type $l->{POINTER_TYPE}");
 	}
@@ -947,10 +949,14 @@
 		}
 		
 		return;
-	} else {
-		pidl "NDR_CHECK(ndr_pull_unique_ptr($ndr, &_ptr_$e->{NAME}));";
+	} elsif (($l->{POINTER_TYPE} eq "unique") or 
+		 ($l->{POINTER_TYPE} eq "relative") or
+		 ($l->{POINTER_TYPE} eq "sptr")) {
+		pidl "NDR_CHECK(ndr_pull_generic_ptr($ndr, &_ptr_$e->{NAME}));";
 		pidl "if (_ptr_$e->{NAME}) {";
 		indent;
+	} else {
+		die("Unhandled pointer type $l->{POINTER_TYPE}");
 	}
 
 	# Don't do this for arrays, they're allocated at the actual level 

Modified: branches/SAMBA_4_0/source/build/pidl/validator.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/validator.pm	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/build/pidl/validator.pm	2005-07-05 12:09:33 UTC (rev 8167)
@@ -83,8 +83,9 @@
 	# pointer
 	"ref"			=> ["ELEMENT"],
 	"ptr"			=> ["ELEMENT"],
+	"sptr"			=> ["ELEMENT"],
 	"unique"		=> ["ELEMENT"],
-	"ignore"        => ["ELEMENT"],
+	"ignore"		=> ["ELEMENT"],
 	"relative"		=> ["ELEMENT"],
 	"relative_base"		=> ["TYPEDEF"],
 
@@ -125,9 +126,9 @@
 	# array
 	"range"			=> ["ELEMENT"],
 	"size_is"		=> ["ELEMENT"],
-	"string"        => ["ELEMENT"],
-	"noheader"      => ["ELEMENT"],
-	"charset"       => ["ELEMENT"],
+	"string"		=> ["ELEMENT"],
+	"noheader"		=> ["ELEMENT"],
+	"charset"		=> ["ELEMENT"],
 	"length_is"		=> ["ELEMENT"],
 );
 
@@ -222,6 +223,7 @@
 
 	if (!$e->{POINTERS} && (
 		util::has_property($e, "ptr") or
+		util::has_property($e, "sptr") or
 		util::has_property($e, "unique") or
 		util::has_property($e, "relative") or
 		util::has_property($e, "ref"))) {

Modified: branches/SAMBA_4_0/source/librpc/idl/epmapper.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/epmapper.idl	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/librpc/idl/epmapper.idl	2005-07-05 12:09:33 UTC (rev 8167)
@@ -14,8 +14,8 @@
  endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", 
 		  "ncalrpc:[EPMAPPER]"),
  helpstring("EndPoint Mapper"),
- pointer_default_top(unique),
- pointer_default(unique)
+ pointer_default_top(sptr),
+ pointer_default(sptr)
 ]
 interface epmapper
 {

Modified: branches/SAMBA_4_0/source/librpc/idl/mgmt.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/mgmt.idl	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/librpc/idl/mgmt.idl	2005-07-05 12:09:33 UTC (rev 8167)
@@ -7,8 +7,8 @@
 [
   uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"), 
   version(1.0),
-  pointer_default(unique),
-  pointer_default_top(unique),
+  pointer_default(sptr),
+  pointer_default_top(sptr),
   endpoint("ncalrpc:[EPMAPPER]", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
   helpstring("DCE/RPC Remote Management")
 ] 

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2005-07-05 12:09:33 UTC (rev 8167)
@@ -128,7 +128,7 @@
 /*
   parse a pointer referent identifier
 */
-NTSTATUS ndr_pull_unique_ptr(struct ndr_pull *ndr, uint32_t *v)
+NTSTATUS ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v)
 {
 	NTSTATUS status;
 	status = ndr_pull_uint32(ndr, NDR_SCALARS, v);
@@ -563,14 +563,22 @@
 {
 	uint32_t ptr = 0;
 	if (p) {
-#if 0
 		ptr = ndr->ptr_count * 4;
 		ptr |= 0x00020000;
 		ndr->ptr_count++;
-#else
+	}
+	return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
+}
+
+/*
+  push a 'simple' full non-zero value if a pointer is non-NULL, otherwise 0
+*/
+NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p)
+{
+	uint32_t ptr = 0;
+	if (p) {
 		ndr->ptr_count++;
 		ptr = ndr->ptr_count;
-#endif
 	}
 	return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
 }

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_krb5pac.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_krb5pac.c	2005-07-05 11:32:04 UTC (rev 8166)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_krb5pac.c	2005-07-05 12:09:33 UTC (rev 8167)
@@ -90,7 +90,7 @@
 		{
 			uint32_t _flags_save_PAC_INFO = ndr->flags;
 			ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
-			NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_info));
+			NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
 			if (_ptr_info) {
 				NDR_ALLOC(ndr, r->info);
 				NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->info, _ptr_info));



More information about the samba-cvs mailing list