WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, const char *mydcname,
- const char *domainname, fstring newdcname)
+ const char *domainname, char **newdcname)
{
prs_struct qbuf, rbuf;
NET_Q_GETANYDCNAME q;
result = r.status;
- if (W_ERROR_IS_OK(result)) {
- rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
+ if (W_ERROR_IS_OK(result) && newdcname) {
+ *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
+ W_ERROR_HAVE_NO_MEMORY(*newdcname);
}
return result;
WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, const char *mydcname,
- const char *domainname, fstring newdcname)
+ const char *domainname, char **newdcname)
{
prs_struct qbuf, rbuf;
NET_Q_GETDCNAME q;
result = r.status;
- if (W_ERROR_IS_OK(result)) {
- rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
+ if (W_ERROR_IS_OK(result) && newdcname) {
+ *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
+ W_ERROR_HAVE_NO_MEMORY(*newdcname);
}
return result;
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- fstring dcname;
+ char *dcname = NULL;
WERROR result = WERR_GENERAL_FAILURE;
int old_timeout;
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+ result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
cli_set_timeout(cli->cli, old_timeout);
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- fstring dcname;
+ char *dcname = NULL;
WERROR result = WERR_GENERAL_FAILURE;
int old_timeout;
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+ result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
cli_set_timeout(cli->cli, old_timeout);
WERROR werr;
TALLOC_CTX *mem_ctx;
unsigned int orig_timeout;
- fstring tmp;
+ char *tmp = NULL;
char *p;
/* Hmmmm. We can only open one connection to the NETLOGON pipe at the
orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, our_domain->dcname,
- domain->name, tmp);
+ domain->name, &tmp);
/* And restore our original timeout. */
cli_set_timeout(netlogon_pipe->cli, orig_timeout);
enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
struct winbindd_cli_state *state)
{
- fstring dcname_slash;
+ char *dcname_slash = NULL;
char *p;
struct rpc_pipe_client *netlogon_pipe;
NTSTATUS result;
werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx,
domain->dcname,
state->request.domain_name,
- dcname_slash);
+ &dcname_slash);
} else {
werr = rpccli_netlogon_getanydcname(netlogon_pipe, state->mem_ctx,
domain->dcname,
state->request.domain_name,
- dcname_slash);
+ &dcname_slash);
}
/* And restore our original timeout. */
cli_set_timeout(netlogon_pipe->cli, orig_timeout);