~ubuntu-branches/ubuntu/precise/samba/precise

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/srv_drsuapi.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Unix SMB/CIFS implementation.
 
3
 * server auto-generated by pidl. DO NOT MODIFY!
 
4
 */
 
5
 
 
6
#include "includes.h"
 
7
#include "ntdomain.h"
 
8
#include "librpc/gen_ndr/srv_drsuapi.h"
 
9
 
 
10
static bool api_drsuapi_DsBind(struct pipes_struct *p)
 
11
{
 
12
        const struct ndr_interface_call *call;
 
13
        struct ndr_pull *pull;
 
14
        struct ndr_push *push;
 
15
        enum ndr_err_code ndr_err;
 
16
        struct drsuapi_DsBind *r;
 
17
 
 
18
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSBIND];
 
19
 
 
20
        r = talloc(talloc_tos(), struct drsuapi_DsBind);
 
21
        if (r == NULL) {
 
22
                return false;
 
23
        }
 
24
 
 
25
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
26
        if (pull == NULL) {
 
27
                talloc_free(r);
 
28
                return false;
 
29
        }
 
30
 
 
31
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
32
        if (p->endian) {
 
33
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
34
        }
 
35
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
36
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
37
                talloc_free(r);
 
38
                return false;
 
39
        }
 
40
 
 
41
        if (DEBUGLEVEL >= 10) {
 
42
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsBind, NDR_IN, r);
 
43
        }
 
44
 
 
45
        ZERO_STRUCT(r->out);
 
46
        r->out.bind_info = r->in.bind_info;
 
47
        r->out.bind_handle = talloc_zero(r, struct policy_handle);
 
48
        if (r->out.bind_handle == NULL) {
 
49
                talloc_free(r);
 
50
                return false;
 
51
        }
 
52
 
 
53
        r->out.result = _drsuapi_DsBind(p, r);
 
54
 
 
55
        if (p->rng_fault_state) {
 
56
                talloc_free(r);
 
57
                /* Return true here, srv_pipe_hnd.c will take care */
 
58
                return true;
 
59
        }
 
60
 
 
61
        if (DEBUGLEVEL >= 10) {
 
62
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsBind, NDR_OUT | NDR_SET_VALUES, r);
 
63
        }
 
64
 
 
65
        push = ndr_push_init_ctx(r);
 
66
        if (push == NULL) {
 
67
                talloc_free(r);
 
68
                return false;
 
69
        }
 
70
 
 
71
        /*
 
72
         * carry over the pointer count to the reply in case we are
 
73
         * using full pointer. See NDR specification for full pointers
 
74
         */
 
75
        push->ptr_count = pull->ptr_count;
 
76
 
 
77
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
78
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
79
                talloc_free(r);
 
80
                return false;
 
81
        }
 
82
 
 
83
        p->out_data.rdata = ndr_push_blob(push);
 
84
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
85
 
 
86
        talloc_free(r);
 
87
 
 
88
        return true;
 
89
}
 
90
 
 
91
static bool api_drsuapi_DsUnbind(struct pipes_struct *p)
 
92
{
 
93
        const struct ndr_interface_call *call;
 
94
        struct ndr_pull *pull;
 
95
        struct ndr_push *push;
 
96
        enum ndr_err_code ndr_err;
 
97
        struct drsuapi_DsUnbind *r;
 
98
 
 
99
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSUNBIND];
 
100
 
 
101
        r = talloc(talloc_tos(), struct drsuapi_DsUnbind);
 
102
        if (r == NULL) {
 
103
                return false;
 
104
        }
 
105
 
 
106
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
107
        if (pull == NULL) {
 
108
                talloc_free(r);
 
109
                return false;
 
110
        }
 
111
 
 
112
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
113
        if (p->endian) {
 
114
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
115
        }
 
116
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
117
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
118
                talloc_free(r);
 
119
                return false;
 
120
        }
 
121
 
 
122
        if (DEBUGLEVEL >= 10) {
 
123
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsUnbind, NDR_IN, r);
 
124
        }
 
125
 
 
126
        ZERO_STRUCT(r->out);
 
127
        r->out.bind_handle = r->in.bind_handle;
 
128
        r->out.result = _drsuapi_DsUnbind(p, r);
 
129
 
 
130
        if (p->rng_fault_state) {
 
131
                talloc_free(r);
 
132
                /* Return true here, srv_pipe_hnd.c will take care */
 
133
                return true;
 
134
        }
 
135
 
 
136
        if (DEBUGLEVEL >= 10) {
 
137
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsUnbind, NDR_OUT | NDR_SET_VALUES, r);
 
138
        }
 
139
 
 
140
        push = ndr_push_init_ctx(r);
 
141
        if (push == NULL) {
 
142
                talloc_free(r);
 
143
                return false;
 
144
        }
 
145
 
 
146
        /*
 
147
         * carry over the pointer count to the reply in case we are
 
148
         * using full pointer. See NDR specification for full pointers
 
149
         */
 
150
        push->ptr_count = pull->ptr_count;
 
151
 
 
152
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
153
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
154
                talloc_free(r);
 
155
                return false;
 
156
        }
 
157
 
 
158
        p->out_data.rdata = ndr_push_blob(push);
 
159
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
160
 
 
161
        talloc_free(r);
 
162
 
 
163
        return true;
 
164
}
 
165
 
 
166
static bool api_drsuapi_DsReplicaSync(struct pipes_struct *p)
 
167
{
 
168
        const struct ndr_interface_call *call;
 
169
        struct ndr_pull *pull;
 
170
        struct ndr_push *push;
 
171
        enum ndr_err_code ndr_err;
 
172
        struct drsuapi_DsReplicaSync *r;
 
173
 
 
174
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICASYNC];
 
175
 
 
176
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaSync);
 
177
        if (r == NULL) {
 
178
                return false;
 
179
        }
 
180
 
 
181
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
182
        if (pull == NULL) {
 
183
                talloc_free(r);
 
184
                return false;
 
185
        }
 
186
 
 
187
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
188
        if (p->endian) {
 
189
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
190
        }
 
191
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
192
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
193
                talloc_free(r);
 
194
                return false;
 
195
        }
 
196
 
 
197
        if (DEBUGLEVEL >= 10) {
 
198
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaSync, NDR_IN, r);
 
199
        }
 
200
 
 
201
        r->out.result = _drsuapi_DsReplicaSync(p, r);
 
202
 
 
203
        if (p->rng_fault_state) {
 
204
                talloc_free(r);
 
205
                /* Return true here, srv_pipe_hnd.c will take care */
 
206
                return true;
 
207
        }
 
208
 
 
209
        if (DEBUGLEVEL >= 10) {
 
210
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaSync, NDR_OUT | NDR_SET_VALUES, r);
 
211
        }
 
212
 
 
213
        push = ndr_push_init_ctx(r);
 
214
        if (push == NULL) {
 
215
                talloc_free(r);
 
216
                return false;
 
217
        }
 
218
 
 
219
        /*
 
220
         * carry over the pointer count to the reply in case we are
 
221
         * using full pointer. See NDR specification for full pointers
 
222
         */
 
223
        push->ptr_count = pull->ptr_count;
 
224
 
 
225
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
226
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
227
                talloc_free(r);
 
228
                return false;
 
229
        }
 
230
 
 
231
        p->out_data.rdata = ndr_push_blob(push);
 
232
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
233
 
 
234
        talloc_free(r);
 
235
 
 
236
        return true;
 
237
}
 
238
 
 
239
static bool api_drsuapi_DsGetNCChanges(struct pipes_struct *p)
 
240
{
 
241
        const struct ndr_interface_call *call;
 
242
        struct ndr_pull *pull;
 
243
        struct ndr_push *push;
 
244
        enum ndr_err_code ndr_err;
 
245
        struct drsuapi_DsGetNCChanges *r;
 
246
 
 
247
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSGETNCCHANGES];
 
248
 
 
249
        r = talloc(talloc_tos(), struct drsuapi_DsGetNCChanges);
 
250
        if (r == NULL) {
 
251
                return false;
 
252
        }
 
253
 
 
254
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
255
        if (pull == NULL) {
 
256
                talloc_free(r);
 
257
                return false;
 
258
        }
 
259
 
 
260
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
261
        if (p->endian) {
 
262
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
263
        }
 
264
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
265
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
266
                talloc_free(r);
 
267
                return false;
 
268
        }
 
269
 
 
270
        if (DEBUGLEVEL >= 10) {
 
271
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetNCChanges, NDR_IN, r);
 
272
        }
 
273
 
 
274
        ZERO_STRUCT(r->out);
 
275
        r->out.level_out = talloc_zero(r, uint32_t);
 
276
        if (r->out.level_out == NULL) {
 
277
                talloc_free(r);
 
278
                return false;
 
279
        }
 
280
 
 
281
        r->out.ctr = talloc_zero(r, union drsuapi_DsGetNCChangesCtr);
 
282
        if (r->out.ctr == NULL) {
 
283
                talloc_free(r);
 
284
                return false;
 
285
        }
 
