summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_netlogon.c30
-rw-r--r--source3/rpcclient/display.c2
-rw-r--r--source3/rpcclient/rpcclient.c1
3 files changed, 31 insertions, 2 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 1ad71b7f4f..be5bf8596a 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -101,7 +101,7 @@ void cmd_netlogon_login_test(struct client_info *info)
{
unsigned char new_trust_passwd[16];
generate_random_buffer(new_trust_passwd, 16, True);
- res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd) : False;
+ res = res ? cli_nt_srv_pwset(smb_cli, nt_pipe_fnum, new_trust_passwd, SEC_CHAN_WKSTA) : False;
if (res)
{
@@ -174,3 +174,31 @@ void cmd_netlogon_domain_test(struct client_info *info)
nt_trust_dom, BOOLSTR(res));
}
+/****************************************************************************
+experimental SAM synchronisation.
+****************************************************************************/
+void cmd_sam_sync(struct client_info *info)
+{
+ uint16 nt_pipe_fnum;
+ BOOL res = True;
+ unsigned char trust_passwd[16];
+
+ DEBUG(5,("Attempting SAM Synchronisation with PDC\n"));
+
+ res = res ? trust_get_passwd(trust_passwd, smb_cli->domain, info->myhostname) : False;
+
+ /* open NETLOGON session. negotiate credentials */
+ res = res ? cli_nt_session_open(smb_cli, PIPE_NETLOGON, &nt_pipe_fnum) : False;
+
+ res = res ? cli_nt_setup_creds(smb_cli, nt_pipe_fnum, smb_cli->mach_acct,
+ trust_passwd, SEC_CHAN_BDC) : False;
+
+ res = res ? cli_net_sam_sync(smb_cli, nt_pipe_fnum, 0) : False;
+
+ memset(trust_passwd, 0, 16);
+
+ /* close the session */
+ cli_nt_session_close(smb_cli, nt_pipe_fnum);
+
+ fprintf(out_hnd,"cmd_sam_sync: test succeeded: %s\n", BOOLSTR(res));
+}
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index 060dac8d55..831378ab96 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -1476,7 +1476,7 @@ static void print_reg_value(FILE *out_hnd, char *val_name, uint32 val_type, BUFF
{
case 0x01: /* unistr */
{
- unistr_to_ascii(valstr, value->buffer,
+ unibuf_to_ascii(valstr, value->buffer,
MIN(value->buf_len, sizeof(valstr)-1));
fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, valstr);
break;
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index a0e3fe90a3..870555e6e2 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -142,6 +142,7 @@ struct
{"enumgroups", cmd_sam_enum_groups, "SAM Group Database Query (experimental!)"},
{"samgroups", cmd_sam_query_dominfo, "SAM Query Domain Info(experimental!)"},
{"querysecret", cmd_lsa_query_secret, "LSA Query Secret (developer use)"},
+ {"samsync", cmd_sam_sync, "SAM Synchronization Test (experimental)"},
{"quit", cmd_quit, "logoff the server"},
{"q", cmd_quit, "logoff the server"},
{"exit", cmd_quit, "logoff the server"},