svn commit: samba r3515 - in branches/SAMBA_4_0/source: build/pidl include lib/dcom/common librpc/idl librpc/rpc

jelmer at samba.org jelmer at samba.org
Thu Nov 4 01:09:43 GMT 2004


Author: jelmer
Date: 2004-11-04 01:09:43 +0000 (Thu, 04 Nov 2004)
New Revision: 3515

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

Log:
Fix RemoteActivation correctly this time (-: 
Thanks to tridge for some help on this one!

Modified:
   branches/SAMBA_4_0/source/build/pidl/util.pm
   branches/SAMBA_4_0/source/include/includes.h
   branches/SAMBA_4_0/source/lib/dcom/common/dcom.h
   branches/SAMBA_4_0/source/lib/dcom/common/main.c
   branches/SAMBA_4_0/source/librpc/idl/dcom.idl
   branches/SAMBA_4_0/source/librpc/idl/remact.idl
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/util.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/util.pm	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/build/pidl/util.pm	2004-11-04 01:09:43 UTC (rev 3515)
@@ -239,6 +239,7 @@
     return 4, if ($type eq "DATA_BLOB");
     return 4, if ($type eq "int32");
 
+	print STDERR "Had to guess align width for type $type\n";
     # it must be an external type - all we can do is guess 
     return 4;
 }

Modified: branches/SAMBA_4_0/source/include/includes.h
===================================================================
--- branches/SAMBA_4_0/source/include/includes.h	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/include/includes.h	2004-11-04 01:09:43 UTC (rev 3515)
@@ -182,6 +182,7 @@
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "librpc/gen_ndr/ndr_dcerpc.h"
 #include "librpc/rpc/dcerpc.h"
+#include "librpc/gen_ndr/ndr_dcom.h"
 #include "lib/dcom/common/dcom.h"
 #include "smb_interfaces.h"
 #include "smbd/server.h"

Modified: branches/SAMBA_4_0/source/lib/dcom/common/dcom.h
===================================================================
--- branches/SAMBA_4_0/source/lib/dcom/common/dcom.h	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/lib/dcom/common/dcom.h	2004-11-04 01:09:43 UTC (rev 3515)
@@ -28,7 +28,7 @@
 struct dcom_interface
 {
 	struct dcerpc_pipe *pipe;
-	struct GUID ipid; /* Appears in object field */
+	struct OBJREF object;
 };
 
 #endif /* _DCOM_H */

Modified: branches/SAMBA_4_0/source/lib/dcom/common/main.c
===================================================================
--- branches/SAMBA_4_0/source/lib/dcom/common/main.c	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/lib/dcom/common/main.c	2004-11-04 01:09:43 UTC (rev 3515)
@@ -90,6 +90,7 @@
 WERROR dcom_create_object(TALLOC_CTX *mem_ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct dcom_interface **ip, const char *domain, const char *user, const char *pass)
 {
 	struct RemoteActivation r;
+	int i;
 	struct dcerpc_pipe *p;
 	NTSTATUS status;
 	uint16 protseq[] = DCOM_NEGOTIATED_PROTOCOLS;
@@ -110,7 +111,8 @@
 	r.in.protseq = protseq;
 	r.in.Interfaces = num_ifaces;
 	r.in.pIIDs = iid;
-
+	r.out.ifaces = talloc_array_p(mem_ctx, struct pMInterfacePointer, num_ifaces);
+	
 	status = dcerpc_RemoteActivation(p, mem_ctx, &r);
 	if(NT_STATUS_IS_ERR(status)) {
 		DEBUG(1, ("Error while running RemoteActivation %s\n", nt_errstr(status)));
@@ -121,15 +123,21 @@
 	if(!W_ERROR_IS_OK(r.out.hr)) { return r.out.hr; }
 	if(!W_ERROR_IS_OK(r.out.results[0])) { return r.out.results[0]; }
 
-	/* FIXME: Fill ip */
+	*ip = talloc_array_p(mem_ctx, struct dcom_interface, num_ifaces);
+	for (i = 0; i < num_ifaces; i++) {
+		(*ip)[i].object = r.out.ifaces[i].p->obj;
+		(*ip)[i].pipe = NULL; /* FIXME */
+	}
+
 	return WERR_OK;
 }
 
-WERROR dcom_get_class_object(TALLOC_CTX *mem_ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct dcom_interface **ip, const char *domain, const char *user, const char *pass)
+WERROR dcom_get_class_object(TALLOC_CTX *mem_ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct dcom_interface *ip, const char *domain, const char *user, const char *pass)
 {
 	struct RemoteActivation r;
 	struct dcerpc_pipe *p;
 	NTSTATUS status;
+	struct pMInterfacePointer pm;
 	uint16 protseq[] = DCOM_NEGOTIATED_PROTOCOLS;
 
 	status = dcom_connect(&p, server, domain, user, pass);
@@ -149,6 +157,7 @@
 	r.in.Interfaces = 1;
 	r.in.pIIDs = iid;
 	r.in.Mode = MODE_GET_CLASS_OBJECT;
+	r.out.ifaces = &pm;
 
 	status = dcerpc_RemoteActivation(p, mem_ctx, &r);
 	if(NT_STATUS_IS_ERR(status)) {
@@ -160,6 +169,8 @@
 	if(!W_ERROR_IS_OK(r.out.hr)) { return r.out.hr; }
 	if(!W_ERROR_IS_OK(r.out.results[0])) { return r.out.results[0]; }
 
-	/* FIXME: Fill ip */
+	ip->pipe = NULL; /* FIXME */
+	ip->object = pm.p->obj;
+
 	return WERR_OK;
 }

Modified: branches/SAMBA_4_0/source/librpc/idl/dcom.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/dcom.idl	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/librpc/idl/dcom.idl	2004-11-04 01:09:43 UTC (rev 3515)
@@ -262,8 +262,7 @@
 	typedef [public] struct 
 	{
 		uint32 size;
-		uint32 sizex;
-		[subcontext(4),align(1)] OBJREF obj;
+		[subcontext(4),align(4)] OBJREF obj;
 	} MInterfacePointer;
 }
 

Modified: branches/SAMBA_4_0/source/librpc/idl/remact.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/remact.idl	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/librpc/idl/remact.idl	2004-11-04 01:09:43 UTC (rev 3515)
@@ -10,6 +10,7 @@
 [
 	uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
 	pointer_default(unique),
+	endpoint("ncalrpc:", "ncacn_ip_tcp:[135]"),
 	depends(dcom)
 ]
 interface IRemoteActivation
@@ -22,7 +23,11 @@
 		RPC_C_IMP_LEVEL_IMPERSONATE = 3,
 		RPC_C_IMP_LEVEL_DELEGATE = 4
 	} imp_levels;
