summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-10-07 05:26:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:18 -0500
commit7b84b133fe375e69817fe5c76089f67280507809 (patch)
tree8171348f76887d3d757d44246f1193f0663bfd88 /source3/rpc_client
parente0b6961ac5b501f51bd004a392c606e3ef308fee (diff)
downloadsamba-7b84b133fe375e69817fe5c76089f67280507809.tar.gz
samba-7b84b133fe375e69817fe5c76089f67280507809.tar.bz2
samba-7b84b133fe375e69817fe5c76089f67280507809.zip
r19161: Add NET_GETANYDCNAME (getdcname only gives the PDC while getanydcname
gives just any DC), also make sure to set timeouts in rpcclient accordingly so that we actually get the DC's reply. Guenther (This used to be commit 6091c8152a3998d2503cb0911a217ee904509633)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_netlogon.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 5396de9bf0..28395de067 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -418,6 +418,44 @@ WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
return result;
}
+/* GetAnyDCName */
+
+WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, const char *mydcname,
+ const char *domainname, fstring newdcname)
+{
+ prs_struct qbuf, rbuf;
+ NET_Q_GETANYDCNAME q;
+ NET_R_GETANYDCNAME r;
+ WERROR result;
+ fstring mydcname_slash;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise input parameters */
+
+ slprintf(mydcname_slash, sizeof(fstring)-1, "\\\\%s", mydcname);
+ init_net_q_getanydcname(&q, mydcname_slash, domainname);
+
+ /* Marshall data and send request */
+
+ CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETANYDCNAME,
+ q, r,
+ qbuf, rbuf,
+ net_io_q_getanydcname,
+ net_io_r_getanydcname,
+ WERR_GENERAL_FAILURE);
+
+ result = r.status;
+
+ if (W_ERROR_IS_OK(result)) {
+ rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
+ }
+
+ return result;
+}
+
/* Dsr_GetDCName */
WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,