summaryrefslogtreecommitdiff
path: root/source4/lib/messaging
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-08-30 13:44:41 +0200
committerStefan Metzmacher <metze@samba.org>2010-09-03 17:00:18 +0200
commit611357aee31ad58632a2b029a91d950a2cffb341 (patch)
tree9b188db10dd08f6f4fd2679f05d835c41d06a8bd /source4/lib/messaging
parente26f0abe9183ac46fd8b749f7696f404414b780e (diff)
downloadsamba-611357aee31ad58632a2b029a91d950a2cffb341.tar.gz
samba-611357aee31ad58632a2b029a91d950a2cffb341.tar.bz2
samba-611357aee31ad58632a2b029a91d950a2cffb341.zip
s4:lib/messaging: add irpc_binding_handle_by_name() helper function
metze
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r--source4/lib/messaging/irpc.h4
-rw-r--r--source4/lib/messaging/messaging.c32
2 files changed, 36 insertions, 0 deletions
diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h
index 158b9cb3ec..88f142ee1e 100644
--- a/source4/lib/messaging/irpc.h
+++ b/source4/lib/messaging/irpc.h
@@ -102,6 +102,10 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct server_id server_id,
const struct ndr_interface_table *table);
+struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ const char *dest_task,
+ const struct ndr_interface_table *table);
NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name);
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 67b8401bf5..f460d676cd 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -1401,3 +1401,35 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
return h;
}
+
+struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ const char *dest_task,
+ const struct ndr_interface_table *table)
+{
+ struct dcerpc_binding_handle *h;
+ struct server_id *sids;
+ struct server_id sid;
+
+ /* find the server task */
+ sids = irpc_servers_byname(msg_ctx, mem_ctx, dest_task);
+ if (sids == NULL) {
+ errno = EADDRNOTAVAIL;
+ return NULL;
+ }
+ if (sids[0].id == 0) {
+ talloc_free(sids);
+ errno = EADDRNOTAVAIL;
+ return NULL;
+ }
+ sid = sids[0];
+ talloc_free(sids);
+
+ h = irpc_binding_handle(mem_ctx, msg_ctx,
+ sid, table);
+ if (h == NULL) {
+ return NULL;
+ }
+
+ return h;
+}