-
+	
+	typedef struct {
+		MInterfacePointer *p;
+	} pMInterfacePointer;
+	
 	const uint32 MODE_GET_CLASS_OBJECT = 0xffffffff;
 	WERROR RemoteActivation (
 			[in] ORPCTHIS this,
@@ -32,7 +37,7 @@
 			[in, unique] MInterfacePointer *pObjectStorage,
 			[in] uint32 ClientImpLevel,
 			[in] uint32 Mode,
-			[in] uint32 Interfaces,
+			[in,range(1,32768)] uint32 Interfaces,
 			[in, unique,size_is(Interfaces)] GUID *pIIDs,
 			[in] uint16 num_protseqs,
 			[in, size_is(num_protseqs)] uint16 protseq[],
@@ -42,7 +47,7 @@
 			[out] uint32 AuthnHint,
 			[out] COMVERSION ServerVersion,
 			[out] WERROR hr,
-			[out,size_is(Interfaces)] MInterfacePointer ifaces[],
+			[out,size_is(Interfaces),ref] pMInterfacePointer *ifaces,
 			[out,size_is(Interfaces)] WERROR results[]
 			);
 }

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c	2004-11-03 21:44:18 UTC (rev 3514)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c	2004-11-04 01:09:43 UTC (rev 3515)
@@ -24,6 +24,9 @@
 #include "includes.h"
 #include "system/network.h"
 #include "librpc/gen_ndr/ndr_epmapper.h"
+#include "librpc/gen_ndr/ndr_remact.h"
+#include "librpc/gen_ndr/ndr_oxidresolver.h"
+#include "librpc/gen_ndr/ndr_mgmt.h"
 #include "librpc/gen_ndr/tables.h"
 
 /*
@@ -659,7 +662,10 @@
 	struct dcerpc_binding epmapper_binding;
 
 
-	if (!strcmp(uuid, DCERPC_EPMAPPER_UUID)) {
+	if (!strcmp(uuid, DCERPC_EPMAPPER_UUID) ||
+		!strcmp(uuid, DCERPC_MGMT_UUID) ||
+		!strcmp(uuid, DCERPC_IREMOTEACTIVATION_UUID) ||
+		!strcmp(uuid, DCERPC_IOXIDRESOLVER_UUID)) {
 		switch(binding->transport) {
 			case NCACN_IP_TCP: binding->endpoint = talloc_asprintf(mem_ctx, "%d", EPMAPPER_PORT); return NT_STATUS_OK;
 			case NCALRPC: binding->endpoint = EPMAPPER_IDENTIFIER; return NT_STATUS_OK;



More information about the samba-cvs mailing list