s3:winbind: Add async wb_seqnum
[Samba/aatanasov.git] / libcli / ndr_netlogon.c
blob0354cfb592ce473614e6d24b50f7aee85b696fae
1 /*
2 Unix SMB/CIFS implementation.
4 CLDAP server structures
6 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /* parser auto-generated by pidl, then hand-modified by abartlet */
24 #include "includes.h"
25 #include "../libcli/netlogon.h"
27 /* Manually modified to handle the dom_sid being optional based on if it is present or all zero */
28 enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r)
30 if (ndr_flags & NDR_SCALARS) {
31 NDR_CHECK(ndr_push_align(ndr, 4));
32 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count));
34 uint32_t _flags_save_string = ndr->flags;
35 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
36 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
37 ndr->flags = _flags_save_string;
40 uint32_t _flags_save_string = ndr->flags;
41 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
42 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
43 ndr->flags = _flags_save_string;
46 uint32_t _flags_save_string = ndr->flags;
47 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
48 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
49 ndr->flags = _flags_save_string;
51 NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_control));
52 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
53 if (ndr_size_dom_sid0(&r->sid, ndr->flags)) {
54 struct ndr_push *_ndr_sid;
55 uint32_t _flags_save_DATA_BLOB = ndr->flags;
56 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
57 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
58 ndr->flags = _flags_save_DATA_BLOB;
59 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
60 NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
61 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
63 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
64 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
65 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
67 if (ndr_flags & NDR_BUFFERS) {
69 return NDR_ERR_SUCCESS;
72 /* Manually modified to handle the dom_sid being optional based on if it is present (size is non-zero) or not */
73 enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r)
75 if (ndr_flags & NDR_SCALARS) {
76 NDR_CHECK(ndr_pull_align(ndr, 4));
77 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count));
79 uint32_t _flags_save_string = ndr->flags;
80 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
81 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
82 ndr->flags = _flags_save_string;
85 uint32_t _flags_save_string = ndr->flags;
86 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
87 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
88 ndr->flags = _flags_save_string;
91 uint32_t _flags_save_string = ndr->flags;
92 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
93 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
94 ndr->flags = _flags_save_string;
96 NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_control));
97 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
98 if (r->sid_size) {
99 uint32_t _flags_save_DATA_BLOB = ndr->flags;
100 struct ndr_pull *_ndr_sid;
101 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
102 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
103 ndr->flags = _flags_save_DATA_BLOB;
104 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
105 NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
106 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
107 } else {
108 ZERO_STRUCT(r->sid);
110 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
111 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
112 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
114 if (ndr_flags & NDR_BUFFERS) {
116 return NDR_ERR_SUCCESS;
119 /* Manually modified to only push some parts of the structure if certain flags are set */
120 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)
123 uint32_t _flags_save_STRUCT = ndr->flags;
124 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
125 if (ndr_flags & NDR_SCALARS) {
126 NDR_CHECK(ndr_push_align(ndr, 4));
127 NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
128 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
129 NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
130 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
131 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
132 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
133 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
134 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
135 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
136 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
137 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
138 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
139 if (r->nt_version & NETLOGON_NT_VERSION_5EX_WITH_IP) {
140 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->iconv_convenience, ndr->flags)));
142 struct ndr_push *_ndr_sockaddr;
143 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->iconv_convenience, ndr->flags)));
144 NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS|NDR_BUFFERS, &r->sockaddr));
145 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->iconv_convenience, ndr->flags)));
148 if (r->nt_version & NETLOGON_NT_VERSION_WITH_CLOSEST_SITE) {
149 NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
151 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
152 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
153 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
155 if (ndr_flags & NDR_BUFFERS) {
156 NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_uuid));
158 ndr->flags = _flags_save_STRUCT;
160 return NDR_ERR_SUCCESS;
163 /* Manually modified to only pull some parts of the structure if certain flags provided */
164 enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
165 uint32_t nt_version_flags)
168 uint32_t _flags_save_STRUCT = ndr->flags;
169 ZERO_STRUCTP(r);
170 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
171 if (ndr_flags & NDR_SCALARS) {
172 NDR_CHECK(ndr_pull_align(ndr, 4));
173 NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
174 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
175 NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
176 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
177 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
178 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
179 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
180 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
181 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
182 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
183 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
184 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
185 if (nt_version_flags & NETLOGON_NT_VERSION_5EX_WITH_IP) {
186 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sockaddr_size));
188 struct ndr_pull *_ndr_sockaddr;
189 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sockaddr, 0, r->sockaddr_size));
190 NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS|NDR_BUFFERS, &r->sockaddr));
191 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sockaddr, 0, r->sockaddr_size));
194 if (nt_version_flags & NETLOGON_NT_VERSION_WITH_CLOSEST_SITE) {
195 NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
197 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
198 if (r->nt_version != nt_version_flags) {
199 return NDR_ERR_VALIDATE;
201 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
202 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
204 if (ndr_flags & NDR_BUFFERS) {
205 NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_uuid));
207 ndr->flags = _flags_save_STRUCT;
209 return NDR_ERR_SUCCESS;