summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-08-15 11:16:28 +0200
committerVolker Lendecke <vl@samba.org>2009-08-16 10:38:24 +0200
commit1d110e0ef6efa030a65465291f2b8c7874fed1fb (patch)
tree357e535904a6d0aa3a446eae98ed89f3dd0d3bc0 /source3/librpc
parentc6b36ce57391a083162e0918be34f685385df91a (diff)
downloadsamba-1d110e0ef6efa030a65465291f2b8c7874fed1fb.tar.gz
samba-1d110e0ef6efa030a65465291f2b8c7874fed1fb.tar.bz2
samba-1d110e0ef6efa030a65465291f2b8c7874fed1fb.zip
s3:winbind: Add async wb_seqnum
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.c156
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.h10
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.c71
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.h5
-rw-r--r--source3/librpc/gen_ndr/srv_wbint.c93
-rw-r--r--source3/librpc/gen_ndr/srv_wbint.h2
-rw-r--r--source3/librpc/gen_ndr/wbint.h9
-rw-r--r--source3/librpc/idl/wbint.idl4
8 files changed, 348 insertions, 2 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c
index de6b345a0e..07486c2e40 100644
--- a/source3/librpc/gen_ndr/cli_wbint.c
+++ b/source3/librpc/gen_ndr/cli_wbint.c
@@ -1645,3 +1645,159 @@ NTSTATUS rpccli_wbint_LookupUserGroups(struct rpc_pipe_client *cli,
return r.out.result;
}
+struct rpccli_wbint_QuerySequenceNumber_state {
+ struct wbint_QuerySequenceNumber orig;
+ struct wbint_QuerySequenceNumber tmp;
+ TALLOC_CTX *out_mem_ctx;
+ NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_QuerySequenceNumber_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_QuerySequenceNumber_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ uint32_t *_sequence /* [out] [ref] */)
+{
+ struct tevent_req *req;
+ struct rpccli_wbint_QuerySequenceNumber_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct rpccli_wbint_QuerySequenceNumber_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->out_mem_ctx = NULL;
+ state->dispatch_recv = cli->dispatch_recv;
+
+ /* In parameters */
+
+ /* Out parameters */
+ state->orig.out.sequence = _sequence;
+
+ /* Result */
+ ZERO_STRUCT(state->orig.out.result);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_QuerySequenceNumber, &state->orig);
+ }
+
+ state->out_mem_ctx = talloc_named_const(state, 0,
+ "rpccli_wbint_QuerySequenceNumber_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_QUERYSEQUENCENUMBER,
+ &state->tmp);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, rpccli_wbint_QuerySequenceNumber_done, req);
+ return req;
+}
+
+static void rpccli_wbint_QuerySequenceNumber_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpccli_wbint_QuerySequenceNumber_state *state = tevent_req_data(
+ req, struct rpccli_wbint_QuerySequenceNumber_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.sequence = *state->tmp.out.sequence;
+
+ /* Copy result */
+ state->orig.out.result = state->tmp.out.result;
+
+ /* Reset temporary structure */
+ ZERO_STRUCT(state->tmp);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_QuerySequenceNumber, &state->orig);
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_QuerySequenceNumber_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result)
+{
+ struct rpccli_wbint_QuerySequenceNumber_state *state = tevent_req_data(
+ req, struct rpccli_wbint_QuerySequenceNumber_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);
+
+ /* Return result */
+ *result = state->orig.out.result;
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
+NTSTATUS rpccli_wbint_QuerySequenceNumber(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ uint32_t *sequence /* [out] [ref] */)
+{
+ struct wbint_QuerySequenceNumber r;
+ NTSTATUS status;
+
+ /* In parameters */
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_QuerySequenceNumber, &r);
+ }
+
+ status = cli->dispatch(cli,
+ mem_ctx,
+ &ndr_table_wbint,
+ NDR_WBINT_QUERYSEQUENCENUMBER,
+ &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_QuerySequenceNumber, &r);
+ }
+
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+
+ /* Return variables */
+ *sequence = *r.out.sequence;
+
+ /* Return result */
+ return r.out.result;
+}
diff --git a/source3/librpc/gen_ndr/cli_wbint.h b/source3/librpc/gen_ndr/cli_wbint.h
index e9927c1c35..ded93309ae 100644
--- a/source3/librpc/gen_ndr/cli_wbint.h
+++ b/source3/librpc/gen_ndr/cli_wbint.h
@@ -138,4 +138,14 @@ NTSTATUS rpccli_wbint_LookupUserGroups(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct dom_sid *sid /* [in] [ref] */,
struct wbint_SidArray *sids /* [out] [ref] */);
+struct tevent_req *rpccli_wbint_QuerySequenceNumber_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ uint32_t *_sequence /* [out] [ref] */);
+NTSTATUS rpccli_wbint_QuerySequenceNumber_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result);
+NTSTATUS rpccli_wbint_QuerySequenceNumber(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ uint32_t *sequence /* [out] [ref] */);
#endif /* __CLI_WBINT__ */
diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c
index 5a8c1c33d7..295b72f1cf 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.c
+++ b/source3/librpc/gen_ndr/ndr_wbint.c
@@ -1287,6 +1287,67 @@ _PUBLIC_ void ndr_print_wbint_LookupUserGroups(struct ndr_print *ndr, const char
ndr->depth--;
}
+static enum ndr_err_code ndr_push_wbint_QuerySequenceNumber(struct ndr_push *ndr, int flags, const struct wbint_QuerySequenceNumber *r)
+{
+ if (flags & NDR_IN) {
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.sequence == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.sequence));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_QuerySequenceNumber(struct ndr_pull *ndr, int flags, struct wbint_QuerySequenceNumber *r)
+{
+ TALLOC_CTX *_mem_save_sequence_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_PULL_ALLOC(ndr, r->out.sequence);
+ ZERO_STRUCTP(r->out.sequence);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.sequence);
+ }
+ _mem_save_sequence_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.sequence, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.sequence));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sequence_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_wbint_QuerySequenceNumber(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QuerySequenceNumber *r)
+{
+ ndr_print_struct(ndr, name, "wbint_QuerySequenceNumber");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "wbint_QuerySequenceNumber");
+ ndr->depth++;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "wbint_QuerySequenceNumber");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sequence", r->out.sequence);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "sequence", *r->out.sequence);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
static const struct ndr_interface_call wbint_calls[] = {
{
"wbint_Ping",
@@ -1368,6 +1429,14 @@ static const struct ndr_interface_call wbint_calls[] = {
(ndr_print_function_t) ndr_print_wbint_LookupUserGroups,
false,
},
+ {
+ "wbint_QuerySequenceNumber",
+ sizeof(struct wbint_QuerySequenceNumber),
+ (ndr_push_flags_fn_t) ndr_push_wbint_QuerySequenceNumber,
+ (ndr_pull_flags_fn_t) ndr_pull_wbint_QuerySequenceNumber,
+ (ndr_print_function_t) ndr_print_wbint_QuerySequenceNumber,
+ false,
+ },
{ NULL, 0, NULL, NULL, NULL, false }
};
@@ -1397,7 +1466,7 @@ const struct ndr_interface_table ndr_table_wbint = {
NDR_WBINT_VERSION
},
.helpstring = NDR_WBINT_HELPSTRING,
- .num_calls = 10,
+ .num_calls = 11,
.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
index 6fd6b1d74d..4acdc404ec 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.h
+++ b/source3/librpc/gen_ndr/ndr_wbint.h
@@ -31,7 +31,9 @@ extern const struct ndr_interface_table ndr_table_wbint;
#define NDR_WBINT_LOOKUPUSERGROUPS (0x09)
-#define NDR_WBINT_CALL_COUNT (10)
+#define NDR_WBINT_QUERYSEQUENCENUMBER (0x0a)
+
+#define NDR_WBINT_CALL_COUNT (11)
enum ndr_err_code ndr_push_wbint_userinfo(struct ndr_push *ndr, int ndr_flags, const struct wbint_userinfo *r);
enum ndr_err_code ndr_pull_wbint_userinfo(struct ndr_pull *ndr, int ndr_flags, struct wbint_userinfo *r);
void ndr_print_wbint_userinfo(struct ndr_print *ndr, const char *name, const struct wbint_userinfo *r);
@@ -51,4 +53,5 @@ void ndr_print_wbint_Gid2Sid(struct ndr_print *ndr, const char *name, int flags,
void ndr_print_wbint_QueryUser(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QueryUser *r);
void ndr_print_wbint_LookupUserAliases(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupUserAliases *r);
void ndr_print_wbint_LookupUserGroups(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupUserGroups *r);
+void ndr_print_wbint_QuerySequenceNumber(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QuerySequenceNumber *r);
#endif /* _HEADER_NDR_wbint */
diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c
index 95c0619058..1c2799c165 100644
--- a/source3/librpc/gen_ndr/srv_wbint.c
+++ b/source3/librpc/gen_ndr/srv_wbint.c
@@ -824,6 +824,86 @@ static bool api_wbint_LookupUserGroups(pipes_struct *p)
return true;
}
+static bool api_wbint_QuerySequenceNumber(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_QuerySequenceNumber *r;
+
+ call = &ndr_table_wbint.calls[NDR_WBINT_QUERYSEQUENCENUMBER];
+
+ r = talloc(talloc_tos(), struct wbint_QuerySequenceNumber);
+ 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_QuerySequenceNumber, r);
+ }
+
+ ZERO_STRUCT(r->out);
+ r->out.sequence = talloc_zero(r, uint32_t);
+ if (r->out.sequence == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ r->out.result = _wbint_QuerySequenceNumber(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_QuerySequenceNumber, 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[] =
@@ -838,6 +918,7 @@ static struct api_struct api_wbint_cmds[] =
{"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser},
{"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases},
{"WBINT_LOOKUPUSERGROUPS", NDR_WBINT_LOOKUPUSERGROUPS, api_wbint_LookupUserGroups},
+ {"WBINT_QUERYSEQUENCENUMBER", NDR_WBINT_QUERYSEQUENCENUMBER, api_wbint_QuerySequenceNumber},
};
void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
@@ -989,6 +1070,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
return NT_STATUS_OK;
}
+ case NDR_WBINT_QUERYSEQUENCENUMBER: {
+ struct wbint_QuerySequenceNumber *r = (struct wbint_QuerySequenceNumber *)_r;
+ ZERO_STRUCT(r->out);
+ r->out.sequence = talloc_zero(mem_ctx, uint32_t);
+ if (r->out.sequence == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ r->out.result = _wbint_QuerySequenceNumber(cli->pipes_struct, r);
+ return NT_STATUS_OK;
+ }
+
default:
return NT_STATUS_NOT_IMPLEMENTED;
}
diff --git a/source3/librpc/gen_ndr/srv_wbint.h b/source3/librpc/gen_ndr/srv_wbint.h
index 20ca316375..5749b1e9ae 100644
--- a/source3/librpc/gen_ndr/srv_wbint.h
+++ b/source3/librpc/gen_ndr/srv_wbint.h
@@ -11,6 +11,7 @@ NTSTATUS _wbint_Gid2Sid(pipes_struct *p, struct wbint_Gid2Sid *r);
NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r);
NTSTATUS _wbint_LookupUserAliases(pipes_struct *p, struct wbint_LookupUserAliases *r);
NTSTATUS _wbint_LookupUserGroups(pipes_struct *p, struct wbint_LookupUserGroups *r);
+NTSTATUS _wbint_QuerySequenceNumber(pipes_struct *p, struct wbint_QuerySequenceNumber *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);
@@ -23,5 +24,6 @@ NTSTATUS _wbint_Gid2Sid(pipes_struct *p, struct wbint_Gid2Sid *r);
NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r);
NTSTATUS _wbint_LookupUserAliases(pipes_struct *p, struct wbint_LookupUserAliases *r);
NTSTATUS _wbint_LookupUserGroups(pipes_struct *p, struct wbint_LookupUserGroups *r);
+NTSTATUS _wbint_QuerySequenceNumber(pipes_struct *p, struct wbint_QuerySequenceNumber *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
index 28382ec346..c5caa79a4b 100644
--- a/source3/librpc/gen_ndr/wbint.h
+++ b/source3/librpc/gen_ndr/wbint.h
@@ -166,4 +166,13 @@ struct wbint_LookupUserGroups {
};
+
+struct wbint_QuerySequenceNumber {
+ struct {
+ uint32_t *sequence;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
#endif /* _HEADER_wbint */
diff --git a/source3/librpc/idl/wbint.idl b/source3/librpc/idl/wbint.idl
index f994126711..a4aab7c1ac 100644
--- a/source3/librpc/idl/wbint.idl
+++ b/source3/librpc/idl/wbint.idl
@@ -88,4 +88,8 @@ interface wbint
[in] dom_sid *sid,
[out] wbint_SidArray *sids
);
+
+ NTSTATUS wbint_QuerySequenceNumber(
+ [out] uint32 *sequence
+ );
} \ No newline at end of file