286
 
 
287
        r->out.result = _drsuapi_DsGetNCChanges(p, r);
 
288
 
 
289
        if (p->rng_fault_state) {
 
290
                talloc_free(r);
 
291
                /* Return true here, srv_pipe_hnd.c will take care */
 
292
                return true;
 
293
        }
 
294
 
 
295
        if (DEBUGLEVEL >= 10) {
 
296
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetNCChanges, NDR_OUT | NDR_SET_VALUES, r);
 
297
        }
 
298
 
 
299
        push = ndr_push_init_ctx(r);
 
300
        if (push == NULL) {
 
301
                talloc_free(r);
 
302
                return false;
 
303
        }
 
304
 
 
305
        /*
 
306
         * carry over the pointer count to the reply in case we are
 
307
         * using full pointer. See NDR specification for full pointers
 
308
         */
 
309
        push->ptr_count = pull->ptr_count;
 
310
 
 
311
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
312
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
313
                talloc_free(r);
 
314
                return false;
 
315
        }
 
316
 
 
317
        p->out_data.rdata = ndr_push_blob(push);
 
318
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
319
 
 
320
        talloc_free(r);
 
321
 
 
322
        return true;
 
323
}
 
324
 
 
325
static bool api_drsuapi_DsReplicaUpdateRefs(struct pipes_struct *p)
 
326
{
 
327
        const struct ndr_interface_call *call;
 
328
        struct ndr_pull *pull;
 
329
        struct ndr_push *push;
 
330
        enum ndr_err_code ndr_err;
 
331
        struct drsuapi_DsReplicaUpdateRefs *r;
 
332
 
 
333
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICAUPDATEREFS];
 
334
 
 
335
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaUpdateRefs);
 
336
        if (r == NULL) {
 
337
                return false;
 
338
        }
 
339
 
 
340
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
341
        if (pull == NULL) {
 
342
                talloc_free(r);
 
343
                return false;
 
344
        }
 
345
 
 
346
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
347
        if (p->endian) {
 
348
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
349
        }
 
350
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
351
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
352
                talloc_free(r);
 
353
                return false;
 
354
        }
 
355
 
 
356
        if (DEBUGLEVEL >= 10) {
 
357
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaUpdateRefs, NDR_IN, r);
 
358
        }
 
359
 
 
360
        r->out.result = _drsuapi_DsReplicaUpdateRefs(p, r);
 
361
 
 
362
        if (p->rng_fault_state) {
 
363
                talloc_free(r);
 
364
                /* Return true here, srv_pipe_hnd.c will take care */
 
365
                return true;
 
366
        }
 
367
 
 
368
        if (DEBUGLEVEL >= 10) {
 
369
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaUpdateRefs, NDR_OUT | NDR_SET_VALUES, r);
 
370
        }
 
371
 
 
372
        push = ndr_push_init_ctx(r);
 
373
        if (push == NULL) {
 
374
                talloc_free(r);
 
375
                return false;
 
376
        }
 
377
 
 
378
        /*
 
379
         * carry over the pointer count to the reply in case we are
 
380
         * using full pointer. See NDR specification for full pointers
 
381
         */
 
382
        push->ptr_count = pull->ptr_count;
 
383
 
 
384
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
385
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
386
                talloc_free(r);
 
387
                return false;
 
388
        }
 
389
 
 
390
        p->out_data.rdata = ndr_push_blob(push);
 
391
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
392
 
 
393
        talloc_free(r);
 
394
 
 
395
        return true;
 
396
}
 
397
 
 
398
static bool api_drsuapi_DsReplicaAdd(struct pipes_struct *p)
 
399
{
 
400
        const struct ndr_interface_call *call;
 
401
        struct ndr_pull *pull;
 
402
        struct ndr_push *push;
 
403
        enum ndr_err_code ndr_err;
 
404
        struct drsuapi_DsReplicaAdd *r;
 
405
 
 
406
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICAADD];
 
407
 
 
408
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaAdd);
 
409
        if (r == NULL) {
 
410
                return false;
 
411
        }
 
412
 
 
413
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
414
        if (pull == NULL) {
 
415
                talloc_free(r);
 
416
                return false;
 
417
        }
 
418
 
 
419
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
420
        if (p->endian) {
 
421
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
422
        }
 
423
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
424
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
425
                talloc_free(r);
 
426
                return false;
 
427
        }
 
428
 
 
429
        if (DEBUGLEVEL >= 10) {
 
430
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaAdd, NDR_IN, r);
 
431
        }
 
432
 
 
433
        r->out.result = _drsuapi_DsReplicaAdd(p, r);
 
434
 
 
435
        if (p->rng_fault_state) {
 
436
                talloc_free(r);
 
437
                /* Return true here, srv_pipe_hnd.c will take care */
 
438
                return true;
 
439
        }
 
440
 
 
441
        if (DEBUGLEVEL >= 10) {
 
442
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaAdd, NDR_OUT | NDR_SET_VALUES, r);
 
443
        }
 
444
 
 
445
        push = ndr_push_init_ctx(r);
 
446
        if (push == NULL) {
 
447
                talloc_free(r);
 
448
                return false;
 
449
        }
 
450
 
 
451
        /*
 
452
         * carry over the pointer count to the reply in case we are
 
453
         * using full pointer. See NDR specification for full pointers
 
454
         */
 
455
        push->ptr_count = pull->ptr_count;
 
456
 
 
457
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
458
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
459
                talloc_free(r);
 
460
                return false;
 
461
        }
 
462
 
 
463
        p->out_data.rdata = ndr_push_blob(push);
 
464
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
465
 
 
466
        talloc_free(r);
 
467
 
 
468
        return true;
 
469
}
 
470
 
 
471
static bool api_drsuapi_DsReplicaDel(struct pipes_struct *p)
 
472
{
 
473
        const struct ndr_interface_call *call;
 
474
        struct ndr_pull *pull;
 
475
        struct ndr_push *push;
 
476
        enum ndr_err_code ndr_err;
 
477
        struct drsuapi_DsReplicaDel *r;
 
478
 
 
479
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICADEL];
 
480
 
 
481
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaDel);
 
482
        if (r == NULL) {
 
483
                return false;
 
484
        }
 
485
 
 
486
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
487
        if (pull == NULL) {
 
488
                talloc_free(r);
 
489
                return false;
 
490
        }
 
491
 
 
492
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
493
        if (p->endian) {
 
494
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
495
        }
 
496
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
497
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
498
                talloc_free(r);
 
499
                return false;
 
500
        }
 
501
 
 
502
        if (DEBUGLEVEL >= 10) {
 
503
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaDel, NDR_IN, r);
 
504
        }
 
505
 
 
506
        r->out.result = _drsuapi_DsReplicaDel(p, r);
 
507
 
 
508
        if (p->rng_fault_state) {
 
509
                talloc_free(r);
 
510
                /* Return true here, srv_pipe_hnd.c will take care */
 
511
                return true;
 
512
        }
 
513
 
 
514
        if (DEBUGLEVEL >= 10) {
 
515
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaDel, NDR_OUT | NDR_SET_VALUES, r);
 
516
        }
 
517
 
 
518
        push = ndr_push_init_ctx(r);
 
519
        if (push == NULL) {
 
520
                talloc_free(r);
 
521
                return false;
 
522
        }
 
523
 
 
524
        /*
 
525
         * carry over the pointer count to the reply in case we are
 
526
         * using full pointer. See NDR specification for full pointers
 
527
         */
 
528
        push->ptr_count = pull->ptr_count;
 
529
 
 
530
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
531
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
532
                talloc_free(r);
 
533
                return false;
 
534
        }
 
535
 
 
536
        p->out_data.rdata = ndr_push_blob(push);
 
537
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
538
 
 
539
        talloc_free(r);
 
540
 
 
541
        return true;
 
542
}
 
543
 
 
544
static bool api_drsuapi_DsReplicaMod(struct pipes_struct *p)
 
545
{
 
546
        const struct ndr_interface_call *call;
 
547
        struct ndr_pull *pull;
 
548
        struct ndr_push *push;
 
549
        enum ndr_err_code ndr_err;
 
550
        struct drsuapi_DsReplicaMod *r;
 
551
 
 
552
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICAMOD];
 
553
 
 
554
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaMod);
 
555
        if (r == NULL) {
 
556
                return false;
 
557
        }
 
558
 
 
559
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
560
        if (pull == NULL) {
 
561
                talloc_free(r);
 
562
                return false;
 
563
        }
 
564
 
 
565
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
566
        if (p->endian) {
 
567
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
568
        }
 
569
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
570
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
571
                talloc_free(r);
 
572
                return false;
 
573
        }
 
574
 
 
575
        if (DEBUGLEVEL >= 10) {
 
576
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaMod, NDR_IN, r);
 
577
        }
 
578
 
 
579
        r->out.result = _drsuapi_DsReplicaMod(p, r);
 
580
 
 
581
        if (p->rng_fault_state) {
 
582
                talloc_free(r);
 
583
                /* Return true here, srv_pipe_hnd.c will take care */
 
584
                return true;
 
585
        }
 
