summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-06-30 12:02:33 +0200
committerAndreas Schneider <asn@samba.org>2011-08-01 08:50:35 +0200
commit169d0c431265651996f3063c3de6503f84894720 (patch)
treecbd3f57b4f58da26b54bfd2ea4d5564e62f2553e
parenteaced2e909b58ce5b83998e6bde9750985f7a99d (diff)
downloadsamba-169d0c431265651996f3063c3de6503f84894720.tar.gz
samba-169d0c431265651996f3063c3de6503f84894720.tar.bz2
samba-169d0c431265651996f3063c3de6503f84894720.zip
s3-librpc: Add dcerpc_binding_vector_add_unix().
-rw-r--r--source3/librpc/rpc/dcerpc_ep.c53
-rw-r--r--source3/librpc/rpc/dcerpc_ep.h15
2 files changed, 68 insertions, 0 deletions
diff --git a/source3/librpc/rpc/dcerpc_ep.c b/source3/librpc/rpc/dcerpc_ep.c
index 20936bcbf3..520460a853 100644
--- a/source3/librpc/rpc/dcerpc_ep.c
+++ b/source3/librpc/rpc/dcerpc_ep.c
@@ -190,6 +190,59 @@ NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
return NT_STATUS_OK;
}
+NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
+ struct dcerpc_binding_vector *bvec,
+ const char *name)
+{
+ uint32_t ep_count = iface->endpoints->count;
+ uint32_t i;
+ NTSTATUS status;
+ bool ok;
+
+ for (i = 0; i < ep_count; i++) {
+ struct dcerpc_binding *b;
+
+ b = talloc_zero(bvec->bindings, struct dcerpc_binding);
+ if (b == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_parse_binding(b, iface->endpoints->names[i], &b);
+ if (!NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ if (b->transport != NCALRPC) {
+ talloc_free(b);
+ continue;
+ }
+
+ b->object = iface->syntax_id;
+
+ b->endpoint = talloc_asprintf(b,
+ "%s/%s",
+ lp_ncalrpc_dir(),
+ name);
+ if (b->endpoint == NULL) {
+ talloc_free(b);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ok = binding_vector_realloc(bvec);
+ if (!ok) {
+ talloc_free(b);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ bvec->bindings[bvec->count] = *b;
+ bvec->count++;
+
+ break;
+ }
+
+ return NT_STATUS_OK;
+}
+
NTSTATUS dcerpc_binding_vector_create(TALLOC_CTX *mem_ctx,
const struct ndr_interface_table *iface,
uint16_t port,
diff --git a/source3/librpc/rpc/dcerpc_ep.h b/source3/librpc/rpc/dcerpc_ep.h
index 9375589c68..421038f0ad 100644
--- a/source3/librpc/rpc/dcerpc_ep.h
+++ b/source3/librpc/rpc/dcerpc_ep.h
@@ -68,6 +68,21 @@ NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
const char *host,
uint16_t port);
+/**
+ * @brief Add a unix socket (ncalrpc) to a binding vector.
+ *
+ * @param[in] iface The rpc interface to add.
+ *
+ * @param[in] bvec The binding vector to add the intface, host and port.
+ *
+ * @param[in] name The name of the unix socket.
+ *
+ * @return An NTSTATUS error code.
+ */
+NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
+ struct dcerpc_binding_vector *bvec,
+ const char *name);
+
NTSTATUS dcerpc_binding_vector_create(TALLOC_CTX *mem_ctx,
const struct ndr_interface_table *iface,
uint16_t port,