r15819: Use updated API in smbtorture, use UI tools in registry tests.
[Samba/aatanasov.git] / source / torture / torture.c
blob706bb43e2a1b61b455f52ca1e18a16e60944aca7
1 /*
2 Unix SMB/CIFS implementation.
3 SMB torture tester
4 Copyright (C) Andrew Tridgell 1997-2003
5 Copyright (C) Jelmer Vernooij 2006
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.
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.
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.
22 #include "includes.h"
23 #include "libcli/raw/libcliraw.h"
24 #include "system/time.h"
25 #include "system/wait.h"
26 #include "system/filesys.h"
27 #include "libcli/raw/ioctl.h"
28 #include "libcli/libcli.h"
29 #include "lib/ldb/include/ldb.h"
30 #include "lib/events/events.h"
31 #include "libcli/resolve/resolve.h"
32 #include "auth/credentials/credentials.h"
33 #include "libcli/ldap/ldap_client.h"
34 #include "librpc/gen_ndr/ndr_nbt.h"
35 #include "torture/torture.h"
37 #include "torture/raw/proto.h"
38 #include "libcli/smb2/smb2.h"
39 #include "torture/smb2/proto.h"
40 #include "torture/rap/proto.h"
41 #include "torture/auth/proto.h"
42 #include "torture/local/proto.h"
43 #include "torture/nbench/proto.h"
44 #include "torture/ldap/proto.h"
45 #include "torture/com/proto.h"
46 #include "torture/nbt/proto.h"
47 #include "torture/libnet/proto.h"
48 #include "torture/util.h"
49 #include "build.h"
50 #include "dlinklist.h"
52 _PUBLIC_ int torture_nprocs=4;
53 _PUBLIC_ int torture_numops=10;
54 _PUBLIC_ int torture_entries=1000;
55 _PUBLIC_ int torture_failures=1;
56 _PUBLIC_ int torture_seed=0;
57 _PUBLIC_ int torture_numasync=100;
58 _PUBLIC_ BOOL use_oplocks;
59 static int procnum; /* records process count number when forking */
60 static struct smbcli_state *current_cli;
61 _PUBLIC_ BOOL use_level_II_oplocks;
62 _PUBLIC_ BOOL torture_showall = False;
67 static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
69 while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
70 if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False;
72 return True;
76 static BOOL rw_torture(struct smbcli_state *c)
78 const char *lockfname = "\\torture.lck";
79 char *fname;
80 int fnum;
81 int fnum2;
82 pid_t pid2, pid = getpid();
83 int i, j;
84 uint8_t buf[1024];
85 BOOL correct = True;
87 fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
88 DENY_NONE);
89 if (fnum2 == -1)
90 fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
91 if (fnum2 == -1) {
92 printf("open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree));
93 return False;
97 for (i=0;i<torture_numops;i++) {
98 uint_t n = (uint_t)random()%10;
99 if (i % 10 == 0) {
100 printf("%d\r", i); fflush(stdout);
102 asprintf(&fname, "\\torture.%u", n);
104 if (!wait_lock(c, fnum2, n*sizeof(int), sizeof(int))) {
105 return False;
108 fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
109 if (fnum == -1) {
110 printf("open failed (%s)\n", smbcli_errstr(c->tree));
111 correct = False;
112 break;
115 if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) {
116 printf("write failed (%s)\n", smbcli_errstr(c->tree));
117 correct = False;
120 for (j=0;j<50;j++) {
121 if (smbcli_write(c->tree, fnum, 0, buf,
122 sizeof(pid)+(j*sizeof(buf)),
123 sizeof(buf)) != sizeof(buf)) {
124 printf("write failed (%s)\n", smbcli_errstr(c->tree));
125 correct = False;
129 pid2 = 0;
131 if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) {
132 printf("read failed (%s)\n", smbcli_errstr(c->tree));
133 correct = False;
136 if (pid2 != pid) {
137 printf("data corruption!\n");
138 correct = False;
141 if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
142 printf("close failed (%s)\n", smbcli_errstr(c->tree));
143 correct = False;
146 if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) {
147 printf("unlink failed (%s)\n", smbcli_errstr(c->tree));
148 correct = False;
151 if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
152 printf("unlock failed (%s)\n", smbcli_errstr(c->tree));
153 correct = False;
155 free(fname);
158 smbcli_close(c->tree, fnum2);
159 smbcli_unlink(c->tree, lockfname);
161 printf("%d\n", i);
163 return correct;
166 static BOOL run_torture(struct smbcli_state *cli, int dummy)
168 BOOL ret;
170 ret = rw_torture(cli);
172 if (!torture_close_connection(cli)) {
173 ret = False;
176 return ret;
181 see how many RPC pipes we can open at once
183 static BOOL run_pipe_number(struct torture_context *torture)
185 struct smbcli_state *cli1;
186 const char *pipe_name = "\\WKSSVC";
187 int fnum;
188 int num_pipes = 0;
190 printf("starting pipenumber test\n");
191 if (!torture_open_connection(&cli1)) {
192 return False;
195 while(1) {
196 fnum = smbcli_nt_create_full(cli1->tree, pipe_name, 0, SEC_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
197 NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN_IF, 0, 0);
199 if (fnum == -1) {
200 printf("Open of pipe %s failed with error (%s)\n", pipe_name, smbcli_errstr(cli1->tree));
201 break;
203 num_pipes++;
204 printf("%d\r", num_pipes);
205 fflush(stdout);
208 printf("pipe_number test - we can open %d %s pipes.\n", num_pipes, pipe_name );
209 torture_close_connection(cli1);
210 return True;
217 open N connections to the server and just hold them open
218 used for testing performance when there are N idle users
219 already connected
221 static BOOL torture_holdcon(struct torture_context *torture)
223 int i;
224 struct smbcli_state **cli;
225 int num_dead = 0;
227 printf("Opening %d connections\n", torture_numops);
229 cli = malloc_array_p(struct smbcli_state *, torture_numops);
231 for (i=0;i<torture_numops;i++) {
232 if (!torture_open_connection(&cli[i])) {
233 return False;
235 printf("opened %d connections\r", i);
236 fflush(stdout);
239 printf("\nStarting pings\n");
241 while (1) {
242 for (i=0;i<torture_numops;i++) {
243 NTSTATUS status;
244 if (cli[i]) {
245 status = smbcli_chkpath(cli[i]->tree, "\\");
246 if (!NT_STATUS_IS_OK(status)) {
247 printf("Connection %d is dead\n", i);
248 cli[i] = NULL;
249 num_dead++;
251 usleep(100);
255 if (num_dead == torture_numops) {
256 printf("All connections dead - finishing\n");
257 break;
260 printf(".");
261 fflush(stdout);
264 return True;
268 test how many open files this server supports on the one socket
270 static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
272 #define MAXFID_TEMPLATE "\\maxfid\\fid%d\\maxfid.%d.%d"
273 char *fname;
274 int fnums[0x11000], i;
275 int retries=4, maxfid;
276 BOOL correct = True;
278 if (retries <= 0) {
279 printf("failed to connect\n");
280 return False;
283 if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
284 printf("Failed to deltree \\maxfid - %s\n",
285 smbcli_errstr(cli->tree));
286 return False;
288 if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\maxfid"))) {
289 printf("Failed to mkdir \\maxfid, error=%s\n",
290 smbcli_errstr(cli->tree));
291 return False;
294 printf("Testing maximum number of open files\n");
296 for (i=0; i<0x11000; i++) {
297 if (i % 1000 == 0) {
298 asprintf(&fname, "\\maxfid\\fid%d", i/1000);
299 if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) {
300 printf("Failed to mkdir %s, error=%s\n",
301 fname, smbcli_errstr(cli->tree));
302 return False;
304 free(fname);
306 asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
307 if ((fnums[i] = smbcli_open(cli->tree, fname,
308 O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) ==
309 -1) {
310 printf("open of %s failed (%s)\n",
311 fname, smbcli_errstr(cli->tree));
312 printf("maximum fnum is %d\n", i);
313 break;
315 free(fname);
316 printf("%6d\r", i);
318 printf("%6d\n", i);
319 i--;
321 maxfid = i;
323 printf("cleaning up\n");
324 for (i=0;i<maxfid/2;i++) {
325 asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
326 if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[i]))) {
327 printf("Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree));
329 if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
330 printf("unlink of %s failed (%s)\n",
331 fname, smbcli_errstr(cli->tree));
332 correct = False;
334 free(fname);
336 asprintf(&fname, MAXFID_TEMPLATE, (maxfid-i)/1000, maxfid-i,(int)getpid());
337 if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[maxfid-i]))) {
338 printf("Close of fnum %d failed - %s\n", fnums[maxfid-i], smbcli_errstr(cli->tree));
340 if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
341 printf("unlink of %s failed (%s)\n",
342 fname, smbcli_errstr(cli->tree));
343 correct = False;
345 free(fname);
347 printf("%6d %6d\r", i, maxfid-i);
349 printf("%6d\n", 0);
351 if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
352 printf("Failed to deltree \\maxfid - %s\n",
353 smbcli_errstr(cli->tree));
354 return False;
357 printf("maxfid test finished\n");
358 if (!torture_close_connection(cli)) {
359 correct = False;
361 return correct;
362 #undef MAXFID_TEMPLATE
368 sees what IOCTLs are supported
370 static BOOL torture_ioctl_test(struct torture_context *torture)
372 struct smbcli_state *cli;
373 uint16_t device, function;
374 int fnum;
375 const char *fname = "\\ioctl.dat";
376 NTSTATUS status;
377 union smb_ioctl parms;
378 TALLOC_CTX *mem_ctx;
380 if (!torture_open_connection(&cli)) {
381 return False;
384 mem_ctx = talloc_init("ioctl_test");
386 printf("starting ioctl test\n");
388 smbcli_unlink(cli->tree, fname);
390 fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
391 if (fnum == -1) {
392 printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
393 return False;
396 parms.ioctl.level = RAW_IOCTL_IOCTL;
397 parms.ioctl.in.file.fnum = fnum;
398 parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
399 status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
400 printf("ioctl job info: %s\n", smbcli_errstr(cli->tree));
402 for (device=0;device<0x100;device++) {
403 printf("testing device=0x%x\n", device);
404 for (function=0;function<0x100;function++) {
405 parms.ioctl.in.request = (device << 16) | function;
406 status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
408 if (NT_STATUS_IS_OK(status)) {
409 printf("ioctl device=0x%x function=0x%x OK : %d bytes\n",
410 device, function, (int)parms.ioctl.out.blob.length);
415 if (!torture_close_connection(cli)) {
416 return False;
419 return True;
423 static void sigcont(int sig)
427 double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result)
429 int i, status;
430 volatile pid_t *child_status;
431 volatile BOOL *child_status_out;
432 int synccount;
433 int tries = 8;
434 double start_time_limit = 10 + (torture_nprocs * 1.5);
435 char **unc_list = NULL;
436 const char *p;
437 int num_unc_names = 0;
438 struct timeval tv;
440 *result = True;
442 synccount = 0;
444 signal(SIGCONT, sigcont);
446 child_status = (volatile pid_t *)shm_setup(sizeof(pid_t)*torture_nprocs);
447 if (!child_status) {
448 printf("Failed to setup shared memory\n");
449 return -1;
452 child_status_out = (volatile BOOL *)shm_setup(sizeof(BOOL)*torture_nprocs);
453 if (!child_status_out) {
454 printf("Failed to setup result status shared memory\n");
455 return -1;
458 p = lp_parm_string(-1, "torture", "unclist");
459 if (p) {
460 unc_list = file_lines_load(p, &num_unc_names, NULL);
461 if (!unc_list || num_unc_names <= 0) {
462 printf("Failed to load unc names list from '%s'\n", p);
463 exit(1);
467 for (i = 0; i < torture_nprocs; i++) {
468 child_status[i] = 0;
469 child_status_out[i] = True;
472 tv = timeval_current();
474 for (i=0;i<torture_nprocs;i++) {
475 procnum = i;
476 if (fork() == 0) {
477 char *myname;
478 char *hostname=NULL, *sharename;
480 pid_t mypid = getpid();
481 srandom(((int)mypid) ^ ((int)time(NULL)));
483 asprintf(&myname, "CLIENT%d", i);
484 lp_set_cmdline("netbios name", myname);
485 free(myname);
488 if (unc_list) {
489 if (!smbcli_parse_unc(unc_list[i % num_unc_names],
490 NULL, &hostname, &sharename)) {
491 printf("Failed to parse UNC name %s\n",
492 unc_list[i % num_unc_names]);
493 exit(1);
497 while (1) {
498 if (hostname) {
499 if (torture_open_connection_share(NULL,
500 &current_cli,
501 hostname,
502 sharename,
503 NULL)) {
504 break;
506 } else if (torture_open_connection(&current_cli)) {
507 break;
509 if (tries-- == 0) {
510 printf("pid %d failed to start\n", (int)getpid());
511 _exit(1);
513 msleep(100);
516 child_status[i] = getpid();
518 pause();
520 if (child_status[i]) {
521 printf("Child %d failed to start!\n", i);
522 child_status_out[i] = 1;
523 _exit(1);
526 child_status_out[i] = fn(current_cli, i);
527 _exit(0);
531 do {
532 synccount = 0;
533 for (i=0;i<torture_nprocs;i++) {
534 if (child_status[i]) synccount++;
536 if (synccount == torture_nprocs) break;
537 msleep(100);
538 } while (timeval_elapsed(&tv) < start_time_limit);
540 if (synccount != torture_nprocs) {
541 printf("FAILED TO START %d CLIENTS (started %d)\n", torture_nprocs, synccount);
542 *result = False;
543 return timeval_elapsed(&tv);
546 printf("Starting %d clients\n", torture_nprocs);
548 /* start the client load */
549 tv = timeval_current();
550 for (i=0;i<torture_nprocs;i++) {
551 child_status[i] = 0;
554 printf("%d clients started\n", torture_nprocs);
556 kill(0, SIGCONT);
558 for (i=0;i<torture_nprocs;i++) {
559 int ret;
560 while ((ret=waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
561 if (ret == -1 || WEXITSTATUS(status) != 0) {
562 *result = False;
566 printf("\n");
568 for (i=0;i<torture_nprocs;i++) {
569 if (!child_status_out[i]) {
570 *result = False;
573 return timeval_elapsed(&tv);
576 #define FLAG_MULTIPROC 1
578 static struct {
579 const char *name;
580 BOOL (*fn)(struct torture_context *);
581 BOOL (*multi_fn)(struct smbcli_state *, int );
582 } builtin_torture_ops[] = {
583 /* benchmarking tests */
584 {"BENCH-HOLDCON", torture_holdcon, 0},
585 {"BENCH-NBENCH", torture_nbench, 0},
586 {"BENCH-TORTURE", NULL, run_torture},
587 {"BENCH-NBT", torture_bench_nbt, 0},
588 {"BENCH-WINS", torture_bench_wins, 0},
589 {"BENCH-CLDAP", torture_bench_cldap, 0},
590 {"BENCH-OPLOCK", torture_bench_oplock, 0},
592 /* RAW smb tests */
593 {"RAW-QFSINFO", torture_raw_qfsinfo, 0},
594 {"RAW-QFILEINFO", torture_raw_qfileinfo, 0},
595 {"RAW-SFILEINFO", torture_raw_sfileinfo, 0},
596 {"RAW-SFILEINFO-BUG", torture_raw_sfileinfo_bug, 0},
597 {"RAW-SEARCH", torture_raw_search, 0},
598 {"RAW-CLOSE", torture_raw_close, 0},
599 {"RAW-OPEN", torture_raw_open, 0},
600 {"RAW-MKDIR", torture_raw_mkdir, 0},
601 {"RAW-OPLOCK", torture_raw_oplock, 0},
602 {"RAW-NOTIFY", torture_raw_notify, 0},
603 {"RAW-MUX", torture_raw_mux, 0},
604 {"RAW-IOCTL", torture_raw_ioctl, 0},
605 {"RAW-CHKPATH", torture_raw_chkpath, 0},
606 {"RAW-UNLINK", torture_raw_unlink, 0},
607 {"RAW-READ", torture_raw_read, 0},
608 {"RAW-WRITE", torture_raw_write, 0},
609 {"RAW-LOCK", torture_raw_lock, 0},
610 {"RAW-CONTEXT", torture_raw_context, 0},
611 {"RAW-RENAME", torture_raw_rename, 0},
612 {"RAW-SEEK", torture_raw_seek, 0},
613 {"RAW-EAS", torture_raw_eas, 0},
614 {"RAW-STREAMS", torture_raw_streams, 0},
615 {"RAW-ACLS", torture_raw_acls, 0},
616 {"RAW-COMPOSITE", torture_raw_composite, 0},
618 /* SMB2 tests */
619 {"SMB2-CONNECT", torture_smb2_connect, 0},
620 {"SMB2-SCAN", torture_smb2_scan, 0},
621 {"SMB2-SCANGETINFO", torture_smb2_getinfo_scan, 0},
622 {"SMB2-SCANSETINFO", torture_smb2_setinfo_scan, 0},
623 {"SMB2-SCANFIND", torture_smb2_find_scan, 0},
624 {"SMB2-GETINFO", torture_smb2_getinfo, 0},
625 {"SMB2-SETINFO", torture_smb2_setinfo, 0},
626 {"SMB2-FIND", torture_smb2_find, 0},
627 {"SMB2-LOCK", torture_smb2_lock, 0},
629 /* RAP tests */
630 {"RAP-BASIC", torture_rap_basic, 0},
632 /* protocol scanners */
633 {"SCAN-MAXFID", NULL, run_maxfidtest},
634 {"SCAN-PIPE_NUMBER", run_pipe_number, 0},
635 {"SCAN-IOCTL", torture_ioctl_test, 0},
636 {"SCAN-RAP", torture_rap_scan, 0},
637 {"SCAN-EAMAX", torture_max_eas, 0},
639 /* local (no server) testers */
640 {"LOCAL-NTLMSSP", torture_ntlmssp_self_check, 0},
641 {"LOCAL-ICONV", torture_local_iconv, 0},
642 {"LOCAL-TALLOC", torture_local_talloc, 0},
643 {"LOCAL-MESSAGING", torture_local_messaging, 0},
644 {"LOCAL-IRPC", torture_local_irpc, 0},
645 {"LOCAL-BINDING", torture_local_binding_string, 0},
646 {"LOCAL-STRLIST", torture_local_util_strlist, 0},
647 {"LOCAL-FILE", torture_local_util_file, 0},
648 {"LOCAL-IDTREE", torture_local_idtree, 0},
649 {"LOCAL-SOCKET", torture_local_socket, 0},
650 {"LOCAL-PAC", torture_pac, 0},
651 {"LOCAL-REGISTRY", torture_registry, 0},
652 {"LOCAL-RESOLVE", torture_local_resolve, 0},
653 {"LOCAL-SDDL", torture_local_sddl, 0},
654 {"LOCAL-NDR", torture_local_ndr, 0},
656 /* ldap testers */
657 {"LDAP-BASIC", torture_ldap_basic, 0},
658 {"LDAP-CLDAP", torture_cldap, 0},
660 /* nbt tests */
661 {"NBT-REGISTER", torture_nbt_register, 0},
662 {"NBT-WINS", torture_nbt_wins, 0},
663 {"NBT-DGRAM", torture_nbt_dgram, 0},
664 {"NBT-BROWSE", torture_nbt_browse, 0},
665 {"NBT-WINSREPLICATION-SIMPLE", torture_nbt_winsreplication_simple, 0},
666 {"NBT-WINSREPLICATION-REPLICA", torture_nbt_winsreplication_replica, 0},
667 {"NBT-WINSREPLICATION-OWNED", torture_nbt_winsreplication_owned, 0},
669 {NULL, NULL, 0}};
671 static void register_builtin_ops(void)
673 int i;
674 for (i = 0; builtin_torture_ops[i].name; i++) {
675 register_torture_op(builtin_torture_ops[i].name,
676 builtin_torture_ops[i].fn,
677 builtin_torture_ops[i].multi_fn);
681 struct torture_op *torture_ops = NULL;
683 _PUBLIC_ NTSTATUS register_torture_op(const char *name, BOOL (*fn)(struct torture_context *), BOOL (*multi_fn)(struct smbcli_state *, int ))
685 struct torture_op *op, *p;
687 op = talloc(talloc_autofree_context(), struct torture_op);
689 op->name = talloc_strdup(op, name);
690 op->fn = fn;
691 op->multi_fn = multi_fn;
693 for (p = torture_ops; p; p = p->next) {
694 if (strcmp(p->name, op->name) == 0) {
695 /* Check for duplicates */
696 DEBUG(0,("There already is a torture op registered with the name %s!\n", name));
697 talloc_free(op);
698 return NT_STATUS_OBJECT_NAME_COLLISION;
701 if (strcmp(p->name, op->name) < 0 &&
702 (!p->next || strcmp(p->next->name, op->name) > 0)) {
703 DLIST_ADD_AFTER(torture_ops, op, p);
704 return NT_STATUS_OK;
708 DLIST_ADD(torture_ops, op);
710 return NT_STATUS_OK;
713 int torture_init(void)
715 init_module_fn static_init[] = STATIC_torture_MODULES;
716 init_module_fn *shared_init = load_samba_modules(NULL, "torture");
718 register_builtin_ops();
720 run_init_functions(static_init);
721 run_init_functions(shared_init);
723 talloc_free(shared_init);
725 return 0;