Beispiel #1
0
static bool test_server_role_default(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be standalone by default");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");
	return true;
}
Beispiel #2
0
static bool test_file_load_save(struct torture_context *tctx)
{
	size_t len;
	char *data;
	TALLOC_CTX *mem_ctx = tctx;
	
	torture_assert(tctx, file_save(TEST_FILENAME, TEST_DATA, strlen(TEST_DATA)),
				   "saving file");

	torture_assert_file_contains_text(tctx, TEST_FILENAME, TEST_DATA, 
								      "file contents");

	data = file_load(TEST_FILENAME, &len, 0, mem_ctx);
	torture_assert(tctx, data, "loading file");

	torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");
	
	torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");

	data = file_load(TEST_FILENAME, &len, 5, mem_ctx);

	torture_assert_int_equal(tctx, len, 5, "Length");

	torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");

	unlink(TEST_FILENAME);
	return true;
}
Beispiel #3
0
static bool test_strv_split_none(struct torture_context *tctx)
{
	char *strv = NULL;
	int ret;

	/* NULL has 0 entries */
	ret = strv_split(tctx, &strv, NULL, " ");
	torture_assert(tctx, ret == 0, "strv_split() on NULL failed");
	torture_assert_int_equal(tctx,
				 strv_count(strv),
				 0,
				 "strv_split() on NULL failed");
	TALLOC_FREE(strv);

	/* Empty string has 0 entries */
	ret = strv_split(tctx, &strv, "", " ");
	torture_assert(tctx, ret == 0, "strv_split() on NULL failed");
	torture_assert_int_equal(tctx,
				 strv_count(strv),
				 0,
				 "strv_split() on \"\" failed");
	TALLOC_FREE(strv);

	/* String containing only separators has 0 entries */
	ret = strv_split(tctx, &strv, "abcabcabc", "cba ");
	torture_assert(tctx, ret == 0, "strv_split() on NULL failed");
	torture_assert_int_equal(tctx,
				 strv_count(strv),
				 0,
				 "strv_split() on seps-only failed");
	TALLOC_FREE(strv);

	return true;
}
Beispiel #4
0
/*
 * Test that a ticket obtained for the DNS service will be accepted on the Samba DLZ side
 *
 */