586
 
 
587
        if (DEBUGLEVEL >= 10) {
 
588
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaMod, NDR_OUT | NDR_SET_VALUES, r);
 
589
        }
 
590
 
 
591
        push = ndr_push_init_ctx(r);
 
592
        if (push == NULL) {
 
593
                talloc_free(r);
 
594
                return false;
 
595
        }
 
596
 
 
597
        /*
 
598
         * carry over the pointer count to the reply in case we are
 
599
         * using full pointer. See NDR specification for full pointers
 
600
         */
 
601
        push->ptr_count = pull->ptr_count;
 
602
 
 
603
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
604
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
605
                talloc_free(r);
 
606
                return false;
 
607
        }
 
608
 
 
609
        p->out_data.rdata = ndr_push_blob(push);
 
610
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
611
 
 
612
        talloc_free(r);
 
613
 
 
614
        return true;
 
615
}
 
616
 
 
617
static bool api_DRSUAPI_VERIFY_NAMES(struct pipes_struct *p)
 
618
{
 
619
        const struct ndr_interface_call *call;
 
620
        struct ndr_pull *pull;
 
621
        struct ndr_push *push;
 
622
        enum ndr_err_code ndr_err;
 
623
        struct DRSUAPI_VERIFY_NAMES *r;
 
624
 
 
625
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_VERIFY_NAMES];
 
626
 
 
627
        r = talloc(talloc_tos(), struct DRSUAPI_VERIFY_NAMES);
 
628
        if (r == NULL) {
 
629
                return false;
 
630
        }
 
631
 
 
632
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
633
        if (pull == NULL) {
 
634
                talloc_free(r);
 
635
                return false;
 
636
        }
 
637
 
 
638
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
639
        if (p->endian) {
 
640
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
641
        }
 
642
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
643
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
644
                talloc_free(r);
 
645
                return false;
 
646
        }
 
647
 
 
648
        if (DEBUGLEVEL >= 10) {
 
649
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_VERIFY_NAMES, NDR_IN, r);
 
650
        }
 
651
 
 
652
        r->out.result = _DRSUAPI_VERIFY_NAMES(p, r);
 
653
 
 
654
        if (p->rng_fault_state) {
 
655
                talloc_free(r);
 
656
                /* Return true here, srv_pipe_hnd.c will take care */
 
657
                return true;
 
658
        }
 
659
 
 
660
        if (DEBUGLEVEL >= 10) {
 
661
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_VERIFY_NAMES, NDR_OUT | NDR_SET_VALUES, r);
 
662
        }
 
663
 
 
664
        push = ndr_push_init_ctx(r);
 
665
        if (push == NULL) {
 
666
                talloc_free(r);
 
667
                return false;
 
668
        }
 
669
 
 
670
        /*
 
671
         * carry over the pointer count to the reply in case we are
 
672
         * using full pointer. See NDR specification for full pointers
 
673
         */
 
674
        push->ptr_count = pull->ptr_count;
 
675
 
 
676
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
677
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
678
                talloc_free(r);
 
679
                return false;
 
680
        }
 
681
 
 
682
        p->out_data.rdata = ndr_push_blob(push);
 
683
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
684
 
 
685
        talloc_free(r);
 
686
 
 
687
        return true;
 
688
}
 
689
 
 
690
static bool api_drsuapi_DsGetMemberships(struct pipes_struct *p)
 
691
{
 
692
        const struct ndr_interface_call *call;
 
693
        struct ndr_pull *pull;
 
694
        struct ndr_push *push;
 
695
        enum ndr_err_code ndr_err;
 
696
        struct drsuapi_DsGetMemberships *r;
 
697
 
 
698
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSGETMEMBERSHIPS];
 
699
 
 
700
        r = talloc(talloc_tos(), struct drsuapi_DsGetMemberships);
 
701
        if (r == NULL) {
 
702
                return false;
 
703
        }
 
704
 
 
705
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
706
        if (pull == NULL) {
 
707
                talloc_free(r);
 
708
                return false;
 
709
        }
 
710
 
 
711
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
712
        if (p->endian) {
 
713
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
714
        }
 
715
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
716
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
717
                talloc_free(r);
 
718
                return false;
 
719
        }
 
720
 
 
721
        if (DEBUGLEVEL >= 10) {
 
722
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetMemberships, NDR_IN, r);
 
723
        }
 
724
 
 
725
        ZERO_STRUCT(r->out);
 
726
        r->out.level_out = talloc_zero(r, uint32_t);
 
727
        if (r->out.level_out == NULL) {
 
728
                talloc_free(r);
 
729
                return false;
 
730
        }
 
731
 
 
732
        r->out.ctr = talloc_zero(r, union drsuapi_DsGetMembershipsCtr);
 
733
        if (r->out.ctr == NULL) {
 
734
                talloc_free(r);
 
735
                return false;
 
736
        }
 
737
 
 
738
        r->out.result = _drsuapi_DsGetMemberships(p, r);
 
739
 
 
740
        if (p->rng_fault_state) {
 
741
                talloc_free(r);
 
742
                /* Return true here, srv_pipe_hnd.c will take care */
 
743
                return true;
 
744
        }
 
745
 
 
746
        if (DEBUGLEVEL >= 10) {
 
747
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetMemberships, NDR_OUT | NDR_SET_VALUES, r);
 
748
        }
 
749
 
 
750
        push = ndr_push_init_ctx(r);
 
751
        if (push == NULL) {
 
752
                talloc_free(r);
 
753
                return false;
 
754
        }
 
755
 
 
756
        /*
 
757
         * carry over the pointer count to the reply in case we are
 
758
         * using full pointer. See NDR specification for full pointers
 
759
         */
 
760
        push->ptr_count = pull->ptr_count;
 
761
 
 
762
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
763
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
764
                talloc_free(r);
 
765
                return false;
 
766
        }
 
767
 
 
768
        p->out_data.rdata = ndr_push_blob(push);
 
769
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
770
 
 
771
        talloc_free(r);
 
772
 
 
773
        return true;
 
774
}
 
775
 
 
776
static bool api_DRSUAPI_INTER_DOMAIN_MOVE(struct pipes_struct *p)
 
777
{
 
778
        const struct ndr_interface_call *call;
 
779
        struct ndr_pull *pull;
 
780
        struct ndr_push *push;
 
781
        enum ndr_err_code ndr_err;
 
782
        struct DRSUAPI_INTER_DOMAIN_MOVE *r;
 
783
 
 
784
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_INTER_DOMAIN_MOVE];
 
785
 
 
786
        r = talloc(talloc_tos(), struct DRSUAPI_INTER_DOMAIN_MOVE);
 
787
        if (r == NULL) {
 
788
                return false;
 
789
        }
 
790
 
 
791
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
792
        if (pull == NULL) {
 
793
                talloc_free(r);
 
794
                return false;
 
795
        }
 
796
 
 
797
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
798
        if (p->endian) {
 
799
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
800
        }
 
801
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
802
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
803
                talloc_free(r);
 
804
                return false;
 
805
        }
 
806
 
 
807
        if (DEBUGLEVEL >= 10) {
 
808
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_INTER_DOMAIN_MOVE, NDR_IN, r);
 
809
        }
 
810
 
 
811
        r->out.result = _DRSUAPI_INTER_DOMAIN_MOVE(p, r);
 
812
 
 
813
        if (p->rng_fault_state) {
 
814
                talloc_free(r);
 
815
                /* Return true here, srv_pipe_hnd.c will take care */
 
816
                return true;
 
817
        }
 
818
 
 
819
        if (DEBUGLEVEL >= 10) {
 
820
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_INTER_DOMAIN_MOVE, NDR_OUT | NDR_SET_VALUES, r);
 
821
        }
 
822
 
 
823
        push = ndr_push_init_ctx(r);
 
824
        if (push == NULL) {
 
825
                talloc_free(r);
 
826
                return false;
 
827
        }
 
828
 
 
829
        /*
 
830
         * carry over the pointer count to the reply in case we are
 
831
         * using full pointer. See NDR specification for full pointers
 
832
         */
 
833
        push->ptr_count = pull->ptr_count;
 
834
 
 
835
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
836
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
837
                talloc_free(r);
 
838
                return false;
 
839
        }
 
840
 
 
841
        p->out_data.rdata = ndr_push_blob(push);
 
842
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
843
 
 
844
        talloc_free(r);
 
845
 
 
846
        return true;
 
847
}
 
848
 
 
849
static bool api_drsuapi_DsGetNT4ChangeLog(struct pipes_struct *p)
 
850
{
 
851
        const struct ndr_interface_call *call;
 
852
        struct ndr_pull *pull;
 
853
        struct ndr_push *push;
 
854
        enum ndr_err_code ndr_err;
 
855
        struct drsuapi_DsGetNT4ChangeLog *r;
 
856
 
 
857
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSGETNT4CHANGELOG];
 
858
 
 
859
        r = talloc(talloc_tos(), struct drsuapi_DsGetNT4ChangeLog);
 
