summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_netlogon.c69
-rw-r--r--source3/rpcclient/cmd_spoolss.c14
-rw-r--r--source3/rpcclient/rpcclient.c2
3 files changed, 76 insertions, 9 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 6efa316cf4..9955d2d3fa 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -221,7 +221,7 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,
}
printf("rpccli_netlogon_dsr_getdcname returned %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
return werr;
}
@@ -1040,6 +1040,72 @@ static WERROR cmd_netlogon_getdcsitecoverage(struct rpc_pipe_client *cli,
return werr;
}
+static NTSTATUS cmd_netlogon_database_redo(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, int argc,
+ const char **argv)
+{
+ NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ const char *server_name = cli->desthost;
+ uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
+ struct netr_Authenticator clnt_creds, srv_cred;
+ struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL;
+ unsigned char trust_passwd_hash[16];
+ uint32_t sec_channel_type = 0;
+ struct netr_ChangeLogEntry e;
+ uint32_t rid = 500;
+
+ if (argc > 2) {
+ fprintf(stderr, "Usage: %s <user rid>\n", argv[0]);
+ return NT_STATUS_OK;
+ }
+
+ if (argc == 2) {
+ sscanf(argv[1], "%d", &rid);
+ }
+
+ if (!secrets_fetch_trust_account_password(lp_workgroup(),
+ trust_passwd_hash,
+ NULL, &sec_channel_type)) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ status = rpccli_netlogon_setup_creds(cli,
+ server_name, /* server name */
+ lp_workgroup(), /* domain */
+ global_myname(), /* client name */
+ global_myname(), /* machine account name */
+ trust_passwd_hash,
+ sec_channel_type,
+ &neg_flags);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ netlogon_creds_client_step(cli->dc, &clnt_creds);
+
+ ZERO_STRUCT(e);
+
+ e.object_rid = rid;
+ e.db_index = SAM_DATABASE_DOMAIN;
+ e.delta_type = NETR_DELTA_USER;
+
+ status = rpccli_netr_DatabaseRedo(cli, mem_ctx,
+ server_name,
+ global_myname(),
+ &clnt_creds,
+ &srv_cred,
+ e,
+ 0, /* is calculated automatically */
+ &delta_enum_array);
+
+ if (!netlogon_creds_client_check(cli->dc, &srv_cred.cred)) {
+ DEBUG(0,("credentials chain check failed\n"));
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ return status;
+}
/* List of commands exported by this module */
@@ -1067,6 +1133,7 @@ struct cmd_set netlogon_commands[] = {
{ "netrenumtrusteddomains", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomains, &ndr_table_netlogon.syntax_id, NULL, "Enumerate trusted domains", "" },
{ "netrenumtrusteddomainsex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomainsex, &ndr_table_netlogon.syntax_id, NULL, "Enumerate trusted domains", "" },
{ "getdcsitecoverage", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcsitecoverage, &ndr_table_netlogon.syntax_id, NULL, "Get the Site-Coverage from a DC", "" },
+ { "database_redo", RPC_RTYPE_NTSTATUS, cmd_netlogon_database_redo, NULL, &ndr_table_netlogon.syntax_id, NULL, "Replicate single object from a DC", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 378ec891a7..26a73203b9 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1539,7 +1539,7 @@ static WERROR cmd_spoolss_deletedriverex(struct rpc_pipe_client *cli,
{
if ( !W_ERROR_EQUAL(result, WERR_UNKNOWN_PRINTER_DRIVER) ) {
printf ("Failed to remove driver %s for arch [%s] (version: %d): %s\n",
- argv[1], archi_table[i].long_archi, archi_table[i].version, dos_errstr(result));
+ argv[1], archi_table[i].long_archi, archi_table[i].version, win_errstr(result));
}
}
else
@@ -2555,7 +2555,7 @@ static bool compare_printer( struct rpc_pipe_client *cli1, POLICY_HND *hnd1,
printf("Retrieving printer propertiesfor %s...", cli1->desthost);
werror = rpccli_spoolss_getprinter( cli1, mem_ctx, hnd1, 2, &ctr1);
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
talloc_destroy(mem_ctx);
return False;
}
@@ -2564,7 +2564,7 @@ static bool compare_printer( struct rpc_pipe_client *cli1, POLICY_HND *hnd1,
printf("Retrieving printer properties for %s...", cli2->desthost);
werror = rpccli_spoolss_getprinter( cli2, mem_ctx, hnd2, 2, &ctr2);
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
talloc_destroy(mem_ctx);
return False;
}
@@ -2591,7 +2591,7 @@ static bool compare_printer_secdesc( struct rpc_pipe_client *cli1, POLICY_HND *h
printf("Retrieving printer security for %s...", cli1->desthost);
werror = rpccli_spoolss_getprinter( cli1, mem_ctx, hnd1, 3, &ctr1);
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
result = False;
goto done;
}
@@ -2600,7 +2600,7 @@ static bool compare_printer_secdesc( struct rpc_pipe_client *cli1, POLICY_HND *h
printf("Retrieving printer security for %s...", cli2->desthost);
werror = rpccli_spoolss_getprinter( cli2, mem_ctx, hnd2, 3, &ctr2);
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
result = False;
goto done;
}
@@ -2701,7 +2701,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
werror = rpccli_spoolss_open_printer_ex( cli, mem_ctx, printername_path,
"", PRINTER_ALL_ACCESS, servername1, cli_server1->user_name, &hPrinter1);
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
goto done;
}
printf("ok\n");
@@ -2717,7 +2717,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
werror = rpccli_spoolss_open_printer_ex( cli2, mem_ctx, printername_path,
"", PRINTER_ALL_ACCESS, servername2, cli_server2->user_name, &hPrinter2 );
if ( !W_ERROR_IS_OK(werror) ) {
- printf("failed (%s)\n", dos_errstr(werror));
+ printf("failed (%s)\n", win_errstr(werror));
goto done;
}
printf("ok\n");
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index e4cdd9c3f3..61d8d7c485 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -669,7 +669,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, (const char **) argv);
/* print out the DOS error */
if (!W_ERROR_IS_OK(wresult)) {
- printf( "result was %s\n", dos_errstr(wresult));
+ printf( "result was %s\n", win_errstr(wresult));
}
ntresult = W_ERROR_IS_OK(wresult)?NT_STATUS_OK:NT_STATUS_UNSUCCESSFUL;
}