static bool test_dlz_bind9_gensec(struct torture_context *tctx, const char *mech)
{
	NTSTATUS status;

	struct gensec_security *gensec_client_context;

	DATA_BLOB client_to_server, server_to_client;

	void *dbdata;
	const char *argv[] = {
		"samba_dlz",
		"-H",
		lpcfg_private_path(tctx, tctx->lp_ctx, "dns/sam.ldb"),
		NULL
	};
	tctx_static = tctx;
	torture_assert_int_equal(tctx, dlz_create("samba_dlz", 3, discard_const_p(char *, argv), &dbdata,
						  "log", dlz_bind9_log_wrapper,
						  "writeable_zone", dlz_bind9_writeable_zone_hook, NULL),
				 ISC_R_SUCCESS,
				 "Failed to create samba_dlz");

	torture_assert_int_equal(tctx, dlz_configure((void*)tctx, dbdata),
						     ISC_R_SUCCESS,
				 "Failed to configure samba_dlz");

	status = gensec_client_start(tctx, &gensec_client_context,
				     lpcfg_gensec_settings(tctx, tctx->lp_ctx));
	torture_assert_ntstatus_ok(tctx, status, "gensec_client_start (client) failed");

	status = gensec_set_target_hostname(gensec_client_context, torture_setting_string(tctx, "host", NULL));
	torture_assert_ntstatus_ok(tctx, status, "gensec_set_target_hostname (client) failed");

	status = gensec_set_credentials(gensec_client_context, cmdline_credentials);
	torture_assert_ntstatus_ok(tctx, status, "gensec_set_credentials (client) failed");

	status = gensec_start_mech_by_sasl_name(gensec_client_context, mech);
	torture_assert_ntstatus_ok(tctx, status, "gensec_start_mech_by_sasl_name (client) failed");

	server_to_client = data_blob(NULL, 0);

	/* Do one step of the client-server update dance */
	status = gensec_update(gensec_client_context, tctx, tctx->ev, server_to_client, &client_to_server);
	if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {;
		torture_assert_ntstatus_ok(tctx, status, "gensec_update (client) failed");
	}

	torture_assert_int_equal(tctx, dlz_ssumatch(cli_credentials_get_username(cmdline_credentials),
						    lpcfg_dnsdomain(tctx->lp_ctx),
						    "127.0.0.1", "type", "key",
						    client_to_server.length,
						    client_to_server.data,
						    dbdata),
				 ISC_R_SUCCESS,
				 "Failed to check key for update rights samba_dlz");

	dlz_destroy(dbdata);

	return true;
}
Beispiel #5
0
static bool test_get_value(struct torture_context *tctx, const void *test_data)
{
	WERROR error;
	struct hive_key *subkey;
	const struct hive_key *root = (const struct hive_key *)test_data;
	TALLOC_CTX *mem_ctx = tctx;
	uint32_t type;
	uint8_t d[] = { 0x42, 0x00, 0x00, 0x00 };
	DATA_BLOB db = { d, 4 }, data;

	error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL,
				  NULL, &subkey);
	torture_assert_werr_ok(tctx, error, "hive_key_add_name");

	error = hive_get_value(mem_ctx, subkey, "Answer", &type, &data);
	torture_assert_werr_equal(tctx, error, WERR_BADFILE,
				  "getting missing value");

	error = hive_key_set_value(subkey, "Answer", REG_DWORD, db);
	torture_assert_werr_ok(tctx, error, "hive_key_set_value");

	error = hive_get_value(mem_ctx, subkey, "Answer", &type, &data);
	torture_assert_werr_ok(tctx, error, "getting value");

	torture_assert_int_equal(tctx, data.length, 4, "value length");
	torture_assert_int_equal(tctx, type, REG_DWORD, "value type");

	torture_assert_mem_equal(tctx, data.data, db.data, 4, "value data");

	return true;
}
Beispiel #6
0
static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data)
{
	uint32_t num_subkeys, num_values;
	struct hive_key *root = (struct hive_key *)test_data;
	WERROR error;
	struct hive_key *subkey;
	uint8_t d[] = { 0x42, 0x00, 0x00, 0x00 };
	DATA_BLOB db = { d, 4 };

	error = hive_key_add_name(tctx, root, "Nested Keyll", NULL,
				  NULL, &subkey);
	torture_assert_werr_ok(tctx, error, "hive_key_add_name");

	error = hive_key_set_value(root, "Answer", REG_DWORD, db);
	torture_assert_werr_ok(tctx, error, "hive_key_set_value");

	/* This is a new backend. There should be no subkeys and no
	 * values */
	error = hive_key_get_info(tctx, root, NULL, &num_subkeys, &num_values,
				  NULL, NULL, NULL, NULL);
	torture_assert_werr_ok(tctx, error, "reg_key_num_subkeys()");

	torture_assert_int_equal(tctx, num_subkeys, 1, "subkey count");

	torture_assert_werr_ok(tctx, error, "reg_key_num_values");

	torture_assert_int_equal(tctx, num_values, 1, "value count");

	return true;
}
Beispiel #7
0
static bool test_tolower_m(struct torture_context *tctx)
{
	torture_assert_int_equal(tctx, tolower_m('C'), 'c', "c");
	torture_assert_int_equal(tctx, tolower_m('z'), 'z', "z");
	torture_assert_int_equal(tctx, tolower_m(0xFFFF4565), 0xFFFF4565, "0xFFFF4565");
	return true;
}
Beispiel #8
0
static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data)
{
	uint32_t num_subkeys, num_values;
	struct hive_key *root = (struct hive_key *)test_data;
	WERROR error;
	struct hive_key *subkey;
	char data[4];
	SIVAL(data, 0, 42);

	error = hive_key_add_name(tctx, root, "Nested Keyll", NULL,
				  NULL, &subkey);
	torture_assert_werr_ok(tctx, error, "hive_key_add_name");

	error = hive_key_set_value(root, "Answer", REG_DWORD,
			       data_blob_talloc(tctx, data, sizeof(data)));
	torture_assert_werr_ok(tctx, error, "hive_key_set_value");

	/* This is a new backend. There should be no subkeys and no
	 * values */
	error = hive_key_get_info(tctx, root, NULL, &num_subkeys, &num_values,
				  NULL, NULL, NULL, NULL);
	torture_assert_werr_ok(tctx, error, "reg_key_num_subkeys()");

	torture_assert_int_equal(tctx, num_subkeys, 1, "subkey count");

	torture_assert_werr_ok(tctx, error, "reg_key_num_values");

	torture_assert_int_equal(tctx, num_values, 1, "value count");

	return true;
}
Beispiel #9
0
static bool find_single_info2(void *mem_ctx,
			struct torture_context *torture,
			struct smbcli_state *cli,
			const char *fname,
			struct unix_info2 *info2)
{
	union smb_search_first search;
	NTSTATUS status;