860
        if (r == NULL) {
 
861
                return false;
 
862
        }
 
863
 
 
864
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
865
        if (pull == NULL) {
 
866
                talloc_free(r);
 
867
                return false;
 
868
        }
 
869
 
 
870
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
871
        if (p->endian) {
 
872
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
873
        }
 
874
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
875
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
876
                talloc_free(r);
 
877
                return false;
 
878
        }
 
879
 
 
880
        if (DEBUGLEVEL >= 10) {
 
881
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetNT4ChangeLog, NDR_IN, r);
 
882
        }
 
883
 
 
884
        ZERO_STRUCT(r->out);
 
885
        r->out.level_out = talloc_zero(r, uint32_t);
 
886
        if (r->out.level_out == NULL) {
 
887
                talloc_free(r);
 
888
                return false;
 
889
        }
 
890
 
 
891
        r->out.info = talloc_zero(r, union drsuapi_DsGetNT4ChangeLogInfo);
 
892
        if (r->out.info == NULL) {
 
893
                talloc_free(r);
 
894
                return false;
 
895
        }
 
896
 
 
897
        r->out.result = _drsuapi_DsGetNT4ChangeLog(p, r);
 
898
 
 
899
        if (p->rng_fault_state) {
 
900
                talloc_free(r);
 
901
                /* Return true here, srv_pipe_hnd.c will take care */
 
902
                return true;
 
903
        }
 
904
 
 
905
        if (DEBUGLEVEL >= 10) {
 
906
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetNT4ChangeLog, NDR_OUT | NDR_SET_VALUES, r);
 
907
        }
 
908
 
 
909
        push = ndr_push_init_ctx(r);
 
910
        if (push == NULL) {
 
911
                talloc_free(r);
 
912
                return false;
 
913
        }
 
914
 
 
915
        /*
 
916
         * carry over the pointer count to the reply in case we are
 
917
         * using full pointer. See NDR specification for full pointers
 
918
         */
 
919
        push->ptr_count = pull->ptr_count;
 
920
 
 
921
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
922
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
923
                talloc_free(r);
 
924
                return false;
 
925
        }
 
926
 
 
927
        p->out_data.rdata = ndr_push_blob(push);
 
928
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
929
 
 
930
        talloc_free(r);
 
931
 
 
932
        return true;
 
933
}
 
934
 
 
935
static bool api_drsuapi_DsCrackNames(struct pipes_struct *p)
 
936
{
 
937
        const struct ndr_interface_call *call;
 
938
        struct ndr_pull *pull;
 
939
        struct ndr_push *push;
 
940
        enum ndr_err_code ndr_err;
 
941
        struct drsuapi_DsCrackNames *r;
 
942
 
 
943
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSCRACKNAMES];
 
944
 
 
945
        r = talloc(talloc_tos(), struct drsuapi_DsCrackNames);
 
946
        if (r == NULL) {
 
947
                return false;
 
948
        }
 
949
 
 
950
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
951
        if (pull == NULL) {
 
952
                talloc_free(r);
 
953
                return false;
 
954
        }
 
955
 
 
956
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
957
        if (p->endian) {
 
958
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
959
        }
 
960
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
961
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
962
                talloc_free(r);
 
963
                return false;
 
964
        }
 
965
 
 
966
        if (DEBUGLEVEL >= 10) {
 
967
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsCrackNames, NDR_IN, r);
 
968
        }
 
969
 
 
970
        ZERO_STRUCT(r->out);
 
971
        r->out.level_out = talloc_zero(r, uint32_t);
 
972
        if (r->out.level_out == NULL) {
 
973
                talloc_free(r);
 
974
                return false;
 
975
        }
 
976
 
 
977
        r->out.ctr = talloc_zero(r, union drsuapi_DsNameCtr);
 
978
        if (r->out.ctr == NULL) {
 
979
                talloc_free(r);
 
980
                return false;
 
981
        }
 
982
 
 
983
        r->out.result = _drsuapi_DsCrackNames(p, r);
 
984
 
 
985
        if (p->rng_fault_state) {
 
986
                talloc_free(r);
 
987
                /* Return true here, srv_pipe_hnd.c will take care */
 
988
                return true;
 
989
        }
 
990
 
 
991
        if (DEBUGLEVEL >= 10) {
 
992
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsCrackNames, NDR_OUT | NDR_SET_VALUES, r);
 
993
        }
 
994
 
 
995
        push = ndr_push_init_ctx(r);
 
996
        if (push == NULL) {
 
997
                talloc_free(r);
 
998
                return false;
 
999
        }
 
1000
 
 
1001
        /*
 
1002
         * carry over the pointer count to the reply in case we are
 
1003
         * using full pointer. See NDR specification for full pointers
 
1004
         */
 
1005
        push->ptr_count = pull->ptr_count;
 
1006
 
 
1007
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1008
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1009
                talloc_free(r);
 
1010
                return false;
 
1011
        }
 
1012
 
 
1013
        p->out_data.rdata = ndr_push_blob(push);
 
1014
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1015
 
 
1016
        talloc_free(r);
 
1017
 
 
1018
        return true;
 
1019
}
 
1020
 
 
1021
static bool api_drsuapi_DsWriteAccountSpn(struct pipes_struct *p)
 
1022
{
 
1023
        const struct ndr_interface_call *call;
 
1024
        struct ndr_pull *pull;
 
1025
        struct ndr_push *push;
 
1026
        enum ndr_err_code ndr_err;
 
1027
        struct drsuapi_DsWriteAccountSpn *r;
 
1028
 
 
1029
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSWRITEACCOUNTSPN];
 
1030
 
 
1031
        r = talloc(talloc_tos(), struct drsuapi_DsWriteAccountSpn);
 
1032
        if (r == NULL) {
 
1033
                return false;
 
1034
        }
 
1035
 
 
1036
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1037
        if (pull == NULL) {
 
1038
                talloc_free(r);
 
1039
                return false;
 
1040
        }
 
1041
 
 
1042
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1043
        if (p->endian) {
 
1044
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1045
        }
 
1046
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1047
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1048
                talloc_free(r);
 
1049
                return false;
 
1050
        }
 
1051
 
 
1052
        if (DEBUGLEVEL >= 10) {
 
1053
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsWriteAccountSpn, NDR_IN, r);
 
1054
        }
 
1055
 
 
1056
        ZERO_STRUCT(r->out);
 
1057
        r->out.level_out = talloc_zero(r, uint32_t);
 
1058
        if (r->out.level_out == NULL) {
 
1059
                talloc_free(r);
 
1060
                return false;
 
1061
        }
 
1062
 
 
1063
        r->out.res = talloc_zero(r, union drsuapi_DsWriteAccountSpnResult);
 
1064
        if (r->out.res == NULL) {
 
1065
                talloc_free(r);
 
1066
                return false;
 
1067
        }
 
1068
 
 
1069
        r->out.result = _drsuapi_DsWriteAccountSpn(p, r);
 
1070
 
 
1071
        if (p->rng_fault_state) {
 
1072
                talloc_free(r);
 
1073
                /* Return true here, srv_pipe_hnd.c will take care */
 
1074
                return true;
 
1075
        }
 
1076
 
 
1077
        if (DEBUGLEVEL >= 10) {
 
1078
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsWriteAccountSpn, NDR_OUT | NDR_SET_VALUES, r);
 
1079
        }
 
1080
 
 
1081
        push = ndr_push_init_ctx(r);
 
1082
        if (push == NULL) {
 
1083
                talloc_free(r);
 
1084
                return false;
 
1085
        }
 
1086
 
 
1087
        /*
 
1088
         * carry over the pointer count to the reply in case we are
 
1089
         * using full pointer. See NDR specification for full pointers
 
1090
         */
 
1091
        push->ptr_count = pull->ptr_count;
 
1092
 
 
1093
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1094
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1095
                talloc_free(r);
 
1096
                return false;
 
1097
        }
 
1098
 
 
1099
        p->out_data.rdata = ndr_push_blob(push);
 
1100
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1101
 
 
1102
        talloc_free(r);
 
1103
 
 
1104
        return true;
 
1105
}
 
1106
 
 
1107
static bool api_drsuapi_DsRemoveDSServer(struct pipes_struct *p)
 
1108
{
 
1109
        const struct ndr_interface_call *call;
 
1110
        struct ndr_pull *pull;
 
1111
        struct ndr_push *push;
 
1112
        enum ndr_err_code ndr_err;
 
1113
        struct drsuapi_DsRemoveDSServer *r;
 
1114
 
 
1115
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREMOVEDSSERVER];
 
1116
 
 
1117
        r = talloc(talloc_tos(), struct drsuapi_DsRemoveDSServer);
 
1118
        if (r == NULL) {
 
1119
                return false;
 
1120
        }
 
1121
 
 
1122
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1123
        if (pull == NULL) {
 
1124
                talloc_free(r);
 
1125
                return false;
 
1126
        }
 
1127
 
 
1128
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1129
        if (p->endian) {
 
1130
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1131
        }
 
