static bool torture_rpc_connect(struct torture_context *torture, const enum libnet_RpcConnect_level level, const char *bindstr, const char *hostname) { struct libnet_context *ctx; ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; torture_comment(torture, "Testing connection to LSA interface\n"); if (!test_connect_service(torture, ctx, &ndr_table_lsarpc, bindstr, hostname, level, false, NT_STATUS_OK)) { torture_comment(torture, "failed to connect LSA interface\n"); return false; } torture_comment(torture, "Testing connection to SAMR interface\n"); if (!test_connect_service(torture, ctx, &ndr_table_samr, bindstr, hostname, level, false, NT_STATUS_OK)) { torture_comment(torture, "failed to connect SAMR interface\n"); return false; } torture_comment(torture, "Testing connection to SRVSVC interface\n"); if (!test_connect_service(torture, ctx, &ndr_table_srvsvc, bindstr, hostname, level, false, NT_STATUS_OK)) { torture_comment(torture, "failed to connect SRVSVC interface\n"); return false; } torture_comment(torture, "Testing connection to LSA interface with wrong credentials\n"); if (!test_connect_service(torture, ctx, &ndr_table_lsarpc, bindstr, hostname, level, true, NT_STATUS_LOGON_FAILURE)) { torture_comment(torture, "failed to test wrong credentials on LSA interface\n"); return false; } torture_comment(torture, "Testing connection to SAMR interface with wrong credentials\n"); if (!test_connect_service(torture, ctx, &ndr_table_samr, bindstr, hostname, level, true, NT_STATUS_LOGON_FAILURE)) { torture_comment(torture, "failed to test wrong credentials on SAMR interface\n"); return false; } talloc_free(ctx); return true; }
static BOOL torture_rpc_connect(struct torture_context *torture, const enum libnet_RpcConnect_level level, const char *bindstr, const char *hostname) { struct libnet_context *ctx; ctx = libnet_context_init(NULL); ctx->cred = cmdline_credentials; d_printf("Testing connection to LSA interface\n"); if (!test_connect_service(ctx, &dcerpc_table_lsarpc, bindstr, hostname, level, False, NT_STATUS_OK)) { d_printf("failed to connect LSA interface\n"); return False; } d_printf("Testing connection to SAMR interface\n"); if (!test_connect_service(ctx, &dcerpc_table_samr, bindstr, hostname, level, False, NT_STATUS_OK)) { d_printf("failed to connect SAMR interface\n"); return False; } d_printf("Testing connection to SRVSVC interface\n"); if (!test_connect_service(ctx, &dcerpc_table_srvsvc, bindstr, hostname, level, False, NT_STATUS_OK)) { d_printf("failed to connect SRVSVC interface\n"); return False; } d_printf("Testing connection to LSA interface with wrong credentials\n"); if (!test_connect_service(ctx, &dcerpc_table_lsarpc, bindstr, hostname, level, True, NT_STATUS_LOGON_FAILURE)) { d_printf("failed to test wrong credentials on LSA interface\n"); return False; } d_printf("Testing connection to SAMR interface with wrong credentials\n"); if (!test_connect_service(ctx, &dcerpc_table_samr, bindstr, hostname, level, True, NT_STATUS_LOGON_FAILURE)) { d_printf("failed to test wrong credentials on SAMR interface\n"); return False; } talloc_free(ctx); return True; }