#include "librpc/gen_ndr/ndr_netlogon.h"
#include "librpc/gen_ndr/ndr_netlogon_c.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
-#include "auth/auth.h"
#include "../lib/crypto/crypto.h"
#include "lib/cmdline/popt_common.h"
-#include "torture/rpc/rpc.h"
-#include "../libcli/auth/schannel.h"
+#include "torture/rpc/torture_rpc.h"
#include "auth/gensec/gensec.h"
#include "libcli/auth/libcli_auth.h"
#include "param/param.h"
NTSTATUS expected_error;
bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */
DATA_BLOB chall;
- struct smb_iconv_convenience *iconv_convenience;
};
/*
netlogon_creds_client_authenticator(samlogon_state->creds, &samlogon_state->auth);
r->out.return_authenticator = NULL;
- status = dcerpc_netr_LogonSamLogon(samlogon_state->p, samlogon_state->mem_ctx, r);
+ status = dcerpc_netr_LogonSamLogon_r(samlogon_state->p->binding_handle,
+ samlogon_state->mem_ctx, r);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (error_string) {
+ *error_string = strdup(nt_errstr(status));
+ }
+ return status;
+ }
if (!r->out.return_authenticator ||
!netlogon_creds_client_check(samlogon_state->creds, &r->out.return_authenticator->cred)) {
d_printf("Credential chaining failed\n");
}
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(r->out.result)) {
if (error_string) {
- *error_string = strdup(nt_errstr(status));
+ *error_string = strdup(nt_errstr(r->out.result));
}
- return status;
+ return r->out.result;
}
validation_level = r->in.validation_level;
}
break;
case NDR_NETR_LOGONSAMLOGONEX:
- status = dcerpc_netr_LogonSamLogonEx(samlogon_state->p, samlogon_state->mem_ctx, r_ex);
+ status = dcerpc_netr_LogonSamLogonEx_r(samlogon_state->p->binding_handle,
+ samlogon_state->mem_ctx, r_ex);
if (!NT_STATUS_IS_OK(status)) {
if (error_string) {
*error_string = strdup(nt_errstr(status));
}
return status;
}
+ if (!NT_STATUS_IS_OK(r_ex->out.result)) {
+ if (error_string) {
+ *error_string = strdup(nt_errstr(r_ex->out.result));
+ }
+ return r_ex->out.result;
+ }
validation_level = r_ex->in.validation_level;
netlogon_creds_client_authenticator(samlogon_state->creds, &samlogon_state->auth);
r_flags->out.return_authenticator = NULL;
- status = dcerpc_netr_LogonSamLogonWithFlags(samlogon_state->p, samlogon_state->mem_ctx, r_flags);
+ status = dcerpc_netr_LogonSamLogonWithFlags_r(samlogon_state->p->binding_handle,
+ samlogon_state->mem_ctx, r_flags);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (error_string) {
+ *error_string = strdup(nt_errstr(status));
+ }
+ return status;
+ }
if (!r_flags->out.return_authenticator ||
!netlogon_creds_client_check(samlogon_state->creds, &r_flags->out.return_authenticator->cred)) {
d_printf("Credential chaining failed\n");
}
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(r_flags->out.result)) {
if (error_string) {
- *error_string = strdup(nt_errstr(status));
+ *error_string = strdup(nt_errstr(r_flags->out.result));
}
- return status;
+ return r_flags->out.result;
}
validation_level = r_flags->in.validation_level;
password = strupper_talloc(samlogon_state->mem_ctx, samlogon_state->password);
- if (!convert_string_talloc_convenience(samlogon_state->mem_ctx,
- samlogon_state->iconv_convenience,
+ if (!convert_string_talloc(samlogon_state->mem_ctx,
CH_UNIX, CH_DOS,
password, strlen(password)+1,
(void**)&dospw, NULL, false)) {
ZERO_STRUCT(logon);
- d_printf("testing netr_LogonSamLogon and netr_LogonSamLogonWithFlags\n");
+ d_printf("Testing netr_LogonSamLogon and netr_LogonSamLogonWithFlags\n");
samlogon_state.comment = comment;
samlogon_state.account_name = account_name;
samlogon_state.chall = data_blob_talloc(fn_ctx, NULL, 8);
samlogon_state.parameter_control = parameter_control;
samlogon_state.old_password = old_password;
- samlogon_state.iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
generate_random_buffer(samlogon_state.chall.data, 8);
samlogon_state.r_flags.in.server_name = talloc_asprintf(fn_ctx, "\\\\%s", dcerpc_server_name(p));
union netr_LogonLevel logon;
union netr_Validation validation;
uint8_t authoritative = 0;
+ struct dcerpc_binding_handle *b = p->binding_handle;
ZERO_STRUCT(a);
ZERO_STRUCT(r);
d_printf("Testing netr_LogonSamLogonWithFlags '%s' (Interactive Logon)\n", comment);
- status = dcerpc_netr_LogonSamLogonWithFlags(p, fn_ctx, &r);
+ status = dcerpc_netr_LogonSamLogonWithFlags_r(b, fn_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("%s: netr_LogonSamLogonWithFlags - %s\n",
+ __location__, nt_errstr(status));
+ return false;
+ }
if (!r.out.return_authenticator
|| !netlogon_creds_client_check(creds, &r.out.return_authenticator->cred)) {
d_printf("Credential chaining failed\n");
talloc_free(fn_ctx);
- if (!NT_STATUS_EQUAL(expected_error, status)) {
+ if (!NT_STATUS_EQUAL(expected_error, r.out.result)) {
d_printf("[%s]\\[%s] netr_LogonSamLogonWithFlags - expected %s got %s\n",
- account_domain, account_name, nt_errstr(expected_error), nt_errstr(status));
+ account_domain, account_name, nt_errstr(expected_error), nt_errstr(r.out.result));
return false;
}
};
struct netlogon_creds_CredentialState *creds;
+ struct dcerpc_pipe *tmp_p = NULL;
test_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
/* We only need to join as a workstation here, and in future,
old_user_password = user_password;
- test_ChangePasswordUser3(torture_join_samr_pipe(user_ctx), torture,
+ tmp_p = torture_join_samr_pipe(user_ctx);
+ test_ChangePasswordUser3(tmp_p, torture,
TEST_USER_NAME, 16 /* > 14 */, &user_password,
NULL, 0, false);
u.info21.fields_present = SAMR_FIELD_WORKSTATIONS;
u.info21.workstations.string = "not" TEST_MACHINE_NAME;
- status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_wks), mem_ctx, &s);
+ tmp_p = torture_join_samr_pipe(user_ctx_wrong_wks);
+ status = dcerpc_samr_SetUserInfo_r(tmp_p->binding_handle, mem_ctx, &s);
if (!NT_STATUS_IS_OK(status)) {
printf("SetUserInfo (list of workstations) failed - %s\n", nt_errstr(status));
ret = false;
goto failed;
}
+ if (!NT_STATUS_IS_OK(s.out.result)) {
+ printf("SetUserInfo (list of workstations) failed - %s\n", nt_errstr(s.out.result));
+ ret = false;
+ goto failed;
+ }
user_ctx_wrong_time
= torture_create_testuser(torture, TEST_USER_NAME_WRONG_TIME,
u.info21.logon_hours.units_per_week = 168;
u.info21.logon_hours.bits = talloc_zero_array(mem_ctx, uint8_t, 168);
- status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_time), mem_ctx, &s);
+ tmp_p = torture_join_samr_pipe(user_ctx_wrong_time);
+ status = dcerpc_samr_SetUserInfo_r(tmp_p->binding_handle, mem_ctx, &s);
if (!NT_STATUS_IS_OK(status)) {
printf("SetUserInfo (logon times and list of workstations) failed - %s\n", nt_errstr(status));
ret = false;
goto failed;
}
+ if (!NT_STATUS_IS_OK(s.out.result)) {
+ printf("SetUserInfo (list of workstations) failed - %s\n", nt_errstr(s.out.result));
+ ret = false;
+ goto failed;
+ }
status = torture_rpc_binding(torture, &b);
if (!NT_STATUS_IS_OK(status)) {