summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-04-02 12:56:18 +0000
committerVolker Lendecke <vlendec@samba.org>2004-04-02 12:56:18 +0000
commit044c6f513dca21d4fc01db4a686c75d43d4952d2 (patch)
tree212fe9763acacfab4f671746ec6cec45a217996e /source3/rpc_client
parent620e1eaddc5e72cbfc8fb7de69b56167fcb3d34d (diff)
downloadsamba-044c6f513dca21d4fc01db4a686c75d43d4952d2.tar.gz
samba-044c6f513dca21d4fc01db4a686c75d43d4952d2.tar.bz2
samba-044c6f513dca21d4fc01db4a686c75d43d4952d2.zip
Implement NETLOGON GetDCName client side. You can ask a DC for the name of
a DC it trusts. Volker (This used to be commit ae6840320ff47827c2817549fe3133a57e3fe77f)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_netlogon.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 70ac460303..f6d88a1950 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -331,6 +331,55 @@ NTSTATUS cli_netlogon_logon_ctrl2(struct cli_state *cli, TALLOC_CTX *mem_ctx,
return result;
}
+/* GetDCName */
+
+NTSTATUS cli_netlogon_getdcname(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ const char *domainname, fstring dcname)
+{
+ prs_struct qbuf, rbuf;
+ NET_Q_GETDCNAME q;
+ NET_R_GETDCNAME r;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ init_net_q_getdcname(&q, cli->srv_name_slash, domainname);
+
+ /* Marshall data and send request */
+
+ if (!net_io_q_getdcname("", &q, &qbuf, 0) ||
+ !rpc_api_pipe_req(cli, NET_GETDCNAME, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!net_io_r_getdcname("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ result = r.status;
+
+ if (NT_STATUS_IS_OK(result))
+ rpcstr_pull_unistr2_fstring(dcname, &r.uni_dcname);
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
/****************************************************************************
Generate the next creds to use.
****************************************************************************/