	/* Set up a new search for a single item, not using resume keys. */
	ZERO_STRUCT(search);
	search.t2ffirst.level = RAW_SEARCH_TRANS2;
	search.t2ffirst.data_level = SMB_FIND_UNIX_INFO2;
	search.t2ffirst.in.max_count = 1;
	search.t2ffirst.in.flags = FLAG_TRANS2_FIND_CLOSE;
	search.t2ffirst.in.pattern = fname;

	status = smb_raw_search_first(cli->tree, mem_ctx,
				      &search, info2, search_callback);
	torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
			smbcli_errstr(cli->tree));

	torture_assert_int_equal(torture, search.t2ffirst.out.count, 1,
			"expected exactly one result");
	torture_assert_int_equal(torture, search.t2ffirst.out.end_of_search, 1,
			"expected end_of_search to be true");

	return check_unix_info2(torture, info2);
}
Beispiel #10
0
static bool torture_krb5_init_context(struct torture_context *tctx,
				      enum torture_krb5_test test,
				      struct smb_krb5_context **smb_krb5_context)
{
	const char *host = torture_setting_string(tctx, "host", NULL);
	krb5_error_code k5ret;
	bool ok;

	struct torture_krb5_context *test_context = talloc_zero(tctx, struct torture_krb5_context);
	torture_assert(tctx, test_context != NULL, "Failed to allocate");

	test_context->test = test;
	test_context->tctx = tctx;
	
	k5ret = smb_krb5_init_context(tctx, tctx->lp_ctx, smb_krb5_context);
	torture_assert_int_equal(tctx, k5ret, 0, "smb_krb5_init_context failed");

	ok = interpret_string_addr_internal(&test_context->server, host, AI_NUMERICHOST);
	torture_assert(tctx, ok, "Failed to parse target server");

	talloc_set_destructor(test_context, test_context_destructor);
	
	set_sockaddr_port(test_context->server->ai_addr, 88);

