#include "includes.h"
#include "../libcli/auth/libcli_auth.h"
-#include "../librpc/gen_ndr/cli_netlogon.h"
+#include "../librpc/gen_ndr/ndr_netlogon_c.h"
#include "rpc_client/cli_netlogon.h"
#include "rpc_client/init_netlogon.h"
enum netr_SchannelType sec_chan_type,
uint32_t *neg_flags_inout)
{
+ NTSTATUS status;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
struct netr_Credential clnt_chal_send;
struct netr_Credential srv_chal_recv;
bool retried = false;
fstring mach_acct;
uint32_t neg_flags = *neg_flags_inout;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (!ndr_syntax_id_equal(&cli->abstract_syntax,
&ndr_table_netlogon.syntax_id)) {
generate_random_buffer(clnt_chal_send.data, 8);
/* Get the server challenge. */
- result = rpccli_netr_ServerReqChallenge(cli, talloc_tos(),
+ status = dcerpc_netr_ServerReqChallenge(b, talloc_tos(),
cli->srv_name_slash,
clnt_name,
&clnt_chal_send,
- &srv_chal_recv);
+ &srv_chal_recv,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
if (!NT_STATUS_IS_OK(result)) {
return result;
}
* Send client auth-2 challenge and receive server repy.
*/
- result = rpccli_netr_ServerAuthenticate2(cli, talloc_tos(),
+ status = dcerpc_netr_ServerAuthenticate2(b, talloc_tos(),
cli->srv_name_slash,
cli->dc->account_name,
sec_chan_type,
cli->dc->computer_name,
&clnt_chal_send, /* input. */
&srv_chal_recv, /* output. */
- &neg_flags);
-
+ &neg_flags,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
/* we might be talking to NT4, so let's downgrade in that case and retry
* with the returned neg_flags - gd */
int logon_type)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status;
struct netr_Authenticator clnt_creds;
struct netr_Authenticator ret_creds;
union netr_LogonLevel *logon;
uint8_t authoritative;
int validation_level = 3;
fstring clnt_name_slash;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
ZERO_STRUCT(ret_creds);
return NT_STATUS_INVALID_INFO_CLASS;
}
- result = rpccli_netr_LogonSamLogon(cli, mem_ctx,
+ status = dcerpc_netr_LogonSamLogon(b, mem_ctx,
cli->srv_name_slash,
global_myname(),
&clnt_creds,
logon,
validation_level,
&validation,
- &authoritative);
+ &authoritative,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
/* Always check returned credentials */
if (!netlogon_creds_client_check(cli->dc, &ret_creds.cred)) {
struct netr_SamInfo3 **info3)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status;
int validation_level = 3;
const char *workstation_name_slash;
const char *server_name_slash;
union netr_Validation validation;
struct netr_ChallengeResponse lm;
struct netr_ChallengeResponse nt;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
*info3 = NULL;
/* Marshall data and send request */
- result = rpccli_netr_LogonSamLogon(cli, mem_ctx,
+ status = dcerpc_netr_LogonSamLogon(b, mem_ctx,
server_name_slash,
global_myname(),
&clnt_creds,
logon,
validation_level,
&validation,
- &authoritative);
- if (!NT_STATUS_IS_OK(result)) {
- return result;
+ &authoritative,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
/* Always check returned credentials. */
return NT_STATUS_ACCESS_DENIED;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ return result;
+ }
+
netlogon_creds_decrypt_samlogon(cli->dc, validation_level, &validation);
*info3 = validation.sam3;
struct netr_SamInfo3 **info3)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status;
int validation_level = 3;
const char *workstation_name_slash;
const char *server_name_slash;
struct netr_ChallengeResponse lm;
struct netr_ChallengeResponse nt;
uint32_t flags = 0;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
*info3 = NULL;
/* Marshall data and send request */
- result = rpccli_netr_LogonSamLogonEx(cli, mem_ctx,
+ status = dcerpc_netr_LogonSamLogonEx(b, mem_ctx,
server_name_slash,
global_myname(),
NetlogonNetworkInformation,
validation_level,
&validation,
&authoritative,
- &flags);
+ &flags,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if (!NT_STATUS_IS_OK(result)) {
return result;
}
const unsigned char new_trust_passwd_hash[16],
enum netr_SchannelType sec_channel_type)
{
- NTSTATUS result;
+ NTSTATUS result, status;
struct netr_Authenticator clnt_creds, srv_cred;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
if (!cli->dc) {
uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
cli->dc->session_key,
&new_password);
- result = rpccli_netr_ServerPasswordSet2(cli, mem_ctx,
+ status = dcerpc_netr_ServerPasswordSet2(b, mem_ctx,
cli->srv_name_slash,
cli->dc->account_name,
sec_channel_type,
cli->dc->computer_name,
&clnt_creds,
&srv_cred,
- &new_password);
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(0,("rpccli_netr_ServerPasswordSet2 failed: %s\n",
- nt_errstr(result)));
- return result;
+ &new_password,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("dcerpc_netr_ServerPasswordSet2 failed: %s\n",
+ nt_errstr(status)));
+ return status;
}
} else {
memcpy(new_password.hash, new_trust_passwd_hash, sizeof(new_password.hash));
netlogon_creds_des_encrypt(cli->dc, &new_password);
- result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
+ status = dcerpc_netr_ServerPasswordSet(b, mem_ctx,
cli->srv_name_slash,
cli->dc->account_name,
sec_channel_type,
cli->dc->computer_name,
&clnt_creds,
&srv_cred,
- &new_password);
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(0,("rpccli_netr_ServerPasswordSet failed: %s\n",
- nt_errstr(result)));
- return result;
+ &new_password,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("dcerpc_netr_ServerPasswordSet failed: %s\n",
+ nt_errstr(status)));
+ return status;
}
}
return NT_STATUS_ACCESS_DENIED;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(0,("dcerpc_netr_ServerPasswordSet{2} failed: %s\n",
+ nt_errstr(result)));
+ return result;
+ }
+
return result;
}