diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-11-10 21:20:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:43 -0500 |
commit | 0d696dc0e9867889fe198e61ed576af51ee732d1 (patch) | |
tree | c41461d05cdfb72d62cabef049c364f4e5fef128 /source4 | |
parent | f847f3a3e13d2d96f9b74a398047d84b4ad78127 (diff) | |
download | samba-0d696dc0e9867889fe198e61ed576af51ee732d1.tar.gz samba-0d696dc0e9867889fe198e61ed576af51ee732d1.tar.bz2 samba-0d696dc0e9867889fe198e61ed576af51ee732d1.zip |
r3667: Small COM fixes
(This used to be commit 7484b9be7423ccd7e37432951700939e8a53d513)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/header.pm | 17 | ||||
-rw-r--r-- | source4/build/pidl/idl.pm | 2 | ||||
-rw-r--r-- | source4/build/pidl/idl.yp | 2 | ||||
-rw-r--r-- | source4/lib/dcom/common/dcom.h | 1 | ||||
-rw-r--r-- | source4/lib/dcom/common/local.c | 10 | ||||
-rw-r--r-- | source4/lib/dcom/common/main.c | 30 | ||||
-rw-r--r-- | source4/librpc/idl/dcom.idl | 23 | ||||
-rw-r--r-- | source4/rpc_server/dcom/dcom.h | 5 | ||||
-rw-r--r-- | source4/rpc_server/dcom/remact.c | 19 |
9 files changed, 70 insertions, 39 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index cc9b804387..b981200781 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -350,16 +350,27 @@ sub HeaderInterface($) $res .= "NTSTATUS dcerpc_server_$interface->{NAME}_init(void);\n\n"; } - $count = $interface->{INHERITED_FUNCTIONS}; foreach my $d (@{$data}) { if ($d->{TYPE} eq "FUNCTION") { my $u_name = uc $d->{NAME}; - $res .= "#define DCERPC_$u_name " . sprintf("0x%02x", $count) . "\n"; + $res .= "#define DCERPC_$u_name ("; + + if (defined($interface->{BASE})) { + $res .= "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + "; + } + + $res .= sprintf("0x%02x", $count) . ")\n"; $count++; } } - $res .= "\n\n"; + $res .= "\n#define DCERPC_" . uc $interface->{NAME} . "_CALL_COUNT ("; + + if (defined($interface->{BASE})) { + $res .= "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + "; + } + + $res .= "$count)\n\n"; foreach my $d (@{$data}) { ($d->{TYPE} eq "CONST") && diff --git a/source4/build/pidl/idl.pm b/source4/build/pidl/idl.pm index a3e2e2ca8c..19525e42f3 100644 --- a/source4/build/pidl/idl.pm +++ b/source4/build/pidl/idl.pm @@ -2080,10 +2080,8 @@ sub parse_idl($$) die("No such parent interface " . $x->{BASE}); } - $x->{INHERITED_FUNCTIONS} = scalar @{$parent->{INHERITED_DATA}}; @{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}}); } else { - $x->{INHERITED_FUNCTIONS} = 0; $x->{INHERITED_DATA} = $x->{DATA}; } } diff --git a/source4/build/pidl/idl.yp b/source4/build/pidl/idl.yp index e571645c4b..24f88dd531 100644 --- a/source4/build/pidl/idl.yp +++ b/source4/build/pidl/idl.yp @@ -368,10 +368,8 @@ sub parse_idl($$) die("No such parent interface " . $x->{BASE}); } - $x->{INHERITED_FUNCTIONS} = scalar @{$parent->{INHERITED_DATA}}; @{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}}); } else { - $x->{INHERITED_FUNCTIONS} = 0; $x->{INHERITED_DATA} = $x->{DATA}; } } diff --git a/source4/lib/dcom/common/dcom.h b/source4/lib/dcom/common/dcom.h index 23db4c355f..320b5a4a9f 100644 --- a/source4/lib/dcom/common/dcom.h +++ b/source4/lib/dcom/common/dcom.h @@ -38,6 +38,7 @@ struct dcom_context const char *domain; const char *user; const char *password; + uint32_t dcerpc_flags; }; struct dcom_interface diff --git a/source4/lib/dcom/common/local.c b/source4/lib/dcom/common/local.c index 3c5405e9dc..a68f5f4593 100644 --- a/source4/lib/dcom/common/local.c +++ b/source4/lib/dcom/common/local.c @@ -70,3 +70,13 @@ NTSTATUS dcerpc_IUnknown_QueryInterface(struct dcom_interface *o, TALLOC_CTX *me * call RemQueryInterface if necessary */ return NT_STATUS_NOT_SUPPORTED; } + +NTSTATUS dcerpc_IClassFactory_CreateInstance(struct dcom_interface *o, TALLOC_CTX *mem_ctx, struct IClassFactory_CreateInstance *rr) +{ + return NT_STATUS_NOT_SUPPORTED; +} + +NTSTATUS dcerpc_IClassFactory_LockServer(struct dcom_interface *o, TALLOC_CTX *mem_ctx, struct IClassFactory_LockServer *rr) +{ + return NT_STATUS_NOT_SUPPORTED; +} diff --git a/source4/lib/dcom/common/main.c b/source4/lib/dcom/common/main.c index b2cb782953..996432181a 100644 --- a/source4/lib/dcom/common/main.c +++ b/source4/lib/dcom/common/main.c @@ -291,15 +291,16 @@ NTSTATUS dcom_get_pipe (struct dcom_interface *iface, struct dcerpc_pipe **p) i = 0; do { status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]); - i++; - } while (!NT_STATUS_IS_OK(status) && iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Error parsing string binding")); - return status; - } + if (NT_STATUS_IS_OK(status)) { + binding.flags = iface->ctx->dcerpc_flags; + status = dcerpc_pipe_connect_b(&po, &binding, DCERPC_IOXIDRESOLVER_UUID, DCERPC_IOXIDRESOLVER_VERSION, iface->ctx->domain, iface->ctx->user, iface->ctx->password); + } else { + DEBUG(1, ("Error parsing string binding - %s", nt_errstr(status))); + } - status = dcerpc_pipe_connect_b(&po, &binding, DCERPC_IOXIDRESOLVER_UUID, DCERPC_IOXIDRESOLVER_VERSION, iface->ctx->domain, iface->ctx->user, iface->ctx->password); + i++; + } while (!NT_STATUS_IS_OK(status) && iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]); if (NT_STATUS_IS_ERR(status)) { DEBUG(1, ("Error while connecting to OXID Resolver : %s\n", nt_errstr(status))); @@ -337,17 +338,18 @@ NTSTATUS dcom_get_pipe (struct dcom_interface *iface, struct dcerpc_pipe **p) i = 0; do { status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, m->bindings.stringbindings[i]); + if (NT_STATUS_IS_ERR(status)) { + DEBUG(1, ("Error parsing string binding")); + } else { + binding.flags = iface->ctx->dcerpc_flags; + status = dcerpc_pipe_connect_b(&m->pipe, &binding, GUID_string(iface->ctx, &iid) , 0.0, iface->ctx->domain, iface->ctx->user, iface->ctx->password); + } + i++; } while (NT_STATUS_IS_ERR(status) && m->bindings.stringbindings[i]); if (NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Error parsing string binding")); - return status; - } - - status = dcerpc_pipe_connect_b(&m->pipe, &binding, GUID_string(iface->ctx, &iid) , 0.0, iface->ctx->domain, iface->ctx->user, iface->ctx->password); - - if (NT_STATUS_IS_ERR(status)) { + DEBUG(0, ("Unable to connect to remote host - %s\n", nt_errstr(status))); return status; } diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl index 165d47473a..b1295315d8 100644 --- a/source4/librpc/idl/dcom.idl +++ b/source4/librpc/idl/dcom.idl @@ -57,14 +57,13 @@ interface ObjectRpcBaseTypes } COMVERSION; /* enumeration of additional information present in the call packet. */ - /* Should be an enum but DCE IDL does not support sparse enumerators. */ typedef enum { - ORPCF_NULL = 0, /* no additional info in packet */ - ORPCF_LOCAL = 1, /* call is local to this machine */ - ORPCF_RESERVED1 = 2, /* reserved for local use */ - ORPCF_RESERVED2 = 4, /* reserved for local use */ - ORPCF_RESERVED3 = 8, /* reserved for local use */ - ORPCF_RESERVED4 = 16 /* reserved for local use */ + ORPCF_NULL = 0x00, /* no additional info in packet */ + ORPCF_LOCAL = 0x01, /* call is local to this machine */ + ORPCF_RESERVED1 = 0x02, /* reserved for local use */ + ORPCF_RESERVED2 = 0x04, /* reserved for local use */ + ORPCF_RESERVED3 = 0x08, /* reserved for local use */ + ORPCF_RESERVED4 = 0x10 /* reserved for local use */ } ORPC_FLAGS; /* Extension to implicit parameters. */ @@ -127,7 +126,9 @@ interface ObjectRpcBaseTypes } SECURITYBINDING; /* signature value for OBJREF (object reference, actually the */ - /* marshaled form of a COM interface). */ + /* marshaled form of a COM interface). + * MEOW apparently stands for "Microsoft Extended Object Wireformat" + */ const uint32 OBJREF_SIGNATURE = 0x574f454d; /* 'MEOW' */ /* flag values for OBJREF */ @@ -198,7 +199,7 @@ interface ObjectRpcBaseTypes } OBJREF_Types; /* OBJREF is the format of a marshaled interface pointer. */ - typedef [public] struct + typedef [public,flag(NDR_LITTLE_ENDIAN)] struct { uint32 signature; uint32 flags; /* OBJREF flags (see above) */ @@ -245,7 +246,7 @@ interface IUnknown pointer_default(unique) ] interface IClassFactory : IUnknown { - [local] WERROR CreateInstance(/*FIXME[in] IUnknown *pUnknown*/, + [local] WERROR IClassFactory_CreateInstance([in] MInterfacePointer *pUnknown, [in] GUID *iid, [out, iid_is(riid)] MInterfacePointer *ppv); @@ -253,7 +254,7 @@ interface IUnknown /* Set lock to TRUE when you want to do a lock and set it to FALSE when you want to unlock */ - [local] WERROR LockServer([in] uint8 lock); + [local] WERROR IClassFactory_LockServer([in] uint8 lock); [call_as(LockServer)] WERROR RemoteLockServer(); } diff --git a/source4/rpc_server/dcom/dcom.h b/source4/rpc_server/dcom/dcom.h index 4fdcd0e0e6..2d4dc7d628 100644 --- a/source4/rpc_server/dcom/dcom.h +++ b/source4/rpc_server/dcom/dcom.h @@ -24,13 +24,15 @@ struct dcom_class { const char *name; + const char *prog_id; struct GUID CLSID; /* List of IID's implemented */ - uint32 cIIDs; + uint32 num_iids; struct GUID *IID; /* Pointers to functions this class implements */ + void **interfaces; }; struct dcom_object @@ -45,6 +47,7 @@ struct dcom_object struct dcom_interface_pointer { struct dcom_object *object; + struct dcerpc_interface_table *interface; struct GUID ipid; }; diff --git a/source4/rpc_server/dcom/remact.c b/source4/rpc_server/dcom/remact.c index 0ec1ea5a51..7a2b21a789 100644 --- a/source4/rpc_server/dcom/remact.c +++ b/source4/rpc_server/dcom/remact.c @@ -38,11 +38,14 @@ struct dcom_interface_pointer *dcom_interface_pointer_by_ipid(struct GUID *ipid) */ static WERROR RemoteActivation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct RemoteActivation *r) { + struct IClassFactory_CreateInstance *cr; + struct IUnknown_Release *ur; + struct dcom_interface *o; int i; + /* FIXME: CoGetClassObject() */ /* FIXME: IClassFactory::CreateInstance() */ - /* FIXME: Register newly created object with dcerpc subsystem */ - /* FIXME: IClassFactory::Release() */ + /* FIXME: IUnknown::Release() */ ZERO_STRUCT(r->out); r->out.ServerVersion.MajorVersion = COM_MAJOR_VERSION; @@ -55,17 +58,21 @@ static WERROR RemoteActivation(struct dcesrv_call_state *dce_call, TALLOC_CTX *m * r->out.interfaces */ r->out.ifaces = talloc_array_p(mem_ctx, struct pMInterfacePointer, r->in.Interfaces); r->out.results = talloc_array_p(mem_ctx, WERROR, r->in.Interfaces); + r->out.hr = cr->out.result; + for (i = 0; i < r->in.Interfaces; i++) { - ZERO_STRUCT(r->out.ifaces[i]); - r->out.results[i] = WERR_NOT_SUPPORTED; + struct IUnknown_QueryInterface rr; + rr.in.iid = &r->in.pIIDs[i]; + dcerpc_IUnknown_QueryInterface(o, mem_ctx, &rr); + ZERO_STRUCT(r->out.ifaces[i]); + r->out.results[i] = rr.out.result; } /* FIXME: */ r->out.pOxid = 0; ZERO_STRUCT(r->out.ipidRemUnknown); - r->out.hr = WERR_NOT_SUPPORTED; - return WERR_NOT_SUPPORTED; + return WERR_OK; } |