2 Unix SMB/CIFS implementation.
4 Manually parsed structures found in the DRS protocol
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/>.
23 #include "librpc/gen_ndr/ndr_drsblobs.h"
25 /* parser auto-generated by pidl, then hand-modified by abartlet */
27 /* Modified to have 'count' specified */
28 static enum ndr_err_code
ndr_push_AuthenticationInformationArray_with_count(struct ndr_push
*ndr
, int ndr_flags
, int count
,
29 const struct AuthenticationInformationArray
*r
)
31 uint32_t cntr_array_0
;
32 if (ndr_flags
& NDR_SCALARS
) {
33 NDR_CHECK(ndr_push_align(ndr
, 4));
34 for (cntr_array_0
= 0; cntr_array_0
< count
; cntr_array_0
++) {
35 NDR_CHECK(ndr_push_AuthenticationInformation(ndr
, NDR_SCALARS
, &r
->array
[cntr_array_0
]));
38 if (ndr_flags
& NDR_BUFFERS
) {
39 for (cntr_array_0
= 0; cntr_array_0
< count
; cntr_array_0
++) {
40 NDR_CHECK(ndr_push_AuthenticationInformation(ndr
, NDR_BUFFERS
, &r
->array
[cntr_array_0
]));
43 return NDR_ERR_SUCCESS
;
46 /* Modified to have 'count' specified, and to allocate the array */
47 static enum ndr_err_code
ndr_pull_AuthenticationInformationArray_with_count(struct ndr_pull
*ndr
, int ndr_flags
, int count
, struct AuthenticationInformationArray
*r
)
49 uint32_t cntr_array_0
;
50 TALLOC_CTX
*_mem_save_array_0
;
51 if (ndr_flags
& NDR_SCALARS
) {
52 NDR_CHECK(ndr_pull_align(ndr
, 4));
53 NDR_PULL_ALLOC_N(ndr
, r
->array
, count
);
54 _mem_save_array_0
= NDR_PULL_GET_MEM_CTX(ndr
);
55 NDR_PULL_SET_MEM_CTX(ndr
, r
->array
, 0);
56 for (cntr_array_0
= 0; cntr_array_0
< count
; cntr_array_0
++) {
57 NDR_CHECK(ndr_pull_AuthenticationInformation(ndr
, NDR_SCALARS
, &r
->array
[cntr_array_0
]));
59 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_array_0
, 0);
61 if (ndr_flags
& NDR_BUFFERS
) {
62 for (cntr_array_0
= 0; cntr_array_0
< count
; cntr_array_0
++) {
63 NDR_CHECK(ndr_pull_AuthenticationInformation(ndr
, NDR_BUFFERS
, &r
->array
[cntr_array_0
]));
66 return NDR_ERR_SUCCESS
;
69 /* Modified to have 'count' specified */
70 _PUBLIC_
void ndr_print_AuthenticationInformationArray_with_count(struct ndr_print
*ndr
, const char *name
, int count
, const struct AuthenticationInformationArray
*r
)
72 uint32_t cntr_array_0
;
73 ndr_print_struct(ndr
, name
, "AuthenticationInformationArray");
75 ndr
->print(ndr
, "%s: ARRAY(%d)", "array", (int)1);
77 for (cntr_array_0
=0;cntr_array_0
<count
;cntr_array_0
++) {
79 if (asprintf(&idx_0
, "[%d]", cntr_array_0
) != -1) {
80 ndr_print_AuthenticationInformation(ndr
, "array", &r
->array
[cntr_array_0
]);
88 /* Modified to call AuthenticationInformationArray with 'count' specified */
89 _PUBLIC_
enum ndr_err_code
ndr_push_trustAuthInOutBlob(struct ndr_push
*ndr
, int ndr_flags
, const struct trustAuthInOutBlob
*r
)
91 if (ndr_flags
& NDR_SCALARS
) {
92 NDR_CHECK(ndr_push_align(ndr
, 4));
93 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->count
));
94 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->current
));
95 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->previous
));
97 if (ndr_flags
& NDR_BUFFERS
) {
99 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->current
));
100 NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->count
, r
->current
));
103 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->previous
));
104 NDR_CHECK(ndr_push_AuthenticationInformationArray_with_count(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->count
, r
->previous
));
107 return NDR_ERR_SUCCESS
;
110 _PUBLIC_
enum ndr_err_code
ndr_pull_trustAuthInOutBlob(struct ndr_pull
*ndr
, int ndr_flags
, struct trustAuthInOutBlob
*r
)
112 uint32_t _ptr_current
;
113 TALLOC_CTX
*_mem_save_current_0
;
114 uint32_t _ptr_previous
;
115 TALLOC_CTX
*_mem_save_previous_0
;
116 if (ndr_flags
& NDR_SCALARS
) {
117 NDR_CHECK(ndr_pull_align(ndr
, 4));
118 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->count
));
119 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_current
));
121 NDR_PULL_ALLOC(ndr
, r
->current
);
122 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->current
, _ptr_current
));
126 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_previous
));
128 NDR_PULL_ALLOC(ndr
, r
->previous
);
129 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->previous
, _ptr_previous
));
134 if (ndr_flags
& NDR_BUFFERS
) {
136 uint32_t _relative_save_offset
;
137 _relative_save_offset
= ndr
->offset
;
138 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->current
));
139 _mem_save_current_0
= NDR_PULL_GET_MEM_CTX(ndr
);
140 NDR_PULL_SET_MEM_CTX(ndr
, r
->current
, 0);
141 NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->count
, r
->current
));
142 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_current_0
, 0);
143 ndr
->offset
= _relative_save_offset
;
146 uint32_t _relative_save_offset
;
147 _relative_save_offset
= ndr
->offset
;
148 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->previous
));
149 _mem_save_previous_0
= NDR_PULL_GET_MEM_CTX(ndr
);
150 NDR_PULL_SET_MEM_CTX(ndr
, r
->previous
, 0);
151 NDR_CHECK(ndr_pull_AuthenticationInformationArray_with_count(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->count
, r
->previous
));
152 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_previous_0
, 0);
153 ndr
->offset
= _relative_save_offset
;
156 return NDR_ERR_SUCCESS
;
159 _PUBLIC_
void ndr_print_trustAuthInOutBlob(struct ndr_print
*ndr
, const char *name
, const struct trustAuthInOutBlob
*r
)
161 ndr_print_struct(ndr
, name
, "trustAuthInOutBlob");
163 ndr_print_uint32(ndr
, "count", r
->count
);
164 ndr_print_ptr(ndr
, "current", r
->current
);
167 ndr_print_AuthenticationInformationArray_with_count(ndr
, "current", r
->count
, r
->current
);
170 ndr_print_ptr(ndr
, "previous", r
->previous
);
173 ndr_print_AuthenticationInformationArray_with_count(ndr
, "previous", r
->count
, r
->previous
);
179 _PUBLIC_
enum ndr_err_code
ndr_pull_trustDomainPasswords(struct ndr_pull
*ndr
, int ndr_flags
, struct trustDomainPasswords
*r
)
181 if (ndr_flags
& NDR_SCALARS
) {
183 NDR_PULL_ALIGN(ndr
, 4);
184 NDR_PULL_NEED_BYTES(ndr
, 8);
186 offset
= ndr
->offset
;
187 ndr
->offset
= ndr
->data_size
- 8;
189 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->outgoing_size
));
190 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->incoming_size
));
192 ndr
->offset
= offset
;
193 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->confounder
, 512));
195 struct ndr_pull
*_ndr_outgoing
;
196 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_outgoing
, 0, r
->outgoing_size
));
197 NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_outgoing
, NDR_SCALARS
|NDR_BUFFERS
, &r
->outgoing
));
198 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_outgoing
, 0, r
->outgoing_size
));
201 struct ndr_pull
*_ndr_incoming
;
202 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_incoming
, 0, r
->incoming_size
));
203 NDR_CHECK(ndr_pull_trustCurrentPasswords(_ndr_incoming
, NDR_SCALARS
|NDR_BUFFERS
, &r
->incoming
));
204 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_incoming
, 0, r
->incoming_size
));
206 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->outgoing_size
));
207 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->incoming_size
));
209 if (ndr_flags
& NDR_BUFFERS
) {
211 return NDR_ERR_SUCCESS
;