diff options
author | Jeremy Allison <jra@samba.org> | 2008-02-08 17:00:31 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-02-08 17:00:31 -0800 |
commit | c7f34889591174ae335a37ab62747afab8fc418c (patch) | |
tree | 3dacbead8b7c8425e0e69bcebaa82b810f70976d | |
parent | 7a694af2f4581b6ca96745f7b82318cb75d26d6e (diff) | |
parent | 5da927716a857ce686f3b75476671d32f047d2c0 (diff) | |
download | samba-c7f34889591174ae335a37ab62747afab8fc418c.tar.gz samba-c7f34889591174ae335a37ab62747afab8fc418c.tar.bz2 samba-c7f34889591174ae335a37ab62747afab8fc418c.zip |
Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
(This used to be commit 33a9859cbdb0dac035af36aa561b6acb24196c86)
31 files changed, 413 insertions, 835 deletions
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 902d1e20b2..5cdcd21251 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -689,19 +689,6 @@ typedef struct lsa_r_unk_get_connuser } LSA_R_UNK_GET_CONNUSER; -typedef struct lsa_q_openaccount -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; - uint32 access; /* desired access */ -} LSA_Q_OPENACCOUNT; - -typedef struct lsa_r_openaccount -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; -} LSA_R_OPENACCOUNT; - typedef struct lsa_q_enumprivsaccount { POLICY_HND pol; /* policy handle */ @@ -715,29 +702,6 @@ typedef struct lsa_r_enumprivsaccount NTSTATUS status; } LSA_R_ENUMPRIVSACCOUNT; -typedef struct lsa_q_getsystemaccount -{ - POLICY_HND pol; /* policy handle */ -} LSA_Q_GETSYSTEMACCOUNT; - -typedef struct lsa_r_getsystemaccount -{ - uint32 access; - NTSTATUS status; -} LSA_R_GETSYSTEMACCOUNT; - - -typedef struct lsa_q_setsystemaccount -{ - POLICY_HND pol; /* policy handle */ - uint32 access; -} LSA_Q_SETSYSTEMACCOUNT; - -typedef struct lsa_r_setsystemaccount -{ - NTSTATUS status; -} LSA_R_SETSYSTEMACCOUNT; - typedef struct { UNIHDR hdr; UNISTR2 unistring; diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index 21dd42d77e..bab2caaf61 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -1029,37 +1029,4 @@ struct DS_DOMAIN_CONTROLLER_INFO { const char *client_site_name; }; -/* NET_Q_DSR_GETDCNAME */ -typedef struct net_q_dsr_getdcname { - uint32 ptr_server_unc; - UNISTR2 uni_server_unc; - uint32 ptr_domain_name; - UNISTR2 uni_domain_name; - uint32 ptr_domain_guid; - struct GUID *domain_guid; - uint32 ptr_site_guid; - struct GUID *site_guid; - uint32 flags; -} NET_Q_DSR_GETDCNAME; - -/* NET_R_DSR_GETDCNAME */ -typedef struct net_r_dsr_getdcname { - uint32 ptr_dc_unc; - UNISTR2 uni_dc_unc; - uint32 ptr_dc_address; - UNISTR2 uni_dc_address; - int32 dc_address_type; - struct GUID domain_guid; - uint32 ptr_domain_name; - UNISTR2 uni_domain_name; - uint32 ptr_forest_name; - UNISTR2 uni_forest_name; - uint32 dc_flags; - uint32 ptr_dc_site_name; - UNISTR2 uni_dc_site_name; - uint32 ptr_client_site_name; - UNISTR2 uni_client_site_name; - WERROR result; -} NET_R_DSR_GETDCNAME; - #endif /* _RPC_NETLOGON_H */ diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 227ae809c9..64da84d55f 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -762,7 +762,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, - struct policy_handle *acct_handle) + struct policy_handle **acct_handle) { struct lsa_OpenAccount r; NTSTATUS status; @@ -1004,12 +1004,15 @@ NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, } NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *access_mask) { struct lsa_GetSystemAccessAccount r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &r); @@ -1035,18 +1038,23 @@ NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, } /* Return variables */ + *access_mask = *r.out.access_mask; /* Return result */ return r.out.result; } NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t access_mask) { struct lsa_SetSystemAccessAccount r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.access_mask = access_mask; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &r); @@ -2085,7 +2093,7 @@ NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - struct lsa_String trusted_domain, + struct lsa_String *trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info) { @@ -2121,9 +2129,7 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, } /* Return variables */ - if (info && r.out.info) { - *info = *r.out.info; - } + *info = *r.out.info; /* Return result */ return r.out.result; diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h index ec9abaf568..396debaca8 100644 --- a/source3/librpc/gen_ndr/cli_lsa.h +++ b/source3/librpc/gen_ndr/cli_lsa.h @@ -95,7 +95,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, - struct policy_handle *acct_handle); + struct policy_handle **acct_handle); NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, @@ -114,9 +114,13 @@ NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *access_mask); NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t access_mask); NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, @@ -229,7 +233,7 @@ NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - struct lsa_String trusted_domain, + struct lsa_String *trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info); NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index cac3962073..de04c21dc5 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -1057,7 +1057,7 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror) { struct netr_DsRGetDCName r; diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index fa043233ea..4aa0f9fa73 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -178,7 +178,7 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror); NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/cli_samr.c b/source3/librpc/gen_ndr/cli_samr.c index c3cb5ad273..efedb00078 100644 --- a/source3/librpc/gen_ndr/cli_samr.c +++ b/source3/librpc/gen_ndr/cli_samr.c @@ -261,8 +261,8 @@ NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *connect_handle, uint32_t *resume_handle, + struct samr_SamArray **sam, uint32_t buf_size, - struct samr_SamArray *sam, uint32_t *num_entries) { struct samr_EnumDomains r; diff --git a/source3/librpc/gen_ndr/cli_samr.h b/source3/librpc/gen_ndr/cli_samr.h index 5df5e3a70c..9eac177001 100644 --- a/source3/librpc/gen_ndr/cli_samr.h +++ b/source3/librpc/gen_ndr/cli_samr.h @@ -31,8 +31,8 @@ NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *connect_handle, uint32_t *resume_handle, + struct samr_SamArray **sam, uint32_t buf_size, - struct samr_SamArray *sam, uint32_t *num_entries); NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index 810ce945da..06f714acc8 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -829,7 +829,7 @@ struct lsa_OpenAccount { } in; struct { - struct policy_handle *acct_handle;/* [ref] */ + struct policy_handle **acct_handle;/* [ref] */ NTSTATUS result; } out; @@ -894,6 +894,11 @@ struct lsa_SetQuotasForAccount { struct lsa_GetSystemAccessAccount { struct { + struct policy_handle *handle;/* [ref] */ + } in; + + struct { + uint32_t *access_mask;/* [ref] */ NTSTATUS result; } out; @@ -902,6 +907,11 @@ struct lsa_GetSystemAccessAccount { struct lsa_SetSystemAccessAccount { struct { + struct policy_handle *handle;/* [ref] */ + uint32_t access_mask; + } in; + + struct { NTSTATUS result; } out; @@ -1223,12 +1233,12 @@ struct lsa_SetInfoPolicy2 { struct lsa_QueryTrustedDomainInfoByName { struct { struct policy_handle *handle;/* [ref] */ - struct lsa_String trusted_domain; + struct lsa_String *trusted_domain;/* [ref] */ enum lsa_TrustDomInfoEnum level; } in; struct { - union lsa_TrustedDomainInfo *info;/* [unique,switch_is(level)] */ + union lsa_TrustedDomainInfo *info;/* [ref,switch_is(level)] */ NTSTATUS result; } out; diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c index 8c863085a9..5ac4cbcb59 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.c +++ b/source3/librpc/gen_ndr/ndr_lsa.c @@ -6208,7 +6208,10 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag if (r->out.acct_handle == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle)); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle)); + if (*r->out.acct_handle) { + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle)); + } NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -6216,9 +6219,11 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flags, struct lsa_OpenAccount *r) { + uint32_t _ptr_acct_handle; TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_sid_0; TALLOC_CTX *_mem_save_acct_handle_0; + TALLOC_CTX *_mem_save_acct_handle_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -6246,7 +6251,18 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag } _mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle)); + if (_ptr_acct_handle) { + NDR_PULL_ALLOC(ndr, *r->out.acct_handle); + } else { + *r->out.acct_handle = NULL; + } + if (*r->out.acct_handle) { + _mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -6279,7 +6295,12 @@ _PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name, ndr->depth++; ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle); ndr->depth++; - ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle); + ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle); + ndr->depth++; + if (*r->out.acct_handle) { + ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle); + } + ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -6612,8 +6633,16 @@ _PUBLIC_ void ndr_print_lsa_SetQuotasForAccount(struct ndr_print *ndr, const cha static enum ndr_err_code ndr_push_lsa_GetSystemAccessAccount(struct ndr_push *ndr, int flags, const struct lsa_GetSystemAccessAccount *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); } if (flags & NDR_OUT) { + if (r->out.access_mask == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.access_mask)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -6621,9 +6650,29 @@ static enum ndr_err_code ndr_push_lsa_GetSystemAccessAccount(struct ndr_push *nd static enum ndr_err_code ndr_pull_lsa_GetSystemAccessAccount(struct ndr_pull *ndr, int flags, struct lsa_GetSystemAccessAccount *r) { + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_access_mask_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.access_mask); + ZERO_STRUCTP(r->out.access_mask); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.access_mask); + } + _mem_save_access_mask_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.access_mask, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.access_mask)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_access_mask_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -6639,11 +6688,19 @@ _PUBLIC_ void ndr_print_lsa_GetSystemAccessAccount(struct ndr_print *ndr, const if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_GetSystemAccessAccount"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "lsa_GetSystemAccessAccount"); ndr->depth++; + ndr_print_ptr(ndr, "access_mask", r->out.access_mask); + ndr->depth++; + ndr_print_uint32(ndr, "access_mask", *r->out.access_mask); + ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; } @@ -6653,6 +6710,11 @@ _PUBLIC_ void ndr_print_lsa_GetSystemAccessAccount(struct ndr_print *ndr, const static enum ndr_err_code ndr_push_lsa_SetSystemAccessAccount(struct ndr_push *ndr, int flags, const struct lsa_SetSystemAccessAccount *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); @@ -6662,7 +6724,16 @@ static enum ndr_err_code ndr_push_lsa_SetSystemAccessAccount(struct ndr_push *nd static enum ndr_err_code ndr_pull_lsa_SetSystemAccessAccount(struct ndr_pull *ndr, int flags, struct lsa_SetSystemAccessAccount *r) { + TALLOC_CTX *_mem_save_handle_0; if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); @@ -6680,6 +6751,11 @@ _PUBLIC_ void ndr_print_lsa_SetSystemAccessAccount(struct ndr_print *ndr, const if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_SetSystemAccessAccount"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_uint32(ndr, "access_mask", r->in.access_mask); ndr->depth--; } if (flags & NDR_OUT) { @@ -8938,15 +9014,18 @@ static enum ndr_err_code ndr_push_lsa_QueryTrustedDomainInfoByName(struct ndr_pu return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.trusted_domain)); + if (r->in.trusted_domain == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain)); NDR_CHECK(ndr_push_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, r->in.level)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); - if (r->out.info) { - NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); - NDR_CHECK(ndr_push_lsa_TrustedDomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_lsa_TrustedDomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -8954,8 +9033,8 @@ static enum ndr_err_code ndr_push_lsa_QueryTrustedDomainInfoByName(struct ndr_pu static enum ndr_err_code ndr_pull_lsa_QueryTrustedDomainInfoByName(struct ndr_pull *ndr, int flags, struct lsa_QueryTrustedDomainInfoByName *r) { - uint32_t _ptr_info; TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_trusted_domain_0; TALLOC_CTX *_mem_save_info_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -8967,23 +9046,26 @@ static enum ndr_err_code ndr_pull_lsa_QueryTrustedDomainInfoByName(struct ndr_pu NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.trusted_domain)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.trusted_domain); + } + _mem_save_trusted_domain_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.trusted_domain, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domain_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); - if (_ptr_info) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.info); - } else { - r->out.info = NULL; - } - if (r->out.info) { - _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); - NDR_CHECK(ndr_pull_lsa_TrustedDomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } + _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_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_lsa_TrustedDomainInfo(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; @@ -9003,7 +9085,10 @@ _PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoByName(struct ndr_print *ndr, ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_lsa_String(ndr, "trusted_domain", &r->in.trusted_domain); + ndr_print_ptr(ndr, "trusted_domain", r->in.trusted_domain); + ndr->depth++; + ndr_print_lsa_String(ndr, "trusted_domain", r->in.trusted_domain); + ndr->depth--; ndr_print_lsa_TrustDomInfoEnum(ndr, "level", r->in.level); ndr->depth--; } @@ -9012,10 +9097,8 @@ _PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoByName(struct ndr_print *ndr, ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - if (r->out.info) { - ndr_print_set_switch_value(ndr, r->out.info, r->in.level); - ndr_print_lsa_TrustedDomainInfo(ndr, "info", r->out.info); - } + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_lsa_TrustedDomainInfo(ndr, "info", r->out.info); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index eabbc337fc..dd1d2cf387 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -10983,7 +10983,10 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCName(struct ndr_push *ndr, int fl if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10995,11 +10998,13 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_guid; + uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_domain_name_0; TALLOC_CTX *_mem_save_domain_guid_0; TALLOC_CTX *_mem_save_site_guid_0; TALLOC_CTX *_mem_save_info_0; + TALLOC_CTX *_mem_save_info_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -11073,7 +11078,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl } _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_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -11122,7 +11138,12 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); + ndr_print_ptr(ndr, "info", *r->out.info); + ndr->depth++; + if (*r->out.info) { + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + } + ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c index f257c17864..8c97ea1d95 100644 --- a/source3/librpc/gen_ndr/ndr_samr.c +++ b/source3/librpc/gen_ndr/ndr_samr.c @@ -5788,7 +5788,10 @@ static enum ndr_err_code ndr_push_samr_EnumDomains(struct ndr_push *ndr, int fla if (r->out.sam == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.sam)); + if (*r->out.sam) { + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sam)); + } if (r->out.num_entries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -5800,9 +5803,11 @@ static enum ndr_err_code ndr_push_samr_EnumDomains(struct ndr_push *ndr, int fla static enum ndr_err_code ndr_pull_samr_EnumDomains(struct ndr_pull *ndr, int flags, struct samr_EnumDomains *r) { + uint32_t _ptr_sam; TALLOC_CTX *_mem_save_connect_handle_0; TALLOC_CTX *_mem_save_resume_handle_0; TALLOC_CTX *_mem_save_sam_0; + TALLOC_CTX *_mem_save_sam_1; TALLOC_CTX *_mem_save_num_entries_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -5842,7 +5847,18 @@ static enum ndr_err_code ndr_pull_samr_EnumDomains(struct ndr_pull *ndr, int fla } _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam)); + if (_ptr_sam) { + NDR_PULL_ALLOC(ndr, *r->out.sam); + } else { + *r->out.sam = NULL; + } + if (*r->out.sam) { + _mem_save_sam_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.sam, 0); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.num_entries); @@ -5886,7 +5902,12 @@ _PUBLIC_ void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name ndr->depth--; ndr_print_ptr(ndr, "sam", r->out.sam); ndr->depth++; - ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + ndr_print_ptr(ndr, "sam", *r->out.sam); + ndr->depth++; + if (*r->out.sam) { + ndr_print_samr_SamArray(ndr, "sam", *r->out.sam); + } + ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "num_entries", r->out.num_entries); ndr->depth++; diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 612e30914a..ef2218c0f2 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -1181,7 +1181,7 @@ struct netr_DsRGetDCName { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [ref] */ + struct netr_DsRGetDCNameInfo **info;/* [ref] */ WERROR result; } out; diff --git a/source3/librpc/gen_ndr/samr.h b/source3/librpc/gen_ndr/samr.h index 376feae5d1..2d6126a3f4 100644 --- a/source3/librpc/gen_ndr/samr.h +++ b/source3/librpc/gen_ndr/samr.h @@ -837,7 +837,7 @@ struct samr_EnumDomains { } in; struct { - struct samr_SamArray *sam;/* [ref] */ + struct samr_SamArray **sam;/* [ref] */ uint32_t *num_entries;/* [ref] */ uint32_t *resume_handle;/* [ref] */ NTSTATUS result; diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index 9d41be35a8..874cf4c410 100644 --- a/source3/librpc/gen_ndr/srv_lsa.c +++ b/source3/librpc/gen_ndr/srv_lsa.c @@ -1372,7 +1372,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.acct_handle = talloc_zero(r, struct policy_handle); + r->out.acct_handle = talloc_zero(r, struct policy_handle *); if (r->out.acct_handle == NULL) { talloc_free(r); return false; @@ -1823,6 +1823,13 @@ static bool api_lsa_GetSystemAccessAccount(pipes_struct *p) NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, r); } + ZERO_STRUCT(r->out); + r->out.access_mask = talloc_zero(r, uint32_t); + if (r->out.access_mask == NULL) { + talloc_free(r); + return false; + } + r->out.result = _lsa_GetSystemAccessAccount(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index b9e6ae69b1..673f9503df 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -1679,7 +1679,7 @@ static bool api_netr_DsRGetDCName(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *); if (r->out.info == NULL) { talloc_free(r); return false; diff --git a/source3/librpc/gen_ndr/srv_samr.c b/source3/librpc/gen_ndr/srv_samr.c index 374df34a96..3312964178 100644 --- a/source3/librpc/gen_ndr/srv_samr.c +++ b/source3/librpc/gen_ndr/srv_samr.c @@ -507,7 +507,7 @@ static bool api_samr_EnumDomains(pipes_struct *p) ZERO_STRUCT(r->out); r->out.resume_handle = r->in.resume_handle; - r->out.sam = talloc_zero(r, struct samr_SamArray); + r->out.sam = talloc_zero(r, struct samr_SamArray *); if (r->out.sam == NULL) { talloc_free(r); return false; diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index fc36689a19..df1da31c97 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -431,9 +431,9 @@ import "security.idl"; /* Function: 0x11 */ NTSTATUS lsa_OpenAccount ( [in] policy_handle *handle, - [in] dom_sid2 *sid, + [in,ref] dom_sid2 *sid, [in] uint32 access_mask, - [out] policy_handle *acct_handle + [out] policy_handle **acct_handle ); @@ -480,9 +480,16 @@ import "security.idl"; NTSTATUS lsa_SetQuotasForAccount(); /* Function: 0x17 */ - NTSTATUS lsa_GetSystemAccessAccount(); + NTSTATUS lsa_GetSystemAccessAccount( + [in] policy_handle *handle, + [out,ref] uint32 *access_mask + ); + /* Function: 0x18 */ - NTSTATUS lsa_SetSystemAccessAccount(); + NTSTATUS lsa_SetSystemAccessAccount( + [in] policy_handle *handle, + [in] uint32 access_mask + ); /* Function: 0x19 */ NTSTATUS lsa_OpenTrustedDomain( @@ -764,10 +771,10 @@ import "security.idl"; /**********************/ /* Function 0x30 */ NTSTATUS lsa_QueryTrustedDomainInfoByName( - [in] policy_handle *handle, - [in] lsa_String trusted_domain, - [in] lsa_TrustDomInfoEnum level, - [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain, + [in] lsa_TrustDomInfoEnum level, + [out,ref,switch_is(level)] lsa_TrustedDomainInfo *info ); /**********************/ diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 5b84452e3f..ae16884896 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -982,7 +982,7 @@ interface netlogon [in,unique] GUID *domain_guid, [in,unique] GUID *site_guid, [in] netr_DsRGetDCName_flags flags, - [out,ref] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo **info ); /*****************/ diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index 1c18b2604f..6841420151 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -160,10 +160,10 @@ import "misc.idl", "lsa.idl", "security.idl"; } samr_SamArray; NTSTATUS samr_EnumDomains ( - [in,ref] policy_handle *connect_handle, + [in] policy_handle *connect_handle, [in,out,ref] uint32 *resume_handle, + [out,ref] samr_SamArray **sam, [in] uint32 buf_size, - [out,ref] samr_SamArray *sam, [out,ref] uint32 *num_entries ); diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 514b8f5dfd..150d55d1c3 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -721,44 +721,6 @@ NTSTATUS rpccli_lsa_enum_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return result; } -/** Open a LSA user handle - * - * @param cli Handle on an initialised SMB connection */ - -NTSTATUS rpccli_lsa_open_account(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *dom_pol, DOM_SID *sid, uint32 des_access, - POLICY_HND *user_pol) -{ - prs_struct qbuf, rbuf; - LSA_Q_OPENACCOUNT q; - LSA_R_OPENACCOUNT r; - NTSTATUS result; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - init_lsa_q_open_account(&q, dom_pol, sid, des_access); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENACCOUNT, - q, r, - qbuf, rbuf, - lsa_io_q_open_account, - lsa_io_r_open_account, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - *user_pol = r.pol; - } - - return result; -} - /** Enumerate user privileges * * @param cli Handle on an initialised SMB connection */ diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 5a0c5816e6..a6167bb851 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -379,142 +379,6 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *me return result; } -static WERROR pull_domain_controller_info_from_getdcname_reply(TALLOC_CTX *mem_ctx, - struct DS_DOMAIN_CONTROLLER_INFO **info_out, - NET_R_DSR_GETDCNAME *r) -{ - struct DS_DOMAIN_CONTROLLER_INFO *info; - - info = TALLOC_ZERO_P(mem_ctx, struct DS_DOMAIN_CONTROLLER_INFO); - if (!info) { - return WERR_NOMEM; - } - - if (&r->uni_dc_unc) { - - char *tmp; - tmp = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_dc_unc); - if (tmp == NULL) { - return WERR_GENERAL_FAILURE; - } - if (*tmp == '\\') tmp += 1; - if (*tmp == '\\') tmp += 1; - - info->domain_controller_name = talloc_strdup(mem_ctx, tmp); - if (info->domain_controller_name == NULL) { - return WERR_GENERAL_FAILURE; - } - } - - if (&r->uni_dc_address) { - - char *tmp; - tmp = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_dc_address); - if (tmp == NULL) { - return WERR_GENERAL_FAILURE; - } - if (*tmp == '\\') tmp += 1; - if (*tmp == '\\') tmp += 1; - - info->domain_controller_address = talloc_strdup(mem_ctx, tmp); - if (info->domain_controller_address == NULL) { - return WERR_GENERAL_FAILURE; - } - } - - info->domain_controller_address_type = r->dc_address_type; - - info->domain_guid = (struct GUID *)talloc_memdup( - mem_ctx, &r->domain_guid, sizeof(struct GUID)); - if (!info->domain_guid) { - return WERR_GENERAL_FAILURE; - } - - if (&r->uni_domain_name) { - info->domain_name = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_domain_name); - if (!info->domain_name) { - return WERR_GENERAL_FAILURE; - } - } - - if (&r->uni_forest_name) { - info->dns_forest_name = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_forest_name); - if (!info->dns_forest_name) { - return WERR_GENERAL_FAILURE; - } - } - - info->flags = r->dc_flags; - - if (&r->uni_dc_site_name) { - info->dc_site_name = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_dc_site_name); - if (!info->dc_site_name) { - return WERR_GENERAL_FAILURE; - } - } - - if (&r->uni_client_site_name) { - info->client_site_name = rpcstr_pull_unistr2_talloc(mem_ctx, &r->uni_client_site_name); - if (!info->client_site_name) { - return WERR_GENERAL_FAILURE; - } - } - - *info_out = info; - - return WERR_OK; -} - -/* Dsr_GetDCName */ - -WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *server_name, - const char *domain_name, - struct GUID *domain_guid, - struct GUID *site_guid, - uint32_t flags, - struct DS_DOMAIN_CONTROLLER_INFO **info_out) -{ - prs_struct qbuf, rbuf; - NET_Q_DSR_GETDCNAME q; - NET_R_DSR_GETDCNAME r; - char *tmp_str; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialize input parameters */ - - tmp_str = talloc_asprintf(mem_ctx, "\\\\%s", server_name); - if (tmp_str == NULL) { - return WERR_NOMEM; - } - - init_net_q_dsr_getdcname(&q, tmp_str, domain_name, domain_guid, - site_guid, flags); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAME, - q, r, - qbuf, rbuf, - net_io_q_dsr_getdcname, - net_io_r_dsr_getdcname, - WERR_GENERAL_FAILURE); - - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - r.result = pull_domain_controller_info_from_getdcname_reply(mem_ctx, info_out, &r); - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - return WERR_OK; -} - /* Sam synchronisation */ NTSTATUS rpccli_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ef54b4a30d..5f22a28082 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1985,60 +1985,6 @@ bool lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, pr return True; } -void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access) -{ - memcpy(&trn->pol, hnd, sizeof(trn->pol)); - - init_dom_sid2(&trn->sid, sid); - trn->access = desired_access; -} - -/******************************************************************* - Reads or writes an LSA_Q_OPENACCOUNT structure. -********************************************************************/ - -bool lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_account"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) - return False; - - if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */ - return False; - - if(!prs_uint32("access", ps, depth, &out->access)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_OPENACCOUNT structure. -********************************************************************/ - -bool lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_open_account"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - - void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) { memcpy(&trn->pol, hnd, sizeof(trn->pol)); @@ -2192,88 +2138,6 @@ bool lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *out, p return True; } - - -/******************************************************************* - Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. -********************************************************************/ - -bool lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_getsystemaccount"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. -********************************************************************/ - -bool lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_getsystemaccount"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("access", ps, depth, &out->access)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure. -********************************************************************/ - -bool lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_setsystemaccount"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) - return False; - - if(!prs_uint32("access", ps, depth, &out->access)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_SETSYSTEMACCOUNT structure. -********************************************************************/ - -bool lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_setsystemaccount"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - - void init_lsa_string( LSA_STRING *uni, const char *string ) { init_unistr2(&uni->unistring, string, UNI_FLAGS_NONE); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c68d9300b9..55af8211cf 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3240,239 +3240,3 @@ bool net_io_r_sam_deltas(const char *desc, return True; } - -/******************************************************************* - Inits a NET_Q_DSR_GETDCNAME structure. -********************************************************************/ - -void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, - const char *domain_name, - struct GUID *domain_guid, - struct GUID *site_guid, - uint32_t flags) -{ - DEBUG(5, ("init_net_q_dsr_getdcname\n")); - - r_t->ptr_server_unc = (server_unc != NULL); - init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE); - - r_t->ptr_domain_name = (domain_name != NULL); - init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE); - - r_t->ptr_domain_guid = (domain_guid != NULL); - r_t->domain_guid = domain_guid; - - r_t->ptr_site_guid = (site_guid != NULL); - r_t->site_guid = site_guid; - - r_t->flags = flags; -} - -/******************************************************************* - Reads or writes an NET_Q_DSR_GETDCNAME structure. -********************************************************************/ - -bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, - prs_struct *ps, int depth) -{ - if (r_t == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_q_dsr_getdcname"); - depth++; - - if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc)) - return False; - - if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc, - r_t->ptr_server_unc, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name)) - return False; - - if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name, - r_t->ptr_domain_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid)) - return False; - - if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) { - r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); - if (r_t->domain_guid == NULL) - return False; - } - - if ((r_t->ptr_domain_guid) && - (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth))) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_site_guid", ps, depth, &r_t->ptr_site_guid)) - return False; - - if (UNMARSHALLING(ps) && (r_t->ptr_site_guid)) { - r_t->site_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); - if (r_t->site_guid == NULL) - return False; - } - - if ((r_t->ptr_site_guid) && - (!smb_io_uuid("site_guid", r_t->site_guid, ps, depth))) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("flags", ps, depth, &r_t->flags)) - return False; - - return True; -} - -/******************************************************************* - Inits a NET_R_DSR_GETDCNAME structure. -********************************************************************/ -void init_net_r_dsr_getdcname(NET_R_DSR_GETDCNAME *r_t, const char *dc_unc, - const char *dc_address, int32 dc_address_type, - struct GUID domain_guid, const char *domain_name, - const char *forest_name, uint32 dc_flags, - const char *dc_site_name, - const char *client_site_name) -{ - DEBUG(5, ("init_net_q_dsr_getdcname\n")); - - r_t->ptr_dc_unc = (dc_unc != NULL); - init_unistr2(&r_t->uni_dc_unc, dc_unc, UNI_STR_TERMINATE); - - r_t->ptr_dc_address = (dc_address != NULL); - init_unistr2(&r_t->uni_dc_address, dc_address, UNI_STR_TERMINATE); - - r_t->dc_address_type = dc_address_type; - r_t->domain_guid = domain_guid; - - r_t->ptr_domain_name = (domain_name != NULL); - init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE); - - r_t->ptr_forest_name = (forest_name != NULL); - init_unistr2(&r_t->uni_forest_name, forest_name, UNI_STR_TERMINATE); - - r_t->dc_flags = dc_flags; - - r_t->ptr_dc_site_name = (dc_site_name != NULL); - init_unistr2(&r_t->uni_dc_site_name, dc_site_name, UNI_STR_TERMINATE); - - r_t->ptr_client_site_name = (client_site_name != NULL); - init_unistr2(&r_t->uni_client_site_name, client_site_name, - UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes an NET_R_DSR_GETDCNAME structure. -********************************************************************/ - -bool net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, - prs_struct *ps, int depth) -{ - uint32 info_ptr = 1; - - if (r_t == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_r_dsr_getdcname"); - depth++; - - /* The reply contains *just* an info struct, this is the ptr to it */ - if (!prs_uint32("info_ptr", ps, depth, &info_ptr)) - return False; - - if (info_ptr == 0) - return False; - - if (!prs_uint32("ptr_dc_unc", ps, depth, &r_t->ptr_dc_unc)) - return False; - - if (!prs_uint32("ptr_dc_address", ps, depth, &r_t->ptr_dc_address)) - return False; - - if (!prs_int32("dc_address_type", ps, depth, &r_t->dc_address_type)) - return False; - - if (!smb_io_uuid("domain_guid", &r_t->domain_guid, ps, depth)) - return False; - - if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name)) - return False; - - if (!prs_uint32("ptr_forest_name", ps, depth, &r_t->ptr_forest_name)) - return False; - - if (!prs_uint32("dc_flags", ps, depth, &r_t->dc_flags)) - return False; - - if (!prs_uint32("ptr_dc_site_name", ps, depth, &r_t->ptr_dc_site_name)) - return False; - - if (!prs_uint32("ptr_client_site_name", ps, depth, - &r_t->ptr_client_site_name)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("dc_unc", &r_t->uni_dc_unc, - r_t->ptr_dc_unc, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("dc_address", &r_t->uni_dc_address, - r_t->ptr_dc_address, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name, - r_t->ptr_domain_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("forest_name", &r_t->uni_forest_name, - r_t->ptr_forest_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("dc_site_name", &r_t->uni_dc_site_name, - r_t->ptr_dc_site_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!smb_io_unistr2("client_site_name", &r_t->uni_client_site_name, - r_t->ptr_client_site_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_werror("result", ps, depth, &r_t->result)) - return False; - - return True; -} diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 5811d8535b..24bc65c51a 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -316,29 +316,7 @@ static bool api_lsa_create_account(pipes_struct *p) static bool api_lsa_open_account(pipes_struct *p) { - LSA_Q_OPENACCOUNT q_u; - LSA_R_OPENACCOUNT r_u; - - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!lsa_io_q_open_account("", &q_u, data, 0)) { - DEBUG(0,("api_lsa_open_account: failed to unmarshall LSA_Q_OPENACCOUNT.\n")); - return False; - } - - r_u.status = _lsa_open_account(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if(!lsa_io_r_open_account("", &r_u, rdata, 0)) { - DEBUG(0,("api_lsa_open_account: Failed to marshall LSA_R_OPENACCOUNT.\n")); - return False; - } - - return True; + return proxy_lsa_call(p, NDR_LSA_OPENACCOUNT); } /*************************************************************************** @@ -378,29 +356,7 @@ static bool api_lsa_enum_privsaccount(pipes_struct *p) static bool api_lsa_getsystemaccount(pipes_struct *p) { - LSA_Q_GETSYSTEMACCOUNT q_u; - LSA_R_GETSYSTEMACCOUNT r_u; - - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!lsa_io_q_getsystemaccount("", &q_u, data, 0)) { - DEBUG(0,("api_lsa_getsystemaccount: failed to unmarshall LSA_Q_GETSYSTEMACCOUNT.\n")); - return False; - } - - r_u.status = _lsa_getsystemaccount(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if(!lsa_io_r_getsystemaccount("", &r_u, rdata, 0)) { - DEBUG(0,("api_lsa_getsystemaccount: Failed to marshall LSA_R_GETSYSTEMACCOUNT.\n")); - return False; - } - - return True; + return proxy_lsa_call(p, NDR_LSA_GETSYSTEMACCESSACCOUNT); } @@ -410,29 +366,7 @@ static bool api_lsa_getsystemaccount(pipes_struct *p) static bool api_lsa_setsystemaccount(pipes_struct *p) { - LSA_Q_SETSYSTEMACCOUNT q_u; - LSA_R_SETSYSTEMACCOUNT r_u; - - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!lsa_io_q_setsystemaccount("", &q_u, data, 0)) { - DEBUG(0,("api_lsa_setsystemaccount: failed to unmarshall LSA_Q_SETSYSTEMACCOUNT.\n")); - return False; - } - - r_u.status = _lsa_setsystemaccount(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if(!lsa_io_r_setsystemaccount("", &r_u, rdata, 0)) { - DEBUG(0,("api_lsa_setsystemaccount: Failed to marshall LSA_R_SETSYSTEMACCOUNT.\n")); - return False; - } - - return True; + return proxy_lsa_call(p, NDR_LSA_SETSYSTEMACCESSACCOUNT); } /*************************************************************************** diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index c197f20bfe..247a52df46 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -1655,16 +1655,17 @@ NTSTATUS _lsa_CreateAccount(pipes_struct *p, /*************************************************************************** - Lsa Open Account + _lsa_OpenAccount ***************************************************************************/ -NTSTATUS _lsa_open_account(pipes_struct *p, LSA_Q_OPENACCOUNT *q_u, LSA_R_OPENACCOUNT *r_u) +NTSTATUS _lsa_OpenAccount(pipes_struct *p, + struct lsa_OpenAccount *r) { struct lsa_info *handle; struct lsa_info *info; /* find the connection policy handle. */ - if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) + if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) return NT_STATUS_INVALID_HANDLE; /* check if the user have enough rights */ @@ -1686,11 +1687,11 @@ NTSTATUS _lsa_open_account(pipes_struct *p, LSA_Q_OPENACCOUNT *q_u, LSA_R_OPENAC return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(info); - info->sid = q_u->sid.sid; - info->access = q_u->access; + info->sid = *r->in.sid; + info->access = r->in.access_mask; /* get a (unique) handle. open a policy on it. */ - if (!create_policy_hnd(p, &r_u->pol, free_lsa_info, (void *)info)) + if (!create_policy_hnd(p, *r->out.acct_handle, free_lsa_info, (void *)info)) return NT_STATUS_OBJECT_NAME_NOT_FOUND; return NT_STATUS_OK; @@ -1732,16 +1733,17 @@ NTSTATUS _lsa_enum_privsaccount(pipes_struct *p, prs_struct *ps, LSA_Q_ENUMPRIVS } /*************************************************************************** - + _lsa_GetSystemAccessAccount ***************************************************************************/ -NTSTATUS _lsa_getsystemaccount(pipes_struct *p, LSA_Q_GETSYSTEMACCOUNT *q_u, LSA_R_GETSYSTEMACCOUNT *r_u) +NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p, + struct lsa_GetSystemAccessAccount *r) { struct lsa_info *info=NULL; /* find the connection policy handle. */ - if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info)) + if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info)) return NT_STATUS_INVALID_HANDLE; if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL)) @@ -1756,7 +1758,7 @@ NTSTATUS _lsa_getsystemaccount(pipes_struct *p, LSA_Q_GETSYSTEMACCOUNT *q_u, LSA they can be ORed together */ - r_u->access = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK; + *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK; return NT_STATUS_OK; } @@ -1765,14 +1767,14 @@ NTSTATUS _lsa_getsystemaccount(pipes_struct *p, LSA_Q_GETSYSTEMACCOUNT *q_u, LSA update the systemaccount information ***************************************************************************/ -NTSTATUS _lsa_setsystemaccount(pipes_struct *p, LSA_Q_SETSYSTEMACCOUNT *q_u, LSA_R_SETSYSTEMACCOUNT *r_u) +NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p, + struct lsa_SetSystemAccessAccount *r) { struct lsa_info *info=NULL; GROUP_MAP map; - r_u->status = NT_STATUS_OK; /* find the connection policy handle. */ - if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info)) + if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info)) return NT_STATUS_INVALID_HANDLE; /* check to see if the pipe_user is a Domain Admin since @@ -2240,12 +2242,6 @@ NTSTATUS _lsa_LookupSids(pipes_struct *p, struct lsa_LookupSids *r) return NT_STATUS_NOT_IMPLEMENTED; } -NTSTATUS _lsa_OpenAccount(pipes_struct *p, struct lsa_OpenAccount *r) -{ - p->rng_fault_state = True; - return NT_STATUS_NOT_IMPLEMENTED; -} - NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, struct lsa_EnumPrivsAccount *r) { p->rng_fault_state = True; @@ -2276,18 +2272,6 @@ NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccoun return NT_STATUS_NOT_IMPLEMENTED; } -NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p, struct lsa_GetSystemAccessAccount *r) -{ - p->rng_fault_state = True; - return NT_STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p, struct lsa_SetSystemAccessAccount *r) -{ - p->rng_fault_state = True; - return NT_STATUS_NOT_IMPLEMENTED; -} - NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r) { p->rng_fault_state = True; diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 9ed7014bff..4c242dc323 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -586,8 +586,9 @@ NTSTATUS _samr_OpenDomain(pipes_struct *p, if ( !find_policy_by_hnd(p, r->in.connect_handle, (void**)(void *)&info) ) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function( info->acc_granted, - SA_RIGHT_SAM_OPEN_DOMAIN, "_samr_OpenDomain" ); + status = access_check_samr_function(info->acc_granted, + SA_RIGHT_SAM_OPEN_DOMAIN, + "_samr_OpenDomain" ); if ( !NT_STATUS_IS_OK(status) ) return status; @@ -728,7 +729,9 @@ NTSTATUS _samr_SetSecurity(pipes_struct *p, return NT_STATUS_ACCESS_DENIED; } - status = access_check_samr_function(acc_granted, SA_RIGHT_USER_SET_ATTRIBUTES, "_samr_SetSecurity"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_USER_SET_ATTRIBUTES, + "_samr_SetSecurity"); if (NT_STATUS_IS_OK(status)) { become_root(); status = pdb_update_sam_account(sampass); @@ -1550,9 +1553,9 @@ NTSTATUS _samr_LookupNames(pipes_struct *p, /******************************************************************* _samr_ChangePasswordUser2 ********************************************************************/ + NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, struct samr_ChangePasswordUser2 *r) - { NTSTATUS status; fstring user_name; @@ -1577,8 +1580,12 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, * is case insensitive. */ - status = pass_oem_change(user_name, r->in.lm_password->data, r->in.lm_verifier->hash, - r->in.nt_password->data, r->in.nt_verifier->hash, NULL); + status = pass_oem_change(user_name, + r->in.lm_password->data, + r->in.lm_verifier->hash, + r->in.nt_password->data, + r->in.nt_verifier->hash, + NULL); DEBUG(5,("_samr_ChangePasswordUser2: %d\n", __LINE__)); @@ -1825,8 +1832,9 @@ NTSTATUS _samr_OpenUser(pipes_struct *p, if ( !get_lsa_policy_samr_sid(p, &domain_pol, &sid, &acc_granted, NULL) ) return NT_STATUS_INVALID_HANDLE; - nt_status = access_check_samr_function( acc_granted, - SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenUser" ); + nt_status = access_check_samr_function(acc_granted, + SA_RIGHT_DOMAIN_OPEN_ACCOUNT, + "_samr_OpenUser" ); if ( !NT_STATUS_IS_OK(nt_status) ) return nt_status; @@ -2940,6 +2948,7 @@ NTSTATUS _samr_Connect5(pipes_struct *p, /********************************************************************** _samr_LookupDomain **********************************************************************/ + NTSTATUS _samr_LookupDomain(pipes_struct *p, struct samr_LookupDomain *r) { @@ -3079,7 +3088,8 @@ NTSTATUS _samr_OpenAlias(pipes_struct *p, return NT_STATUS_INVALID_HANDLE; status = access_check_samr_function(acc_granted, - SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenAlias"); + SA_RIGHT_DOMAIN_OPEN_ACCOUNT, + "_samr_OpenAlias"); if ( !NT_STATUS_IS_OK(status) ) return status; @@ -3894,8 +3904,12 @@ NTSTATUS _samr_GetAliasMembership(pipes_struct *p, if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) return NT_STATUS_INVALID_HANDLE; - ntstatus1 = access_check_samr_function(info->acc_granted, SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM, "_samr_GetAliasMembership"); - ntstatus2 = access_check_samr_function(info->acc_granted, SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_GetAliasMembership"); + ntstatus1 = access_check_samr_function(info->acc_granted, + SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM, + "_samr_GetAliasMembership"); + ntstatus2 = access_check_samr_function(info->acc_granted, + SA_RIGHT_DOMAIN_OPEN_ACCOUNT, + "_samr_GetAliasMembership"); if (!NT_STATUS_IS_OK(ntstatus1) || !NT_STATUS_IS_OK(ntstatus2)) { if (!(NT_STATUS_EQUAL(ntstatus1,NT_STATUS_ACCESS_DENIED) && NT_STATUS_IS_OK(ntstatus2)) && @@ -3960,7 +3974,9 @@ NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.alias_handle, &alias_sid, &acc_granted, NULL)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_ALIAS_GET_MEMBERS, "_samr_GetMembersInAlias"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_ALIAS_GET_MEMBERS, + "_samr_GetMembersInAlias"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4026,7 +4042,9 @@ NTSTATUS _samr_QueryGroupMember(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, NULL)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_GROUP_GET_MEMBERS, "_samr_QueryGroupMember"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_GROUP_GET_MEMBERS, + "_samr_QueryGroupMember"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4088,7 +4106,9 @@ NTSTATUS _samr_AddAliasMember(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.alias_handle, &alias_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_ALIAS_ADD_MEMBER, "_samr_AddAliasMember"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_ALIAS_ADD_MEMBER, + "_samr_AddAliasMember"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4135,7 +4155,9 @@ NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.alias_handle, &alias_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_ALIAS_REMOVE_MEMBER, "_samr_DeleteAliasMember"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_ALIAS_REMOVE_MEMBER, + "_samr_DeleteAliasMember"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4184,7 +4206,9 @@ NTSTATUS _samr_AddGroupMember(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_GROUP_ADD_MEMBER, "_samr_AddGroupMember"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_GROUP_ADD_MEMBER, + "_samr_AddGroupMember"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4242,7 +4266,9 @@ NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_GROUP_REMOVE_MEMBER, "_samr_DeleteGroupMember"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_GROUP_REMOVE_MEMBER, + "_samr_DeleteGroupMember"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4294,7 +4320,9 @@ NTSTATUS _samr_DeleteUser(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.user_handle, &user_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteUser"); + status = access_check_samr_function(acc_granted, + STD_RIGHT_DELETE_ACCESS, + "_samr_DeleteUser"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4379,7 +4407,9 @@ NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteDomainGroup"); + status = access_check_samr_function(acc_granted, + STD_RIGHT_DELETE_ACCESS, + "_samr_DeleteDomainGroup"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4446,7 +4476,9 @@ NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, memcpy(r->out.alias_handle, r->in.alias_handle, sizeof(r->out.alias_handle)); - status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteDomAlias"); + status = access_check_samr_function(acc_granted, + STD_RIGHT_DELETE_ACCESS, + "_samr_DeleteDomAlias"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4513,7 +4545,9 @@ NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &dom_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - status = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_GROUP, "_samr_CreateDomainGroup"); + status = access_check_samr_function(acc_granted, + SA_RIGHT_DOMAIN_CREATE_GROUP, + "_samr_CreateDomainGroup"); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -4593,7 +4627,9 @@ NTSTATUS _samr_CreateDomAlias(pipes_struct *p, if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &dom_sid, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - result = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_ALIAS, "_samr_CreateDomAlias"); + result = access_check_samr_function(acc_granted, + SA_RIGHT_DOMAIN_CREATE_ALIAS, + "_samr_CreateDomAlias"); if (!NT_STATUS_IS_OK(result)) { return result; } @@ -4982,7 +5018,8 @@ NTSTATUS _samr_OpenGroup(pipes_struct *p, return NT_STATUS_INVALID_HANDLE; status = access_check_samr_function(acc_granted, - SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenGroup"); + SA_RIGHT_DOMAIN_OPEN_ACCOUNT, + "_samr_OpenGroup"); if ( !NT_STATUS_IS_OK(status) ) return status; @@ -5053,8 +5090,9 @@ NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, &acc_granted, &disp_info)) return NT_STATUS_INVALID_HANDLE; - result = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, - "_samr_RemoveMemberFromForeignDomain"); + result = access_check_samr_function(acc_granted, + STD_RIGHT_DELETE_ACCESS, + "_samr_RemoveMemberFromForeignDomain"); if (!NT_STATUS_IS_OK(result)) return result; diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index fb8ca76d3b..54791f143c 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -632,7 +632,7 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli, const char **argv) { POLICY_HND dom_pol; - POLICY_HND user_pol; + POLICY_HND *user_pol = NULL; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 access_desired = 0x000f000f; @@ -657,12 +657,16 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_open_account(cli, mem_ctx, &dom_pol, &sid, access_desired, &user_pol); + result = rpccli_lsa_OpenAccount(cli, mem_ctx, + &dom_pol, + &sid, + access_desired, + &user_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, &user_pol, &count, &set); + result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, user_pol, &count, &set); if (!NT_STATUS_IS_OK(result)) goto done; @@ -1008,7 +1012,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli, result = rpccli_lsa_QueryTrustedDomainInfoByName(cli, mem_ctx, &pol, - trusted_domain, + &trusted_domain, info_class, &info); if (!NT_STATUS_IS_OK(result)) diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index ecd033f39d..a752003e8d 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -126,13 +126,14 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - WERROR result; + NTSTATUS result; + WERROR werr = WERR_OK; uint32 flags = DS_RETURN_DNS_NAME; const char *server_name = cli->cli->desthost; const char *domain_name; struct GUID domain_guid = GUID_zero(); struct GUID site_guid = GUID_zero(); - struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + struct netr_DsRGetDCNameInfo *info = NULL; if (argc < 2) { fprintf(stderr, "Usage: %s [domain_name] [domain_guid] " @@ -160,20 +161,25 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, debug_dsdcinfo_flags(1,flags); - result = rpccli_netlogon_dsr_getdcname(cli, mem_ctx, server_name, domain_name, - &domain_guid, &site_guid, flags, - &info); + result = rpccli_netr_DsRGetDCName(cli, mem_ctx, + server_name, + domain_name, + &domain_guid, + &site_guid, + flags, + &info, + &werr); - if (W_ERROR_IS_OK(result)) { - d_printf("DsGetDcName gave\n"); - display_ds_domain_controller_info(mem_ctx, info); + if (W_ERROR_IS_OK(werr)) { + d_printf("DsGetDcName gave: %s\n", + NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info)); return WERR_OK; } printf("rpccli_netlogon_dsr_getdcname returned %s\n", - dos_errstr(result)); + dos_errstr(werr)); - return result; + return werr; } static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index edc3c9d4b2..4f0e45ec74 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -245,7 +245,7 @@ static void display_sam_info_1(struct samr_DispEntryGeneral *r) { printf("index: 0x%x ", r->idx); printf("RID: 0x%x ", r->rid); - printf("acb: 0x%x ", r->acct_flags); + printf("acb: 0x%08x ", r->acct_flags); printf("Account: %s\t", r->account_name.string); printf("Name: %s\t", r->full_name.string); printf("Desc: %s\n", r->description.string); @@ -255,7 +255,7 @@ static void display_sam_info_2(struct samr_DispEntryFull *r) { printf("index: 0x%x ", r->idx); printf("RID: 0x%x ", r->rid); - printf("acb: 0x%x ", r->acct_flags); + printf("acb: 0x%08x ", r->acct_flags); printf("Account: %s\t", r->account_name.string); printf("Desc: %s\n", r->description.string); } @@ -264,7 +264,7 @@ static void display_sam_info_3(struct samr_DispEntryFullGroup *r) { printf("index: 0x%x ", r->idx); printf("RID: 0x%x ", r->rid); - printf("acb: 0x%x ", r->acct_flags); + printf("acb: 0x%08x ", r->acct_flags); printf("Account: %s\t", r->account_name.string); printf("Desc: %s\n", r->description.string); } @@ -1046,6 +1046,72 @@ static NTSTATUS cmd_samr_enum_als_groups(struct rpc_pipe_client *cli, return result; } +/* Enumerate domains */ + +static NTSTATUS cmd_samr_enum_domains(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + POLICY_HND connect_pol; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + uint32 start_idx, size, num_entries, i; + uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + bool got_connect_pol = false; + struct samr_SamArray *sam = NULL; + + if ((argc < 1) || (argc > 2)) { + printf("Usage: %s [access mask]\n", argv[0]); + return NT_STATUS_OK; + } + + if (argc > 2) { + sscanf(argv[2], "%x", &access_mask); + } + + /* Get sam policy handle */ + + result = try_samr_connects(cli, mem_ctx, + access_mask, + &connect_pol); + + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + got_connect_pol = true; + + /* Enumerate alias groups */ + + start_idx = 0; + size = 0xffff; + + do { + result = rpccli_samr_EnumDomains(cli, mem_ctx, + &connect_pol, + &start_idx, + &sam, + size, + &num_entries); + + if (NT_STATUS_IS_OK(result) || + NT_STATUS_V(result) == NT_STATUS_V(STATUS_MORE_ENTRIES)) { + + for (i = 0; i < num_entries; i++) + printf("name:[%s] idx:[0x%x]\n", + sam->entries[i].name.string, + sam->entries[i].idx); + } + } while (NT_STATUS_V(result) == NT_STATUS_V(STATUS_MORE_ENTRIES)); + + done: + if (got_connect_pol) { + rpccli_samr_Close(cli, mem_ctx, &connect_pol); + } + + return result; +} + + /* Query alias membership */ static NTSTATUS cmd_samr_query_aliasmem(struct rpc_pipe_client *cli, @@ -2485,6 +2551,7 @@ struct cmd_set samr_commands[] = { { "enumdomusers", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_users, NULL, PI_SAMR, NULL, "Enumerate domain users", "" }, { "enumdomgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_groups, NULL, PI_SAMR, NULL, "Enumerate domain groups", "" }, { "enumalsgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_als_groups, NULL, PI_SAMR, NULL, "Enumerate alias groups", "" }, + { "enumdomains", RPC_RTYPE_NTSTATUS, cmd_samr_enum_domains, NULL, PI_SAMR, NULL, "Enumerate domains", "" }, { "createdomuser", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_user, NULL, PI_SAMR, NULL, "Create domain user", "" }, { "createdomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_group, NULL, PI_SAMR, NULL, "Create domain group", "" }, diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index dbdab65f70..0f536cdfb8 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -602,19 +602,20 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000); if (our_domain->active_directory) { - struct DS_DOMAIN_CONTROLLER_INFO *domain_info = NULL; - - werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe, - mem_ctx, - our_domain->dcname, - domain->name, - NULL, - NULL, - DS_RETURN_DNS_NAME, - &domain_info); + struct netr_DsRGetDCNameInfo *domain_info = NULL; + + result = rpccli_netr_DsRGetDCName(netlogon_pipe, + mem_ctx, + our_domain->dcname, + domain->name, + NULL, + NULL, + DS_RETURN_DNS_NAME, + &domain_info, + &werr); if (W_ERROR_IS_OK(werr)) { tmp = talloc_strdup( - mem_ctx, domain_info->domain_controller_name); + mem_ctx, domain_info->dc_unc); if (tmp == NULL) { DEBUG(0, ("talloc_strdup failed\n")); talloc_destroy(mem_ctx); @@ -626,7 +627,7 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, } if (strlen(domain->forest_name) == 0) { fstrcpy(domain->forest_name, - domain_info->dns_forest_name); + domain_info->forest_name); } } } else { |