ZERO_STRUCT(ret_creds);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
+ logon = talloc_zero(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
if (workstation) {
fstr_sprintf( clnt_name_slash, "\\\\%s", workstation );
} else {
- fstr_sprintf( clnt_name_slash, "\\\\%s", global_myname() );
+ fstr_sprintf( clnt_name_slash, "\\\\%s", lp_netbios_name() );
}
/* Initialise input parameters */
struct samr_Password lmpassword;
struct samr_Password ntpassword;
- password_info = TALLOC_ZERO_P(mem_ctx, struct netr_PasswordInfo);
+ password_info = talloc_zero(mem_ctx, struct netr_PasswordInfo);
if (!password_info) {
return NT_STATUS_NO_MEMORY;
}
nt_lm_owf_gen(password, ntpassword.hash, lmpassword.hash);
- if (cli->dc->negotiate_flags & NETLOGON_NEG_ARCFOUR) {
+ if (cli->dc->negotiate_flags & NETLOGON_NEG_SUPPORTS_AES) {
+ netlogon_creds_aes_encrypt(cli->dc, lmpassword.hash, 16);
+ netlogon_creds_aes_encrypt(cli->dc, ntpassword.hash, 16);
+ } else if (cli->dc->negotiate_flags & NETLOGON_NEG_ARCFOUR) {
netlogon_creds_arcfour_crypt(cli->dc, lmpassword.hash, 16);
netlogon_creds_arcfour_crypt(cli->dc, ntpassword.hash, 16);
} else {
ZERO_STRUCT(lm);
ZERO_STRUCT(nt);
- network_info = TALLOC_ZERO_P(mem_ctx, struct netr_NetworkInfo);
+ network_info = talloc_zero(mem_ctx, struct netr_NetworkInfo);
if (!network_info) {
return NT_STATUS_NO_MEMORY;
}
status = dcerpc_netr_LogonSamLogon(b, mem_ctx,
cli->srv_name_slash,
- global_myname(),
+ lp_netbios_name(),
&clnt_creds,
&ret_creds,
logon_type,
ZERO_STRUCT(lm);
ZERO_STRUCT(nt);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
+ logon = talloc_zero(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
- network_info = TALLOC_ZERO_P(mem_ctx, struct netr_NetworkInfo);
+ network_info = talloc_zero(mem_ctx, struct netr_NetworkInfo);
if (!network_info) {
return NT_STATUS_NO_MEMORY;
}
status = dcerpc_netr_LogonSamLogon(b, mem_ctx,
server_name_slash,
- global_myname(),
+ lp_netbios_name(),
&clnt_creds,
&ret_creds,
NetlogonNetworkInformation,
ZERO_STRUCT(lm);
ZERO_STRUCT(nt);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
+ logon = talloc_zero(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
- network_info = TALLOC_ZERO_P(mem_ctx, struct netr_NetworkInfo);
+ network_info = talloc_zero(mem_ctx, struct netr_NetworkInfo);
if (!network_info) {
return NT_STATUS_NO_MEMORY;
}
status = dcerpc_netr_LogonSamLogonEx(b, mem_ctx,
server_name_slash,
- global_myname(),
+ lp_netbios_name(),
NetlogonNetworkInformation,
logon,
validation_level,
result = rpccli_netlogon_setup_creds(cli,
cli->desthost, /* server name */
lp_workgroup(), /* domain */
- global_myname(), /* client name */
+ lp_netbios_name(), /* client name */
account_name, /* machine account name */
orig_trust_passwd_hash,
sec_channel_type,
if (cli->dc->negotiate_flags & NETLOGON_NEG_PASSWORD_SET2) {
struct netr_CryptPassword new_password;
+ uint32_t old_timeout;
init_netr_CryptPassword(new_trust_pwd_cleartext,
- cli->dc->session_key,
+ cli->dc,
&new_password);
+ old_timeout = dcerpc_binding_handle_set_timeout(b, 600000);
+
status = dcerpc_netr_ServerPasswordSet2(b, mem_ctx,
cli->srv_name_slash,
cli->dc->account_name,
&srv_cred,
&new_password,
&result);
+
+ dcerpc_binding_handle_set_timeout(b, old_timeout);
+
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("dcerpc_netr_ServerPasswordSet2 failed: %s\n",
nt_errstr(status)));
} else {
struct samr_Password new_password;
+ uint32_t old_timeout;
+
memcpy(new_password.hash, new_trust_passwd_hash, sizeof(new_password.hash));
netlogon_creds_des_encrypt(cli->dc, &new_password);
+ old_timeout = dcerpc_binding_handle_set_timeout(b, 600000);
+
status = dcerpc_netr_ServerPasswordSet(b, mem_ctx,
cli->srv_name_slash,
cli->dc->account_name,
&srv_cred,
&new_password,
&result);
+
+ dcerpc_binding_handle_set_timeout(b, old_timeout);
+
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("dcerpc_netr_ServerPasswordSet failed: %s\n",
nt_errstr(status)));