summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-07-28 15:06:11 -0400
committerVolker Lendecke <vl@samba.org>2009-08-05 03:21:19 -0400
commit6cf3db91499ebd245b08997a319edf36cfee3365 (patch)
treea7355f3e0b25e2a13964b7500c77980e94cf2373 /source3/librpc
parentddd13c6816e7d289406948fe2f68db1aba7669d3 (diff)
downloadsamba-6cf3db91499ebd245b08997a319edf36cfee3365.tar.gz
samba-6cf3db91499ebd245b08997a319edf36cfee3365.tar.bz2
samba-6cf3db91499ebd245b08997a319edf36cfee3365.zip
s3:winbind: Add NDR-based parent-child communication to winbind
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.c159
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.h15
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.c110
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.h18
-rw-r--r--source3/librpc/gen_ndr/srv_wbint.c130
-rw-r--r--source3/librpc/gen_ndr/srv_wbint.h9
-rw-r--r--source3/librpc/gen_ndr/wbint.h22
-rw-r--r--source3/librpc/idl/wbint.idl14
8 files changed, 477 insertions, 0 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c
new file mode 100644
index 0000000000..044fdf9d1c
--- /dev/null
+++ b/source3/librpc/gen_ndr/cli_wbint.c
@@ -0,0 +1,159 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * client auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/cli_wbint.h"
+
+struct rpccli_wbint_Ping_state {
+ struct wbint_Ping orig;
+ struct wbint_Ping tmp;
+ TALLOC_CTX *out_mem_ctx;
+ NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_Ping_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_Ping_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ uint32_t _in_data /* [in] */,
+ uint32_t *_out_data /* [out] [ref] */)
+{
+ struct tevent_req *req;
+ struct rpccli_wbint_Ping_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct rpccli_wbint_Ping_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->out_mem_ctx = NULL;
+ state->dispatch_recv = cli->dispatch_recv;
+
+ /* In parameters */
+ state->orig.in.in_data = _in_data;
+
+ /* Out parameters */
+ state->orig.out.out_data = _out_data;
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_Ping, &state->orig);
+ }
+
+ state->out_mem_ctx = talloc_named_const(state, 0,
+ "rpccli_wbint_Ping_out_memory");
+ if (tevent_req_nomem(state->out_mem_ctx, req)) {
+ return tevent_req_post(req, ev);
+ }
+
+ /* make a temporary copy, that we pass to the dispatch function */
+ state->tmp = state->orig;
+
+ subreq = cli->dispatch_send(state, ev, cli,
+ &ndr_table_wbint,
+ NDR_WBINT_PING,
+ &state->tmp);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, rpccli_wbint_Ping_done, req);
+ return req;
+}
+
+static void rpccli_wbint_Ping_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpccli_wbint_Ping_state *state = tevent_req_data(
+ req, struct rpccli_wbint_Ping_state);
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx;
+
+ if (state->out_mem_ctx) {
+ mem_ctx = state->out_mem_ctx;
+ } else {
+ mem_ctx = state;
+ }
+
+ status = state->dispatch_recv(subreq, mem_ctx);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return;
+ }
+
+ /* Copy out parameters */
+ *state->orig.out.out_data = *state->tmp.out.out_data;
+
+ /* Reset temporary structure */
+ ZERO_STRUCT(state->tmp);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_Ping, &state->orig);
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_Ping_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx)
+{
+ struct rpccli_wbint_Ping_state *state = tevent_req_data(
+ req, struct rpccli_wbint_Ping_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ /* Steal possbile out parameters to the callers context */
+ talloc_steal(mem_ctx, state->out_mem_ctx);
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
+NTSTATUS rpccli_wbint_Ping(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ uint32_t in_data /* [in] */,
+ uint32_t *out_data /* [out] [ref] */)
+{
+ struct wbint_Ping r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.in_data = in_data;
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_Ping, &r);
+ }
+
+ status = cli->dispatch(cli,
+ mem_ctx,
+ &ndr_table_wbint,
+ NDR_WBINT_PING,
+ &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_Ping, &r);
+ }
+
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+
+ /* Return variables */
+ *out_data = *r.out.out_data;
+
+ /* Return result */
+ return NT_STATUS_OK;
+}
+
diff --git a/source3/librpc/gen_ndr/cli_wbint.h b/source3/librpc/gen_ndr/cli_wbint.h
new file mode 100644
index 0000000000..25b13f2b64
--- /dev/null
+++ b/source3/librpc/gen_ndr/cli_wbint.h
@@ -0,0 +1,15 @@
+#include "librpc/gen_ndr/ndr_wbint.h"
+#ifndef __CLI_WBINT__
+#define __CLI_WBINT__
+struct tevent_req *rpccli_wbint_Ping_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ uint32_t _in_data /* [in] */,
+ uint32_t *_out_data /* [out] [ref] */);
+NTSTATUS rpccli_wbint_Ping_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_wbint_Ping(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ uint32_t in_data /* [in] */,
+ uint32_t *out_data /* [out] [ref] */);
+#endif /* __CLI_WBINT__ */
diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c
new file mode 100644
index 0000000000..fed1ce2f1e
--- /dev/null
+++ b/source3/librpc/gen_ndr/ndr_wbint.c
@@ -0,0 +1,110 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_wbint.h"
+
+static enum ndr_err_code ndr_push_wbint_Ping(struct ndr_push *ndr, int flags, const struct wbint_Ping *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.in_data));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.out_data == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.out_data));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_Ping(struct ndr_pull *ndr, int flags, struct wbint_Ping *r)
+{
+ TALLOC_CTX *_mem_save_out_data_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.in_data));
+ NDR_PULL_ALLOC(ndr, r->out.out_data);
+ ZERO_STRUCTP(r->out.out_data);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.out_data);
+ }
+ _mem_save_out_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.out_data, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.out_data));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_out_data_0, LIBNDR_FLAG_REF_ALLOC);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_wbint_Ping(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Ping *r)
+{
+ ndr_print_struct(ndr, name, "wbint_Ping");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "wbint_Ping");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "in_data", r->in.in_data);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "wbint_Ping");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "out_data", r->out.out_data);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "out_data", *r->out.out_data);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+static const struct ndr_interface_call wbint_calls[] = {
+ {
+ "wbint_Ping",
+ sizeof(struct wbint_Ping),
+ (ndr_push_flags_fn_t) ndr_push_wbint_Ping,
+ (ndr_pull_flags_fn_t) ndr_pull_wbint_Ping,
+ (ndr_print_function_t) ndr_print_wbint_Ping,
+ false,
+ },
+ { NULL, 0, NULL, NULL, NULL, false }
+};
+
+static const char * const wbint_endpoint_strings[] = {
+ "ncalrpc:",
+};
+
+static const struct ndr_interface_string_array wbint_endpoints = {
+ .count = 1,
+ .names = wbint_endpoint_strings
+};
+
+static const char * const wbint_authservice_strings[] = {
+ "host",
+};
+
+static const struct ndr_interface_string_array wbint_authservices = {
+ .count = 1,
+ .names = wbint_authservice_strings
+};
+
+
+const struct ndr_interface_table ndr_table_wbint = {
+ .name = "wbint",
+ .syntax_id = {
+ {0xbf09192c,0xed60,0x4928,{0x9d,0xff},{0xd0,0xd7,0xbc,0xb0,0x3e,0xd8}},
+ NDR_WBINT_VERSION
+ },
+ .helpstring = NDR_WBINT_HELPSTRING,
+ .num_calls = 1,
+ .calls = wbint_calls,
+ .endpoints = &wbint_endpoints,
+ .authservices = &wbint_authservices
+};
+
diff --git a/source3/librpc/gen_ndr/ndr_wbint.h b/source3/librpc/gen_ndr/ndr_wbint.h
new file mode 100644
index 0000000000..6c38087687
--- /dev/null
+++ b/source3/librpc/gen_ndr/ndr_wbint.h
@@ -0,0 +1,18 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/wbint.h"
+
+#ifndef _HEADER_NDR_wbint
+#define _HEADER_NDR_wbint
+
+#define NDR_WBINT_UUID "bf09192c-ed60-4928-9dff-d0d7bcb03ed8"
+#define NDR_WBINT_VERSION 1.0
+#define NDR_WBINT_NAME "wbint"
+#define NDR_WBINT_HELPSTRING "winbind parent-child protocol"
+extern const struct ndr_interface_table ndr_table_wbint;
+#define NDR_WBINT_PING (0x00)
+
+#define NDR_WBINT_CALL_COUNT (1)
+void ndr_print_wbint_Ping(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Ping *r);
+#endif /* _HEADER_NDR_wbint */
diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c
new file mode 100644
index 0000000000..0a3569b874
--- /dev/null
+++ b/source3/librpc/gen_ndr/srv_wbint.c
@@ -0,0 +1,130 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * server auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/srv_wbint.h"
+
+static bool api_wbint_Ping(pipes_struct *p)
+{
+ const struct ndr_interface_call *call;
+ struct ndr_pull *pull;
+ struct ndr_push *push;
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
+ struct wbint_Ping *r;
+
+ call = &ndr_table_wbint.calls[NDR_WBINT_PING];
+
+ r = talloc(talloc_tos(), struct wbint_Ping);
+ if (r == NULL) {
+ return false;
+ }
+
+ if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+ talloc_free(r);
+ return false;
+ }
+
+ pull = ndr_pull_init_blob(&blob, r, NULL);
+ if (pull == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+ ndr_err = call->ndr_pull(pull, NDR_IN, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(r);
+ return false;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_Ping, r);
+ }
+
+ ZERO_STRUCT(r->out);
+ r->out.out_data = talloc_zero(r, uint32_t);
+ if (r->out.out_data == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ _wbint_Ping(p, r);
+
+ if (p->rng_fault_state) {
+ talloc_free(r);
+ /* Return true here, srv_pipe_hnd.c will take care */
+ return true;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_Ping, r);
+ }
+
+ push = ndr_push_init_ctx(r, NULL);
+ if (push == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ ndr_err = call->ndr_push(push, NDR_OUT, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(r);
+ return false;
+ }
+
+ blob = ndr_push_blob(push);
+ if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+ talloc_free(r);
+ return false;
+ }
+
+ talloc_free(r);
+
+ return true;
+}
+
+
+/* Tables */
+static struct api_struct api_wbint_cmds[] =
+{
+ {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
+};
+
+void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
+{
+ *fns = api_wbint_cmds;
+ *n_fns = sizeof(api_wbint_cmds) / sizeof(struct api_struct);
+}
+
+NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
+{
+ if (cli->pipes_struct == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ switch (opnum)
+ {
+ case NDR_WBINT_PING: {
+ struct wbint_Ping *r = (struct wbint_Ping *)_r;
+ ZERO_STRUCT(r->out);
+ r->out.out_data = talloc_zero(mem_ctx, uint32_t);
+ if (r->out.out_data == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ _wbint_Ping(cli->pipes_struct, r);
+ return NT_STATUS_OK;
+ }
+
+ default:
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+}
+
+NTSTATUS rpc_wbint_init(void)
+{
+ return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "wbint", "wbint", &ndr_table_wbint, api_wbint_cmds, sizeof(api_wbint_cmds) / sizeof(struct api_struct));
+}
diff --git a/source3/librpc/gen_ndr/srv_wbint.h b/source3/librpc/gen_ndr/srv_wbint.h
new file mode 100644
index 0000000000..af3d21a43d
--- /dev/null
+++ b/source3/librpc/gen_ndr/srv_wbint.h
@@ -0,0 +1,9 @@
+#include "librpc/gen_ndr/ndr_wbint.h"
+#ifndef __SRV_WBINT__
+#define __SRV_WBINT__
+void _wbint_Ping(pipes_struct *p, struct wbint_Ping *r);
+void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns);
+NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r);
+void _wbint_Ping(pipes_struct *p, struct wbint_Ping *r);
+NTSTATUS rpc_wbint_init(void);
+#endif /* __SRV_WBINT__ */
diff --git a/source3/librpc/gen_ndr/wbint.h b/source3/librpc/gen_ndr/wbint.h
new file mode 100644
index 0000000000..641d960a1b
--- /dev/null
+++ b/source3/librpc/gen_ndr/wbint.h
@@ -0,0 +1,22 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "libcli/util/ntstatus.h"
+
+#ifndef _HEADER_wbint
+#define _HEADER_wbint
+
+
+struct wbint_Ping {
+ struct {
+ uint32_t in_data;
+ } in;
+
+ struct {
+ uint32_t *out_data;/* [ref] */
+ } out;
+
+};
+
+#endif /* _HEADER_wbint */
diff --git a/source3/librpc/idl/wbint.idl b/source3/librpc/idl/wbint.idl
new file mode 100644
index 0000000000..40a4545a3a
--- /dev/null
+++ b/source3/librpc/idl/wbint.idl
@@ -0,0 +1,14 @@
+[
+ uuid("bf09192c-ed60-4928-9dff-d0d7bcb03ed8"),
+ endpoint("ncalrpc:"),
+ pointer_default(unique),
+ version(1.0),
+ helpstring("winbind parent-child protocol")
+]
+interface wbint
+{
+ void wbint_Ping(
+ [in] uint32 in_data,
+ [out] uint32 *out_data
+ );
+} \ No newline at end of file