#include "includes.h"
-extern int DEBUGLEVEL;
extern pstring global_myname;
extern fstring global_myworkgroup;
/****************************************************************************
do a LSA Logon Control2
****************************************************************************/
-BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level)
+BOOL cli_net_logon_ctrl2(struct cli_state *cli, NTSTATUS status_level)
{
prs_struct rbuf;
prs_struct buf;
encrypt of the server challenge originally received. JRA.
****************************************************************************/
-BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan,
- uint32 neg_flags, DOM_CHAL *srv_chal)
+NTSTATUS cli_net_auth2(struct cli_state *cli, uint16 sec_chan,
+ uint32 neg_flags, DOM_CHAL *srv_chal)
{
prs_struct rbuf;
prs_struct buf;
NET_Q_AUTH_2 q_a;
BOOL ok = False;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
prs_init(&buf , 1024, cli->mem_ctx, MARSHALL);
prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL);
DEBUG(0,("cli_net_auth2: Error : failed to marshall NET_Q_AUTH_2 struct.\n"));
prs_mem_free(&buf);
prs_mem_free(&rbuf);
- return False;
+ return result;
}
/* send the data on \PIPE\ */
NET_R_AUTH_2 r_a;
ok = net_io_r_auth_2("", &r_a, &rbuf, 0);
-
- if (ok && r_a.status != 0)
+ result = r_a.status;
+
+ if (ok && !NT_STATUS_IS_OK(result))
{
/* report error code */
- DEBUG(0,("cli_net_auth2: Error %s\n", get_nt_error_msg(r_a.status)));
+ DEBUG(0,("cli_net_auth2: Error %s\n", get_nt_error_msg(result)));
ok = False;
}
prs_mem_free(&buf);
prs_mem_free(&rbuf);
- return ok;
+ return result;
}
/****************************************************************************
ok = net_io_r_req_chal("", &r_c, &rbuf, 0);
- if (ok && r_c.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_c.status))
{
/* report error code */
DEBUG(0,("cli_net_req_chal: Error %s\n", get_nt_error_msg(r_c.status)));
ok = net_io_r_srv_pwset("", &r_s, &rbuf, 0);
- if (ok && r_s.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_s.status))
{
/* report error code */
DEBUG(0,("cli_net_srv_pwset: %s\n", get_nt_error_msg(r_s.status)));
returns level 3.
****************************************************************************/
-static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
- NET_USER_INFO_3 *user_info3, uint16 validation_level)
+static NTSTATUS cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+ NET_USER_INFO_3 *user_info3,
+ uint16 validation_level)
{
DOM_CRED new_clnt_cred;
DOM_CRED dummy_rtn_creds;
prs_struct buf;
NET_Q_SAM_LOGON q_s;
NET_R_SAM_LOGON r_s;
- uint32 retval = 0;
+ NTSTATUS retval = NT_STATUS_OK;
gen_next_creds( cli, &new_clnt_cred);
* the call.
*/
- if (retval == NT_STATUS_INVALID_INFO_CLASS) {
+ if (NT_STATUS_V(retval) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
goto out;
}
- if (retval != 0) {
+ if (!NT_STATUS_IS_OK(retval)) {
/* report error code */
DEBUG(0,("cli_net_sam_logon_internal: %s\n", get_nt_error_msg(r_s.status)));
goto out;
- }
+ }
- /* Update the credentials. */
- if (!clnt_deal_with_creds(cli->sess_key, &cli->clnt_cred, &r_s.srv_creds)) {
+ /* Update the credentials. */
+ if (!clnt_deal_with_creds(cli->sess_key, &cli->clnt_cred, &r_s.srv_creds)) {
/*
* Server replied with bad credential. Fail.
*/
DEBUG(0,("cli_net_sam_logon_internal: server %s replied with bad credential (bad machine \
password ?).\n", cli->desthost ));
retval = NT_STATUS_WRONG_PASSWORD;
- }
-
- if (r_s.switch_value != validation_level) {
+ }
+
+ if (r_s.switch_value != validation_level) {
/* report different switch_value */
DEBUG(0,("cli_net_sam_logon: switch_value of %x expected %x\n", (unsigned int)validation_level,
- (unsigned int)r_s.switch_value));
+ (unsigned int)r_s.switch_value));
retval = NT_STATUS_INVALID_PARAMETER;
- }
+ }
- out:
+out:
prs_mem_free(&buf);
prs_mem_free(&rbuf);
-
+
return retval;
}
LSA SAM Logon - interactive or network.
****************************************************************************/
-BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3)
+NTSTATUS cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+ NET_USER_INFO_3 *user_info3)
{
- BOOL ok = True;
uint16 validation_level=3;
- uint32 ret_err_code;
+ NTSTATUS result;
- ret_err_code = cli_net_sam_logon_internal(cli, ctr, user_info3, validation_level);
+ result = cli_net_sam_logon_internal(cli, ctr, user_info3,
+ validation_level);
- if(ret_err_code == NT_STATUS_NOPROBLEMO) {
+ if (NT_STATUS_IS_OK(result)) {
DEBUG(10,("cli_net_sam_logon: Success \n"));
- ok = True;
- } else if (ret_err_code == NT_STATUS_INVALID_INFO_CLASS) {
+ } else if (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
DEBUG(10,("cli_net_sam_logon: STATUS INVALID INFO CLASS \n"));
validation_level=2;
* for the error. If its error, return False.
*/
- if(cli_net_sam_logon_internal(cli, ctr, user_info3, validation_level) != 0)
- ok = False;
-
+ result = cli_net_sam_logon_internal(cli, ctr, user_info3,
+ validation_level);
} else {
DEBUG(10,("cli_net_sam_logon: Error\n"));
- ok = False;
}
- return ok;
+ return result;
}
/***************************************************************************
ok = net_io_r_sam_logoff("", &r_s, &rbuf, 0);
- if (ok && r_s.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_s.status))
{
/* report error code */
DEBUG(0,("cli_net_sam_logoff: %s\n", get_nt_error_msg(r_s.status)));