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 */
25 #include "../libcli/netlogon/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
->flags
&= ~LIBNDR_FLAG_NOALIGN
;
57 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
58 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->_pad
));
59 ndr
->flags
= _flags_save_DATA_BLOB
;
60 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_sid
, 0, ndr_size_dom_sid0(&r
->sid
, ndr
->flags
)));
61 NDR_CHECK(ndr_push_dom_sid0(_ndr_sid
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sid
));
62 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_sid
, 0, ndr_size_dom_sid0(&r
->sid
, ndr
->flags
)));
64 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
65 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
66 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
68 if (ndr_flags
& NDR_BUFFERS
) {
70 return NDR_ERR_SUCCESS
;
73 /* Manually modified to handle the dom_sid being optional based on if it is present (size is non-zero) or not */
74 enum ndr_err_code
ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull
*ndr
, int ndr_flags
, struct NETLOGON_SAM_LOGON_REQUEST
*r
)
76 if (ndr_flags
& NDR_SCALARS
) {
77 NDR_CHECK(ndr_pull_align(ndr
, 4));
78 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->request_count
));
80 uint32_t _flags_save_string
= ndr
->flags
;
81 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
82 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->computer_name
));
83 ndr
->flags
= _flags_save_string
;
86 uint32_t _flags_save_string
= ndr
->flags
;
87 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
);
88 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->user_name
));
89 ndr
->flags
= _flags_save_string
;
92 uint32_t _flags_save_string
= ndr
->flags
;
93 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
94 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->mailslot_name
));
95 ndr
->flags
= _flags_save_string
;
97 NDR_CHECK(ndr_pull_samr_AcctFlags(ndr
, NDR_SCALARS
, &r
->acct_control
));
98 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->sid_size
));
100 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
101 struct ndr_pull
*_ndr_sid
;
102 ndr
->flags
&= ~LIBNDR_FLAG_NOALIGN
;
103 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN4
);
104 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->_pad
));
105 ndr
->flags
= _flags_save_DATA_BLOB
;
106 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_sid
, 0, r
->sid_size
));
107 NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sid
));
108 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_sid
, 0, r
->sid_size
));
112 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
113 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
114 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
116 if (ndr_flags
& NDR_BUFFERS
) {
118 return NDR_ERR_SUCCESS
;
121 /* Manually modified to only push some parts of the structure if certain flags are set */
122 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
)
125 uint32_t _flags_save_STRUCT
= ndr
->flags
;
126 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
127 if (ndr_flags
& NDR_SCALARS
) {
128 NDR_CHECK(ndr_push_align(ndr
, 4));
129 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
130 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->sbz
));
131 NDR_CHECK(ndr_push_nbt_server_type(ndr
, NDR_SCALARS
, r
->server_type
));
132 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
133 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->forest
));
134 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->dns_domain
));
135 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->pdc_dns_name
));
136 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->domain_name
));
137 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->pdc_name
));
138 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->user_name
));
139 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->server_site
));
140 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->client_site
));
141 if (r
->nt_version
& NETLOGON_NT_VERSION_5EX_WITH_IP
) {
142 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->flags
)));
144 struct ndr_push
*_ndr_sockaddr
;
145 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_sockaddr
, 0, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->flags
)));
146 NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sockaddr
));
147 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_sockaddr
, 0, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->flags
)));
150 if (r
->nt_version
& NETLOGON_NT_VERSION_WITH_CLOSEST_SITE
) {
151 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->next_closest_site
));
153 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
154 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
155 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
157 if (ndr_flags
& NDR_BUFFERS
) {
158 NDR_CHECK(ndr_push_GUID(ndr
, NDR_BUFFERS
, &r
->domain_uuid
));
160 ndr
->flags
= _flags_save_STRUCT
;
162 return NDR_ERR_SUCCESS
;
165 /* Manually modified to only pull some parts of the structure if certain flags provided */
166 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
,
167 uint32_t nt_version_flags
)
170 uint32_t _flags_save_STRUCT
= ndr
->flags
;
172 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
173 if (ndr_flags
& NDR_SCALARS
) {
174 NDR_CHECK(ndr_pull_align(ndr
, 4));
175 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
176 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->sbz
));
177 NDR_CHECK(ndr_pull_nbt_server_type(ndr
, NDR_SCALARS
, &r
->server_type
));
178 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
179 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->forest
));
180 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->dns_domain
));
181 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->pdc_dns_name
));
182 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->domain_name
));
183 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->pdc_name
));
184 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->user_name
));
185 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->server_site
));
186 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->client_site
));
187 if (nt_version_flags
& NETLOGON_NT_VERSION_5EX_WITH_IP
) {
188 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->sockaddr_size
));
190 struct ndr_pull
*_ndr_sockaddr
;
191 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_sockaddr
, 0, r
->sockaddr_size
));
192 NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sockaddr
));
193 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_sockaddr
, 0, r
->sockaddr_size
));
196 if (nt_version_flags
& NETLOGON_NT_VERSION_WITH_CLOSEST_SITE
) {
197 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->next_closest_site
));
199 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
200 if (r
->nt_version
!= nt_version_flags
) {
201 return NDR_ERR_VALIDATE
;
203 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
204 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
206 if (ndr_flags
& NDR_BUFFERS
) {
207 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_BUFFERS
, &r
->domain_uuid
));
209 ndr
->flags
= _flags_save_STRUCT
;
211 return NDR_ERR_SUCCESS
;