From 5da927716a857ce686f3b75476671d32f047d2c0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 23:33:52 +0100 Subject: Remove unused marshalling for NET_DSR_GETDCNAME. Guenther (This used to be commit 65c2aa344e45064cbfddd87715862d60f7ac2a8a) --- source3/include/rpc_netlogon.h | 33 ------ source3/rpc_client/cli_netlogon.c | 136 ---------------------- source3/rpc_parse/parse_net.c | 236 -------------------------------------- 3 files changed, 405 deletions(-) (limited to 'source3') 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/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_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; -} -- cgit