1132
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1133
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1134
                talloc_free(r);
 
1135
                return false;
 
1136
        }
 
1137
 
 
1138
        if (DEBUGLEVEL >= 10) {
 
1139
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsRemoveDSServer, NDR_IN, r);
 
1140
        }
 
1141
 
 
1142
        ZERO_STRUCT(r->out);
 
1143
        r->out.level_out = talloc_zero(r, uint32_t);
 
1144
        if (r->out.level_out == NULL) {
 
1145
                talloc_free(r);
 
1146
                return false;
 
1147
        }
 
1148
 
 
1149
        r->out.res = talloc_zero(r, union drsuapi_DsRemoveDSServerResult);
 
1150
        if (r->out.res == NULL) {
 
1151
                talloc_free(r);
 
1152
                return false;
 
1153
        }
 
1154
 
 
1155
        r->out.result = _drsuapi_DsRemoveDSServer(p, r);
 
1156
 
 
1157
        if (p->rng_fault_state) {
 
1158
                talloc_free(r);
 
1159
                /* Return true here, srv_pipe_hnd.c will take care */
 
1160
                return true;
 
1161
        }
 
1162
 
 
1163
        if (DEBUGLEVEL >= 10) {
 
1164
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsRemoveDSServer, NDR_OUT | NDR_SET_VALUES, r);
 
1165
        }
 
1166
 
 
1167
        push = ndr_push_init_ctx(r);
 
1168
        if (push == NULL) {
 
1169
                talloc_free(r);
 
1170
                return false;
 
1171
        }
 
1172
 
 
1173
        /*
 
1174
         * carry over the pointer count to the reply in case we are
 
1175
         * using full pointer. See NDR specification for full pointers
 
1176
         */
 
1177
        push->ptr_count = pull->ptr_count;
 
1178
 
 
1179
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1180
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1181
                talloc_free(r);
 
1182
                return false;
 
1183
        }
 
1184
 
 
1185
        p->out_data.rdata = ndr_push_blob(push);
 
1186
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1187
 
 
1188
        talloc_free(r);
 
1189
 
 
1190
        return true;
 
1191
}
 
1192
 
 
1193
static bool api_DRSUAPI_REMOVE_DS_DOMAIN(struct pipes_struct *p)
 
1194
{
 
1195
        const struct ndr_interface_call *call;
 
1196
        struct ndr_pull *pull;
 
1197
        struct ndr_push *push;
 
1198
        enum ndr_err_code ndr_err;
 
1199
        struct DRSUAPI_REMOVE_DS_DOMAIN *r;
 
1200
 
 
1201
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_REMOVE_DS_DOMAIN];
 
1202
 
 
1203
        r = talloc(talloc_tos(), struct DRSUAPI_REMOVE_DS_DOMAIN);
 
1204
        if (r == NULL) {
 
1205
                return false;
 
1206
        }
 
1207
 
 
1208
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1209
        if (pull == NULL) {
 
1210
                talloc_free(r);
 
1211
                return false;
 
1212
        }
 
1213
 
 
1214
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1215
        if (p->endian) {
 
1216
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1217
        }
 
1218
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1219
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1220
                talloc_free(r);
 
1221
                return false;
 
1222
        }
 
1223
 
 
1224
        if (DEBUGLEVEL >= 10) {
 
1225
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_REMOVE_DS_DOMAIN, NDR_IN, r);
 
1226
        }
 
1227
 
 
1228
        r->out.result = _DRSUAPI_REMOVE_DS_DOMAIN(p, r);
 
1229
 
 
1230
        if (p->rng_fault_state) {
 
1231
                talloc_free(r);
 
1232
                /* Return true here, srv_pipe_hnd.c will take care */
 
1233
                return true;
 
1234
        }
 
1235
 
 
1236
        if (DEBUGLEVEL >= 10) {
 
1237
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_REMOVE_DS_DOMAIN, NDR_OUT | NDR_SET_VALUES, r);
 
1238
        }
 
1239
 
 
1240
        push = ndr_push_init_ctx(r);
 
1241
        if (push == NULL) {
 
1242
                talloc_free(r);
 
1243
                return false;
 
1244
        }
 
1245
 
 
1246
        /*
 
1247
         * carry over the pointer count to the reply in case we are
 
1248
         * using full pointer. See NDR specification for full pointers
 
1249
         */
 
1250
        push->ptr_count = pull->ptr_count;
 
1251
 
 
1252
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1253
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1254
                talloc_free(r);
 
1255
                return false;
 
1256
        }
 
1257
 
 
1258
        p->out_data.rdata = ndr_push_blob(push);
 
1259
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1260
 
 
1261
        talloc_free(r);
 
1262
 
 
1263
        return true;
 
1264
}
 
1265
 
 
1266
static bool api_drsuapi_DsGetDomainControllerInfo(struct pipes_struct *p)
 
1267
{
 
1268
        const struct ndr_interface_call *call;
 
1269
        struct ndr_pull *pull;
 
1270
        struct ndr_push *push;
 
1271
        enum ndr_err_code ndr_err;
 
1272
        struct drsuapi_DsGetDomainControllerInfo *r;
 
1273
 
 
1274
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSGETDOMAINCONTROLLERINFO];
 
1275
 
 
1276
        r = talloc(talloc_tos(), struct drsuapi_DsGetDomainControllerInfo);
 
1277
        if (r == NULL) {
 
1278
                return false;
 
1279
        }
 
1280
 
 
1281
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1282
        if (pull == NULL) {
 
1283
                talloc_free(r);
 
1284
                return false;
 
1285
        }
 
1286
 
 
1287
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1288
        if (p->endian) {
 
1289
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1290
        }
 
1291
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1292
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1293
                talloc_free(r);
 
1294
                return false;
 
1295
        }
 
1296
 
 
1297
        if (DEBUGLEVEL >= 10) {
 
1298
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetDomainControllerInfo, NDR_IN, r);
 
1299
        }
 
1300
 
 
1301
        ZERO_STRUCT(r->out);
 
1302
        r->out.level_out = talloc_zero(r, int32_t);
 
1303
        if (r->out.level_out == NULL) {
 
1304
                talloc_free(r);
 
1305
                return false;
 
1306
        }
 
1307
 
 
1308
        r->out.ctr = talloc_zero(r, union drsuapi_DsGetDCInfoCtr);
 
1309
        if (r->out.ctr == NULL) {
 
1310
                talloc_free(r);
 
1311
                return false;
 
1312
        }
 
1313
 
 
1314
        r->out.result = _drsuapi_DsGetDomainControllerInfo(p, r);
 
1315
 
 
1316
        if (p->rng_fault_state) {
 
1317
                talloc_free(r);
 
1318
                /* Return true here, srv_pipe_hnd.c will take care */
 
1319
                return true;
 
1320
        }
 
1321
 
 
1322
        if (DEBUGLEVEL >= 10) {
 
1323
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetDomainControllerInfo, NDR_OUT | NDR_SET_VALUES, r);
 
1324
        }
 
1325
 
 
1326
        push = ndr_push_init_ctx(r);
 
1327
        if (push == NULL) {
 
1328
                talloc_free(r);
 
1329
                return false;
 
1330
        }
 
1331
 
 
1332
        /*
 
1333
         * carry over the pointer count to the reply in case we are
 
1334
         * using full pointer. See NDR specification for full pointers
 
1335
         */
 
1336
        push->ptr_count = pull->ptr_count;
 
1337
 
 
1338
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1339
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1340
                talloc_free(r);
 
1341
                return false;
 
1342
        }
 
1343
 
 
1344
        p->out_data.rdata = ndr_push_blob(push);
 
1345
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1346
 
 
1347
        talloc_free(r);
 
1348
 
 
1349
        return true;
 
1350
}
 
1351
 
 
1352
static bool api_drsuapi_DsAddEntry(struct pipes_struct *p)
 
1353
{
 
1354
        const struct ndr_interface_call *call;
 
1355
        struct ndr_pull *pull;
 
1356
        struct ndr_push *push;
 
1357
        enum ndr_err_code ndr_err;
 
1358
        struct drsuapi_DsAddEntry *r;
 
1359
 
 
1360
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSADDENTRY];
 
1361
 
 
1362
        r = talloc(talloc_tos(), struct drsuapi_DsAddEntry);
 
1363
        if (r == NULL) {
 
1364
                return false;
 
1365
        }
 
1366
 
 
1367
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1368
        if (pull == NULL) {
 
1369
                talloc_free(r);
 
1370
                return false;
 
1371
        }
 
1372
 
 
1373
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1374
        if (p->endian) {
 
1375
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1376
        }
 
1377
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1378
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1379
                talloc_free(r);
 
1380
                return false;
 
1381
        }
 
1382
 
 
1383
        if (DEBUGLEVEL >= 10) {
 
1384
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsAddEntry, NDR_IN, r);
 
1385
        }
 
1386
 
 
1387
        ZERO_STRUCT(r->out);
 
1388
        r->out.level_out = talloc_zero(r, uint32_t);
 