	k5ret = krb5_set_send_to_kdc_func((*smb_krb5_context)->krb5_context,
					  smb_krb5_send_and_recv_func_override,
					  test_context);
	torture_assert_int_equal(tctx, k5ret, 0, "krb5_set_send_to_kdc_func failed");
	return true;
}
Beispiel #11
0
static bool test_get_value(struct torture_context *tctx, const void *test_data)
{
	WERROR error;
	struct hive_key *subkey;
	const struct hive_key *root = (const struct hive_key *)test_data;
	TALLOC_CTX *mem_ctx = tctx;
	char data[4];
	uint32_t type;
	DATA_BLOB value;

	SIVAL(data, 0, 42);

	error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL,
				  NULL, &subkey);
	torture_assert_werr_ok(tctx, error, "hive_key_add_name");

	error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
	torture_assert_werr_equal(tctx, error, WERR_BADFILE,
				  "getting missing value");

	error = hive_key_set_value(subkey, "Answer", REG_DWORD,
			       data_blob_talloc(mem_ctx, data, sizeof(data)));
	torture_assert_werr_ok(tctx, error, "hive_key_set_value");

	error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
	torture_assert_werr_ok(tctx, error, "getting value");

	torture_assert_int_equal(tctx, value.length, 4, "value length");
	torture_assert_int_equal(tctx, type, REG_DWORD, "value type");

	torture_assert_mem_equal(tctx, &data, value.data, sizeof(uint32_t),
				 "value data");

	return true;
}
Beispiel #12
0
static BOOL test_PrinterData(struct torture_context *tctx,
			     LPSTR servername,
			     HANDLE handle)
{
	BOOL ret = TRUE;
	DWORD i;
	DWORD type, type_ex;
	LPBYTE buffer, buffer_ex;
	DWORD size, size_ex;
	LPSTR valuenames[] = {
		SPLREG_DEFAULT_SPOOL_DIRECTORY,
		SPLREG_MAJOR_VERSION,
		SPLREG_MINOR_VERSION,
		SPLREG_DS_PRESENT,
		SPLREG_DNS_MACHINE_NAME,
		SPLREG_ARCHITECTURE,
		SPLREG_OS_VERSION
	};

	for (i=0; i < ARRAY_SIZE(valuenames); i++) {
		ret &= test_GetPrinterData(tctx, servername, valuenames[i], handle, &type, &buffer, &size);
		ret &= test_GetPrinterDataEx(tctx, servername, "random", valuenames[i], handle, &type_ex, &buffer_ex, &size_ex);
		torture_assert_int_equal(tctx, type, type_ex, "type mismatch");
		torture_assert_int_equal(tctx, size, size_ex, "size mismatch");
		torture_assert_mem_equal(tctx, buffer, buffer_ex, size, "buffer mismatch");
		free(buffer);
		free(buffer_ex);
	}

	return ret;
}
Beispiel #13
0
static bool test_server_role_member_specified(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=member"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be member");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_ADS, "security should be ADS");
	return true;
}
Beispiel #14
0
static bool openhklm_in_check(struct torture_context *tctx, 
								  struct winreg_OpenHKLM *r)
{
	torture_assert(tctx, r->in.system_name != NULL, "system name pointer");
	torture_assert_int_equal(tctx, *r->in.system_name, 34016, "system name");
	torture_assert_int_equal(tctx, r->in.access_mask, 0x02000000, "access mask");
	return true;
}
Beispiel #15
0
static bool test_server_role_security_server(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=server"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be STANDALONE");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_SERVER, "security should be server");
	return true;
}
Beispiel #16
0
static bool test_server_role_security_domain(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=domain"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be MEMBER");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_DOMAIN, "security should be domain");
	return true;
}
Beispiel #17
0
static bool test_server_role_dc_domain_logons(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain logons=true"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_PDC, "ROLE should be PDC");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");
	return true;
}
Beispiel #18
0
static bool test_server_role_standalone_specified(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=standalone"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be standalone");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be USER");
	return true;
}
Beispiel #19
0
static bool openkey_in_check(struct torture_context *tctx, struct winreg_OpenKey *r)
{
	torture_assert_int_equal(tctx, r->in.options, 0, "unknown");
	torture_assert_int_equal(tctx, r->in.access_mask, 0x02000000, "access mask");
	torture_assert_str_equal(tctx, r->in.keyname.name, "spottyfoot", "keyname");
	/* FIXME: parent handle */
	return true;
}
Beispiel #20
0
static bool getkeysecurity_out_check(struct torture_context *tctx, 
				     struct winreg_GetKeySecurity *r)
{
	torture_assert_int_equal(tctx, r->in.sd->size, 20, "sd size");
	torture_assert_int_equal(tctx, r->in.sd->len, 20, "sd len");
	torture_assert_werr_ok(tctx, r->out.result, "return code");
	return true;
}
Beispiel #21
0
static bool test_strlen_m_term_null(struct torture_context *tctx)
{
	torture_assert_int_equal(tctx, strlen_m_term_null("foo"), 4, "simple len");
	torture_assert_int_equal(tctx, strlen_m_term_null("foo\x83l"), 7, "extended len");
	torture_assert_int_equal(tctx, strlen_m_term_null(""), 0, "empty");
	torture_assert_int_equal(tctx, strlen_m_term_null(NULL), 0, "NULL");
	return true;
}
Beispiel #22
0
static bool test_count_chars_m(struct torture_context *tctx)
{
	torture_assert_int_equal(tctx, count_chars_m("foo", 'o'), 2, "simple");
	torture_assert_int_equal(tctx, count_chars_m("", 'o'), 0, "empty");
	torture_assert_int_equal(tctx, count_chars_m("bla", 'o'), 0, "none");
	torture_assert_int_equal(tctx, count_chars_m("bla", '\0'), 0, "null");
	return true;
}
Beispiel #23
0
static bool test_server_role_dc_specified(struct torture_context *tctx)
{
	struct loadparm_context *lp_ctx = loadparm_init(tctx);
	torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=domain controller"), "lpcfg_set_option failed");
	torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_CONTROLLER, "ROLE should be DC");
	torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be USER");
	return true;
}
Beispiel #24
0
static bool jobdel_in_check(struct torture_context *tctx, 
							 struct atsvc_JobDel *r)
{
	torture_assert_str_equal(tctx, r->in.servername, "WIN2KDC1", "servername");
	torture_assert_int_equal(tctx, r->in.min_job_id, 14, "min job id");
	torture_assert_int_equal(tctx, r->in.max_job_id, 14, "max job id");
	return true;
}
Beispiel #25
0
static bool test_codepoint_cmpi(struct torture_context *tctx)
{
	torture_assert_int_equal(tctx, codepoint_cmpi('a', 'a'), 0, "same char");
	torture_assert_int_equal(tctx, codepoint_cmpi('A', 'a'), 0, "upcase version");
	torture_assert_int_equal(tctx, codepoint_cmpi('b', 'a'), 1, "right diff");
	torture_assert_int_equal(tctx, codepoint_cmpi('a', 'b'), -1, "right diff");
	return true;
}
Beispiel #26
0
static bool test_rpc_netservergetinfo(struct torture_context *tctx,
				      struct smbcli_state *cli)
{
	struct rap_WserverGetInfo r;
	struct dcerpc_pipe *p;
	struct dcerpc_binding_handle *b;
	struct srvsvc_NetSrvGetInfo s;
	union srvsvc_NetSrvInfo info;

