From 106fe88be01f7ac7d1369e97a6468dcd80c0a813 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 1 Dec 1999 16:39:51 +0000 Subject: 1) when no domain used in ntlogin test command, should use default one from previous lsaquery command. over-ridden from DOMAIN\username 2) initialisation of cli_state is a little more specific: sets use_ntlmv2 to Auto. this can always be over-ridden. 3) fixed reusage of ntlmssp_cli_flgs which was being a pain 4) added pwd_compare() function then fixed bug in cli_use where NULL domain name was making connections multiply unfruitfully 5) type-casting of mallocs and Reallocs that cause ansi-c compilers to bitch (This used to be commit 301a6efaf67ddc96e6dcfd21b45a82863ff8f39a) --- source3/rpcclient/cmd_netlogon.c | 29 ++++++++++++++++++++++++++++- source3/rpcclient/cmd_samr.c | 2 +- source3/rpcclient/rpcclient.c | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 0b0292e632..89e52ed779 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -53,12 +53,20 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]) char *nt_password; unsigned char trust_passwd[16]; fstring trust_acct; + fstring domain; + char *p; fstring srv_name; fstrcpy(srv_name, "\\\\"); fstrcat(srv_name, info->dest_host); strupper(srv_name); + fstrcpy(domain, usr_creds->domain); + + if (domain[0] == 0) + { + fstrcpy(domain, info->dom.level3_dom); + } #if 0 /* machine account passwords */ pstring new_mach_pwd; @@ -76,6 +84,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]) if (nt_user_name[0] == 0) { report(out_hnd,"ntlogin: must specify username with anonymous connection\n"); + report(out_hnd,"ntlogin [[DOMAIN\\]user] [password]\n"); return; } } @@ -84,6 +93,24 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]) fstrcpy(nt_user_name, argv[0]); } + p = strchr(nt_user_name, '\\'); + if (p != NULL) + { + fstrcpy(domain, nt_user_name); + p = strchr(domain, '\\'); + if (p != NULL) + { + *p = 0; + fstrcpy(nt_user_name, p+1); + } + + } + + if (domain[0] == 0) + { + report(out_hnd,"no domain specified.\n"); + } + argc--; argv++; @@ -102,7 +129,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]) fstrcpy(trust_acct, info->myhostname); fstrcat(trust_acct, "$"); - res = res ? trust_get_passwd(trust_passwd, usr_creds->domain, info->myhostname) : False; + res = res ? trust_get_passwd(trust_passwd, domain, info->myhostname) : False; #if 0 /* check whether the user wants to change their machine password */ diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index c4cb613ee2..f38587ceb6 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -1717,7 +1717,7 @@ void cmd_sam_set_userinfo2(struct client_info *info, int argc, char *argv[]) if (True) { - SAM_USER_INFO_16 *p = malloc(sizeof(SAM_USER_INFO_16)); + SAM_USER_INFO_16 *p = (SAM_USER_INFO_16 *)malloc(sizeof(SAM_USER_INFO_16)); p->acb_info = usr16.acb_info; usr = (void*)p; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index a8546b7733..4dc919fd97 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -318,7 +318,7 @@ struct command_set commands[] = { "ntlogin", cmd_netlogon_login_test, - "[username] [password] NT Domain login test", + "[[DOMAIN\\]username] [password] NT Domain login test", {COMPL_NONE, COMPL_NONE} }, { -- cgit