3ed7af0e29112561347296c4b2207b0e311f1cb8
[samba.git] / source / torture / rpc / winreg.c
1 /* 
2    Unix SMB/CIFS implementation.
3    test suite for winreg rpc operations
4
5    Copyright (C) Tim Potter 2003
6    Copyright (C) Jelmer Vernooij 2004
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "librpc/gen_ndr/ndr_winreg.h"
25
26 static void init_winreg_String(struct winreg_String *name, const char *s)
27 {
28         name->name = s;
29         if (s) {
30                 name->name_len = 2 * (strlen_m(s) + 1);
31                 name->name_size = name->name_len;
32         } else {
33                 name->name_len = 0;
34                 name->name_size = 0;
35         }
36 }
37
38 static BOOL test_GetVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
39                             struct policy_handle *handle)
40 {
41         NTSTATUS status;
42         struct winreg_GetVersion r;
43
44         printf("\ntesting GetVersion\n");
45
46         r.in.handle = handle;
47
48         status = dcerpc_winreg_GetVersion(p, mem_ctx, &r);
49
50         if (!NT_STATUS_IS_OK(status)) {
51                 printf("GetVersion failed - %s\n", nt_errstr(status));
52                 return False;
53         }
54
55         if (!W_ERROR_IS_OK(r.out.result)) {
56                 printf("GetVersion failed - %s\n", win_errstr(r.out.result));
57                 return False;
58         }
59
60         return True;
61 }
62
63 static BOOL test_CreateKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
64                           struct policy_handle *handle, const char *name, 
65                            const char *class)
66 {
67         struct winreg_CreateKey r;
68         struct policy_handle newhandle;
69         NTSTATUS status;
70         uint32_t sec_info = 0;
71
72         printf("\ntesting CreateKey\n");
73
74         r.in.handle = handle;
75         r.out.handle = &newhandle;
76         init_winreg_String(&r.in.key, name);    
77         init_winreg_String(&r.in.class, class);
78         r.in.reserved = 0x0;
79         r.in.access_mask = 0x02000000;
80         r.in.sec_info = &sec_info;
81         r.in.sec_desc = NULL;
82
83         status = dcerpc_winreg_CreateKey(p, mem_ctx, &r);
84
85         if (!NT_STATUS_IS_OK(status)) {
86                 printf("CreateKey failed - %s\n", nt_errstr(status));
87                 return False;
88         }
89
90         if (!W_ERROR_IS_OK(r.out.result)) {
91                 printf("CreateKey failed - %s\n", win_errstr(r.out.result));
92                 return False;
93         }
94
95         return True;
96 }
97
98 static BOOL test_GetKeySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
99                           struct policy_handle *handle)
100 {
101         NTSTATUS status;
102         struct winreg_GetKeySecurity r;
103
104         printf("\ntesting GetKeySecurity\n");
105
106         ZERO_STRUCT(r);
107
108         r.in.handle = handle;
109         r.in.data = r.out.data =  talloc_zero_p(mem_ctx, struct KeySecurityData);
110         r.in.data->size = 0xffff;
111         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
112
113         status = dcerpc_winreg_GetKeySecurity(p, mem_ctx, &r);
114
115         if (!NT_STATUS_IS_OK(status)) {
116                 printf("GetKeySecurity failed - %s\n", nt_errstr(status));
117                 return False;
118         }
119
120         if (!W_ERROR_IS_OK(r.out.result)) {
121                 printf("GetKeySecurity failed - %s\n", win_errstr(r.out.result));
122                 return False;
123         }
124
125         return False;
126 }
127
128 static BOOL test_CloseKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
129                           struct policy_handle *handle)
130 {
131         NTSTATUS status;
132         struct winreg_CloseKey r;
133
134         printf("\ntesting CloseKey\n");
135
136         r.in.handle = r.out.handle = handle;
137
138         status = dcerpc_winreg_CloseKey(p, mem_ctx, &r);
139
140         if (!NT_STATUS_IS_OK(status)) {
141                 printf("CloseKey failed - %s\n", nt_errstr(status));
142                 return False;
143         }
144
145         if (!W_ERROR_IS_OK(r.out.result)) {
146                 printf("CloseKey failed - %s\n", win_errstr(r.out.result));
147                 return False;
148         }
149
150         return True;
151 }
152
153 static BOOL test_FlushKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
154                           struct policy_handle *handle)
155 {
156         NTSTATUS status;
157         struct winreg_FlushKey r;
158
159         printf("\ntesting FlushKey\n");
160
161         r.in.handle = handle;
162
163         status = dcerpc_winreg_FlushKey(p, mem_ctx, &r);
164
165         if (!NT_STATUS_IS_OK(status)) {
166                 printf("FlushKey failed - %s\n", nt_errstr(status));
167                 return False;
168         }
169
170         if (!W_ERROR_IS_OK(r.out.result)) {
171                 printf("FlushKey failed - %s\n", win_errstr(r.out.result));
172                 return False;
173         }
174
175         return True;
176 }
177
178 static BOOL test_OpenKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
179                          struct policy_handle *hive_handle,
180                          const char *keyname, struct policy_handle *key_handle)
181 {
182         NTSTATUS status;
183         struct winreg_OpenKey r;
184
185         printf("\ntesting OpenKey\n");
186
187         r.in.handle = hive_handle;
188         init_winreg_String(&r.in.keyname, keyname);
189         r.in.unknown = 0x00000000;
190         r.in.access_mask = 0x02000000;
191         r.out.handle = key_handle;
192
193         status = dcerpc_winreg_OpenKey(p, mem_ctx, &r);
194
195         if (!NT_STATUS_IS_OK(status)) {
196                 printf("OpenKey failed - %s\n", nt_errstr(status));
197                 return False;
198         }
199
200         if (!W_ERROR_IS_OK(r.out.result)) {
201                 printf("OpenKey failed - %s\n", win_errstr(r.out.result));
202
203                 return False;
204         }
205
206         return True;
207 }
208
209 static BOOL test_DeleteKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
210                            struct policy_handle *handle, const char *key)
211 {
212         NTSTATUS status;
213         struct winreg_DeleteKey r;
214
215         printf("\ntesting DeleteKey\n");
216
217         r.in.handle = handle;
218         init_winreg_String(&r.in.key, key);     
219
220         status = dcerpc_winreg_DeleteKey(p, mem_ctx, &r);
221
222         if (!NT_STATUS_IS_OK(status)) {
223                 printf("DeleteKey failed - %s\n", nt_errstr(status));
224                 return False;
225         }
226
227         if (!W_ERROR_IS_OK(r.out.result)) {
228                 printf("DeleteKey failed - %s\n", win_errstr(r.out.result));
229                 return False;
230         }
231
232         return True;
233 }
234
235 static BOOL test_QueryInfoKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
236                               struct policy_handle *handle, char *class)
237 {
238         NTSTATUS status;
239         struct winreg_QueryInfoKey r;
240
241         printf("\ntesting QueryInfoKey\n");
242
243         r.in.handle = handle;
244         init_winreg_String(&r.in.class, class);
245         
246         status = dcerpc_winreg_QueryInfoKey(p, mem_ctx, &r);
247
248         if (!NT_STATUS_IS_OK(status)) {
249                 printf("QueryInfoKey failed - %s\n", nt_errstr(status));
250                 return False;
251         }
252
253         if (!W_ERROR_IS_OK(r.out.result)) {
254                 printf("QueryInfoKey failed - %s\n", win_errstr(r.out.result));
255                 return False;
256         }
257
258         return True;
259 }
260
261 static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
262                      struct policy_handle *handle, int depth);
263
264 static BOOL test_EnumKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
265                          struct policy_handle *handle, int depth)
266 {
267         struct winreg_EnumKey r;
268         struct winreg_EnumKeyNameRequest keyname;
269         struct winreg_String classname;
270         struct winreg_Time tm;
271         NTSTATUS status;
272
273         printf("Testing EnumKey\n\n");
274
275         r.in.handle = handle;
276         r.in.enum_index = 0;
277         r.in.key_name_len = r.out.key_name_len = 0;
278         r.in.unknown = r.out.unknown = 0x0414;
279         keyname.unknown = 0x0000020a;
280         init_winreg_String(&keyname.key_name, NULL);
281         init_winreg_String(&classname, NULL);
282         r.in.in_name = &keyname;
283         r.in.class = &classname;
284         tm.low = tm.high = 0x7fffffff;
285         r.in.last_changed_time = &tm;
286
287         do {
288                 status = dcerpc_winreg_EnumKey(p, mem_ctx, &r);
289
290                 if (NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(r.out.result)) {
291                         struct policy_handle key_handle;
292
293                         printf("EnumKey: %d: %s\n", r.in.enum_index, r.out.out_name->name);
294
295                         if (!test_OpenKey(
296                                     p, mem_ctx, handle, r.out.out_name->name,
297                                     &key_handle)) {
298                         } else {
299                                 test_key(p, mem_ctx, &key_handle, depth + 1);
300                         }
301                 }
302
303                 r.in.enum_index++;
304
305         } while (NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(r.out.result));
306
307         if (!NT_STATUS_IS_OK(status)) {
308                 printf("EnumKey failed - %s\n", nt_errstr(status));
309                 return False;
310         }
311
312         if (!W_ERROR_IS_OK(r.out.result) && !W_ERROR_EQUAL(r.out.result, WERR_NO_MORE_ITEMS)) {
313                 printf("EnumKey failed - %s\n", win_errstr(r.out.result));
314                 return False;
315         }
316
317
318
319         return True;
320 }
321
322 static BOOL test_QueryMultipleValues(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *valuename)
323 {
324         struct winreg_QueryMultipleValues r;
325         NTSTATUS status;
326
327         printf("Testing QueryMultipleValues\n");
328
329         r.in.key_handle = handle;
330         r.in.values = r.out.values = talloc_array_p(mem_ctx, struct QueryMultipleValue, 1);
331         r.in.values[0].name = talloc_p(mem_ctx, struct winreg_String);
332         r.in.values[0].name->name = valuename;
333         r.in.values[0].offset = 0;
334         r.in.values[0].length = 0;
335         r.in.values[0].type = 0;
336
337         r.in.num_values = 1;
338         r.in.buffer_size = r.out.buffer_size = talloc_p(mem_ctx, uint32);
339         *r.in.buffer_size = 0x20;
340         r.in.buffer = r.out.buffer = talloc_zero_array_p(mem_ctx, uint8, *r.in.buffer_size);
341
342         status = dcerpc_winreg_QueryMultipleValues(p, mem_ctx, &r);
343         if(NT_STATUS_IS_ERR(status)) {
344                 printf("QueryMultipleValues failed - %s\n", nt_errstr(status));
345                 return False;
346         }
347
348         if (!W_ERROR_IS_OK(r.out.result)) {
349                 printf("QueryMultipleValues failed - %s\n", win_errstr(r.out.result));
350                 return False;
351         }
352
353         return True;
354 }
355
356 static BOOL test_QueryValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *valuename)
357 {
358         struct winreg_QueryValue r;
359         NTSTATUS status;
360         uint32 zero = 0;
361         uint32 offered = 0xfff;
362
363         printf("Testing QueryValue\n");
364
365         r.in.handle = handle;
366         r.in.data = NULL;
367         r.in.value_name.name = valuename;
368         r.in.type = &zero;
369         r.in.size = &offered;
370         r.in.length = &zero;
371
372         status = dcerpc_winreg_QueryValue(p, mem_ctx, &r);
373         if(NT_STATUS_IS_ERR(status)) {
374                 printf("QueryValue failed - %s\n", nt_errstr(status));
375                 return False;
376         }
377
378         if (!W_ERROR_IS_OK(r.out.result)) {
379                 printf("QueryValue failed - %s\n", win_errstr(r.out.result));
380                 return False;
381         }
382
383         return True;
384 }
385
386 static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
387                            struct policy_handle *handle, int max_valnamelen, int max_valbufsize)
388 {
389         struct winreg_EnumValue r;
390         uint32 type = 0;
391         uint32 size = max_valbufsize, zero = 0;
392         BOOL ret = True;
393         uint8_t buf8;
394         uint16_t buf16;
395
396         printf("testing EnumValue\n");
397
398         r.in.handle = handle;
399         r.in.enum_index = 0;
400         r.in.name_in.length = 0;
401         r.in.name_in.size = 0x200;
402         r.in.name_in.name = &buf16;
403         r.in.type = &type;
404         r.in.value = &buf8;
405         r.in.length = &zero;
406         r.in.size = &size;
407         
408         do {
409                 NTSTATUS status = dcerpc_winreg_EnumValue(p, mem_ctx, &r);
410                 if(NT_STATUS_IS_ERR(status)) {
411                         printf("EnumValue failed - %s\n", nt_errstr(status));
412                         return False;
413                 }
414
415                 if (W_ERROR_IS_OK(r.out.result)) {
416                         ret &= test_QueryValue(p, mem_ctx, handle, r.out.name_out.name);
417                         ret &= test_QueryMultipleValues(p, mem_ctx, handle, r.out.name_out.name);
418                 }
419
420                 r.in.enum_index++;
421         } while (W_ERROR_IS_OK(r.out.result));
422
423         if(!W_ERROR_EQUAL(r.out.result, WERR_NO_MORE_ITEMS)) {
424                 printf("EnumValue failed - %s\n", win_errstr(r.out.result));
425                 return False;
426         }
427
428         return ret;
429 }
430
431 static BOOL test_OpenHKLM(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
432                           struct policy_handle *handle)
433 {
434         NTSTATUS status;
435         struct winreg_OpenHKLM r;
436         struct winreg_OpenUnknown unknown;
437         BOOL ret = True;
438
439         printf("\ntesting OpenHKLM\n");
440
441         unknown.unknown0 = 0x84e0;
442         unknown.unknown1 = 0x0000;
443         r.in.unknown = &unknown;
444         r.in.access_required = SEC_FLAG_MAXIMUM_ALLOWED;
445         r.out.handle = handle;
446
447         status = dcerpc_winreg_OpenHKLM(p, mem_ctx, &r);
448
449         if (!NT_STATUS_IS_OK(status)) {
450                 printf("OpenHKLM failed - %s\n", nt_errstr(status));
451                 return False;
452         }
453
454         if (!W_ERROR_IS_OK(r.out.result)) {
455                 printf("OpenHKLM failed - %s\n", win_errstr(r.out.result));
456                 return False;
457         }
458
459         return ret;
460 }
461
462 static BOOL test_OpenHKU(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
463                          struct policy_handle *handle)
464 {
465         NTSTATUS status;
466         struct winreg_OpenHKU r;
467         struct winreg_OpenUnknown unknown;
468         BOOL ret = True;
469
470         printf("\ntesting OpenHKU\n");
471
472         unknown.unknown0 = 0x84e0;
473         unknown.unknown1 = 0x0000;
474         r.in.unknown = &unknown;
475         r.in.access_required = SEC_FLAG_MAXIMUM_ALLOWED;
476         r.out.handle = handle;
477
478         status = dcerpc_winreg_OpenHKU(p, mem_ctx, &r);
479
480         if (!NT_STATUS_IS_OK(status)) {
481                 printf("OpenHKU failed - %s\n", nt_errstr(status));
482                 return False;
483         }
484
485         if (!W_ERROR_IS_OK(r.out.result)) {
486                 printf("OpenHKU failed - %s\n", win_errstr(r.out.result));
487                 return False;
488         }
489
490         return ret;
491 }
492
493 static BOOL test_OpenHKCR(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
494                           struct policy_handle *handle)
495 {
496         NTSTATUS status;
497         struct winreg_OpenHKCR r;
498         struct winreg_OpenUnknown unknown;
499         BOOL ret = True;
500
501         printf("\ntesting OpenHKCR\n");
502
503         unknown.unknown0 = 0x84e0;
504         unknown.unknown1 = 0x0000;
505         r.in.unknown = &unknown;
506         r.in.access_required = SEC_FLAG_MAXIMUM_ALLOWED;
507         r.out.handle = handle;
508
509         status = dcerpc_winreg_OpenHKCR(p, mem_ctx, &r);
510
511         if (!NT_STATUS_IS_OK(status)) {
512                 printf("OpenHKCR failed - %s\n", nt_errstr(status));
513                 return False;
514         }
515
516         if (!W_ERROR_IS_OK(r.out.result)) {
517                 printf("OpenHKU failed - %s\n", win_errstr(r.out.result));
518                 return False;
519         }
520         return ret;
521 }
522
523 static BOOL test_InitiateSystemShutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
524                         const char *msg, uint32_t timeout)
525 {
526         struct winreg_InitiateSystemShutdown r;
527         NTSTATUS status;
528         
529         init_winreg_String(&r.in.hostname, NULL);
530         init_winreg_String(&r.in.message, msg);
531         r.in.flags = 0;
532         r.in.timeout = timeout;
533
534         status = dcerpc_winreg_InitiateSystemShutdown(p, mem_ctx, &r);
535
536         if (!NT_STATUS_IS_OK(status)) {
537                 printf("InitiateSystemShutdown failed - %s\n", nt_errstr(status));
538                 return False;
539         }
540
541         if (!W_ERROR_IS_OK(r.out.result)) {
542                 printf("InitiateSystemShutdown failed - %s\n", win_errstr(r.out.result));
543                 return False;
544         }
545
546         return True;
547 }
548
549 static BOOL test_AbortSystemShutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
550 {
551         struct winreg_AbortSystemShutdown r;
552         NTSTATUS status;
553         uint16_t server = 0x0;
554
555         r.in.server = &server;
556         
557         status = dcerpc_winreg_AbortSystemShutdown(p, mem_ctx, &r);
558
559         if (!NT_STATUS_IS_OK(status)) {
560                 printf("AbortSystemShutdown failed - %s\n", nt_errstr(status));
561                 return False;
562         }
563
564         if (!W_ERROR_IS_OK(r.out.result)) {
565                 printf("AbortSystemShutdown failed - %s\n", win_errstr(r.out.result));
566                 return False;
567         }
568
569         return True;
570 }
571
572 static BOOL test_OpenHKCU(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
573                           struct policy_handle *handle)
574 {
575         NTSTATUS status;
576         struct winreg_OpenHKCU r;
577         struct winreg_OpenUnknown unknown;
578         BOOL ret = True;
579
580         printf("\ntesting OpenHKCU\n");
581
582         unknown.unknown0 = 0x84e0;
583         unknown.unknown1 = 0x0000;
584         r.in.unknown = &unknown;
585         r.in.access_required = SEC_FLAG_MAXIMUM_ALLOWED;
586         r.out.handle = handle;
587
588         status = dcerpc_winreg_OpenHKCU(p, mem_ctx, &r);
589
590         if (!NT_STATUS_IS_OK(status)) {
591                 printf("OpenHKCU failed - %s\n", nt_errstr(status));
592                 return False;
593         }
594
595         return ret;
596 }
597
598 #define MAX_DEPTH 2             /* Only go this far down the tree */
599
600 static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
601                      struct policy_handle *handle, int depth)
602 {
603         if (depth == MAX_DEPTH)
604                 return True;
605
606         if (!test_QueryInfoKey(p, mem_ctx, handle, NULL)) {
607         }
608
609
610         if (!test_GetKeySecurity(p, mem_ctx, handle)) {
611         }
612
613         if (!test_EnumKey(p, mem_ctx, handle, depth)) {
614         }
615
616         if (!test_EnumValue(p, mem_ctx, handle, 0xFF, 0xFFFF)) {
617         }
618
619
620         test_CloseKey(p, mem_ctx, handle);
621
622         return True;
623 }
624
625 typedef BOOL winreg_open_fn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
626                             struct policy_handle *handle);
627
628 static BOOL test_Open(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, void *fn)
629 {
630         struct policy_handle handle, newhandle;
631         BOOL ret = True;
632         winreg_open_fn *open_fn = (winreg_open_fn *)fn;
633
634         if (!open_fn(p, mem_ctx, &handle)) {
635                 return False;
636         }
637
638         if (!test_CreateKey(p, mem_ctx, &handle, "spottyfoot", NULL)) {
639                 printf("CreateKey failed\n");
640                 ret = False;
641         }
642
643         if (!test_FlushKey(p, mem_ctx, &handle)) {
644                 printf("FlushKey failed\n");
645                 ret = False;
646         }
647
648         if (!test_OpenKey(p, mem_ctx, &handle, "spottyfoot", &newhandle)) {
649                 printf("CreateKey failed (OpenKey after Create didn't work)\n");
650                 ret = False;
651         }
652
653         if (!test_DeleteKey(p, mem_ctx, &handle, "spottyfoot")) {
654                 printf("DeleteKey failed\n");
655                 ret = False;
656         }
657
658         if (!test_FlushKey(p, mem_ctx, &handle)) {
659                 printf("FlushKey failed\n");
660                 ret = False;
661         }
662
663         if (test_OpenKey(p, mem_ctx, &handle, "spottyfoot", &newhandle)) {
664                 printf("DeleteKey failed (OpenKey after Delete didn't work)\n");
665                 ret = False;
666         }
667
668         if (!test_GetVersion(p, mem_ctx, &handle)) {
669                 printf("GetVersion failed\n");
670                 ret = False;
671         }
672
673         /* The HKCR hive has a very large fanout */
674
675         if (open_fn == test_OpenHKCR) {
676                 if(!test_key(p, mem_ctx, &handle, MAX_DEPTH - 1)) {
677                         ret = False;
678                 }
679         }
680
681         if(!test_key(p, mem_ctx, &handle, 0)) {
682                 ret = False;
683         }
684
685         return ret;
686 }
687
688 BOOL torture_rpc_winreg(void)
689 {
690         NTSTATUS status;
691        struct dcerpc_pipe *p;
692         TALLOC_CTX *mem_ctx;
693         BOOL ret = True;
694         winreg_open_fn *open_fns[] = { test_OpenHKLM, test_OpenHKU,
695                                        test_OpenHKCR, test_OpenHKCU };
696         int i;
697
698         mem_ctx = talloc_init("torture_rpc_winreg");
699
700         status = torture_rpc_connection(&p, 
701                                         DCERPC_WINREG_NAME, 
702                                         DCERPC_WINREG_UUID, 
703                                         DCERPC_WINREG_VERSION);
704
705         if (!NT_STATUS_IS_OK(status)) {
706                 return False;
707         }
708
709         if(!test_InitiateSystemShutdown(p, mem_ctx, "spottyfood", 30))
710                 ret = False;
711
712         if(!test_AbortSystemShutdown(p, mem_ctx))
713                 ret = False;
714
715         for (i = 0; i < ARRAY_SIZE(open_fns); i++) {
716                 if (!test_Open(p, mem_ctx, open_fns[i]))
717                         ret = False;
718         }
719
720         talloc_destroy(mem_ctx);
721
722         torture_rpc_close(p);
723
724         return ret;
725 }