_PUBLIC_ enum ndr_err_code ndr_push_PAC_BUFFER_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER_RAW *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ndr_size)); { uint32_t _flags_save_DATA_BLOB_REM = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8); NDR_CHECK(ndr_push_relative_ptr1(ndr, r->info)); ndr->flags = _flags_save_DATA_BLOB_REM; } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); } if (ndr_flags & NDR_BUFFERS) { { uint32_t _flags_save_DATA_BLOB_REM = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8); if (r->info) { NDR_CHECK(ndr_push_relative_ptr2(ndr, r->info)); { struct ndr_push *_ndr_info; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, NDR_ROUND(r->ndr_size, 8))); NDR_CHECK(ndr_push_DATA_BLOB_REM(_ndr_info, NDR_SCALARS, r->info)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, NDR_ROUND(r->ndr_size, 8))); } } ndr->flags = _flags_save_DATA_BLOB_REM; } } return NDR_ERR_SUCCESS; }
static enum ndr_err_code ndr_push_frsapi_Info(struct ndr_push *ndr, int ndr_flags, const struct frsapi_Info *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->guid)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length2)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); NDR_CHECK(ndr_push_frsapi_InfoEnum(ndr, NDR_SCALARS, r->level)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->query_counter)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->offset)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->blob_len)); { uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); { struct ndr_push *_ndr_blob; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_blob, 0, r->length - r->offset)); NDR_CHECK(ndr_push_DATA_BLOB(_ndr_blob, NDR_SCALARS, r->blob)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_blob, 0, r->length - r->offset)); } ndr->flags = _flags_save_DATA_BLOB; } NDR_CHECK(ndr_push_trailer_align(ndr, 4)); } if (ndr_flags & NDR_BUFFERS) { } return NDR_ERR_SUCCESS; }
enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0))); { uint32_t _flags_save_PAC_INFO = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8); NDR_CHECK(ndr_push_relative_ptr1(ndr, r->info)); ndr->flags = _flags_save_PAC_INFO; } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); } if (ndr_flags & NDR_BUFFERS) { { uint32_t _flags_save_PAC_INFO = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8); if (r->info) { NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->info)); { struct ndr_push *_ndr_info; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience, 0))); NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type)); NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0))); } NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->info)); } ndr->flags = _flags_save_PAC_INFO; } } return NDR_ERR_SUCCESS; }
_PUBLIC_ enum ndr_err_code ndr_push_witness_notifyResponse(struct ndr_push *ndr, int ndr_flags, const struct witness_notifyResponse *r) { uint32_t cntr_messages_0; { uint32_t _flags_save_STRUCT = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags); if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_witness_notifyResponse_type(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_witness_notifyResponse(r, ndr->flags) - 20)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->messages)); if (r->messages) { uint32_t _flags_save_witness_notifyResponse_message = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); { struct ndr_push *_ndr_messages; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20)); for (cntr_messages_0 = 0; cntr_messages_0 < (r->num); cntr_messages_0++) { NDR_CHECK(ndr_push_set_switch_value(_ndr_messages, &r->messages[cntr_messages_0], r->type)); NDR_CHECK(ndr_push_witness_notifyResponse_message(_ndr_messages, NDR_SCALARS, &r->messages[cntr_messages_0])); } NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20)); } ndr->flags = _flags_save_witness_notifyResponse_message; } NDR_CHECK(ndr_push_trailer_align(ndr, 4)); } if (ndr_flags & NDR_BUFFERS) { } ndr->flags = _flags_save_STRUCT; } return NDR_ERR_SUCCESS; }
_PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags, const union PAC_INFO *r) { if (ndr_flags & NDR_SCALARS) { int level = ndr_push_get_switch_value(ndr, r); switch (level) { case PAC_TYPE_LOGON_INFO: { NDR_CHECK(ndr_push_PAC_LOGON_INFO_CTR(ndr, NDR_SCALARS, &r->logon_info)); break; } case PAC_TYPE_SRV_CHECKSUM: { NDR_CHECK(ndr_push_PAC_SIGNATURE_DATA(ndr, NDR_SCALARS, &r->srv_cksum)); break; } case PAC_TYPE_KDC_CHECKSUM: { NDR_CHECK(ndr_push_PAC_SIGNATURE_DATA(ndr, NDR_SCALARS, &r->kdc_cksum)); break; } case PAC_TYPE_LOGON_NAME: { NDR_CHECK(ndr_push_PAC_LOGON_NAME(ndr, NDR_SCALARS, &r->logon_name)); break; } default: { { struct ndr_push *_ndr_unknown; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_unknown, 0, -1)); NDR_CHECK(ndr_push_DATA_BLOB_REM(_ndr_unknown, NDR_SCALARS, &r->unknown)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_unknown, 0, -1)); } break; } } } if (ndr_flags & NDR_BUFFERS) { int level = ndr_push_get_switch_value(ndr, r); switch (level) { case PAC_TYPE_LOGON_INFO: NDR_CHECK(ndr_push_PAC_LOGON_INFO_CTR(ndr, NDR_BUFFERS, &r->logon_info)); break; case PAC_TYPE_SRV_CHECKSUM: break; case PAC_TYPE_KDC_CHECKSUM: break; case PAC_TYPE_LOGON_NAME: break; default: break; } } return NDR_ERR_SUCCESS; }
/* Manually modified to handle the dom_sid being optional based on if it is present or all zero */ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count)); { uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name)); ndr->flags = _flags_save_string; } { uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); ndr->flags = _flags_save_string; } { uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name)); ndr->flags = _flags_save_string; } NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_control)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags))); if (ndr_size_dom_sid0(&r->sid, ndr->flags)) { struct ndr_push *_ndr_sid; uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); ndr->flags = _flags_save_DATA_BLOB; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags))); NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags))); } NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); } if (ndr_flags & NDR_BUFFERS) { } return NDR_ERR_SUCCESS; }
NTSTATUS ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd,ndr->flags))); NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd)); } if (ndr_flags & NDR_BUFFERS) { if (r->sd) { { struct ndr_push *_ndr_sd; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1)); NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1)); } } } return NT_STATUS_OK; }
/* Manually modified to only push some parts of the structure if certain flags are set */ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r) { { uint32_t _flags_save_STRUCT = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz)); NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type)); NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain_name)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site)); NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site)); if (r->nt_version & NETLOGON_NT_VERSION_5EX_WITH_IP) { NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags))); { struct ndr_push *_ndr_sockaddr; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags))); NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS|NDR_BUFFERS, &r->sockaddr)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags))); } } if (r->nt_version & NETLOGON_NT_VERSION_WITH_CLOSEST_SITE) { NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site)); } NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); } if (ndr_flags & NDR_BUFFERS) { NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_uuid)); } ndr->flags = _flags_save_STRUCT; } return NDR_ERR_SUCCESS; }
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r) { if (ndr_flags & NDR_SCALARS) { uint32_t decompressed_length = 0; uint32_t compressed_length = 0; if (r->ts) { { struct ndr_push *_ndr_ts; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); { struct ndr_push *_ndr_ts_compressed; NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); decompressed_length = _ndr_ts_compressed->offset; NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); } compressed_length = _ndr_ts->offset; talloc_free(_ndr_ts); } } NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts)); } if (ndr_flags & NDR_BUFFERS) { if (r->ts) { { struct ndr_push *_ndr_ts; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); { struct ndr_push *_ndr_ts_compressed; NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); } NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1)); } } } return NDR_ERR_SUCCESS; }
_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 5)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->iconv_convenience, ndr->flags))); NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd)); NDR_CHECK(ndr_push_trailer_align(ndr, 5)); } if (ndr_flags & NDR_BUFFERS) { if (r->sd) { { struct ndr_push *_ndr_sd; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1)); NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1)); } } } return NDR_ERR_SUCCESS; }
enum ndr_err_code ndr_push_drsuapi_DsBindInfo(struct ndr_push *ndr, int ndr_flags, const union drsuapi_DsBindInfo *r) { uint32_t _flags_save = ndr->flags; ndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64; NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags); if (ndr_flags & NDR_SCALARS) { uint32_t level = ndr_push_get_switch_value(ndr, r); NDR_CHECK(ndr_push_union_align(ndr, 4)); switch (level) { case 24: { { struct ndr_push *_ndr_info24; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info24, 0, 24)); NDR_CHECK(ndr_push_drsuapi_DsBindInfo24(_ndr_info24, NDR_SCALARS, &r->info24)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info24, 0, 24)); } break; } case 28: { { struct ndr_push *_ndr_info28; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info28, 0, 28)); NDR_CHECK(ndr_push_drsuapi_DsBindInfo28(_ndr_info28, NDR_SCALARS, &r->info28)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info28, 0, 28)); } break; } case 48: { { struct ndr_push *_ndr_info48; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info48, 0, 48)); NDR_CHECK(ndr_push_drsuapi_DsBindInfo48(_ndr_info48, NDR_SCALARS, &r->info48)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info48, 0, 48)); } break; } case 52: { { struct ndr_push *_ndr_info52; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info52, 0, 52)); NDR_CHECK(ndr_push_drsuapi_DsBindInfo52(_ndr_info52, NDR_SCALARS, &r->info52)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info52, 0, 52)); } break; } default: { { struct ndr_push *_ndr_Fallback; NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Fallback, 0, level)); NDR_CHECK(ndr_push_drsuapi_DsBindInfoFallBack(_ndr_Fallback, NDR_SCALARS, &r->Fallback)); NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Fallback, 0, level)); } break; } } } if (ndr_flags & NDR_BUFFERS) { uint32_t level = ndr_push_get_switch_value(ndr, r); switch (level) { case 24: break; case 28: break; case 48: break; case 52: break; default: break; } } ndr->flags = _flags_save; return NDR_ERR_SUCCESS; }