	const char *server_name;

	torture_assert_ntstatus_ok(tctx,
		torture_rpc_connection(tctx, &p, &ndr_table_srvsvc),
		"failed to open srvsvc");

	b = p->binding_handle;

	s.in.server_unc = NULL;
	s.in.level = 101;
	s.out.info = &info;

	torture_assert_ntstatus_ok(tctx,
		dcerpc_srvsvc_NetSrvGetInfo_r(b, tctx, &s),
		"srvsvc_NetSrvGetInfo level 101 failed");
	torture_assert_werr_ok(tctx, s.out.result,
		"srvsvc_NetSrvGetInfo level 101 failed");

	r.in.bufsize = 0xffff;
	r.in.level = 0;

	torture_assert_ntstatus_ok(tctx,
		smbcli_rap_netservergetinfo(cli->tree, tctx, &r),
		"rap_netservergetinfo level 0 failed");
	torture_assert_int_equal(tctx, r.out.status, 0,
		"rap_netservergetinfo level 0 failed");

	server_name = talloc_strndup(tctx, info.info101->server_name, 16);

	torture_assert_str_equal(tctx, (const char *)r.out.info.info0.name, server_name, "server name");

	r.in.level = 1;

	torture_assert_ntstatus_ok(tctx,
		smbcli_rap_netservergetinfo(cli->tree, tctx, &r),
		"rap_netservergetinfo level 1 failed");
	torture_assert_int_equal(tctx, r.out.status, 0,
		"rap_netservergetinfo level 1 failed");

