diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/librpc/gen_ndr/cli_netlogon.c | 20 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_netlogon.h | 9 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_netlogon.c | 108 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_netlogon.h | 4 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/netlogon.h | 8 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_netlogon.c | 23 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_netlogon.h | 2 |
7 files changed, 141 insertions, 33 deletions
diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index 414e053dc9..d6739c5a26 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -1183,24 +1183,29 @@ NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror) +NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + uint32_t *rid, + WERROR *werror) { - struct netr_NETRLOGONGETTRUSTRID r; + struct netr_LogonGetTrustRid r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.domain_name = domain_name; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, &r); } status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, - NDR_NETR_NETRLOGONGETTRUSTRID, + NDR_NETR_LOGONGETTRUSTRID, &r); if (!NT_STATUS_IS_OK(status)) { @@ -1208,7 +1213,7 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1216,6 +1221,7 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, } /* Return variables */ + *rid = *r.out.rid; /* Return result */ if (werror) { diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index 30a9645767..9716f4084b 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -185,9 +185,12 @@ NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror); +NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + uint32_t *rid, + WERROR *werror); NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 88b9fbd6e5..7bc85935d1 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -11184,41 +11184,127 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, cons ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRLOGONGETTRUSTRID(struct ndr_push *ndr, int flags, const struct netr_NETRLOGONGETTRUSTRID *r) +static enum ndr_err_code ndr_push_netr_LogonGetTrustRid(struct ndr_push *ndr, int flags, const struct netr_LogonGetTrustRid *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name)); + if (r->in.domain_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.domain_name, ndr_charset_length(r->in.domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } if (flags & NDR_OUT) { + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRLOGONGETTRUSTRID(struct ndr_pull *ndr, int flags, struct netr_NETRLOGONGETTRUSTRID *r) +static enum ndr_err_code ndr_pull_netr_LogonGetTrustRid(struct ndr_pull *ndr, int flags, struct netr_LogonGetTrustRid *r) { + uint32_t _ptr_server_name; + uint32_t _ptr_domain_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_domain_name_0; + TALLOC_CTX *_mem_save_rid_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_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.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name)); + if (_ptr_domain_name) { + NDR_PULL_ALLOC(ndr, r->in.domain_name); + } else { + r->in.domain_name = NULL; + } + if (r->in.domain_name) { + _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.domain_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.domain_name)); + if (ndr_get_array_length(ndr, &r->in.domain_name) > ndr_get_array_size(ndr, &r->in.domain_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.domain_name), ndr_get_array_length(ndr, &r->in.domain_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.domain_name, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r) +_PUBLIC_ void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r) { - ndr_print_struct(ndr, name, "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, name, "netr_LogonGetTrustRid"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, "in", "netr_LogonGetTrustRid"); ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_ptr(ndr, "domain_name", r->in.domain_name); + ndr->depth++; + if (r->in.domain_name) { + ndr_print_string(ndr, "domain_name", r->in.domain_name); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, "out", "netr_LogonGetTrustRid"); + ndr->depth++; + ndr_print_ptr(ndr, "rid", r->out.rid); ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -14376,11 +14462,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRLOGONGETTRUSTRID", - sizeof(struct netr_NETRLOGONGETTRUSTRID), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONGETTRUSTRID, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONGETTRUSTRID, - (ndr_print_function_t) ndr_print_netr_NETRLOGONGETTRUSTRID, + "netr_LogonGetTrustRid", + sizeof(struct netr_LogonGetTrustRid), + (ndr_push_flags_fn_t) ndr_push_netr_LogonGetTrustRid, + (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetTrustRid, + (ndr_print_function_t) ndr_print_netr_LogonGetTrustRid, false, }, { diff --git a/source3/librpc/gen_ndr/ndr_netlogon.h b/source3/librpc/gen_ndr/ndr_netlogon.h index b1a5ce9973..9338aa760b 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.h +++ b/source3/librpc/gen_ndr/ndr_netlogon.h @@ -57,7 +57,7 @@ extern const struct ndr_interface_table ndr_table_netlogon; #define NDR_NETR_NETRLOGONSETSERVICEBITS (0x16) -#define NDR_NETR_NETRLOGONGETTRUSTRID (0x17) +#define NDR_NETR_LOGONGETTRUSTRID (0x17) #define NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST (0x18) @@ -227,7 +227,7 @@ void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const cha void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r); void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r); void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r); -void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r); +void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r); void ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); void ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); void ndr_print_netr_ServerAuthenticate3(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate3 *r); diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 53aa350bed..64a70ca1a7 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -1200,8 +1200,14 @@ struct netr_NETRLOGONSETSERVICEBITS { }; -struct netr_NETRLOGONGETTRUSTRID { +struct netr_LogonGetTrustRid { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *domain_name;/* [unique,charset(UTF16)] */ + } in; + + struct { + uint32_t *rid;/* [ref] */ WERROR result; } out; diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 421014e829..3f88d7f694 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -1866,18 +1866,18 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p) return true; } -static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) +static bool api_netr_LogonGetTrustRid(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 netr_NETRLOGONGETTRUSTRID *r; + struct netr_LogonGetTrustRid *r; - call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTRUSTRID]; + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETTRUSTRID]; - r = talloc(NULL, struct netr_NETRLOGONGETTRUSTRID); + r = talloc(NULL, struct netr_LogonGetTrustRid); if (r == NULL) { return false; } @@ -1901,10 +1901,17 @@ static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, r); + NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, r); } - r->out.result = _netr_NETRLOGONGETTRUSTRID(p, r); + ZERO_STRUCT(r->out); + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_LogonGetTrustRid(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -1913,7 +1920,7 @@ static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, r); + NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r); } push = ndr_push_init_ctx(r); @@ -3806,7 +3813,7 @@ static struct api_struct api_netlogon_cmds[] = {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName}, {"NETR_NETRLOGONDUMMYROUTINE1", NDR_NETR_NETRLOGONDUMMYROUTINE1, api_netr_NETRLOGONDUMMYROUTINE1}, {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS}, - {"NETR_NETRLOGONGETTRUSTRID", NDR_NETR_NETRLOGONGETTRUSTRID, api_netr_NETRLOGONGETTRUSTRID}, + {"NETR_LOGONGETTRUSTRID", NDR_NETR_LOGONGETTRUSTRID, api_netr_LogonGetTrustRid}, {"NETR_NETRLOGONCOMPUTESERVERDIGEST", NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, api_netr_NETRLOGONCOMPUTESERVERDIGEST}, {"NETR_NETRLOGONCOMPUTECLIENTDIGEST", NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, api_netr_NETRLOGONCOMPUTECLIENTDIGEST}, {"NETR_SERVERAUTHENTICATE3", NDR_NETR_SERVERAUTHENTICATE3, api_netr_ServerAuthenticate3}, diff --git a/source3/librpc/gen_ndr/srv_netlogon.h b/source3/librpc/gen_ndr/srv_netlogon.h index dc91cf5c0c..fb6ed9fa90 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.h +++ b/source3/librpc/gen_ndr/srv_netlogon.h @@ -24,7 +24,7 @@ WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, struct netr_NetrEnumer WERROR _netr_DsRGetDCName(pipes_struct *p, struct netr_DsRGetDCName *r); WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, struct netr_NETRLOGONDUMMYROUTINE1 *r); WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, struct netr_NETRLOGONSETSERVICEBITS *r); -WERROR _netr_NETRLOGONGETTRUSTRID(pipes_struct *p, struct netr_NETRLOGONGETTRUSTRID *r); +WERROR _netr_LogonGetTrustRid(pipes_struct *p, struct netr_LogonGetTrustRid *r); WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, struct netr_ServerAuthenticate3 *r); |