summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_netlogon.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-29 19:46:57 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-29 19:46:57 +0000
commite302cb2b189f679bcf7efe60d5ae9fb4218c1411 (patch)
treed9988ec9a4a7d04690e1c6684640c7f5a6c5685a /source3/rpcclient/cmd_netlogon.c
parentdbc916a25128967c9a227f84c4fd032f5d5a129e (diff)
downloadsamba-e302cb2b189f679bcf7efe60d5ae9fb4218c1411.tar.gz
samba-e302cb2b189f679bcf7efe60d5ae9fb4218c1411.tar.bz2
samba-e302cb2b189f679bcf7efe60d5ae9fb4218c1411.zip
first attempt at getting \PIPE\NETLOGON working. it's pretty horrible.
(This used to be commit 44dd3efa6380544e9a515e91960f9271498cefaf)
Diffstat (limited to 'source3/rpcclient/cmd_netlogon.c')
-rw-r--r--source3/rpcclient/cmd_netlogon.c63
1 files changed, 35 insertions, 28 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 67585ffff4..3010ed5297 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -33,11 +33,9 @@ extern int DEBUGLEVEL;
#define DEBUG_TESTING
-extern struct cli_state *smb_cli;
extern struct user_credentials *usr_creds;
extern FILE* out_hnd;
-extern pstring global_myname;
/****************************************************************************
@@ -45,7 +43,6 @@ experimental nt login.
****************************************************************************/
void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
{
- uint16 nt_pipe_fnum;
#if 0
extern BOOL global_machine_password_needs_changing;
#endif
@@ -55,6 +52,12 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
BOOL res = True;
char *nt_password;
unsigned char trust_passwd[16];
+ fstring trust_acct;
+
+ fstring srv_name;
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, info->dest_host);
+ strupper(srv_name);
#if 0
/* machine account passwords */
@@ -93,7 +96,11 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
nt_password = getpass("Enter NT Login password:");
}
- DEBUG(5,("do_nt_login_test: username %s\n", nt_user_name));
+ DEBUG(5,("do_nt_login_test: username %s from: %s\n",
+ nt_user_name, info->myhostname));
+
+ fstrcpy(trust_acct, info->myhostname);
+ fstrcat(trust_acct, "$");
res = res ? trust_get_passwd(trust_passwd, usr_creds->domain, info->myhostname) : False;
@@ -103,11 +110,9 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
info->myhostname, usr_creds->domain,
info->mach_acct, new_mach_pwd) : False;
#endif
- /* 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, global_myname,
+ res = res ? cli_nt_setup_creds(srv_name, info->myhostname,
+ trust_acct,
trust_passwd, SEC_CHAN_WKSTA) == 0x0 : False;
#if 0
@@ -116,7 +121,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
{
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, SEC_CHAN_WKSTA) : False;
+ res = res ? cli_nt_srv_pwset(srv_name, info->myhostname, new_trust_passwd, SEC_CHAN_WKSTA) : False;
if (res)
{
@@ -130,7 +135,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
memset(trust_passwd, 0, 16);
/* do an NT login */
- res = res ? cli_nt_login_interactive(smb_cli, nt_pipe_fnum,
+ res = res ? cli_nt_login_interactive(srv_name, info->myhostname,
usr_creds->domain, nt_user_name,
getuid(), nt_password,
&info->dom.ctr, &info->dom.user_info3) : False;
@@ -141,10 +146,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[])
/* ok! you're logged in! do anything you like, then... */
/* do an NT logout */
- res = res ? cli_nt_logoff(smb_cli, nt_pipe_fnum, &info->dom.ctr) : False;
-
- /* close the session */
- cli_nt_session_close(smb_cli, nt_pipe_fnum);
+ res = res ? cli_nt_logoff(srv_name, info->myhostname, &info->dom.ctr) : False;
report(out_hnd,"cmd_nt_login: login (%s) test succeeded: %s\n",
nt_user_name, BOOLSTR(res));
@@ -155,13 +157,16 @@ experimental nt login.
****************************************************************************/
void cmd_netlogon_domain_test(struct client_info *info, int argc, char *argv[])
{
- uint16 nt_pipe_fnum;
-
char *nt_trust_dom;
BOOL res = True;
unsigned char trust_passwd[16];
fstring inter_dom_acct;
+ fstring srv_name;
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, info->dest_host);
+ strupper(srv_name);
+
if (argc < 2)
{
report(out_hnd,"domtest: must specify domain name\n");
@@ -177,18 +182,12 @@ void cmd_netlogon_domain_test(struct client_info *info, int argc, char *argv[])
res = res ? trust_get_passwd(trust_passwd, usr_creds->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,
- global_myname, trust_passwd,
+ res = res ? cli_nt_setup_creds(srv_name, info->myhostname, inter_dom_acct,
+ trust_passwd,
SEC_CHAN_DOMAIN) == 0x0 : False;
memset(trust_passwd, 0, 16);
- /* close the session */
- cli_nt_session_close(smb_cli, nt_pipe_fnum);
-
report(out_hnd,"cmd_nt_login: credentials (%s) test succeeded: %s\n",
nt_trust_dom, BOOLSTR(res));
}
@@ -202,16 +201,24 @@ void cmd_sam_sync(struct client_info *info, int argc, char *argv[])
SAM_DELTA_CTR deltas[MAX_SAM_DELTAS];
uint32 num;
uchar trust_passwd[16];
- extern pstring global_myname;
+ fstring srv_name;
+ fstring trust_acct;
+
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, info->dest_host);
+ strupper(srv_name);
+
+ fstrcpy(trust_acct, info->myhostname);
+ fstrcat(trust_acct, "$");
- if (!trust_get_passwd(trust_passwd, usr_creds->domain, global_myname))
+ if (!trust_get_passwd(trust_passwd, usr_creds->domain, info->myhostname))
{
report(out_hnd, "cmd_sam_sync: no trust account password\n");
return;
}
- if (do_sam_sync(smb_cli, trust_passwd,
- smb_cli->mach_acct, global_myname,
+ if (net_sam_sync(srv_name, info->myhostname,
+ trust_acct, trust_passwd,
hdr_deltas, deltas, &num))
{
display_sam_sync(out_hnd, ACTION_HEADER , hdr_deltas, deltas, num);