1389
        if (r->out.level_out == NULL) {
 
1390
                talloc_free(r);
 
1391
                return false;
 
1392
        }
 
1393
 
 
1394
        r->out.ctr = talloc_zero(r, union drsuapi_DsAddEntryCtr);
 
1395
        if (r->out.ctr == NULL) {
 
1396
                talloc_free(r);
 
1397
                return false;
 
1398
        }
 
1399
 
 
1400
        r->out.result = _drsuapi_DsAddEntry(p, r);
 
1401
 
 
1402
        if (p->rng_fault_state) {
 
1403
                talloc_free(r);
 
1404
                /* Return true here, srv_pipe_hnd.c will take care */
 
1405
                return true;
 
1406
        }
 
1407
 
 
1408
        if (DEBUGLEVEL >= 10) {
 
1409
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsAddEntry, NDR_OUT | NDR_SET_VALUES, r);
 
1410
        }
 
1411
 
 
1412
        push = ndr_push_init_ctx(r);
 
1413
        if (push == NULL) {
 
1414
                talloc_free(r);
 
1415
                return false;
 
1416
        }
 
1417
 
 
1418
        /*
 
1419
         * carry over the pointer count to the reply in case we are
 
1420
         * using full pointer. See NDR specification for full pointers
 
1421
         */
 
1422
        push->ptr_count = pull->ptr_count;
 
1423
 
 
1424
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1425
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1426
                talloc_free(r);
 
1427
                return false;
 
1428
        }
 
1429
 
 
1430
        p->out_data.rdata = ndr_push_blob(push);
 
1431
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1432
 
 
1433
        talloc_free(r);
 
1434
 
 
1435
        return true;
 
1436
}
 
1437
 
 
1438
static bool api_drsuapi_DsExecuteKCC(struct pipes_struct *p)
 
1439
{
 
1440
        const struct ndr_interface_call *call;
 
1441
        struct ndr_pull *pull;
 
1442
        struct ndr_push *push;
 
1443
        enum ndr_err_code ndr_err;
 
1444
        struct drsuapi_DsExecuteKCC *r;
 
1445
 
 
1446
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSEXECUTEKCC];
 
1447
 
 
1448
        r = talloc(talloc_tos(), struct drsuapi_DsExecuteKCC);
 
1449
        if (r == NULL) {
 
1450
                return false;
 
1451
        }
 
1452
 
 
1453
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1454
        if (pull == NULL) {
 
1455
                talloc_free(r);
 
1456
                return false;
 
1457
        }
 
1458
 
 
1459
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1460
        if (p->endian) {
 
1461
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1462
        }
 
1463
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1464
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1465
                talloc_free(r);
 
1466
                return false;
 
1467
        }
 
1468
 
 
1469
        if (DEBUGLEVEL >= 10) {
 
1470
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsExecuteKCC, NDR_IN, r);
 
1471
        }
 
1472
 
 
1473
        r->out.result = _drsuapi_DsExecuteKCC(p, r);
 
1474
 
 
1475
        if (p->rng_fault_state) {
 
1476
                talloc_free(r);
 
1477
                /* Return true here, srv_pipe_hnd.c will take care */
 
1478
                return true;
 
1479
        }
 
1480
 
 
1481
        if (DEBUGLEVEL >= 10) {
 
1482
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsExecuteKCC, NDR_OUT | NDR_SET_VALUES, r);
 
1483
        }
 
1484
 
 
1485
        push = ndr_push_init_ctx(r);
 
1486
        if (push == NULL) {
 
1487
                talloc_free(r);
 
1488
                return false;
 
1489
        }
 
1490
 
 
1491
        /*
 
1492
         * carry over the pointer count to the reply in case we are
 
1493
         * using full pointer. See NDR specification for full pointers
 
1494
         */
 
1495
        push->ptr_count = pull->ptr_count;
 
1496
 
 
1497
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1498
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1499
                talloc_free(r);
 
1500
                return false;
 
1501
        }
 
1502
 
 
1503
        p->out_data.rdata = ndr_push_blob(push);
 
1504
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1505
 
 
1506
        talloc_free(r);
 
1507
 
 
1508
        return true;
 
1509
}
 
1510
 
 
1511
static bool api_drsuapi_DsReplicaGetInfo(struct pipes_struct *p)
 
1512
{
 
1513
        const struct ndr_interface_call *call;
 
1514
        struct ndr_pull *pull;
 
1515
        struct ndr_push *push;
 
1516
        enum ndr_err_code ndr_err;
 
1517
        struct drsuapi_DsReplicaGetInfo *r;
 
1518
 
 
1519
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSREPLICAGETINFO];
 
1520
 
 
1521
        r = talloc(talloc_tos(), struct drsuapi_DsReplicaGetInfo);
 
1522
        if (r == NULL) {
 
1523
                return false;
 
1524
        }
 
1525
 
 
1526
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1527
        if (pull == NULL) {
 
1528
                talloc_free(r);
 
1529
                return false;
 
1530
        }
 
1531
 
 
1532
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1533
        if (p->endian) {
 
1534
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1535
        }
 
1536
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1537
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1538
                talloc_free(r);
 
1539
                return false;
 
1540
        }
 
1541
 
 
1542
        if (DEBUGLEVEL >= 10) {
 
1543
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaGetInfo, NDR_IN, r);
 
1544
        }
 
1545
 
 
1546
        ZERO_STRUCT(r->out);
 
1547
        r->out.info_type = talloc_zero(r, enum drsuapi_DsReplicaInfoType);
 
1548
        if (r->out.info_type == NULL) {
 
1549
                talloc_free(r);
 
1550
                return false;
 
1551
        }
 
1552
 
 
1553
        r->out.info = talloc_zero(r, union drsuapi_DsReplicaInfo);
 
1554
        if (r->out.info == NULL) {
 
1555
                talloc_free(r);
 
1556
                return false;
 
1557
        }
 
1558
 
 
1559
        r->out.result = _drsuapi_DsReplicaGetInfo(p, r);
 
1560
 
 
1561
        if (p->rng_fault_state) {
 
1562
                talloc_free(r);
 
1563
                /* Return true here, srv_pipe_hnd.c will take care */
 
1564
                return true;
 
1565
        }
 
1566
 
 
1567
        if (DEBUGLEVEL >= 10) {
 
1568
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsReplicaGetInfo, NDR_OUT | NDR_SET_VALUES, r);
 
1569
        }
 
1570
 
 
1571
        push = ndr_push_init_ctx(r);
 
1572
        if (push == NULL) {
 
1573
                talloc_free(r);
 
1574
                return false;
 
1575
        }
 
1576
 
 
1577
        /*
 
1578
         * carry over the pointer count to the reply in case we are
 
1579
         * using full pointer. See NDR specification for full pointers
 
1580
         */
 
1581
        push->ptr_count = pull->ptr_count;
 
1582
 
 
1583
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1584
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1585
                talloc_free(r);
 
1586
                return false;
 
1587
        }
 
1588
 
 
1589
        p->out_data.rdata = ndr_push_blob(push);
 
1590
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1591
 
 
1592
        talloc_free(r);
 
1593
 
 
1594
        return true;
 
1595
}
 
1596
 
 
1597
static bool api_DRSUAPI_ADD_SID_HISTORY(struct pipes_struct *p)
 
1598
{
 
1599
        const struct ndr_interface_call *call;
 
1600
        struct ndr_pull *pull;
 
1601
        struct ndr_push *push;
 
1602
        enum ndr_err_code ndr_err;
 
1603
        struct DRSUAPI_ADD_SID_HISTORY *r;
 
1604
 
 
1605
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_ADD_SID_HISTORY];
 
1606
 
 
1607
        r = talloc(talloc_tos(), struct DRSUAPI_ADD_SID_HISTORY);
 
1608
        if (r == NULL) {
 
1609
                return false;
 
1610
        }
 
1611
 
 
1612
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1613
        if (pull == NULL) {
 
1614
                talloc_free(r);
 
1615
                return false;
 
1616
        }
 
1617
 
 
1618
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1619
        if (p->endian) {
 
1620
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1621
        }
 
1622
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1623
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1624
                talloc_free(r);
 
1625
                return false;
 
1626
        }
 
1627
 
 
1628
        if (DEBUGLEVEL >= 10) {
 
1629
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_ADD_SID_HISTORY, NDR_IN, r);
 
1630
        }
 
1631
 
 
1632
        r->out.result = _DRSUAPI_ADD_SID_HISTORY(p, r);
 
1633
 
 
1634
        if (p->rng_fault_state) {
 
1635
                talloc_free(r);
 
1636
                /* Return true here, srv_pipe_hnd.c will take care */
 
1637
                return true;
 
1638
        }
 
1639
 
 
1640
        if (DEBUGLEVEL >= 10) {
 
1641
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_ADD_SID_HISTORY, NDR_OUT | NDR_SET_VALUES, r);
 
1642
        }
 
1643
 
 
1644
        push = ndr_push_init_ctx(r);
 
1645
        if (push == NULL) {
 
1646
                talloc_free(r);
 
1647
                return false;
 
1648
        }
 
