summaryrefslogtreecommitdiff
path: root/source3/librpc/gen_ndr
diff options
context:
space:
mode:
Diffstat (limited to 'source3/librpc/gen_ndr')
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.c165
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.h14
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.c120
-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.h14
7 files changed, 411 insertions, 2 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c
index 7502d5f5e4..e0b31705c1 100644
--- a/source3/librpc/gen_ndr/cli_wbint.c
+++ b/source3/librpc/gen_ndr/cli_wbint.c
@@ -502,3 +502,168 @@ NTSTATUS rpccli_wbint_LookupName(struct rpc_pipe_client *cli,
return r.out.result;
}
+struct rpccli_wbint_Sid2Uid_state {
+ struct wbint_Sid2Uid orig;
+ struct wbint_Sid2Uid tmp;
+ TALLOC_CTX *out_mem_ctx;
+ NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_Sid2Uid_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_Sid2Uid_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ const char *_dom_name /* [in] [unique,charset(UTF8)] */,
+ struct dom_sid *_sid /* [in] [ref] */,
+ uint64_t *_uid /* [out] [ref] */)
+{
+ struct tevent_req *req;
+ struct rpccli_wbint_Sid2Uid_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct rpccli_wbint_Sid2Uid_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->out_mem_ctx = NULL;
+ state->dispatch_recv = cli->dispatch_recv;
+
+ /* In parameters */
+ state->orig.in.dom_name = _dom_name;
+ state->orig.in.sid = _sid;
+
+ /* Out parameters */
+ state->orig.out.uid = _uid;
+
+ /* Result */
+ ZERO_STRUCT(state->orig.out.result);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, &state->orig);
+ }
+
+ state->out_mem_ctx = talloc_named_const(state, 0,
+ "rpccli_wbint_Sid2Uid_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_SID2UID,
+ &state->tmp);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, rpccli_wbint_Sid2Uid_done, req);
+ return req;
+}
+
+static void rpccli_wbint_Sid2Uid_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpccli_wbint_Sid2Uid_state *state = tevent_req_data(
+ req, struct rpccli_wbint_Sid2Uid_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.uid = *state->tmp.out.uid;
+
+ /* 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_Sid2Uid, &state->orig);
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_Sid2Uid_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result)
+{
+ struct rpccli_wbint_Sid2Uid_state *state = tevent_req_data(
+ req, struct rpccli_wbint_Sid2Uid_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_Sid2Uid(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *dom_name /* [in] [unique,charset(UTF8)] */,
+ struct dom_sid *sid /* [in] [ref] */,
+ uint64_t *uid /* [out] [ref] */)
+{
+ struct wbint_Sid2Uid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.dom_name = dom_name;
+ r.in.sid = sid;
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_Sid2Uid, &r);
+ }
+
+ status = cli->dispatch(cli,
+ mem_ctx,
+ &ndr_table_wbint,
+ NDR_WBINT_SID2UID,
+ &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_Sid2Uid, &r);
+ }
+
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+
+ /* Return variables */
+ *uid = *r.out.uid;
+
+ /* 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 e2cb963970..eb533012dc 100644
--- a/source3/librpc/gen_ndr/cli_wbint.h
+++ b/source3/librpc/gen_ndr/cli_wbint.h
@@ -46,4 +46,18 @@ NTSTATUS rpccli_wbint_LookupName(struct rpc_pipe_client *cli,
uint32_t flags /* [in] */,
enum lsa_SidType *type /* [out] [ref] */,
struct dom_sid *sid /* [out] [ref] */);
+struct tevent_req *rpccli_wbint_Sid2Uid_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ const char *_dom_name /* [in] [unique,charset(UTF8)] */,
+ struct dom_sid *_sid /* [in] [ref] */,
+ uint64_t *_uid /* [out] [ref] */);
+NTSTATUS rpccli_wbint_Sid2Uid_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result);
+NTSTATUS rpccli_wbint_Sid2Uid(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *dom_name /* [in] [unique,charset(UTF8)] */,
+ struct dom_sid *sid /* [in] [ref] */,
+ uint64_t *uid /* [out] [ref] */);
#endif /* __CLI_WBINT__ */
diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c
index 40554c0fd1..0773ed0e10 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.c
+++ b/source3/librpc/gen_ndr/ndr_wbint.c
@@ -356,6 +356,116 @@ _PUBLIC_ void ndr_print_wbint_LookupName(struct ndr_print *ndr, const char *name
ndr->depth--;
}
+static enum ndr_err_code ndr_push_wbint_Sid2Uid(struct ndr_push *ndr, int flags, const struct wbint_Sid2Uid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.dom_name));
+ if (r->in.dom_name) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dom_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dom_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.dom_name, ndr_charset_length(r->in.dom_name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->in.sid == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->in.sid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.uid == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.uid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_Sid2Uid(struct ndr_pull *ndr, int flags, struct wbint_Sid2Uid *r)
+{
+ uint32_t _ptr_dom_name;
+ TALLOC_CTX *_mem_save_dom_name_0;
+ TALLOC_CTX *_mem_save_sid_0;
+ TALLOC_CTX *_mem_save_uid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dom_name));
+ if (_ptr_dom_name) {
+ NDR_PULL_ALLOC(ndr, r->in.dom_name);
+ } else {
+ r->in.dom_name = NULL;
+ }
+ if (r->in.dom_name) {
+ _mem_save_dom_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.dom_name, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.dom_name));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->in.dom_name));
+ if (ndr_get_array_length(ndr, &r->in.dom_name) > ndr_get_array_size(ndr, &r->in.dom_name)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.dom_name), ndr_get_array_length(ndr, &r->in.dom_name));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.dom_name), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.dom_name, ndr_get_array_length(ndr, &r->in.dom_name), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dom_name_0, 0);
+ }
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.sid);
+ }
+ _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->in.sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ ZERO_STRUCTP(r->out.uid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ }
+ _mem_save_uid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.uid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.uid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uid_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_Sid2Uid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Sid2Uid *r)
+{
+ ndr_print_struct(ndr, name, "wbint_Sid2Uid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "wbint_Sid2Uid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "dom_name", r->in.dom_name);
+ ndr->depth++;
+ if (r->in.dom_name) {
+ ndr_print_string(ndr, "dom_name", r->in.dom_name);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "sid", r->in.sid);
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", r->in.sid);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "wbint_Sid2Uid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "uid", r->out.uid);
+ ndr->depth++;
+ ndr_print_hyper(ndr, "uid", *r->out.uid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
static const struct ndr_interface_call wbint_calls[] = {
{
"wbint_Ping",
@@ -381,6 +491,14 @@ static const struct ndr_interface_call wbint_calls[] = {
(ndr_print_function_t) ndr_print_wbint_LookupName,
false,
},
+ {
+ "wbint_Sid2Uid",
+ sizeof(struct wbint_Sid2Uid),
+ (ndr_push_flags_fn_t) ndr_push_wbint_Sid2Uid,
+ (ndr_pull_flags_fn_t) ndr_pull_wbint_Sid2Uid,
+ (ndr_print_function_t) ndr_print_wbint_Sid2Uid,
+ false,
+ },
{ NULL, 0, NULL, NULL, NULL, false }
};
@@ -410,7 +528,7 @@ const struct ndr_interface_table ndr_table_wbint = {
NDR_WBINT_VERSION
},
.helpstring = NDR_WBINT_HELPSTRING,
- .num_calls = 3,
+ .num_calls = 4,
.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 c2d7ad3f3a..0570df6cd1 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.h
+++ b/source3/librpc/gen_ndr/ndr_wbint.h
@@ -17,8 +17,11 @@ extern const struct ndr_interface_table ndr_table_wbint;
#define NDR_WBINT_LOOKUPNAME (0x02)
-#define NDR_WBINT_CALL_COUNT (3)
+#define NDR_WBINT_SID2UID (0x03)
+
+#define NDR_WBINT_CALL_COUNT (4)
void ndr_print_wbint_Ping(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Ping *r);
void ndr_print_wbint_LookupSid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupSid *r);
void ndr_print_wbint_LookupName(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupName *r);
+void ndr_print_wbint_Sid2Uid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Sid2Uid *r);
#endif /* _HEADER_NDR_wbint */
diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c
index 25e3246004..2fd6c17c28 100644
--- a/source3/librpc/gen_ndr/srv_wbint.c
+++ b/source3/librpc/gen_ndr/srv_wbint.c
@@ -264,6 +264,86 @@ static bool api_wbint_LookupName(pipes_struct *p)
return true;
}
+static bool api_wbint_Sid2Uid(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_Sid2Uid *r;
+
+ call = &ndr_table_wbint.calls[NDR_WBINT_SID2UID];
+
+ r = talloc(talloc_tos(), struct wbint_Sid2Uid);
+ 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_Sid2Uid, r);
+ }
+
+ ZERO_STRUCT(r->out);
+ r->out.uid = talloc_zero(r, uint64_t);
+ if (r->out.uid == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ r->out.result = _wbint_Sid2Uid(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_Sid2Uid, 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[] =
@@ -271,6 +351,7 @@ static struct api_struct api_wbint_cmds[] =
{"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping},
{"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid},
{"WBINT_LOOKUPNAME", NDR_WBINT_LOOKUPNAME, api_wbint_LookupName},
+ {"WBINT_SID2UID", NDR_WBINT_SID2UID, api_wbint_Sid2Uid},
};
void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
@@ -338,6 +419,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
return NT_STATUS_OK;
}
+ case NDR_WBINT_SID2UID: {
+ struct wbint_Sid2Uid *r = (struct wbint_Sid2Uid *)_r;
+ ZERO_STRUCT(r->out);
+ r->out.uid = talloc_zero(mem_ctx, uint64_t);
+ if (r->out.uid == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ r->out.result = _wbint_Sid2Uid(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 259eef7c4f..21c59b85bb 100644
--- a/source3/librpc/gen_ndr/srv_wbint.h
+++ b/source3/librpc/gen_ndr/srv_wbint.h
@@ -4,10 +4,12 @@
void _wbint_Ping(pipes_struct *p, struct wbint_Ping *r);
NTSTATUS _wbint_LookupSid(pipes_struct *p, struct wbint_LookupSid *r);
NTSTATUS _wbint_LookupName(pipes_struct *p, struct wbint_LookupName *r);
+NTSTATUS _wbint_Sid2Uid(pipes_struct *p, struct wbint_Sid2Uid *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 _wbint_LookupSid(pipes_struct *p, struct wbint_LookupSid *r);
NTSTATUS _wbint_LookupName(pipes_struct *p, struct wbint_LookupName *r);
+NTSTATUS _wbint_Sid2Uid(pipes_struct *p, struct wbint_Sid2Uid *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 a007b95b18..f4dc8cfcb1 100644
--- a/source3/librpc/gen_ndr/wbint.h
+++ b/source3/librpc/gen_ndr/wbint.h
@@ -51,4 +51,18 @@ struct wbint_LookupName {
};
+
+struct wbint_Sid2Uid {
+ struct {
+ const char *dom_name;/* [unique,charset(UTF8)] */
+ struct dom_sid *sid;/* [ref] */
+ } in;
+
+ struct {
+ uint64_t *uid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
#endif /* _HEADER_wbint */