From 6e88171bace32ea2f01367e86d87e1c70892084b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 12 Mar 1999 05:47:06 +0000 Subject: new "domtrust" test command. r&d into inter-domain trust accounts. (This used to be commit 65b0abe8b7594ff6c662da86dc2e35bd83a2d13d) --- source3/rpcclient/cmd_netlogon.c | 44 +++++++++++++++++++++++++++++++++++++++- source3/rpcclient/rpcclient.c | 1 + 2 files changed, 44 insertions(+), 1 deletion(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 6001327862..1ad71b7f4f 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -92,7 +92,9 @@ void cmd_netlogon_login_test(struct client_info *info) /* 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, trust_passwd) : False; + res = res ? cli_nt_setup_creds(smb_cli, nt_pipe_fnum, + smb_cli->mach_acct, + trust_passwd, SEC_CHAN_WKSTA) : False; /* change the machine password? */ if (global_machine_password_needs_changing) @@ -132,3 +134,43 @@ void cmd_netlogon_login_test(struct client_info *info) nt_user_name, BOOLSTR(res)); } +/**************************************************************************** +experimental nt login. +****************************************************************************/ +void cmd_netlogon_domain_test(struct client_info *info) +{ + uint16 nt_pipe_fnum; + + fstring nt_trust_dom; + BOOL res = True; + unsigned char trust_passwd[16]; + fstring inter_dom_acct; + + if (!next_token(NULL, nt_trust_dom, NULL, sizeof(nt_trust_dom))) + { + fprintf(out_hnd,"domtest: must specify domain name\n"); + return; + } + + DEBUG(5,("do_nt_login_test: domain %s\n", nt_trust_dom)); + + fstrcpy(inter_dom_acct, nt_trust_dom); + fstrcat(inter_dom_acct, "$"); + + res = res ? trust_get_passwd(trust_passwd, smb_cli->domain, nt_trust_dom) : 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, inter_dom_acct, + trust_passwd, SEC_CHAN_DOMAIN) : False; + + memset(trust_passwd, 0, 16); + + /* close the session */ + cli_nt_session_close(smb_cli, nt_pipe_fnum); + + fprintf(out_hnd,"cmd_nt_login: credentials (%s) test succeeded: %s\n", + nt_trust_dom, BOOLSTR(res)); +} + diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 6001812616..a9719b143b 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -116,6 +116,7 @@ struct {"reggetsec", cmd_reg_get_key_sec, " Registry Key Security"}, {"regtestsec", cmd_reg_test_key_sec, " Test Registry Key Security"}, {"ntlogin", cmd_netlogon_login_test, "[username] [password] NT Domain login test"}, + {"domtrust", cmd_netlogon_domain_test, " NT Inter-Domain test"}, {"wksinfo", cmd_wks_query_info, "Workstation Query Info"}, {"srvinfo", cmd_srv_query_info, "Server Query Info"}, {"srvsessions",cmd_srv_enum_sess, "List sessions on a server"}, -- cgit