summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-16 02:27:33 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-16 02:27:33 +0200
commitc212a65b65ba0100ceb9c4fa48c1f44dc0c804f5 (patch)
treee0277c440075c1830b30d7ae98fe0238cdae6a24 /source4/lib
parent7e239a15b316deb83cbdcb79e392f6aefe289114 (diff)
downloadsamba-c212a65b65ba0100ceb9c4fa48c1f44dc0c804f5.tar.gz
samba-c212a65b65ba0100ceb9c4fa48c1f44dc0c804f5.tar.bz2
samba-c212a65b65ba0100ceb9c4fa48c1f44dc0c804f5.zip
More changes getting WMI code to compile, import manual marshalling.
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/com/com.h12
-rw-r--r--source4/lib/com/dcom/dcom.h2
-rw-r--r--source4/lib/com/dcom/main.c29
-rw-r--r--source4/lib/wmi/tools/wmic.c4
-rw-r--r--source4/lib/wmi/wbemdata.c1
-rw-r--r--source4/lib/wmi/wmicore.c2
6 files changed, 34 insertions, 16 deletions
diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h
index f88c914a04..2074bd11ca 100644
--- a/source4/lib/com/com.h
+++ b/source4/lib/com/com.h
@@ -25,6 +25,18 @@
struct com_context;
struct event_context;
+struct com_context
+{
+ struct dcom_client_context *dcom;
+ struct event_context *event_ctx;
+ struct com_extension {
+ uint32_t id;
+ void *data;
+ struct com_extension *prev, *next;
+ } *extensions;
+ struct loadparm_context *lp_ctx;
+};
+
struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID *clsid);
NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, struct IUnknown *p);
diff --git a/source4/lib/com/dcom/dcom.h b/source4/lib/com/dcom/dcom.h
index 69bb7183b2..3ce0478172 100644
--- a/source4/lib/com/dcom/dcom.h
+++ b/source4/lib/com/dcom/dcom.h
@@ -68,5 +68,7 @@ NTSTATUS dcom_register_marshal(struct GUID *clsid, marshal_fn marshal, unmarshal
#include "libcli/composite/composite.h"
void dcom_release_continue(struct composite_context *cr);
#define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid)
+struct composite_context *dcom_release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx);
+marshal_fn dcom_marshal_by_clsid(struct GUID *clsid);
#endif /* _DCOM_H */
diff --git a/source4/lib/com/dcom/main.c b/source4/lib/com/dcom/main.c
index a4b37f1927..2770897ca3 100644
--- a/source4/lib/com/dcom/main.c
+++ b/source4/lib/com/dcom/main.c
@@ -25,6 +25,7 @@
#include "librpc/gen_ndr/ndr_remact_c.h"
#include "librpc/gen_ndr/com_dcom.h"
#include "librpc/gen_ndr/dcom.h"
+#include "librpc/rpc/dcerpc.h"
#include "lib/com/dcom/dcom.h"
#include "librpc/ndr/ndr_table.h"
#include "lib/util/dlinklist.h"
@@ -154,7 +155,7 @@ struct dcom_client_context *dcom_client_init(struct com_context *ctx, struct cli
cli_credentials_set_conf(credentials, ctx->lp_ctx);
cli_credentials_parse_string(credentials, "%", CRED_SPECIFIED);
}
- dcom_set_server_credentials(ctx, NULL, credentials);
+ dcom_add_server_credentials(ctx, NULL, credentials);
return ctx->dcom;
}
@@ -191,9 +192,11 @@ static NTSTATUS dcom_connect_host(struct com_context *ctx,
if (!binding) {
status = NT_STATUS_NO_MEMORY;
goto end;
- };
- status = dcerpc_pipe_connect(ctx->event_ctx, p, binding, &ndr_table_IRemoteActivation,
- dcom_get_server_credentials(ctx, server), ctx->event_ctx, ctx->lp_ctx);
+ }
+ status = dcerpc_pipe_connect(ctx->event_ctx, p, binding,
+ &ndr_table_IRemoteActivation,
+ dcom_get_server_credentials(ctx, server),
+ ctx->event_ctx, ctx->lp_ctx);
if (NT_STATUS_IS_OK(status)) {
if (DEBUGLVL(11))
@@ -507,7 +510,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
return NT_STATUS_OK;
}
-NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p)
+NTSTATUS dcom_OBJREF_from_IUnknown(TALLLOC_CTX *mem_ctx, struct OBJREF *o, struct IUnknown *p)
{
/* FIXME: Cache generated objref objects? */
ZERO_STRUCTP(o);
@@ -523,7 +526,7 @@ NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p)
marshal = dcom_marshal_by_clsid(&o->u_objref.u_custom.clsid);
if (marshal) {
- return marshal(p, o);
+ return marshal(mem_ctx, p, o);
} else {
return NT_STATUS_NOT_SUPPORTED;
}
@@ -534,15 +537,16 @@ NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p)
return NT_STATUS_OK;
}
-NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o)
+enum ndr_err_code dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o)
{
struct IUnknown *p;
struct dcom_object_exporter *ox;
+ unmarshal_fn unmarshal;
switch(o->flags) {
case OBJREF_NULL:
*_p = NULL;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
case OBJREF_STANDARD:
p = talloc_zero(ctx, struct IUnknown);
@@ -552,7 +556,7 @@ NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p
if (!p->vtable) {
DEBUG(0, ("Unable to find proxy class for interface with IID %s\n", GUID_string(ctx, &o->iid)));
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_INVALID_POINTER;
}
p->vtable->Release_send = dcom_release_send;
@@ -560,7 +564,7 @@ NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p
ox = object_exporter_by_oxid(ctx, o->u_objref.u_standard.std.oxid);
/* FIXME: Add object to list of objects to ping */
*_p = p;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
case OBJREF_HANDLER:
p = talloc_zero(ctx, struct IUnknown);
@@ -579,17 +583,16 @@ NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p
p->ctx = ctx;
p->vtable = NULL;
p->obj = *o;
- unmarshal_fn unmarshal;
unmarshal = dcom_unmarshal_by_clsid(&o->u_objref.u_custom.clsid);
*_p = p;
if (unmarshal) {
return unmarshal(ctx, o, _p);
} else {
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_BAD_SWITCH;
}
}
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_BAD_SWITCH;
}
uint64_t dcom_get_current_oxid(void)
diff --git a/source4/lib/wmi/tools/wmic.c b/source4/lib/wmi/tools/wmic.c
index 4b84c27c8d..bbfe5ed334 100644
--- a/source4/lib/wmi/tools/wmic.c
+++ b/source4/lib/wmi/tools/wmic.c
@@ -200,12 +200,12 @@ int main(int argc, char **argv)
class_name = talloc_strdup(ctx, co[i]->obj_class->__CLASS);
printf("CLASS: %s\n", class_name);
for (j = 0; j < co[i]->obj_class->__PROPERTY_COUNT; ++j)
- printf("%s%s", j?"|":"", co[i]->obj_class->properties[j].name);
+ printf("%s%s", j?"|":"", co[i]->obj_class->properties[j].property.name);
printf("\n");
}
for (j = 0; j < co[i]->obj_class->__PROPERTY_COUNT; ++j) {
char *s;
- s = string_CIMVAR(ctx, &co[i]->instance->data[j], co[i]->obj_class->properties[j].desc->cimtype & CIM_TYPEMASK);
+ s = string_CIMVAR(ctx, &co[i]->instance->data[j], co[i]->obj_class->properties[j].property.desc->cimtype & CIM_TYPEMASK);
printf("%s%s", j?"|":"", s);
}
printf("\n");
diff --git a/source4/lib/wmi/wbemdata.c b/source4/lib/wmi/wbemdata.c
index b24499ab5c..58bf177c0c 100644
--- a/source4/lib/wmi/wbemdata.c
+++ b/source4/lib/wmi/wbemdata.c
@@ -33,6 +33,7 @@
#include "lib/talloc/talloc.h"
#include "libcli/composite/composite.h"
#include "lib/wmi/wmi.h"
+#include "librpc/ndr/ndr_wmi.h"
enum {
DATATYPE_CLASSOBJECT = 2,
diff --git a/source4/lib/wmi/wmicore.c b/source4/lib/wmi/wmicore.c
index fbd6b339bf..49c1e03312 100644
--- a/source4/lib/wmi/wmicore.c
+++ b/source4/lib/wmi/wmicore.c
@@ -69,7 +69,7 @@ WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const uin
cc = cli_credentials_init(cred);
cli_credentials_set_conf(cc, global_loadparm);
cli_credentials_parse_string(cc, cred, CRED_SPECIFIED);
- dcom_set_server_credentials(ctx, server, cc);
+ dcom_add_server_credentials(ctx, server, cc);
talloc_free(cred);
}