Initialize domain session credentials.
****************************************************************************/
-BOOL cli_nt_setup_creds(struct cli_state *cli, uint16 fnum, unsigned char mach_pwd[16])
+uint32 cli_nt_setup_creds(struct cli_state *cli, uint16 fnum,
+ const char* trust_acct,
+ const char* srv_name,
+ unsigned char trust_pwd[16],
+ uint16 sec_chan)
{
DOM_CHAL clnt_chal;
DOM_CHAL srv_chal;
-
+ uint32 ret;
UTIME zerotime;
/******************* Request Challenge ********************/
generate_random_buffer( clnt_chal.data, 8, False);
/* send a client challenge; receive a server challenge */
- if (!cli_net_req_chal(cli, fnum, &clnt_chal, &srv_chal))
+ ret = cli_net_req_chal(cli, fnum, srv_name, &clnt_chal, &srv_chal);
+ if (ret != 0)
{
DEBUG(0,("cli_nt_setup_creds: request challenge failed\n"));
- return False;
+ return ret;
}
/**************** Long-term Session key **************/
/* calculate the session key */
- cred_session_key(&clnt_chal, &srv_chal, (char *)mach_pwd, cli->sess_key);
+ cred_session_key(&clnt_chal, &srv_chal, (char *)trust_pwd, cli->sess_key);
bzero(cli->sess_key+8, 8);
/******************* Authenticate 2 ********************/
* Receive an auth-2 challenge response and check it.
*/
- if (!cli_net_auth2(cli, fnum, SEC_CHAN_WKSTA, 0x000001ff, &srv_chal))
+ ret = cli_net_auth2(cli, fnum, trust_acct, srv_name,
+ sec_chan, 0x000001ff, &srv_chal);
+ if (ret != 0x0)
{
DEBUG(0,("cli_nt_setup_creds: auth2 challenge failed\n"));
- return False;
}
- return True;
+ return ret;
}
/****************************************************************************
Set machine password.
****************************************************************************/
-BOOL cli_nt_srv_pwset(struct cli_state *cli, uint16 fnum, unsigned char *new_hashof_mach_pwd)
+BOOL cli_nt_srv_pwset(struct cli_state *cli, uint16 fnum,
+ unsigned char *new_hashof_trust_pwd, uint16 sec_chan)
{
unsigned char processed_new_pwd[16];
DEBUG(5,("cli_nt_srv_pwset: %d\n", __LINE__));
#ifdef DEBUG_PASSWORD
- dump_data(6, new_hashof_mach_pwd, 16);
+ dump_data(6, new_hashof_trust_pwd, 16);
#endif
/* Process the new password. */
- cred_hash3( processed_new_pwd, new_hashof_mach_pwd, cli->sess_key, 1);
+ cred_hash3( processed_new_pwd, new_hashof_trust_pwd, cli->sess_key, 1);
/* send client srv_pwset challenge */
- return cli_net_srv_pwset(cli, fnum, processed_new_pwd);
+ return cli_net_srv_pwset(cli, fnum, processed_new_pwd, sec_chan);
}
/****************************************************************************