1649
 
 
1650
        /*
 
1651
         * carry over the pointer count to the reply in case we are
 
1652
         * using full pointer. See NDR specification for full pointers
 
1653
         */
 
1654
        push->ptr_count = pull->ptr_count;
 
1655
 
 
1656
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1657
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1658
                talloc_free(r);
 
1659
                return false;
 
1660
        }
 
1661
 
 
1662
        p->out_data.rdata = ndr_push_blob(push);
 
1663
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1664
 
 
1665
        talloc_free(r);
 
1666
 
 
1667
        return true;
 
1668
}
 
1669
 
 
1670
static bool api_drsuapi_DsGetMemberships2(struct pipes_struct *p)
 
1671
{
 
1672
        const struct ndr_interface_call *call;
 
1673
        struct ndr_pull *pull;
 
1674
        struct ndr_push *push;
 
1675
        enum ndr_err_code ndr_err;
 
1676
        struct drsuapi_DsGetMemberships2 *r;
 
1677
 
 
1678
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_DSGETMEMBERSHIPS2];
 
1679
 
 
1680
        r = talloc(talloc_tos(), struct drsuapi_DsGetMemberships2);
 
1681
        if (r == NULL) {
 
1682
                return false;
 
1683
        }
 
1684
 
 
1685
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1686
        if (pull == NULL) {
 
1687
                talloc_free(r);
 
1688
                return false;
 
1689
        }
 
1690
 
 
1691
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1692
        if (p->endian) {
 
1693
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1694
        }
 
1695
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1696
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1697
                talloc_free(r);
 
1698
                return false;
 
1699
        }
 
1700
 
 
1701
        if (DEBUGLEVEL >= 10) {
 
1702
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetMemberships2, NDR_IN, r);
 
1703
        }
 
1704
 
 
1705
        ZERO_STRUCT(r->out);
 
1706
        r->out.level_out = talloc_zero(r, uint32_t);
 
1707
        if (r->out.level_out == NULL) {
 
1708
                talloc_free(r);
 
1709
                return false;
 
1710
        }
 
1711
 
 
1712
        r->out.ctr = talloc_zero(r, union drsuapi_DsGetMemberships2Ctr);
 
1713
        if (r->out.ctr == NULL) {
 
1714
                talloc_free(r);
 
1715
                return false;
 
1716
        }
 
1717
 
 
1718
        r->out.result = _drsuapi_DsGetMemberships2(p, r);
 
1719
 
 
1720
        if (p->rng_fault_state) {
 
1721
                talloc_free(r);
 
1722
                /* Return true here, srv_pipe_hnd.c will take care */
 
1723
                return true;
 
1724
        }
 
1725
 
 
1726
        if (DEBUGLEVEL >= 10) {
 
1727
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetMemberships2, NDR_OUT | NDR_SET_VALUES, r);
 
1728
        }
 
1729
 
 
1730
        push = ndr_push_init_ctx(r);
 
1731
        if (push == NULL) {
 
1732
                talloc_free(r);
 
1733
                return false;
 
1734
        }
 
1735
 
 
1736
        /*
 
1737
         * carry over the pointer count to the reply in case we are
 
1738
         * using full pointer. See NDR specification for full pointers
 
1739
         */
 
1740
        push->ptr_count = pull->ptr_count;
 
1741
 
 
1742
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1743
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1744
                talloc_free(r);
 
1745
                return false;
 
1746
        }
 
1747
 
 
1748
        p->out_data.rdata = ndr_push_blob(push);
 
1749
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1750
 
 
1751
        talloc_free(r);
 
1752
 
 
1753
        return true;
 
1754
}
 
1755
 
 
1756
static bool api_DRSUAPI_REPLICA_VERIFY_OBJECTS(struct pipes_struct *p)
 
1757
{
 
1758
        const struct ndr_interface_call *call;
 
1759
        struct ndr_pull *pull;
 
1760
        struct ndr_push *push;
 
1761
        enum ndr_err_code ndr_err;
 
1762
        struct DRSUAPI_REPLICA_VERIFY_OBJECTS *r;
 
1763
 
 
1764
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_REPLICA_VERIFY_OBJECTS];
 
1765
 
 
1766
        r = talloc(talloc_tos(), struct DRSUAPI_REPLICA_VERIFY_OBJECTS);
 
1767
        if (r == NULL) {
 
1768
                return false;
 
1769
        }
 
1770
 
 
1771
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1772
        if (pull == NULL) {
 
1773
                talloc_free(r);
 
1774
                return false;
 
1775
        }
 
1776
 
 
1777
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1778
        if (p->endian) {
 
1779
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1780
        }
 
1781
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1782
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1783
                talloc_free(r);
 
1784
                return false;
 
1785
        }
 
1786
 
 
1787
        if (DEBUGLEVEL >= 10) {
 
1788
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_REPLICA_VERIFY_OBJECTS, NDR_IN, r);
 
1789
        }
 
1790
 
 
1791
        r->out.result = _DRSUAPI_REPLICA_VERIFY_OBJECTS(p, r);
 
1792
 
 
1793
        if (p->rng_fault_state) {
 
1794
                talloc_free(r);
 
1795
                /* Return true here, srv_pipe_hnd.c will take care */
 
1796
                return true;
 
1797
        }
 
1798
 
 
1799
        if (DEBUGLEVEL >= 10) {
 
1800
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_REPLICA_VERIFY_OBJECTS, NDR_OUT | NDR_SET_VALUES, r);
 
1801
        }
 
1802
 
 
1803
        push = ndr_push_init_ctx(r);
 
1804
        if (push == NULL) {
 
1805
                talloc_free(r);
 
1806
                return false;
 
1807
        }
 
1808
 
 
1809
        /*
 
1810
         * carry over the pointer count to the reply in case we are
 
1811
         * using full pointer. See NDR specification for full pointers
 
1812
         */
 
1813
        push->ptr_count = pull->ptr_count;
 
1814
 
 
1815
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1816
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1817
                talloc_free(r);
 
1818
                return false;
 
1819
        }
 
1820
 
 
1821
        p->out_data.rdata = ndr_push_blob(push);
 
1822
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1823
 
 
1824
        talloc_free(r);
 
1825
 
 
1826
        return true;
 
1827
}
 
1828
 
 
1829
static bool api_DRSUAPI_GET_OBJECT_EXISTENCE(struct pipes_struct *p)
 
1830
{
 
1831
        const struct ndr_interface_call *call;
 
1832
        struct ndr_pull *pull;
 
1833
        struct ndr_push *push;
 
1834
        enum ndr_err_code ndr_err;
 
1835
        struct DRSUAPI_GET_OBJECT_EXISTENCE *r;
 
1836
 
 
1837
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_GET_OBJECT_EXISTENCE];
 
1838
 
 
1839
        r = talloc(talloc_tos(), struct DRSUAPI_GET_OBJECT_EXISTENCE);
 
1840
        if (r == NULL) {
 
1841
                return false;
 
1842
        }
 
1843
 
 
1844
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1845
        if (pull == NULL) {
 
1846
                talloc_free(r);
 
1847
                return false;
 
1848
        }
 
1849
 
 
1850
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1851
        if (p->endian) {
 
1852
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1853
        }
 
1854
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1855
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1856
                talloc_free(r);
 
1857
                return false;
 
1858
        }
 
1859
 
 
1860
        if (DEBUGLEVEL >= 10) {
 
1861
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_GET_OBJECT_EXISTENCE, NDR_IN, r);
 
1862
        }
 
1863
 
 
1864
        r->out.result = _DRSUAPI_GET_OBJECT_EXISTENCE(p, r);
 
1865
 
 
1866
        if (p->rng_fault_state) {
 
1867
                talloc_free(r);
 
1868
                /* Return true here, srv_pipe_hnd.c will take care */
 
1869
                return true;
 
1870
        }
 
1871
 
 
1872
        if (DEBUGLEVEL >= 10) {
 
1873
                NDR_PRINT_FUNCTION_DEBUG(DRSUAPI_GET_OBJECT_EXISTENCE, NDR_OUT | NDR_SET_VALUES, r);
 
1874
        }
 
1875
 
 
1876
        push = ndr_push_init_ctx(r);
 
1877
        if (push == NULL) {
 
1878
                talloc_free(r);
 
1879
                return false;
 
1880
        }
 
1881
 
 
1882
        /*
 
1883
         * carry over the pointer count to the reply in case we are
 
1884
         * using full pointer. See NDR specification for full pointers
 
1885
         */
 
1886
        push->ptr_count = pull->ptr_count;
 
1887
 
 
1888
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1889
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1890
                talloc_free(r);
 
1891
                return false;
 
1892
        }
 
1893
 
 
1894
        p->out_data.rdata = ndr_push_blob(push);
 
1895
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1896
 
 
1897
        talloc_free(r);
 
1898
 
 
1899
        return true;
 
1900
}
 
1901
 
 
1902
static bool api_drsuapi_QuerySitesByCost(struct pipes_struct *p)
 
