{
NET_API_STATUS status;
struct libnetapi_ctx *ctx;
+ TALLOC_CTX *frame = talloc_stackframe();
- if (!lp_load(lpcfg_configfile(tctx->lp_ctx), true, false, false, true)) {
+ if (!lp_load_global(lpcfg_configfile(tctx->lp_ctx))) {
fprintf(stderr, "error loading %s\n", lpcfg_configfile(tctx->lp_ctx));
- return W_ERROR_V(WERR_GENERAL_FAILURE);
+ talloc_free(frame);
+ return W_ERROR_V(WERR_GEN_FAILURE);
}
init_names();
status = libnetapi_net_init(&ctx);
if (status != 0) {
+ talloc_free(frame);
return false;
}
libnetapi_set_username(ctx,
- cli_credentials_get_username(cmdline_credentials));
+ cli_credentials_get_username(popt_get_cmdline_credentials()));
libnetapi_set_password(ctx,
- cli_credentials_get_password(cmdline_credentials));
+ cli_credentials_get_password(popt_get_cmdline_credentials()));
*ctx_p = ctx;
+ talloc_free(frame);
return true;
}
return true;
}
-NTSTATUS torture_libnetapi_init(void)
+NTSTATUS torture_libnetapi_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
- suite = torture_suite_create(talloc_autofree_context(), "netapi");
+ suite = torture_suite_create(ctx, "netapi");
torture_suite_add_simple_test(suite, "server", torture_libnetapi_server);
torture_suite_add_simple_test(suite, "group", torture_libnetapi_group);
suite->description = talloc_strdup(suite, "libnetapi convenience interface tests");
- torture_register_suite(suite);
+ torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}