#include "includes.h"
#include "../libcli/netlogon.h"
-#undef DEBUG
-#define DEBUG(x, y)
-#undef DEBUGLVL
-#define DEBUGLVL(x) false
-#undef DEBUGLEVEL
-#define DEBUGLEVEL 0
-
NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
struct netlogon_samlogon_response *response)
{
enum ndr_err_code ndr_err;
if (response->ntver == NETLOGON_NT_VERSION_1) {
ndr_err = ndr_push_struct_blob(data, mem_ctx,
- iconv_convenience,
&response->data.nt4,
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40);
} else if (response->ntver & NETLOGON_NT_VERSION_5EX) {
ndr_err = ndr_push_struct_blob(data, mem_ctx,
- iconv_convenience,
&response->data.nt5_ex,
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags);
} else if (response->ntver & NETLOGON_NT_VERSION_5) {
ndr_err = ndr_push_struct_blob(data, mem_ctx,
- iconv_convenience,
&response->data.nt5,
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE);
} else {
}
NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
struct netlogon_samlogon_response *response)
{
uint32_t ntver;
if (ntver == NETLOGON_NT_VERSION_1) {
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
- iconv_convenience,
&response->data.nt4,
(ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40);
response->ntver = NETLOGON_NT_VERSION_1;
} else if (ntver & NETLOGON_NT_VERSION_5EX) {
struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(data, mem_ctx, iconv_convenience);
+ ndr = ndr_pull_init_blob(data, mem_ctx);
if (!ndr) {
return NT_STATUS_NO_MEMORY;
}
} else if (ntver & NETLOGON_NT_VERSION_5) {
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
- iconv_convenience,
&response->data.nt5,
(ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE);
response->ntver = NETLOGON_NT_VERSION_5;
response_5_ex.command = response->data.nt5.command;
response_5_ex.pdc_name = response->data.nt5.pdc_name;
response_5_ex.user_name = response->data.nt5.user_name;
- response_5_ex.domain = response->data.nt5.domain_name;
+ response_5_ex.domain_name = response->data.nt5.domain_name;
response_5_ex.domain_uuid = response->data.nt5.domain_uuid;
response_5_ex.forest = response->data.nt5.forest;
response_5_ex.dns_domain = response->data.nt5.dns_domain;
case NETLOGON_NT_VERSION_1:
ZERO_STRUCT(response_5_ex);
response_5_ex.command = response->data.nt4.command;
- response_5_ex.pdc_name = response->data.nt4.server;
+ response_5_ex.pdc_name = response->data.nt4.pdc_name;
response_5_ex.user_name = response->data.nt4.user_name;
- response_5_ex.domain = response->data.nt4.domain;
+ response_5_ex.domain_name = response->data.nt4.domain_name;
response_5_ex.nt_version = response->data.nt4.nt_version;
response_5_ex.lmnt_token = response->data.nt4.lmnt_token;
response_5_ex.lm20_token = response->data.nt4.lm20_token;
}
NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
struct nbt_netlogon_response *response)
{
NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE;
switch (response->response_type) {
case NETLOGON_GET_PDC:
ndr_err = ndr_push_struct_blob(data, mem_ctx,
- iconv_convenience,
&response->data.get_pdc,
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_response_from_pdc);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
break;
case NETLOGON_SAMLOGON:
status = push_netlogon_samlogon_response(
- data, mem_ctx, iconv_convenience,
+ data, mem_ctx,
&response->data.samlogon);
break;
+ case NETLOGON_RESPONSE2:
+ ndr_err = ndr_push_struct_blob(data, mem_ctx,
+ &response->data.response2,
+ (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_response2);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ status = NT_STATUS_OK;
+ break;
}
+
return status;
}
NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
struct nbt_netlogon_response *response)
{
NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE;
switch (command) {
case NETLOGON_RESPONSE_FROM_PDC:
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
- iconv_convenience,
&response->data.get_pdc,
(ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_response_from_pdc);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = NT_STATUS_OK;
response->response_type = NETLOGON_GET_PDC;
break;
+ case LOGON_RESPONSE2:
+ ndr_err = ndr_pull_struct_blob(data, mem_ctx, &response->data.response2,
+ (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_response2);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ status = NT_STATUS_OK;
+ response->response_type = NETLOGON_RESPONSE2;
+ break;
case LOGON_SAM_LOGON_RESPONSE:
case LOGON_SAM_LOGON_PAUSE_RESPONSE:
case LOGON_SAM_LOGON_USER_UNKNOWN:
case LOGON_SAM_LOGON_PAUSE_RESPONSE_EX:
case LOGON_SAM_LOGON_USER_UNKNOWN_EX:
status = pull_netlogon_samlogon_response(
- data, mem_ctx, iconv_convenience,
+ data, mem_ctx,
&response->data.samlogon);
response->response_type = NETLOGON_SAMLOGON;
break;
/* These levels are queries, not responses */
case LOGON_PRIMARY_QUERY:
+ case LOGON_REQUEST:
case NETLOGON_ANNOUNCE_UAS:
case LOGON_SAM_LOGON_REQUEST:
status = NT_STATUS_INVALID_NETWORK_RESPONSE;