1903
{
 
1904
        const struct ndr_interface_call *call;
 
1905
        struct ndr_pull *pull;
 
1906
        struct ndr_push *push;
 
1907
        enum ndr_err_code ndr_err;
 
1908
        struct drsuapi_QuerySitesByCost *r;
 
1909
 
 
1910
        call = &ndr_table_drsuapi.calls[NDR_DRSUAPI_QUERYSITESBYCOST];
 
1911
 
 
1912
        r = talloc(talloc_tos(), struct drsuapi_QuerySitesByCost);
 
1913
        if (r == NULL) {
 
1914
                return false;
 
1915
        }
 
1916
 
 
1917
        pull = ndr_pull_init_blob(&p->in_data.data, r);
 
1918
        if (pull == NULL) {
 
1919
                talloc_free(r);
 
1920
                return false;
 
1921
        }
 
1922
 
 
1923
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
 
1924
        if (p->endian) {
 
1925
                pull->flags |= LIBNDR_FLAG_BIGENDIAN;
 
1926
        }
 
1927
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
 
1928
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1929
                talloc_free(r);
 
1930
                return false;
 
1931
        }
 
1932
 
 
1933
        if (DEBUGLEVEL >= 10) {
 
1934
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_QuerySitesByCost, NDR_IN, r);
 
1935
        }
 
1936
 
 
1937
        ZERO_STRUCT(r->out);
 
1938
        r->out.level_out = talloc_zero(r, uint32_t);
 
1939
        if (r->out.level_out == NULL) {
 
1940
                talloc_free(r);
 
1941
                return false;
 
1942
        }
 
1943
 
 
1944
        r->out.ctr = talloc_zero(r, union drsuapi_QuerySitesByCostCtr);
 
1945
        if (r->out.ctr == NULL) {
 
1946
                talloc_free(r);
 
1947
                return false;
 
1948
        }
 
1949
 
 
1950
        r->out.result = _drsuapi_QuerySitesByCost(p, r);
 
1951
 
 
1952
        if (p->rng_fault_state) {
 
1953
                talloc_free(r);
 
1954
                /* Return true here, srv_pipe_hnd.c will take care */
 
1955
                return true;
 
1956
        }
 
1957
 
 
1958
        if (DEBUGLEVEL >= 10) {
 
1959
                NDR_PRINT_FUNCTION_DEBUG(drsuapi_QuerySitesByCost, NDR_OUT | NDR_SET_VALUES, r);
 
1960
        }
 
1961
 
 
1962
        push = ndr_push_init_ctx(r);
 
1963
        if (push == NULL) {
 
1964
                talloc_free(r);
 
1965
                return false;
 
1966
        }
 
1967
 
 
1968
        /*
 
1969
         * carry over the pointer count to the reply in case we are
 
1970
         * using full pointer. See NDR specification for full pointers
 
1971
         */
 
1972
        push->ptr_count = pull->ptr_count;
 
1973
 
 
1974
        ndr_err = call->ndr_push(push, NDR_OUT, r);
 
1975
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
1976
                talloc_free(r);
 
1977
                return false;
 
1978
        }
 
1979
 
 
1980
        p->out_data.rdata = ndr_push_blob(push);
 
1981
        talloc_steal(p->mem_ctx, p->out_data.rdata.data);
 
1982
 
 
1983
        talloc_free(r);
 
1984
 
 
1985
        return true;
 
1986
}
 
1987
 
 
1988
 
 
1989
/* Tables */
 
1990
static struct api_struct api_drsuapi_cmds[] = 
 
1991
{
 
1992
        {"DRSUAPI_DSBIND", NDR_DRSUAPI_DSBIND, api_drsuapi_DsBind},
 
1993
        {"DRSUAPI_DSUNBIND", NDR_DRSUAPI_DSUNBIND, api_drsuapi_DsUnbind},
 
1994
        {"DRSUAPI_DSREPLICASYNC", NDR_DRSUAPI_DSREPLICASYNC, api_drsuapi_DsReplicaSync},
 
1995
        {"DRSUAPI_DSGETNCCHANGES", NDR_DRSUAPI_DSGETNCCHANGES, api_drsuapi_DsGetNCChanges},
 
1996
        {"DRSUAPI_DSREPLICAUPDATEREFS", NDR_DRSUAPI_DSREPLICAUPDATEREFS, api_drsuapi_DsReplicaUpdateRefs},
 
1997
        {"DRSUAPI_DSREPLICAADD", NDR_DRSUAPI_DSREPLICAADD, api_drsuapi_DsReplicaAdd},
 
1998
        {"DRSUAPI_DSREPLICADEL", NDR_DRSUAPI_DSREPLICADEL, api_drsuapi_DsReplicaDel},
 
1999
        {"DRSUAPI_DSREPLICAMOD", NDR_DRSUAPI_DSREPLICAMOD, api_drsuapi_DsReplicaMod},
 
2000
        {"DRSUAPI_VERIFY_NAMES", NDR_DRSUAPI_VERIFY_NAMES, api_DRSUAPI_VERIFY_NAMES},
 
2001
        {"DRSUAPI_DSGETMEMBERSHIPS", NDR_DRSUAPI_DSGETMEMBERSHIPS, api_drsuapi_DsGetMemberships},
 
2002
        {"DRSUAPI_INTER_DOMAIN_MOVE", NDR_DRSUAPI_INTER_DOMAIN_MOVE, api_DRSUAPI_INTER_DOMAIN_MOVE},
 
2003
        {"DRSUAPI_DSGETNT4CHANGELOG", NDR_DRSUAPI_DSGETNT4CHANGELOG, api_drsuapi_DsGetNT4ChangeLog},
 
2004
        {"DRSUAPI_DSCRACKNAMES", NDR_DRSUAPI_DSCRACKNAMES, api_drsuapi_DsCrackNames},
 
2005
        {"DRSUAPI_DSWRITEACCOUNTSPN", NDR_DRSUAPI_DSWRITEACCOUNTSPN, api_drsuapi_DsWriteAccountSpn},
 
2006
        {"DRSUAPI_DSREMOVEDSSERVER", NDR_DRSUAPI_DSREMOVEDSSERVER, api_drsuapi_DsRemoveDSServer},
 
2007
        {"DRSUAPI_REMOVE_DS_DOMAIN", NDR_DRSUAPI_REMOVE_DS_DOMAIN, api_DRSUAPI_REMOVE_DS_DOMAIN},
 
2008
        {"DRSUAPI_DSGETDOMAINCONTROLLERINFO", NDR_DRSUAPI_DSGETDOMAINCONTROLLERINFO, api_drsuapi_DsGetDomainControllerInfo},
 
2009
        {"DRSUAPI_DSADDENTRY", NDR_DRSUAPI_DSADDENTRY, api_drsuapi_DsAddEntry},
 
2010
        {"DRSUAPI_DSEXECUTEKCC", NDR_DRSUAPI_DSEXECUTEKCC, api_drsuapi_DsExecuteKCC},
 
2011
        {"DRSUAPI_DSREPLICAGETINFO", NDR_DRSUAPI_DSREPLICAGETINFO, api_drsuapi_DsReplicaGetInfo},
 
2012
        {"DRSUAPI_ADD_SID_HISTORY", NDR_DRSUAPI_ADD_SID_HISTORY, api_DRSUAPI_ADD_SID_HISTORY},
 
2013
        {"DRSUAPI_DSGETMEMBERSHIPS2", NDR_DRSUAPI_DSGETMEMBERSHIPS2, api_drsuapi_DsGetMemberships2},
 
2014
        {"DRSUAPI_REPLICA_VERIFY_OBJECTS", NDR_DRSUAPI_REPLICA_VERIFY_OBJECTS, api_DRSUAPI_REPLICA_VERIFY_OBJECTS},
 
2015
        {"DRSUAPI_GET_OBJECT_EXISTENCE", NDR_DRSUAPI_GET_OBJECT_EXISTENCE, api_DRSUAPI_GET_OBJECT_EXISTENCE},
 
2016
        {"DRSUAPI_QUERYSITESBYCOST", NDR_DRSUAPI_QUERYSITESBYCOST, api_drsuapi_QuerySitesByCost},
 
2017
};
 
2018
 
 
2019
void drsuapi_get_pipe_fns(struct api_struct **fns, int *n_fns)
 
2020
{
 
2021
        *fns = api_drsuapi_cmds;
 
2022
        *n_fns = sizeof(api_drsuapi_cmds) / sizeof(struct api_struct);
 
2023
}
 
2024
 
 
2025
NTSTATUS rpc_drsuapi_init(const struct rpc_srv_callbacks *rpc_srv_cb)
 
2026
{
 
2027
        return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "drsuapi", "drsuapi", &ndr_table_drsuapi, api_drsuapi_cmds, sizeof(api_drsuapi_cmds) / sizeof(struct api_struct), rpc_srv_cb);
 
2028
}
 
2029
 
 
2030
NTSTATUS rpc_drsuapi_shutdown(void)
 
2031
{
 
2032
        return rpc_srv_unregister(&ndr_table_drsuapi);
 
2033
}