	torture_assert_str_equal(tctx, (const char *)r.out.info.info1.name, server_name, "server name");
	torture_assert_int_equal(tctx, r.out.info.info1.version_major, info.info101->version_major, "version major");
	torture_assert_int_equal(tctx, r.out.info.info1.version_minor, info.info101->version_minor, "version minor");
	torture_assert_int_equal(tctx, r.out.info.info1.servertype, info.info101->server_type, "server_type");
	torture_assert_str_equal(tctx, r.out.info.info1.comment, info.info101->comment, "comment");

	talloc_free(p);

	return true;
}
Beispiel #27
0
static bool netlogon_logon_request_resp_check(struct torture_context *tctx,
					      struct nbt_netlogon_response2 *r)
{
	torture_assert_int_equal(tctx, r->command, LOGON_RESPONSE2, "command");
	torture_assert_str_equal(tctx, r->pdc_name, "\\\\MTHELENA", "pdc_name");
	torture_assert_int_equal(tctx, r->lm20_token, 0xffff, "lm20_token");

	return true;
}
Beispiel #28
0
static bool map_out_check(struct torture_context *tctx, 
						  struct epm_Map *r)
{
	torture_assert_int_equal(tctx, *r->out.num_towers, 1, "num towers");
	torture_assert_int_equal(tctx, r->out.result, 0x4b, "return code");
	/* FIXME: entry handle */

	return true;
}
Beispiel #29
0
static bool test_generate_random_str(struct torture_context *tctx)
{
	TALLOC_CTX *mem_ctx = talloc_init(__FUNCTION__);
	char *r = generate_random_str(mem_ctx, 10);
	torture_assert_int_equal(tctx, strlen(r), 10, "right length generated");
	r = generate_random_str(mem_ctx, 5);
	torture_assert_int_equal(tctx, strlen(r), 5, "right length generated");
	return true;
}
Beispiel #30
0
static bool test_wbc_users(struct torture_context *tctx)
{
    const char *domain_name = NULL;
    uint32_t num_users;
    const char **users;
    int i;
    struct wbcInterfaceDetails *details;

    torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
                          "%s", "wbcInterfaceDetails failed");

    domain_name = talloc_strdup(tctx, details->netbios_domain);
    wbcFreeMemory(details);

    torture_assert_wbc_ok(tctx, wbcListUsers(domain_name, &num_users, &users),
                          "%s", "wbcListUsers failed");
    torture_assert(tctx, !(num_users > 0 && !users),
                   "wbcListUsers returned invalid results");

    for (i=0; i < MIN(num_users,100); i++) {

        struct wbcDomainSid sid, *sids;
        enum wbcSidType name_type;
        char *domain;
        char *name;
        char *sid_string;
        uint32_t num_sids;

        torture_assert_wbc_ok(tctx, wbcLookupName(domain_name, users[i], &sid, &name_type),
                              "wbcLookupName of %s failed", users[i]);
        torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,
                                 "wbcLookupName expected WBC_SID_NAME_USER");
        wbcSidToString(&sid, &sid_string);
        torture_assert_wbc_ok(tctx, wbcLookupSid(&sid, &domain, &name, &name_type),
                              "wbcLookupSid of %s failed", sid_string);
        torture_assert_int_equal(tctx, name_type, WBC_SID_NAME_USER,
                                 "wbcLookupSid of expected WBC_SID_NAME_USER");
        torture_assert(tctx, name,
                       "wbcLookupSid returned no name");
        wbcFreeMemory(domain);
        wbcFreeMemory(name);
        torture_assert_wbc_ok(tctx, wbcLookupUserSids(&sid, true, &num_sids, &sids),
                              "wbcLookupUserSids of %s failed", sid_string);
        torture_assert_wbc_ok(
            tctx, wbcGetDisplayName(&sid, &domain, &name,
                                    &name_type),
            "wbcGetDisplayName of %s failed", sid_string);
        wbcFreeMemory(domain);
        wbcFreeMemory(name);
        wbcFreeMemory(sids);
        wbcFreeMemory(sid_string);
    }
    wbcFreeMemory(users);

    return true;
}