| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
# Simple tests for pidl's handling of ref pointers, based |
|
3
|
|
|
|
|
|
|
# on tridge's ref_notes.txt |
|
4
|
|
|
|
|
|
|
# (C) 2005 Jelmer Vernooij . |
|
5
|
|
|
|
|
|
|
# Published under the GNU General Public License. |
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
918
|
use Test::More tests => 21 * 8; |
|
|
1
|
|
|
|
|
17882
|
|
|
|
1
|
|
|
|
|
10
|
|
|
9
|
1
|
|
|
1
|
|
1145
|
use FindBin qw($RealBin); |
|
|
1
|
|
|
|
|
3583
|
|
|
|
1
|
|
|
|
|
121
|
|
|
10
|
1
|
|
|
1
|
|
635
|
use lib "$RealBin/../lib"; |
|
|
1
|
|
|
|
|
671
|
|
|
|
1
|
|
|
|
|
6
|
|
|
11
|
1
|
|
|
1
|
|
146
|
use lib "$RealBin"; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
12
|
1
|
|
|
1
|
|
507
|
use Util qw(test_samba4_ndr); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
test_samba4_ndr("noptr-push", |
|
15
|
|
|
|
|
|
|
' typedef struct { |
|
16
|
|
|
|
|
|
|
uint16 x; |
|
17
|
|
|
|
|
|
|
} xstruct; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct foo); |
|
20
|
|
|
|
|
|
|
', |
|
21
|
|
|
|
|
|
|
' |
|
22
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
23
|
|
|
|
|
|
|
uint16_t v = 13; |
|
24
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
25
|
|
|
|
|
|
|
r.in.foo.x = v; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) { |
|
28
|
|
|
|
|
|
|
fprintf(stderr, "push failed\n"); |
|
29
|
|
|
|
|
|
|
return 1; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if (ndr->offset != 2) { |
|
33
|
|
|
|
|
|
|
fprintf(stderr, "Offset(%d) != 2\n", ndr->offset); |
|
34
|
|
|
|
|
|
|
return 2; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if (ndr->data[0] != 13 || ndr->data[1] != 0) { |
|
38
|
|
|
|
|
|
|
fprintf(stderr, "Data incorrect\n"); |
|
39
|
|
|
|
|
|
|
return 3; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
'); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
test_samba4_ndr("ptr-embedded-push", |
|
44
|
|
|
|
|
|
|
' typedef struct { |
|
45
|
|
|
|
|
|
|
uint16 *x; |
|
46
|
|
|
|
|
|
|
} xstruct; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct foo); |
|
49
|
|
|
|
|
|
|
', |
|
50
|
|
|
|
|
|
|
' |
|
51
|
|
|
|
|
|
|
uint16_t v = 13; |
|
52
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
53
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
54
|
|
|
|
|
|
|
r.in.foo.x = &v; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
57
|
|
|
|
|
|
|
return 1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
if (ndr->offset != 6) |
|
60
|
|
|
|
|
|
|
return 2; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if (ndr->data[0] == 0 && ndr->data[1] == 0 && |
|
63
|
|
|
|
|
|
|
ndr->data[2] == 0 && ndr->data[3] == 0) |
|
64
|
|
|
|
|
|
|
return 3; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
if (ndr->data[4] != 13 || ndr->data[5] != 0) |
|
67
|
|
|
|
|
|
|
return 4; |
|
68
|
|
|
|
|
|
|
'); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
test_samba4_ndr("ptr-embedded-push-null", |
|
71
|
|
|
|
|
|
|
' typedef struct { |
|
72
|
|
|
|
|
|
|
uint16 *x; |
|
73
|
|
|
|
|
|
|
} xstruct; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct foo); |
|
76
|
|
|
|
|
|
|
', |
|
77
|
|
|
|
|
|
|
' |
|
78
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
79
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
80
|
|
|
|
|
|
|
r.in.foo.x = NULL; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
83
|
|
|
|
|
|
|
return 1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
if (ndr->offset != 4) |
|
86
|
|
|
|
|
|
|
return 2; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
if (ndr->data[0] != 0 || ndr->data[1] != 0 || |
|
89
|
|
|
|
|
|
|
ndr->data[2] != 0 || ndr->data[3] != 0) |
|
90
|
|
|
|
|
|
|
return 3; |
|
91
|
|
|
|
|
|
|
'); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
test_samba4_ndr("refptr-embedded-push", |
|
94
|
|
|
|
|
|
|
' |
|
95
|
|
|
|
|
|
|
typedef struct { |
|
96
|
|
|
|
|
|
|
[ref] uint16 *x; |
|
97
|
|
|
|
|
|
|
} xstruct; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct foo); |
|
100
|
|
|
|
|
|
|
', |
|
101
|
|
|
|
|
|
|
' |
|
102
|
|
|
|
|
|
|
uint16_t v = 13; |
|
103
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
104
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
105
|
|
|
|
|
|
|
r.in.foo.x = &v; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
108
|
|
|
|
|
|
|
return 1; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
if (ndr->offset != 6) |
|
111
|
|
|
|
|
|
|
return 2; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
if (ndr->data[0] == 0 && ndr->data[1] == 0 && |
|
114
|
|
|
|
|
|
|
ndr->data[2] == 0 && ndr->data[3] == 0) |
|
115
|
|
|
|
|
|
|
return 3; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
if (ndr->data[4] != 13 || ndr->data[5] != 0) |
|
118
|
|
|
|
|
|
|
return 4; |
|
119
|
|
|
|
|
|
|
'); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
test_samba4_ndr("refptr-embedded-push-null", |
|
122
|
|
|
|
|
|
|
' |
|
123
|
|
|
|
|
|
|
typedef struct { |
|
124
|
|
|
|
|
|
|
[ref] uint16 *x; |
|
125
|
|
|
|
|
|
|
} xstruct; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct foo); |
|
128
|
|
|
|
|
|
|
', |
|
129
|
|
|
|
|
|
|
' |
|
130
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
131
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
132
|
|
|
|
|
|
|
r.in.foo.x = NULL; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
135
|
|
|
|
|
|
|
return 1; |
|
136
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
137
|
|
|
|
|
|
|
'); |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-push", |
|
140
|
|
|
|
|
|
|
' |
|
141
|
|
|
|
|
|
|
typedef struct { |
|
142
|
|
|
|
|
|
|
uint16 x; |
|
143
|
|
|
|
|
|
|
} xstruct; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct *foo); |
|
146
|
|
|
|
|
|
|
', |
|
147
|
|
|
|
|
|
|
' |
|
148
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
149
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
150
|
|
|
|
|
|
|
struct xstruct s; |
|
151
|
|
|
|
|
|
|
s.x = 13; |
|
152
|
|
|
|
|
|
|
r.in.foo = &s; |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
155
|
|
|
|
|
|
|
return 1; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
if (ndr->offset != 2) |
|
158
|
|
|
|
|
|
|
return 2; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
if (ndr->data[0] != 13 || ndr->data[1] != 0) |
|
161
|
|
|
|
|
|
|
return 3; |
|
162
|
|
|
|
|
|
|
'); |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-push-null", |
|
165
|
|
|
|
|
|
|
' |
|
166
|
|
|
|
|
|
|
typedef struct { |
|
167
|
|
|
|
|
|
|
uint16 x; |
|
168
|
|
|
|
|
|
|
} xstruct; |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in] xstruct *foo); |
|
171
|
|
|
|
|
|
|
', |
|
172
|
|
|
|
|
|
|
' |
|
173
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
174
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
175
|
|
|
|
|
|
|
r.in.foo = NULL; |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
178
|
|
|
|
|
|
|
return 1; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
181
|
|
|
|
|
|
|
'); |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-push", |
|
185
|
|
|
|
|
|
|
' |
|
186
|
|
|
|
|
|
|
typedef struct { |
|
187
|
|
|
|
|
|
|
uint16 x; |
|
188
|
|
|
|
|
|
|
} xstruct; |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in,ref] xstruct *foo); |
|
191
|
|
|
|
|
|
|
', |
|
192
|
|
|
|
|
|
|
' |
|
193
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
194
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
195
|
|
|
|
|
|
|
struct xstruct s; |
|
196
|
|
|
|
|
|
|
s.x = 13; |
|
197
|
|
|
|
|
|
|
r.in.foo = &s; |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
200
|
|
|
|
|
|
|
return 1; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
if (ndr->offset != 2) |
|
203
|
|
|
|
|
|
|
return 2; |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
if (ndr->data[0] != 13 || ndr->data[1] != 0) |
|
206
|
|
|
|
|
|
|
return 3; |
|
207
|
|
|
|
|
|
|
'); |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-push-null", |
|
210
|
|
|
|
|
|
|
' |
|
211
|
|
|
|
|
|
|
typedef struct { |
|
212
|
|
|
|
|
|
|
uint16 x; |
|
213
|
|
|
|
|
|
|
} xstruct; |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in,ref] xstruct *foo); |
|
216
|
|
|
|
|
|
|
', |
|
217
|
|
|
|
|
|
|
' |
|
218
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
219
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
220
|
|
|
|
|
|
|
r.in.foo = NULL; |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
223
|
|
|
|
|
|
|
return 1; |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
226
|
|
|
|
|
|
|
'); |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
test_samba4_ndr("uniqueptr-top-push", |
|
230
|
|
|
|
|
|
|
' typedef struct { |
|
231
|
|
|
|
|
|
|
uint16 x; |
|
232
|
|
|
|
|
|
|
} xstruct; |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in,unique] xstruct *foo); |
|
235
|
|
|
|
|
|
|
', |
|
236
|
|
|
|
|
|
|
' |
|
237
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
238
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
239
|
|
|
|
|
|
|
struct xstruct s; |
|
240
|
|
|
|
|
|
|
s.x = 13; |
|
241
|
|
|
|
|
|
|
r.in.foo = &s; |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
244
|
|
|
|
|
|
|
return 1; |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
if (ndr->offset != 6) |
|
247
|
|
|
|
|
|
|
return 2; |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
if (ndr->data[0] == 0 && ndr->data[1] == 0 && |
|
250
|
|
|
|
|
|
|
ndr->data[2] == 0 && ndr->data[3] == 0) |
|
251
|
|
|
|
|
|
|
return 3; |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
if (ndr->data[4] != 13 || ndr->data[5] != 0) |
|
254
|
|
|
|
|
|
|
return 4; |
|
255
|
|
|
|
|
|
|
'); |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
test_samba4_ndr("uniqueptr-top-push-null", |
|
258
|
|
|
|
|
|
|
' typedef struct { |
|
259
|
|
|
|
|
|
|
uint16 x; |
|
260
|
|
|
|
|
|
|
} xstruct; |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
[public] uint16 echo_TestRef([in,unique] xstruct *foo); |
|
263
|
|
|
|
|
|
|
', |
|
264
|
|
|
|
|
|
|
' |
|
265
|
|
|
|
|
|
|
struct ndr_push *ndr = ndr_push_init(); |
|
266
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
267
|
|
|
|
|
|
|
r.in.foo = NULL; |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
270
|
|
|
|
|
|
|
return 1; |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
if (ndr->offset != 4) |
|
273
|
|
|
|
|
|
|
return 2; |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
if (ndr->data[0] != 0 || ndr->data[1] != 0 || |
|
276
|
|
|
|
|
|
|
ndr->data[2] != 0 || ndr->data[3] != 0) |
|
277
|
|
|
|
|
|
|
return 3; |
|
278
|
|
|
|
|
|
|
'); |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-out-pull", |
|
282
|
|
|
|
|
|
|
' |
|
283
|
|
|
|
|
|
|
typedef struct { |
|
284
|
|
|
|
|
|
|
uint16 x; |
|
285
|
|
|
|
|
|
|
} xstruct; |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
[public] void echo_TestRef([out] xstruct *foo); |
|
288
|
|
|
|
|
|
|
', |
|
289
|
|
|
|
|
|
|
' |
|
290
|
|
|
|
|
|
|
uint8_t data[] = { 0x0D, 0x00 }; |
|
291
|
|
|
|
|
|
|
DATA_BLOB b = { data, 2 }; |
|
292
|
|
|
|
|
|
|
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL); |
|
293
|
|
|
|
|
|
|
struct xstruct s; |
|
294
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
r.out.foo = &s; |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r))) |
|
299
|
|
|
|
|
|
|
return 1; |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
if (!r.out.foo) |
|
302
|
|
|
|
|
|
|
return 2; |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
if (r.out.foo->x != 13) |
|
305
|
|
|
|
|
|
|
return 3; |
|
306
|
|
|
|
|
|
|
'); |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-out-pull-null", |
|
309
|
|
|
|
|
|
|
' |
|
310
|
|
|
|
|
|
|
typedef struct { |
|
311
|
|
|
|
|
|
|
uint16 x; |
|
312
|
|
|
|
|
|
|
} xstruct; |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
[public] void echo_TestRef([out] xstruct *foo); |
|
315
|
|
|
|
|
|
|
', |
|
316
|
|
|
|
|
|
|
' |
|
317
|
|
|
|
|
|
|
uint8_t data[] = { 0x0D, 0x00 }; |
|
318
|
|
|
|
|
|
|
DATA_BLOB b = { data, 2 }; |
|
319
|
|
|
|
|
|
|
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL); |
|
320
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
r.out.foo = NULL; |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r))) |
|
325
|
|
|
|
|
|
|
return 1; |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
328
|
|
|
|
|
|
|
'); |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-out-pull", |
|
332
|
|
|
|
|
|
|
' |
|
333
|
|
|
|
|
|
|
typedef struct { |
|
334
|
|
|
|
|
|
|
uint16 x; |
|
335
|
|
|
|
|
|
|
} xstruct; |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
[public] void echo_TestRef([out,ref] xstruct *foo); |
|
338
|
|
|
|
|
|
|
', |
|
339
|
|
|
|
|
|
|
' |
|
340
|
|
|
|
|
|
|
uint8_t data[] = { 0x0D, 0x00 }; |
|
341
|
|
|
|
|
|
|
DATA_BLOB b = { data, 2 }; |
|
342
|
|
|
|
|
|
|
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL); |
|
343
|
|
|
|
|
|
|
struct xstruct s; |
|
344
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
r.out.foo = &s; |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r))) |
|
349
|
|
|
|
|
|
|
return 1; |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
if (!r.out.foo) |
|
352
|
|
|
|
|
|
|
return 2; |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
if (r.out.foo->x != 13) |
|
355
|
|
|
|
|
|
|
return 3; |
|
356
|
|
|
|
|
|
|
'); |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-out-pull-null", |
|
359
|
|
|
|
|
|
|
' |
|
360
|
|
|
|
|
|
|
typedef struct { |
|
361
|
|
|
|
|
|
|
uint16 x; |
|
362
|
|
|
|
|
|
|
} xstruct; |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
[public] void echo_TestRef([out,ref] xstruct *foo); |
|
365
|
|
|
|
|
|
|
', |
|
366
|
|
|
|
|
|
|
' |
|
367
|
|
|
|
|
|
|
uint8_t data[] = { 0x0D, 0x00 }; |
|
368
|
|
|
|
|
|
|
DATA_BLOB b = { data, 2 }; |
|
369
|
|
|
|
|
|
|
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL); |
|
370
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
r.out.foo = NULL; |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r))) |
|
375
|
|
|
|
|
|
|
return 1; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
378
|
|
|
|
|
|
|
'); |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-push-double", |
|
382
|
|
|
|
|
|
|
' |
|
383
|
|
|
|
|
|
|
[public] void echo_TestRef([in] uint16 **foo); |
|
384
|
|
|
|
|
|
|
', |
|
385
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
386
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
387
|
|
|
|
|
|
|
uint16_t v = 13; |
|
388
|
|
|
|
|
|
|
uint16_t *pv = &v; |
|
389
|
|
|
|
|
|
|
r.in.foo = &pv; |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
392
|
|
|
|
|
|
|
return 1; |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
if (ndr->offset != 6) |
|
395
|
|
|
|
|
|
|
return 2; |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
if (ndr->data[0] == 0 && ndr->data[1] == 0 && |
|
398
|
|
|
|
|
|
|
ndr->data[2] == 0 && ndr->data[3] == 0) |
|
399
|
|
|
|
|
|
|
return 3; |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
if (ndr->data[4] != 0x0D || ndr->data[5] != 0x00) |
|
402
|
|
|
|
|
|
|
return 4; |
|
403
|
|
|
|
|
|
|
'); |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-push-double-sndnull", |
|
406
|
|
|
|
|
|
|
' |
|
407
|
|
|
|
|
|
|
[public] void echo_TestRef([in] uint16 **foo); |
|
408
|
|
|
|
|
|
|
', |
|
409
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
410
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
411
|
|
|
|
|
|
|
uint16_t *pv = NULL; |
|
412
|
|
|
|
|
|
|
r.in.foo = &pv; |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
415
|
|
|
|
|
|
|
return 1; |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
if (ndr->offset != 4) |
|
418
|
|
|
|
|
|
|
return 2; |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
if (ndr->data[0] != 0 || ndr->data[1] != 0 || |
|
421
|
|
|
|
|
|
|
ndr->data[2] != 0 || ndr->data[3] != 0) |
|
422
|
|
|
|
|
|
|
return 3; |
|
423
|
|
|
|
|
|
|
'); |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
test_samba4_ndr("ptr-top-push-double-fstnull", |
|
426
|
|
|
|
|
|
|
' |
|
427
|
|
|
|
|
|
|
[public] void echo_TestRef([in] uint16 **foo); |
|
428
|
|
|
|
|
|
|
', |
|
429
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
430
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
431
|
|
|
|
|
|
|
r.in.foo = NULL; |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
434
|
|
|
|
|
|
|
return 1; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
'); |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-push-double", |
|
442
|
|
|
|
|
|
|
' |
|
443
|
|
|
|
|
|
|
[public] void echo_TestRef([in,ref] uint16 **foo); |
|
444
|
|
|
|
|
|
|
', |
|
445
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
446
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
447
|
|
|
|
|
|
|
uint16_t v = 13; |
|
448
|
|
|
|
|
|
|
uint16_t *pv = &v; |
|
449
|
|
|
|
|
|
|
r.in.foo = &pv; |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
452
|
|
|
|
|
|
|
return 1; |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
if (ndr->offset != 6) |
|
455
|
|
|
|
|
|
|
return 2; |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
if (ndr->data[0] == 0 && ndr->data[1] == 0 && |
|
458
|
|
|
|
|
|
|
ndr->data[2] == 0 && ndr->data[3] == 0) |
|
459
|
|
|
|
|
|
|
return 3; |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
if (ndr->data[4] != 0x0D || ndr->data[5] != 0x00) |
|
462
|
|
|
|
|
|
|
return 4; |
|
463
|
|
|
|
|
|
|
'); |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-push-double-sndnull", |
|
466
|
|
|
|
|
|
|
' |
|
467
|
|
|
|
|
|
|
[public] void echo_TestRef([in,ref] uint16 **foo); |
|
468
|
|
|
|
|
|
|
', |
|
469
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
470
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
471
|
|
|
|
|
|
|
uint16_t *pv = NULL; |
|
472
|
|
|
|
|
|
|
r.in.foo = &pv; |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
475
|
|
|
|
|
|
|
return 1; |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
if (ndr->offset != 4) |
|
478
|
|
|
|
|
|
|
return 2; |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
if (ndr->data[0] != 0 || ndr->data[1] != 0 || |
|
481
|
|
|
|
|
|
|
ndr->data[2] != 0 || ndr->data[3] != 0) |
|
482
|
|
|
|
|
|
|
return 3; |
|
483
|
|
|
|
|
|
|
'); |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
test_samba4_ndr("refptr-top-push-double-fstnull", |
|
486
|
|
|
|
|
|
|
' |
|
487
|
|
|
|
|
|
|
[public] void echo_TestRef([in,ref] uint16 **foo); |
|
488
|
|
|
|
|
|
|
', |
|
489
|
|
|
|
|
|
|
' struct ndr_push *ndr = ndr_push_init(); |
|
490
|
|
|
|
|
|
|
struct echo_TestRef r; |
|
491
|
|
|
|
|
|
|
r.in.foo = NULL; |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
494
|
|
|
|
|
|
|
return 1; |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
/* Windows gives [client runtime error 0x6f4] */ |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
'); |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
#FIXME: Not supported yet |
|
501
|
|
|
|
|
|
|
#test_samba4_ndr("ignore-ptr", |
|
502
|
|
|
|
|
|
|
#' |
|
503
|
|
|
|
|
|
|
# [public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar); |
|
504
|
|
|
|
|
|
|
#', |
|
505
|
|
|
|
|
|
|
#' struct ndr_push *ndr = ndr_push_init(); |
|
506
|
|
|
|
|
|
|
# struct echo_TestRef r; |
|
507
|
|
|
|
|
|
|
# uint16_t v = 10; |
|
508
|
|
|
|
|
|
|
# r.in.foo = &v; |
|
509
|
|
|
|
|
|
|
# r.in.bar = &v; |
|
510
|
|
|
|
|
|
|
# |
|
511
|
|
|
|
|
|
|
# if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) |
|
512
|
|
|
|
|
|
|
# return 1; |
|
513
|
|
|
|
|
|
|
# |
|
514
|
|
|
|
|
|
|
# if (ndr->offset != 4) |
|
515
|
|
|
|
|
|
|
# return 2; |
|
516
|
|
|
|
|
|
|
#'); |