2 Unix SMB/Netbios implementation.
4 NT Domain Authentication SMB / MSRPC client
5 Copyright (C) Andrew Tridgell 1994-1997
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 extern int DEBUGLEVEL;
36 extern struct cli_state *smb_cli;
41 /****************************************************************************
42 experimental nt login.
43 ****************************************************************************/
44 void cmd_netlogon_login_test(struct client_info *info)
48 /* machine account passwords */
54 DEBUG(5,("do_nt_login_test: %d\n", __LINE__));
57 /* check whether the user wants to change their machine password */
58 res = res ? trust_account_check(info->dest_ip, info->dest_host,
59 info->myhostname, smb_cli->domain,
60 info->mach_acct, new_mach_pwd) : False;
62 /* open NETLOGON session. negotiate credentials */
63 res = res ? do_nt_session_open(smb_cli,
64 info->dest_host, info->myhostname,
66 smb_cli->user_name, smb_cli->domain,
67 info->dom.sess_key, &info->dom.clnt_cred) : False;
69 /* change the machine password? */
70 if (new_mach_pwd != NULL && new_mach_pwd[0] != 0)
72 res = res ? do_nt_srv_pwset(smb_cli, info->dom.lsarpc_fnum,
73 info->dom.sess_key, &info->dom.clnt_cred, &info->dom.rtn_cred,
75 info->dest_host, info->mach_acct, info->myhostname) : False;
78 /* create the user-identification info */
79 make_nt_login_interactive(&info->dom.ctr,
81 smb_cli->domain, info->myhostname,
82 getuid(), smb_cli->user_name);
85 res = res ? do_nt_login(smb_cli, info->dom.lsarpc_fnum,
86 info->dom.sess_key, &info->dom.clnt_cred, &info->dom.rtn_cred,
87 &info->dom.ctr, info->dest_host, info->myhostname, &info->dom.user_info3) : False;
89 /* ok! you're logged in! do anything you like, then... */
92 res = res ? do_nt_logoff(smb_cli, info->dom.lsarpc_fnum,
93 info->dom.sess_key, &info->dom.clnt_cred, &info->dom.rtn_cred,
94 &info->dom.ctr, info->dest_host, info->myhostname) : False;
96 /* close the session */
97 cli_nt_session_close(smb_cli);
101 DEBUG(5,("cmd_nt_login: login test succeeded\n"));
105 DEBUG(5,("cmd_nt_login: login test failed\n"));