summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-08-04 15:23:13 -0400
committerVolker Lendecke <vl@samba.org>2009-08-05 03:21:22 -0400
commit7077492778dbda30e5f865ae1d0ab0237e00f54f (patch)
treea51af896169011db394654f703665673860442e7 /source3/librpc
parent360227a0feb443fbbcc420295d5666da5823685a (diff)
downloadsamba-7077492778dbda30e5f865ae1d0ab0237e00f54f.tar.gz
samba-7077492778dbda30e5f865ae1d0ab0237e00f54f.tar.bz2
samba-7077492778dbda30e5f865ae1d0ab0237e00f54f.zip
s3:winbind: Add async wb_queryuser
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.c161
-rw-r--r--source3/librpc/gen_ndr/cli_wbint.h12
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.c255
-rw-r--r--source3/librpc/gen_ndr/ndr_wbint.h8
-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.h23
-rw-r--r--source3/librpc/idl/wbint.idl15
8 files changed, 567 insertions, 2 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c
index 4176e94a3f..9fdca8ecba 100644
--- a/source3/librpc/gen_ndr/cli_wbint.c
+++ b/source3/librpc/gen_ndr/cli_wbint.c
@@ -1162,3 +1162,164 @@ NTSTATUS rpccli_wbint_Gid2Sid(struct rpc_pipe_client *cli,
return r.out.result;
}
+struct rpccli_wbint_QueryUser_state {
+ struct wbint_QueryUser orig;
+ struct wbint_QueryUser tmp;
+ TALLOC_CTX *out_mem_ctx;
+ NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_QueryUser_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_QueryUser_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ struct dom_sid *_sid /* [in] [ref] */,
+ struct wbint_userinfo *_info /* [out] [ref] */)
+{
+ struct tevent_req *req;
+ struct rpccli_wbint_QueryUser_state *state;
+ struct tevent_req *subreq;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct rpccli_wbint_QueryUser_state);
+ if (req == NULL) {
+ return NULL;
+ }
+ state->out_mem_ctx = NULL;
+ state->dispatch_recv = cli->dispatch_recv;
+
+ /* In parameters */
+ state->orig.in.sid = _sid;
+
+ /* Out parameters */
+ state->orig.out.info = _info;
+
+ /* Result */
+ ZERO_STRUCT(state->orig.out.result);
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_QueryUser, &state->orig);
+ }
+
+ state->out_mem_ctx = talloc_named_const(state, 0,
+ "rpccli_wbint_QueryUser_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_QUERYUSER,
+ &state->tmp);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, rpccli_wbint_QueryUser_done, req);
+ return req;
+}
+
+static void rpccli_wbint_QueryUser_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpccli_wbint_QueryUser_state *state = tevent_req_data(
+ req, struct rpccli_wbint_QueryUser_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.info = *state->tmp.out.info;
+
+ /* 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_QueryUser, &state->orig);
+ }
+
+ tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_QueryUser_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result)
+{
+ struct rpccli_wbint_QueryUser_state *state = tevent_req_data(
+ req, struct rpccli_wbint_QueryUser_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_QueryUser(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct dom_sid *sid /* [in] [ref] */,
+ struct wbint_userinfo *info /* [out] [ref] */)
+{
+ struct wbint_QueryUser r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.sid = sid;
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_IN_DEBUG(wbint_QueryUser, &r);
+ }
+
+ status = cli->dispatch(cli,
+ mem_ctx,
+ &ndr_table_wbint,
+ NDR_WBINT_QUERYUSER,
+ &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (DEBUGLEVEL >= 10) {
+ NDR_PRINT_OUT_DEBUG(wbint_QueryUser, &r);
+ }
+
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
+ }
+
+ /* Return variables */
+ *info = *r.out.info;
+
+ /* 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 55fe22bd8f..ebceddea5f 100644
--- a/source3/librpc/gen_ndr/cli_wbint.h
+++ b/source3/librpc/gen_ndr/cli_wbint.h
@@ -102,4 +102,16 @@ NTSTATUS rpccli_wbint_Gid2Sid(struct rpc_pipe_client *cli,
const char *dom_name /* [in] [unique,charset(UTF8)] */,
uint64_t gid /* [in] */,
struct dom_sid *sid /* [out] [ref] */);
+struct tevent_req *rpccli_wbint_QueryUser_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct rpc_pipe_client *cli,
+ struct dom_sid *_sid /* [in] [ref] */,
+ struct wbint_userinfo *_info /* [out] [ref] */);
+NTSTATUS rpccli_wbint_QueryUser_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS *result);
+NTSTATUS rpccli_wbint_QueryUser(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct dom_sid *sid /* [in] [ref] */,
+ struct wbint_userinfo *info /* [out] [ref] */);
#endif /* __CLI_WBINT__ */
diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c
index f6e53eef96..2b773f3f45 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.c
+++ b/source3/librpc/gen_ndr/ndr_wbint.c
@@ -4,6 +4,174 @@
#include "librpc/gen_ndr/ndr_wbint.h"
#include "librpc/gen_ndr/ndr_lsa.h"
+_PUBLIC_ enum ndr_err_code ndr_push_wbint_userinfo(struct ndr_push *ndr, int ndr_flags, const struct wbint_userinfo *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->acct_name));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->full_name));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->homedir));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->shell));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->primary_gid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->user_sid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->group_sid));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->acct_name) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->acct_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->acct_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->acct_name, ndr_charset_length(r->acct_name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->full_name) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->full_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->full_name, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->full_name, ndr_charset_length(r->full_name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->homedir) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->homedir, ndr_charset_length(r->homedir, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->shell) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->shell, ndr_charset_length(r->shell, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_wbint_userinfo(struct ndr_pull *ndr, int ndr_flags, struct wbint_userinfo *r)
+{
+ uint32_t _ptr_acct_name;
+ TALLOC_CTX *_mem_save_acct_name_0;
+ uint32_t _ptr_full_name;
+ TALLOC_CTX *_mem_save_full_name_0;
+ uint32_t _ptr_homedir;
+ TALLOC_CTX *_mem_save_homedir_0;
+ uint32_t _ptr_shell;
+ TALLOC_CTX *_mem_save_shell_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_name));
+ if (_ptr_acct_name) {
+ NDR_PULL_ALLOC(ndr, r->acct_name);
+ } else {
+ r->acct_name = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_full_name));
+ if (_ptr_full_name) {
+ NDR_PULL_ALLOC(ndr, r->full_name);
+ } else {
+ r->full_name = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_homedir));
+ if (_ptr_homedir) {
+ NDR_PULL_ALLOC(ndr, r->homedir);
+ } else {
+ r->homedir = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_shell));
+ if (_ptr_shell) {
+ NDR_PULL_ALLOC(ndr, r->shell);
+ } else {
+ r->shell = NULL;
+ }
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->primary_gid));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->user_sid));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->group_sid));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->acct_name) {
+ _mem_save_acct_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->acct_name, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->acct_name));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->acct_name));
+ if (ndr_get_array_length(ndr, &r->acct_name) > ndr_get_array_size(ndr, &r->acct_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->acct_name), ndr_get_array_length(ndr, &r->acct_name));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->acct_name), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->acct_name, ndr_get_array_length(ndr, &r->acct_name), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_name_0, 0);
+ }
+ if (r->full_name) {
+ _mem_save_full_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->full_name, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->full_name));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->full_name));
+ if (ndr_get_array_length(ndr, &r->full_name) > ndr_get_array_size(ndr, &r->full_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->full_name), ndr_get_array_length(ndr, &r->full_name));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->full_name), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->full_name, ndr_get_array_length(ndr, &r->full_name), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_full_name_0, 0);
+ }
+ if (r->homedir) {
+ _mem_save_homedir_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->homedir, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->homedir));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->homedir));
+ if (ndr_get_array_length(ndr, &r->homedir) > ndr_get_array_size(ndr, &r->homedir)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->homedir), ndr_get_array_length(ndr, &r->homedir));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->homedir, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_homedir_0, 0);
+ }
+ if (r->shell) {
+ _mem_save_shell_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->shell, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->shell));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->shell));
+ if (ndr_get_array_length(ndr, &r->shell) > ndr_get_array_size(ndr, &r->shell)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->shell), ndr_get_array_length(ndr, &r->shell));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->shell, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_shell_0, 0);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_wbint_userinfo(struct ndr_print *ndr, const char *name, const struct wbint_userinfo *r)
+{
+ ndr_print_struct(ndr, name, "wbint_userinfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "acct_name", r->acct_name);
+ ndr->depth++;
+ if (r->acct_name) {
+ ndr_print_string(ndr, "acct_name", r->acct_name);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "full_name", r->full_name);
+ ndr->depth++;
+ if (r->full_name) {
+ ndr_print_string(ndr, "full_name", r->full_name);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "homedir", r->homedir);
+ ndr->depth++;
+ if (r->homedir) {
+ ndr_print_string(ndr, "homedir", r->homedir);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "shell", r->shell);
+ ndr->depth++;
+ if (r->shell) {
+ ndr_print_string(ndr, "shell", r->shell);
+ }
+ ndr->depth--;
+ ndr_print_hyper(ndr, "primary_gid", r->primary_gid);
+ ndr_print_dom_sid(ndr, "user_sid", &r->user_sid);
+ ndr_print_dom_sid(ndr, "group_sid", &r->group_sid);
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_wbint_Ping(struct ndr_push *ndr, int flags, const struct wbint_Ping *r)
{
if (flags & NDR_IN) {
@@ -770,6 +938,83 @@ _PUBLIC_ void ndr_print_wbint_Gid2Sid(struct ndr_print *ndr, const char *name, i
ndr->depth--;
}
+static enum ndr_err_code ndr_push_wbint_QueryUser(struct ndr_push *ndr, int flags, const struct wbint_QueryUser *r)
+{
+ if (flags & NDR_IN) {
+ 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.info == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_wbint_userinfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_QueryUser(struct ndr_pull *ndr, int flags, struct wbint_QueryUser *r)
+{
+ TALLOC_CTX *_mem_save_sid_0;
+ TALLOC_CTX *_mem_save_info_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ 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.info);
+ ZERO_STRUCTP(r->out.info);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.info);
+ }
+ _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_wbint_userinfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_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_QueryUser(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QueryUser *r)
+{
+ ndr_print_struct(ndr, name, "wbint_QueryUser");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "wbint_QueryUser");
+ 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_QueryUser");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "info", r->out.info);
+ ndr->depth++;
+ ndr_print_wbint_userinfo(ndr, "info", r->out.info);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
static const struct ndr_interface_call wbint_calls[] = {
{
"wbint_Ping",
@@ -827,6 +1072,14 @@ static const struct ndr_interface_call wbint_calls[] = {
(ndr_print_function_t) ndr_print_wbint_Gid2Sid,
false,
},
+ {
+ "wbint_QueryUser",
+ sizeof(struct wbint_QueryUser),
+ (ndr_push_flags_fn_t) ndr_push_wbint_QueryUser,
+ (ndr_pull_flags_fn_t) ndr_pull_wbint_QueryUser,
+ (ndr_print_function_t) ndr_print_wbint_QueryUser,
+ false,
+ },
{ NULL, 0, NULL, NULL, NULL, false }
};
@@ -856,7 +1109,7 @@ const struct ndr_interface_table ndr_table_wbint = {
NDR_WBINT_VERSION
},
.helpstring = NDR_WBINT_HELPSTRING,
- .num_calls = 7,
+ .num_calls = 8,
.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 d8843a3c0c..5db488e69c 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.h
+++ b/source3/librpc/gen_ndr/ndr_wbint.h
@@ -25,7 +25,12 @@ extern const struct ndr_interface_table ndr_table_wbint;
#define NDR_WBINT_GID2SID (0x06)
-#define NDR_WBINT_CALL_COUNT (7)
+#define NDR_WBINT_QUERYUSER (0x07)
+
+#define NDR_WBINT_CALL_COUNT (8)
+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);
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);
@@ -33,4 +38,5 @@ void ndr_print_wbint_Sid2Uid(struct ndr_print *ndr, const char *name, int flags,
void ndr_print_wbint_Sid2Gid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Sid2Gid *r);
void ndr_print_wbint_Uid2Sid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Uid2Sid *r);
void ndr_print_wbint_Gid2Sid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Gid2Sid *r);
+void ndr_print_wbint_QueryUser(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QueryUser *r);
#endif /* _HEADER_NDR_wbint */
diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c
index a04aa8245f..121d3fa79d 100644
--- a/source3/librpc/gen_ndr/srv_wbint.c
+++ b/source3/librpc/gen_ndr/srv_wbint.c
@@ -584,6 +584,86 @@ static bool api_wbint_Gid2Sid(pipes_struct *p)
return true;
}
+static bool api_wbint_QueryUser(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_QueryUser *r;
+
+ call = &ndr_table_wbint.calls[NDR_WBINT_QUERYUSER];
+
+ r = talloc(talloc_tos(), struct wbint_QueryUser);
+ 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_QueryUser, r);
+ }
+
+ ZERO_STRUCT(r->out);
+ r->out.info = talloc_zero(r, struct wbint_userinfo);
+ if (r->out.info == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ r->out.result = _wbint_QueryUser(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_QueryUser, 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[] =
@@ -595,6 +675,7 @@ static struct api_struct api_wbint_cmds[] =
{"WBINT_SID2GID", NDR_WBINT_SID2GID, api_wbint_Sid2Gid},
{"WBINT_UID2SID", NDR_WBINT_UID2SID, api_wbint_Uid2Sid},
{"WBINT_GID2SID", NDR_WBINT_GID2SID, api_wbint_Gid2Sid},
+ {"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser},
};
void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns)
@@ -710,6 +791,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
return NT_STATUS_OK;
}
+ case NDR_WBINT_QUERYUSER: {
+ struct wbint_QueryUser *r = (struct wbint_QueryUser *)_r;
+ ZERO_STRUCT(r->out);
+ r->out.info = talloc_zero(mem_ctx, struct wbint_userinfo);
+ if (r->out.info == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ r->out.result = _wbint_QueryUser(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 9311e6b641..ddefa6acce 100644
--- a/source3/librpc/gen_ndr/srv_wbint.h
+++ b/source3/librpc/gen_ndr/srv_wbint.h
@@ -8,6 +8,7 @@ NTSTATUS _wbint_Sid2Uid(pipes_struct *p, struct wbint_Sid2Uid *r);
NTSTATUS _wbint_Sid2Gid(pipes_struct *p, struct wbint_Sid2Gid *r);
NTSTATUS _wbint_Uid2Sid(pipes_struct *p, struct wbint_Uid2Sid *r);
NTSTATUS _wbint_Gid2Sid(pipes_struct *p, struct wbint_Gid2Sid *r);
+NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *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);
@@ -17,5 +18,6 @@ NTSTATUS _wbint_Sid2Uid(pipes_struct *p, struct wbint_Sid2Uid *r);
NTSTATUS _wbint_Sid2Gid(pipes_struct *p, struct wbint_Sid2Gid *r);
NTSTATUS _wbint_Uid2Sid(pipes_struct *p, struct wbint_Uid2Sid *r);
NTSTATUS _wbint_Gid2Sid(pipes_struct *p, struct wbint_Gid2Sid *r);
+NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *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 d6f344e5c9..eb3dd0cd33 100644
--- a/source3/librpc/gen_ndr/wbint.h
+++ b/source3/librpc/gen_ndr/wbint.h
@@ -8,6 +8,16 @@
#ifndef _HEADER_wbint
#define _HEADER_wbint
+struct wbint_userinfo {
+ const char *acct_name;/* [unique,charset(UTF8)] */
+ const char *full_name;/* [unique,charset(UTF8)] */
+ const char *homedir;/* [unique,charset(UTF8)] */
+ const char *shell;/* [unique,charset(UTF8)] */
+ uint64_t primary_gid;
+ struct dom_sid user_sid;
+ struct dom_sid group_sid;
+}/* [public] */;
+
struct wbint_Ping {
struct {
@@ -107,4 +117,17 @@ struct wbint_Gid2Sid {
};
+
+struct wbint_QueryUser {
+ struct {
+ struct dom_sid *sid;/* [ref] */
+ } in;
+
+ struct {
+ struct wbint_userinfo *info;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
#endif /* _HEADER_wbint */
diff --git a/source3/librpc/idl/wbint.idl b/source3/librpc/idl/wbint.idl
index 93627fbe07..15c4e1f302 100644
--- a/source3/librpc/idl/wbint.idl
+++ b/source3/librpc/idl/wbint.idl
@@ -53,4 +53,19 @@ interface wbint
[in] hyper gid,
[out] dom_sid *sid
);
+
+ typedef [public] struct {
+ [string,charset(UTF8)] char *acct_name;
+ [string,charset(UTF8)] char *full_name;
+ [string,charset(UTF8)] char *homedir;
+ [string,charset(UTF8)] char *shell;
+ hyper primary_gid;
+ dom_sid user_sid;
+ dom_sid group_sid;
+ } wbint_userinfo;
+
+ NTSTATUS wbint_QueryUser(
+ [in] dom_sid *sid,
+ [out] wbint_userinfo *info
+ );
} \ No newline at end of file