5aab8b366a33f39b6d49e9fd5b86c3fbeea8596b
[samba.git] / source / torture / rpc / lsa.c
1 /* 
2    Unix SMB/CIFS implementation.
3    test suite for lsa rpc operations
4
5    Copyright (C) Andrew Tridgell 2003
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23
24 static void init_lsa_Name(struct lsa_Name *name, const char *s)
25 {
26         name->name = s;
27 }
28
29 static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
30 {
31         struct lsa_ObjectAttribute attr;
32         struct policy_handle handle;
33         struct lsa_QosInfo qos;
34         struct lsa_OpenPolicy r;
35         NTSTATUS status;
36         uint16 system_name = '\\';
37
38         printf("\ntesting OpenPolicy\n");
39
40         qos.len = 0;
41         qos.impersonation_level = 2;
42         qos.context_mode = 1;
43         qos.effective_only = 0;
44
45         attr.len = 0;
46         attr.root_dir = NULL;
47         attr.object_name = NULL;
48         attr.attributes = 0;
49         attr.sec_desc = NULL;
50         attr.sec_qos = &qos;
51
52         r.in.system_name = &system_name;
53         r.in.attr = &attr;
54         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
55         r.out.handle = &handle;
56
57         status = dcerpc_lsa_OpenPolicy(p, mem_ctx, &r);
58         if (!NT_STATUS_IS_OK(status)) {
59                 printf("OpenPolicy failed - %s\n", nt_errstr(status));
60                 return False;
61         }
62
63         return True;
64 }
65
66
67 static BOOL test_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
68                              struct policy_handle *handle)
69 {
70         struct lsa_ObjectAttribute attr;
71         struct lsa_QosInfo qos;
72         struct lsa_OpenPolicy2 r;
73         NTSTATUS status;
74
75         printf("\ntesting OpenPolicy2\n");
76
77         qos.len = 0;
78         qos.impersonation_level = 2;
79         qos.context_mode = 1;
80         qos.effective_only = 0;
81
82         attr.len = 0;
83         attr.root_dir = NULL;
84         attr.object_name = NULL;
85         attr.attributes = 0;
86         attr.sec_desc = NULL;
87         attr.sec_qos = &qos;
88
89         r.in.system_name = "\\";
90         r.in.attr = &attr;
91         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
92         r.out.handle = handle;
93
94         status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &r);
95         if (!NT_STATUS_IS_OK(status)) {
96                 printf("OpenPolicy2 failed - %s\n", nt_errstr(status));
97                 return False;
98         }
99
100         return True;
101 }
102
103 static BOOL test_LookupNames(struct dcerpc_pipe *p, 
104                             TALLOC_CTX *mem_ctx, 
105                             struct policy_handle *handle,
106                             struct lsa_TransNameArray *tnames)
107 {
108         struct lsa_LookupNames r;
109         struct lsa_TransSidArray sids;
110         struct lsa_Name *names;
111         uint32 count = 0;
112         NTSTATUS status;
113         int i;
114
115         printf("\nTesting LookupNames\n");
116
117         sids.count = 0;
118         sids.sids = NULL;
119
120         names = talloc(mem_ctx, tnames->count * sizeof(names[0]));
121         for (i=0;i<tnames->count;i++) {
122                 init_lsa_Name(&names[i], tnames->names[i].name.name);
123         }
124
125         r.in.handle = handle;
126         r.in.num_names = tnames->count;
127         r.in.names = names;
128         r.in.sids = &sids;
129         r.in.level = 1;
130         r.in.count = &count;
131         r.out.count = &count;
132         r.out.sids = &sids;
133
134         status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
135         if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
136                 printf("LookupNames failed - %s\n", nt_errstr(status));
137                 return False;
138         }
139
140         printf("\n");
141
142         return True;
143 }
144
145
146 static BOOL test_LookupSids(struct dcerpc_pipe *p, 
147                             TALLOC_CTX *mem_ctx, 
148                             struct policy_handle *handle,
149                             struct lsa_SidArray *sids)
150 {
151         struct lsa_LookupSids r;
152         struct lsa_TransNameArray names;
153         uint32 count = sids->num_sids;
154         NTSTATUS status;
155
156         printf("\nTesting LookupSids\n");
157
158         names.count = 0;
159         names.names = NULL;
160
161         r.in.handle = handle;
162         r.in.sids = sids;
163         r.in.names = &names;
164         r.in.level = 1;
165         r.in.count = &count;
166         r.out.count = &count;
167         r.out.names = &names;
168
169         status = dcerpc_lsa_LookupSids(p, mem_ctx, &r);
170         if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
171                 printf("LookupSids failed - %s\n", nt_errstr(status));
172                 return False;
173         }
174
175         printf("\n");
176
177         if (!test_LookupNames(p, mem_ctx, handle, &names)) {
178                 return False;
179         }
180
181         return True;
182 }
183
184 static BOOL test_LookupPrivName(struct dcerpc_pipe *p, 
185                                 TALLOC_CTX *mem_ctx, 
186                                 struct policy_handle *handle,
187                                 struct lsa_LUID *luid)
188 {
189         NTSTATUS status;
190         struct lsa_LookupPrivName r;
191
192         r.in.handle = handle;
193         r.in.luid = luid;
194
195         status = dcerpc_lsa_LookupPrivName(p, mem_ctx, &r);
196         if (!NT_STATUS_IS_OK(status)) {
197                 printf("\nLookupPrivName failed - %s\n", nt_errstr(status));
198                 return False;
199         }
200
201         return True;
202 }
203
204 static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, 
205                                   TALLOC_CTX *mem_ctx,                            
206                                   struct policy_handle *handle,
207                                   struct policy_handle *acct_handle)
208 {
209         NTSTATUS status;
210         struct lsa_EnumPrivsAccount r;
211
212         printf("Testing EnumPrivsAccount\n");
213
214         r.in.handle = acct_handle;
215
216         status = dcerpc_lsa_EnumPrivsAccount(p, mem_ctx, &r);
217         if (!NT_STATUS_IS_OK(status)) {
218                 printf("EnumPrivsAccount failed - %s\n", nt_errstr(status));
219                 return False;
220         }
221
222         if (r.out.privs) {
223                 int i;
224                 for (i=0;i<r.out.privs->count;i++) {
225                         test_LookupPrivName(p, mem_ctx, handle, 
226                                             &r.out.privs->set[i].luid);
227                 }
228         }
229
230         return True;
231 }
232
233 static BOOL test_Delete(struct dcerpc_pipe *p, 
234                        TALLOC_CTX *mem_ctx, 
235                        struct policy_handle *handle)
236 {
237         NTSTATUS status;
238         struct lsa_Delete r;
239
240         printf("\ntesting Delete\n");
241
242         r.in.handle = handle;
243         status = dcerpc_lsa_Delete(p, mem_ctx, &r);
244         if (!NT_STATUS_IS_OK(status)) {
245                 printf("Delete failed - %s\n", nt_errstr(status));
246                 return False;
247         }
248
249         printf("\n");
250
251         return True;
252 }
253
254
255 static BOOL find_domain_sid(struct dcerpc_pipe *p, 
256                             TALLOC_CTX *mem_ctx,
257                             struct policy_handle *handle,
258                             struct dom_sid2 **sid)
259 {
260         struct lsa_QueryInfoPolicy r;
261         NTSTATUS status;
262
263         r.in.handle = handle;
264         r.in.level = LSA_POLICY_INFO_DOMAIN;
265
266         status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
267
268         if (!NT_STATUS_IS_OK(status)) {
269                 printf("LSA_POLICY_INFO_DOMAIN failed - %s\n", nt_errstr(status));
270                 return False;
271         }
272
273         *sid = r.out.info->domain.sid;
274
275         return True;
276 }
277
278 static struct dom_sid *sid_add_auth(TALLOC_CTX *mem_ctx, 
279                                     const struct dom_sid *sid,
280                                     uint32 sub_auth)
281 {
282         struct dom_sid *ret;
283
284         ret = talloc_p(mem_ctx, struct dom_sid);
285         if (!ret) {
286                 return NULL;
287         }
288
289         *ret = *sid;
290
291         ret->sub_auths = talloc_array_p(mem_ctx, uint32, ret->num_auths+1);
292         if (!ret->sub_auths) {
293                 return NULL;
294         }
295
296         memcpy(ret->sub_auths, sid->sub_auths, 
297                ret->num_auths * sizeof(sid->sub_auths[0]));
298         ret->sub_auths[ret->num_auths] = sub_auth;
299         ret->num_auths++;
300
301         return ret;
302 }
303
304 static BOOL test_CreateAccount(struct dcerpc_pipe *p, 
305                                TALLOC_CTX *mem_ctx, 
306                                struct policy_handle *handle)
307 {
308         NTSTATUS status;
309         struct lsa_CreateAccount r;
310         struct dom_sid2 *domsid, *newsid;
311         struct policy_handle acct_handle;
312
313         if (!find_domain_sid(p, mem_ctx, handle, &domsid)) {
314                 return False;
315         }
316
317         newsid = sid_add_auth(mem_ctx, domsid, 0x1234abcd);
318         if (!newsid) {
319                 printf("Failed to create newsid\n");
320                 return False;
321         }
322
323         printf("Testing CreateAccount\n");
324
325         r.in.handle = handle;
326         r.in.sid = newsid;
327         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
328         r.out.acct_handle = &acct_handle;
329
330         status = dcerpc_lsa_CreateAccount(p, mem_ctx, &r);
331         if (!NT_STATUS_IS_OK(status)) {
332                 printf("CreateAccount failed - %s\n", nt_errstr(status));
333                 return False;
334         }
335
336         if (!test_Delete(p, mem_ctx, &acct_handle)) {
337                 return False;
338         }
339
340         return True;
341 }
342
343
344 static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, 
345                                      TALLOC_CTX *mem_ctx, 
346                                      struct policy_handle *handle)
347 {
348         NTSTATUS status;
349         struct lsa_CreateTrustedDomain r;
350         struct lsa_TrustInformation trustinfo;
351         struct dom_sid *domsid;
352         struct policy_handle dom_handle;
353
354         printf("Testing CreateTrustedDomain\n");
355
356         if (!find_domain_sid(p, mem_ctx, handle, &domsid)) {
357                 return False;
358         }
359
360         domsid->sub_auths[domsid->num_auths-1] ^= 0xF0F0F0F0;
361
362         trustinfo.sid = domsid;
363         init_lsa_Name(&trustinfo.name, "torturedomain");
364
365         r.in.handle = handle;
366         r.in.info = &trustinfo;
367         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
368         r.out.dom_handle = &dom_handle;
369
370         status = dcerpc_lsa_CreateTrustedDomain(p, mem_ctx, &r);
371         if (!NT_STATUS_IS_OK(status)) {
372                 printf("CreateTrustedDomain failed - %s\n", nt_errstr(status));
373                 return False;
374         }
375
376         if (!test_Delete(p, mem_ctx, &dom_handle)) {
377                 return False;
378         }
379
380         return True;
381 }
382
383 static BOOL test_CreateSecret(struct dcerpc_pipe *p, 
384                               TALLOC_CTX *mem_ctx, 
385                               struct policy_handle *handle)
386 {
387         NTSTATUS status;
388         struct lsa_CreateSecret r;
389         struct lsa_OpenSecret r2;
390         struct policy_handle sec_handle, sec_handle2;
391         struct lsa_Delete d;
392
393         printf("Testing CreateSecret\n");
394
395         init_lsa_Name(&r.in.name, "torturesecret");
396
397         r.in.handle = handle;
398         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
399         r.out.sec_handle = &sec_handle;
400
401         status = dcerpc_lsa_CreateSecret(p, mem_ctx, &r);
402         if (!NT_STATUS_IS_OK(status)) {
403                 printf("CreateSecret failed - %s\n", nt_errstr(status));
404                 return False;
405         }
406
407         r2.in.handle = handle;
408         r2.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
409         init_lsa_Name(&r2.in.name, "torturesecret");
410         r2.out.sec_handle = &sec_handle2;
411
412         printf("Testing OpenSecret\n");
413
414         status = dcerpc_lsa_OpenSecret(p, mem_ctx, &r2);
415         if (!NT_STATUS_IS_OK(status)) {
416                 printf("OpenSecret failed - %s\n", nt_errstr(status));
417                 return False;
418         }
419
420         if (!test_Delete(p, mem_ctx, &sec_handle)) {
421                 return False;
422         }
423
424         d.in.handle = &sec_handle2;
425         status = dcerpc_lsa_Delete(p, mem_ctx, &d);
426         if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
427                 printf("Second delete expected INVALID_HANDLE - %s\n", nt_errstr(status));
428                 return False;
429         }
430
431         return True;
432 }
433
434 static BOOL test_EnumAccountRights(struct dcerpc_pipe *p, 
435                                    TALLOC_CTX *mem_ctx, 
436                                    struct policy_handle *acct_handle,
437                                    struct dom_sid *sid)
438 {
439         NTSTATUS status;
440         struct lsa_EnumAccountRights r;
441         struct lsa_RightSet rights;
442
443         printf("Testing EnumAccountRights\n");
444
445         r.in.handle = acct_handle;
446         r.in.sid = sid;
447         r.out.rights = &rights;
448
449         status = dcerpc_lsa_EnumAccountRights(p, mem_ctx, &r);
450         if (!NT_STATUS_IS_OK(status)) {
451                 printf("EnumAccountRights failed - %s\n", nt_errstr(status));
452                 return False;
453         }
454
455         return True;
456 }
457
458
459 static BOOL test_QuerySecObj(struct dcerpc_pipe *p, 
460                              TALLOC_CTX *mem_ctx, 
461                              struct policy_handle *handle,
462                              struct policy_handle *acct_handle)
463 {
464         NTSTATUS status;
465         struct lsa_QuerySecObj r;
466
467         printf("Testing QuerySecObj\n");
468
469         r.in.handle = acct_handle;
470         r.in.sec_info = 7;
471
472         status = dcerpc_lsa_QuerySecObj(p, mem_ctx, &r);
473         if (!NT_STATUS_IS_OK(status)) {
474                 printf("QuerySecObj failed - %s\n", nt_errstr(status));
475                 return False;
476         }
477
478         return True;
479 }
480
481 static BOOL test_OpenAccount(struct dcerpc_pipe *p, 
482                              TALLOC_CTX *mem_ctx, 
483                              struct policy_handle *handle,
484                              struct dom_sid *sid)
485 {
486         NTSTATUS status;
487         struct lsa_OpenAccount r;
488         struct policy_handle acct_handle;
489
490         printf("Testing OpenAccount\n");
491
492         r.in.handle = handle;
493         r.in.sid = sid;
494         r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
495         r.out.acct_handle = &acct_handle;
496
497         status = dcerpc_lsa_OpenAccount(p, mem_ctx, &r);
498         if (!NT_STATUS_IS_OK(status)) {
499                 printf("OpenAccount failed - %s\n", nt_errstr(status));
500                 return False;
501         }
502
503         if (!test_EnumPrivsAccount(p, mem_ctx, handle, &acct_handle)) {
504                 return False;
505         }
506
507         if (!test_QuerySecObj(p, mem_ctx, handle, &acct_handle)) {
508                 return False;
509         }
510
511         return True;
512 }
513
514 static BOOL test_EnumAccounts(struct dcerpc_pipe *p, 
515                           TALLOC_CTX *mem_ctx, 
516                           struct policy_handle *handle)
517 {
518         NTSTATUS status;
519         struct lsa_EnumAccounts r;
520         struct lsa_SidArray sids1, sids2;
521         uint32 resume_handle = 0;
522         int i;
523
524         printf("\ntesting EnumAccounts\n");
525
526         r.in.handle = handle;
527         r.in.resume_handle = &resume_handle;
528         r.in.num_entries = 100;
529         r.out.resume_handle = &resume_handle;
530         r.out.sids = &sids1;
531
532         resume_handle = 0;
533         status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r);
534         if (!NT_STATUS_IS_OK(status)) {
535                 printf("EnumAccounts failed - %s\n", nt_errstr(status));
536                 return False;
537         }
538
539         if (!test_LookupSids(p, mem_ctx, handle, &sids1)) {
540                 return False;
541         }
542
543         printf("testing all accounts\n");
544         for (i=0;i<sids1.num_sids;i++) {
545                 test_OpenAccount(p, mem_ctx, handle, sids1.sids[i].sid);
546                 test_EnumAccountRights(p, mem_ctx, handle, sids1.sids[i].sid);
547         }
548         printf("\n");
549
550         if (sids1.num_sids < 3) {
551                 return True;
552         }
553         
554         printf("trying EnumAccounts partial listing (asking for 1 at 2)\n");
555         resume_handle = 2;
556         r.in.num_entries = 1;
557         r.out.sids = &sids2;
558
559         status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r);
560         if (!NT_STATUS_IS_OK(status)) {
561                 printf("EnumAccounts failed - %s\n", nt_errstr(status));
562                 return False;
563         }
564
565         if (sids2.num_sids != 1) {
566                 printf("Returned wrong number of entries (%d)\n", sids2.num_sids);
567                 return False;
568         }
569
570         return True;
571 }
572
573
574 static BOOL test_EnumPrivs(struct dcerpc_pipe *p, 
575                            TALLOC_CTX *mem_ctx, 
576                            struct policy_handle *handle)
577 {
578         NTSTATUS status;
579         struct lsa_EnumPrivs r;
580         struct lsa_PrivArray privs1;
581         uint32 resume_handle = 0;
582
583         printf("\ntesting EnumPrivs\n");
584
585         r.in.handle = handle;
586         r.in.resume_handle = &resume_handle;
587         r.in.max_count = 1000;
588         r.out.resume_handle = &resume_handle;
589         r.out.privs = &privs1;
590
591         resume_handle = 0;
592         status = dcerpc_lsa_EnumPrivs(p, mem_ctx, &r);
593         if (!NT_STATUS_IS_OK(status)) {
594                 printf("EnumPrivs failed - %s\n", nt_errstr(status));
595                 return False;
596         }
597
598         return True;
599 }
600
601
602 static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, 
603                               TALLOC_CTX *mem_ctx, 
604                               struct policy_handle *handle)
605 {
606         struct lsa_EnumTrustDom r;
607         NTSTATUS status;
608         uint32 resume_handle = 0;
609         struct lsa_DomainList domains;
610
611         printf("\nTesting EnumTrustDom\n");
612
613         r.in.handle = handle;
614         r.in.resume_handle = &resume_handle;
615         r.in.num_entries = 1000;
616         r.out.domains = &domains;
617         r.out.resume_handle = &resume_handle;
618
619         status = dcerpc_lsa_EnumTrustDom(p, mem_ctx, &r);
620
621         /* NO_MORE_ENTRIES is allowed */
622         if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) {
623                 return True;
624         }
625
626         if (!NT_STATUS_IS_OK(status)) {
627                 printf("EnumTrustDom failed - %s\n", nt_errstr(status));
628                 return False;
629         }
630
631         return True;
632 }
633
634 static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, 
635                                  TALLOC_CTX *mem_ctx, 
636                                  struct policy_handle *handle)
637 {
638         struct lsa_QueryInfoPolicy r;
639         NTSTATUS status;
640         int i;
641         BOOL ret = True;
642         printf("\nTesting QueryInfoPolicy\n");
643
644         for (i=1;i<13;i++) {
645                 r.in.handle = handle;
646                 r.in.level = i;
647
648                 printf("\ntrying QueryInfoPolicy level %d\n", i);
649
650                 status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r);
651
652                 if ((i == 9 || i == 10 || i == 11) &&
653                     NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
654                         printf("server failed level %u (OK)\n", i);
655                         continue;
656                 }
657
658                 if (!NT_STATUS_IS_OK(status)) {
659                         printf("QueryInfoPolicy failed - %s\n", nt_errstr(status));
660                         ret = False;
661                         continue;
662                 }
663         }
664
665         return ret;
666 }
667
668 static BOOL test_Close(struct dcerpc_pipe *p, 
669                        TALLOC_CTX *mem_ctx, 
670                        struct policy_handle *handle)
671 {
672         NTSTATUS status;
673         struct lsa_Close r;
674         struct policy_handle handle2;
675
676         printf("\ntesting Close\n");
677
678         r.in.handle = handle;
679         r.out.handle = &handle2;
680
681         status = dcerpc_lsa_Close(p, mem_ctx, &r);
682         if (!NT_STATUS_IS_OK(status)) {
683                 printf("Close failed - %s\n", nt_errstr(status));
684                 return False;
685         }
686
687         status = dcerpc_lsa_Close(p, mem_ctx, &r);
688         /* its really a fault - we need a status code for rpc fault */
689         if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
690                 printf("Close failed - %s\n", nt_errstr(status));
691                 return False;
692         }
693
694         printf("\n");
695
696         return True;
697 }
698
699 BOOL torture_rpc_lsa(int dummy)
700 {
701         NTSTATUS status;
702         struct dcerpc_pipe *p;
703         TALLOC_CTX *mem_ctx;
704         BOOL ret = True;
705         struct policy_handle handle;
706
707         mem_ctx = talloc_init("torture_rpc_lsa");
708
709         status = torture_rpc_connection(&p, 
710                                         DCERPC_LSARPC_NAME, 
711                                         DCERPC_LSARPC_UUID, 
712                                         DCERPC_LSARPC_VERSION);
713         if (!NT_STATUS_IS_OK(status)) {
714                 return False;
715         }
716
717         if (!test_OpenPolicy(p, mem_ctx)) {
718                 ret = False;
719         }
720
721         if (!test_OpenPolicy2(p, mem_ctx, &handle)) {
722                 ret = False;
723         }
724
725         if (!test_CreateAccount(p, mem_ctx, &handle)) {
726                 ret = False;
727         }
728
729         if (!test_CreateSecret(p, mem_ctx, &handle)) {
730                 ret = False;
731         }
732
733         if (!test_CreateTrustedDomain(p, mem_ctx, &handle)) {
734                 ret = False;
735         }
736
737         if (!test_EnumAccounts(p, mem_ctx, &handle)) {
738                 ret = False;
739         }
740
741         if (!test_EnumPrivs(p, mem_ctx, &handle)) {
742                 ret = False;
743         }
744
745         if (!test_EnumTrustDom(p, mem_ctx, &handle)) {
746                 ret = False;
747         }
748
749         if (!test_QueryInfoPolicy(p, mem_ctx, &handle)) {
750                 ret = False;
751         }
752         
753 #if 0
754         if (!test_Delete(p, mem_ctx, &handle)) {
755                 ret = False;
756         }
757 #endif
758         
759         if (!test_Close(p, mem_ctx, &handle)) {
760                 ret = False;
761         }
762
763         talloc_destroy(mem_ctx);
764
765         torture_rpc_close(p);
766
767         return ret;
768 }