summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_netlogon.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient/cmd_netlogon.c')
-rw-r--r--source3/rpcclient/cmd_netlogon.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index b55306ddc8..153daa5cf2 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -22,7 +22,7 @@
#include "includes.h"
#include "rpcclient.h"
-static NTSTATUS cmd_netlogon_logon_ctrl2(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -34,7 +34,7 @@ static NTSTATUS cmd_netlogon_logon_ctrl2(struct cli_state *cli,
return NT_STATUS_OK;
}
- result = cli_netlogon_logon_ctrl2(cli, mem_ctx, query_level);
+ result = rpccli_netlogon_logon_ctrl2(cli, mem_ctx, query_level);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -45,7 +45,7 @@ static NTSTATUS cmd_netlogon_logon_ctrl2(struct cli_state *cli,
return result;
}
-static NTSTATUS cmd_netlogon_getdcname(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -57,7 +57,7 @@ static NTSTATUS cmd_netlogon_getdcname(struct cli_state *cli,
return NT_STATUS_OK;
}
- result = cli_netlogon_getdcname(cli, mem_ctx, argv[1], dcname);
+ result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -70,7 +70,7 @@ static NTSTATUS cmd_netlogon_getdcname(struct cli_state *cli,
return result;
}
-static NTSTATUS cmd_netlogon_logon_ctrl(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_logon_ctrl(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -166,7 +166,7 @@ static void display_sam_sync(uint32 num_deltas, SAM_DELTA_HDR *hdr_deltas,
/* Perform sam synchronisation */
-static NTSTATUS cmd_netlogon_sam_sync(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_sam_sync(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -174,7 +174,6 @@ static NTSTATUS cmd_netlogon_sam_sync(struct cli_state *cli,
uint32 database_id = 0, num_deltas;
SAM_DELTA_HDR *hdr_deltas;
SAM_DELTA_CTR *deltas;
- DOM_CRED ret_creds;
if (argc > 2) {
fprintf(stderr, "Usage: %s [database_id]\n", argv[0]);
@@ -184,12 +183,9 @@ static NTSTATUS cmd_netlogon_sam_sync(struct cli_state *cli,
if (argc == 2)
database_id = atoi(argv[1]);
- /* on first call the returnAuthenticator is empty */
- memset(&ret_creds, 0, sizeof(ret_creds));
-
/* Synchronise sam database */
- result = cli_netlogon_sam_sync(cli, mem_ctx, &ret_creds, database_id,
+ result = rpccli_netlogon_sam_sync(cli, mem_ctx, database_id,
0, &num_deltas, &hdr_deltas, &deltas);
if (!NT_STATUS_IS_OK(result))
@@ -205,7 +201,7 @@ static NTSTATUS cmd_netlogon_sam_sync(struct cli_state *cli,
/* Perform sam delta synchronisation */
-static NTSTATUS cmd_netlogon_sam_deltas(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_sam_deltas(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -226,7 +222,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct cli_state *cli,
seqnum.low = tmp & 0xffff;
seqnum.high = 0;
- result = cli_netlogon_sam_deltas(cli, mem_ctx, database_id,
+ result = rpccli_netlogon_sam_deltas(cli, mem_ctx, database_id,
seqnum, &num_deltas,
&hdr_deltas, &deltas);
@@ -243,7 +239,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct cli_state *cli,
/* Log on a domain user */
-static NTSTATUS cmd_netlogon_sam_logon(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_sam_logon(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -252,7 +248,6 @@ static NTSTATUS cmd_netlogon_sam_logon(struct cli_state *cli,
const char *username, *password;
uint32 neg_flags = 0x000001ff;
int auth_level = 2;
- DOM_CRED ret_creds;
/* Check arguments */
@@ -277,12 +272,8 @@ static NTSTATUS cmd_netlogon_sam_logon(struct cli_state *cli,
/* Perform the sam logon */
- ZERO_STRUCT(ret_creds);
+ result = rpccli_netlogon_sam_logon(cli, mem_ctx, lp_workgroup(), username, password, logon_type);
- result = cli_netlogon_sam_logon(cli, mem_ctx, &ret_creds, username, password, logon_type);
-
- clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &ret_creds);
-
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -292,12 +283,11 @@ static NTSTATUS cmd_netlogon_sam_logon(struct cli_state *cli,
/* Change the trust account password */
-static NTSTATUS cmd_netlogon_change_trust_pw(struct cli_state *cli,
+static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- DOM_CRED ret_creds;
/* Check arguments */
@@ -308,13 +298,9 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct cli_state *cli,
/* Perform the sam logon */
- ZERO_STRUCT(ret_creds);
-
result = trust_pw_find_change_and_store_it(cli, mem_ctx,
lp_workgroup());
- clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &ret_creds);
-
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -329,13 +315,13 @@ struct cmd_set netlogon_commands[] = {
{ "NETLOGON" },
- { "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, "Logon Control 2", "" },
- { "getdcname", RPC_RTYPE_NTSTATUS, cmd_netlogon_getdcname, NULL, PI_NETLOGON, "Get trusted DC name", "" },
- { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, "Logon Control", "" },
- { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, PI_NETLOGON, "Sam Synchronisation", "" },
- { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, "Query Sam Deltas", "" },
- { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, PI_NETLOGON, "Sam Logon", "" },
- { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, PI_NETLOGON, "Change Trust Account Password", "" },
+ { "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, NULL, "Logon Control 2", "" },
+ { "getdcname", RPC_RTYPE_NTSTATUS, cmd_netlogon_getdcname, NULL, PI_NETLOGON, NULL, "Get trusted DC name", "" },
+ { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, NULL, "Logon Control", "" },
+ { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, PI_NETLOGON, NULL, "Sam Synchronisation", "" },
+ { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, NULL, "Query Sam Deltas", "" },
+ { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, PI_NETLOGON, NULL, "Sam Logon", "" },
+ { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, PI_NETLOGON, NULL, "Change Trust Account Password", "" },
{ NULL }
};