summaryrefslogtreecommitdiff
path: root/source4/lib/com/dcom
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-15 04:16:15 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-15 17:40:34 +0200
commit51fbc88fc24c23d17f976217ef907fd7e57fe4ab (patch)
treec327c30df880131028c24d5928cad0bb40575199 /source4/lib/com/dcom
parent82ee6ee5035a6265aa97da0befd8d65358c89c9d (diff)
downloadsamba-51fbc88fc24c23d17f976217ef907fd7e57fe4ab.tar.gz
samba-51fbc88fc24c23d17f976217ef907fd7e57fe4ab.tar.bz2
samba-51fbc88fc24c23d17f976217ef907fd7e57fe4ab.zip
Get code closer to compiling without errors, fix formatting, add docstrings.
Diffstat (limited to 'source4/lib/com/dcom')
-rw-r--r--source4/lib/com/dcom/dcom.h15
-rw-r--r--source4/lib/com/dcom/main.c18
2 files changed, 27 insertions, 6 deletions
diff --git a/source4/lib/com/dcom/dcom.h b/source4/lib/com/dcom/dcom.h
index b3f42bc562..69bb7183b2 100644
--- a/source4/lib/com/dcom/dcom.h
+++ b/source4/lib/com/dcom/dcom.h
@@ -28,10 +28,16 @@ struct dcerpc_pipe;
#include "librpc/gen_ndr/orpc.h"
struct dcom_client_context {
- struct cli_credentials *credentials;
+ struct dcom_server_credentials {
+ const char *server;
+ struct cli_credentials *credentials;
+ struct dcom_server_credentials *prev, *next;
+ } *credentials;
struct dcom_object_exporter {
- uint64_t oxid;
- struct DUALSTRINGARRAY bindings;
+ uint64_t oxid;
+ char *host;
+ struct IRemUnknown *rem_unknown;
+ struct DUALSTRINGARRAY *bindings;
struct dcerpc_pipe *pipe;
struct dcom_object_exporter *prev, *next;
} *object_exporters;
@@ -50,7 +56,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp);
NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p);
NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o);
uint64_t dcom_get_current_oxid(void);
-void dcom_set_server_credentials(struct com_context *ctx, const char *server, struct cli_credentials *credentials);
+void dcom_add_server_credentials(struct com_context *ctx, const char *server, struct cli_credentials *credentials);
WERROR dcom_query_interface(struct IUnknown *d, uint32_t cRefs, uint16_t cIids, struct GUID *iids, struct IUnknown **ip, WERROR *results);
#include "librpc/gen_ndr/com_dcom.h"
@@ -61,5 +67,6 @@ 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)
#endif /* _DCOM_H */
diff --git a/source4/lib/com/dcom/main.c b/source4/lib/com/dcom/main.c
index 01efb68c05..f3eb2ab608 100644
--- a/source4/lib/com/dcom/main.c
+++ b/source4/lib/com/dcom/main.c
@@ -84,12 +84,23 @@ struct cli_credentials *dcom_get_server_credentials(struct com_context *ctx, con
return d;
}
-void dcom_set_server_credentials(struct com_context *ctx, const char *server, struct cli_credentials *credentials)
+/**
+ * Register credentials for a specific server.
+ *
+ * @param ctx COM context
+ * @param server Name of server, can be NULL
+ * @param credentials Credentials object
+ */
+void dcom_add_server_credentials(struct com_context *ctx, const char *server,
+ struct cli_credentials *credentials)
{
struct dcom_server_credentials *c;
+ /* FIXME: Don't use talloc_find_parent_bytype */
for (c = ctx->dcom->credentials; c; c = c->next) {
- if ((server == NULL && c->server == NULL) ||(server && c->server && !strcmp(c->server, server))) {
+ if ((server == NULL && c->server == NULL) ||
+ (server != NULL && c->server != NULL &&
+ !strcmp(c->server, server))) {
if (c->credentials && c->credentials != credentials) {
talloc_unlink(c, c->credentials);
c->credentials = credentials;
@@ -98,9 +109,11 @@ void dcom_set_server_credentials(struct com_context *ctx, const char *server, st
else
talloc_steal(c, c->credentials);
}
+
return;
}
}
+
c = talloc(ctx->event_ctx, struct dcom_server_credentials);
c->server = talloc_strdup(c, server);
c->credentials = credentials;
@@ -108,6 +121,7 @@ void dcom_set_server_credentials(struct com_context *ctx, const char *server, st
(void)talloc_reference(c, c->credentials);
else
talloc_steal(c, c->credentials);
+
DLIST_ADD(ctx->dcom->credentials, c);
}