mirror of
https://github.com/samba-team/samba.git
synced 2025-11-29 16:23:52 +03:00
Remove hand-written rpccli_netlogon_dsr_getdcnameex[2].
Guenther
This commit is contained in:
@@ -1096,41 +1096,6 @@ typedef struct net_r_dsr_getdcname {
|
||||
WERROR result;
|
||||
} NET_R_DSR_GETDCNAME;
|
||||
|
||||
/* NET_Q_DSR_GETDCNAMEEX */
|
||||
typedef struct net_q_dsr_getdcnameex {
|
||||
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_name;
|
||||
UNISTR2 uni_site_name;
|
||||
uint32 flags;
|
||||
} NET_Q_DSR_GETDCNAMEEX;
|
||||
|
||||
/* NET_R_DSR_GETDCNAMEEX */
|
||||
typedef struct net_r_dsr_getdcnameex NET_R_DSR_GETDCNAMEEX;
|
||||
|
||||
/* NET_Q_DSR_GETDCNAMEEX2 */
|
||||
typedef struct net_q_dsr_getdcnameex2 {
|
||||
uint32 ptr_server_unc;
|
||||
UNISTR2 uni_server_unc;
|
||||
uint32 ptr_client_account;
|
||||
UNISTR2 uni_client_account;
|
||||
uint32 mask;
|
||||
uint32 ptr_domain_name;
|
||||
UNISTR2 uni_domain_name;
|
||||
uint32 ptr_domain_guid;
|
||||
struct GUID *domain_guid;
|
||||
uint32 ptr_site_name;
|
||||
UNISTR2 uni_site_name;
|
||||
uint32 flags;
|
||||
} NET_Q_DSR_GETDCNAMEEX2;
|
||||
|
||||
/* NET_R_DSR_GETDCNAMEEX2 */
|
||||
typedef struct net_r_dsr_getdcnameex2 NET_R_DSR_GETDCNAMEEX2;
|
||||
|
||||
/* NET_Q_DSR_GESITENAME */
|
||||
typedef struct net_q_dsr_getsitename {
|
||||
uint32 ptr_computer_name;
|
||||
|
||||
@@ -593,109 +593,6 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
/* Dsr_GetDCNameEx */
|
||||
|
||||
WERROR rpccli_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *server_name,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info_out)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
NET_Q_DSR_GETDCNAMEEX 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_getdcnameex(&q, server_name, domain_name, domain_guid,
|
||||
site_name, flags);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
net_io_q_dsr_getdcnameex,
|
||||
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;
|
||||
}
|
||||
|
||||
/* Dsr_GetDCNameEx */
|
||||
|
||||
WERROR rpccli_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *server_name,
|
||||
const char *client_account,
|
||||
uint32 mask,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags,
|
||||
struct DS_DOMAIN_CONTROLLER_INFO **info_out)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
NET_Q_DSR_GETDCNAMEEX2 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_getdcnameex2(&q, server_name, domain_name, client_account,
|
||||
mask, domain_guid, site_name, flags);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX2,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
net_io_q_dsr_getdcnameex2,
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* Dsr_GetSiteName */
|
||||
|
||||
WERROR rpccli_netlogon_dsr_getsitename(struct rpc_pipe_client *cli,
|
||||
|
||||
@@ -3439,67 +3439,6 @@ void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc,
|
||||
r_t->flags = flags;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits a NET_Q_DSR_GETDCNAMEEX structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_net_q_dsr_getdcnameex(NET_Q_DSR_GETDCNAMEEX *r_t, const char *server_unc,
|
||||
const char *domain_name,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags)
|
||||
{
|
||||
DEBUG(5, ("init_net_q_dsr_getdcnameex\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_name = (site_name != NULL);
|
||||
init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
|
||||
|
||||
r_t->flags = flags;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits a NET_Q_DSR_GETDCNAMEEX2 structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_net_q_dsr_getdcnameex2(NET_Q_DSR_GETDCNAMEEX2 *r_t, const char *server_unc,
|
||||
const char *domain_name,
|
||||
const char *client_account,
|
||||
uint32 mask,
|
||||
struct GUID *domain_guid,
|
||||
const char *site_name,
|
||||
uint32_t flags)
|
||||
{
|
||||
DEBUG(5, ("init_net_q_dsr_getdcnameex2\n"));
|
||||
|
||||
r_t->ptr_server_unc = (server_unc != NULL);
|
||||
init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
|
||||
|
||||
r_t->ptr_client_account = (client_account != NULL);
|
||||
init_unistr2(&r_t->uni_client_account, client_account, UNI_STR_TERMINATE);
|
||||
|
||||
r_t->mask = mask;
|
||||
|
||||
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_name = (site_name != NULL);
|
||||
init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
|
||||
|
||||
r_t->flags = flags;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes an NET_Q_DSR_GETDCNAME structure.
|
||||
********************************************************************/
|
||||
@@ -3571,154 +3510,6 @@ bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t,
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes an NET_Q_DSR_GETDCNAMEEX structure.
|
||||
********************************************************************/
|
||||
|
||||
bool net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_t == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex");
|
||||
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_name", ps, depth, &r_t->ptr_site_name))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
|
||||
r_t->ptr_site_name, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("flags", ps, depth, &r_t->flags))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes an NET_Q_DSR_GETDCNAMEEX2 structure.
|
||||
********************************************************************/
|
||||
|
||||
bool net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_t == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex2");
|
||||
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_client_account", ps, depth, &r_t->ptr_client_account))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("client_account", &r_t->uni_client_account,
|
||||
r_t->ptr_client_account, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("mask", ps, depth, &r_t->mask))
|
||||
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_name", ps, depth, &r_t->ptr_site_name))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
|
||||
r_t->ptr_site_name, 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.
|
||||
********************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user