コード例 #1
0
ファイル: testsuite.c プロジェクト: eduardok/samba
static bool torture_smbconf_reg(void)
{
	sbcErr err;
	bool ret = true;
	struct smbconf_ctx *conf_ctx = NULL;
	TALLOC_CTX *mem_ctx = talloc_stackframe();

	printf("test: registry backend\n");

	printf("TEST: init\n");
	err = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
	if (!SBC_ERROR_IS_OK(err)) {
		printf("FAIL: init failed: %s\n", sbcErrorString(err));
		ret = false;
		goto done;
	}
	printf("OK: init\n");

	ret &= test_get_includes(conf_ctx);
	ret &= test_set_get_includes(conf_ctx);
	ret &= test_delete_includes(conf_ctx);

	smbconf_shutdown(conf_ctx);

done:
	printf("%s: registry backend\n", ret ? "success" : "failure");
	talloc_free(mem_ctx);
	return ret;
}
コード例 #2
0
ファイル: testsuite.c プロジェクト: jameshilliard/WECB-BH-GPL
static bool torture_smbconf_reg(void)
{
	WERROR werr;
	bool ret = true;
	struct smbconf_ctx *conf_ctx = NULL;
	TALLOC_CTX *mem_ctx = talloc_stackframe();

	printf("test: registry backend\n");

	printf("test: init\n");
	werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
	if (!W_ERROR_IS_OK(werr)) {
		printf("failure: init failed: %s\n", dos_errstr(werr));
		ret = false;
		goto done;
	}
	printf("success: init\n");

	ret &= test_get_includes(conf_ctx);
	ret &= test_set_get_includes(conf_ctx);
	ret &= test_delete_includes(conf_ctx);

	smbconf_shutdown(conf_ctx);

	printf("%s: registry backend\n", ret ? "success" : "failure");

done:
	TALLOC_FREE(mem_ctx);
	return ret;
}
コード例 #3
0
ファイル: testsuite.c プロジェクト: eduardok/samba
static bool torture_smbconf_txt(void)
{
	sbcErr err;
	bool ret = true;
	const char *filename = "/tmp/smb.conf.smbconf_testsuite";
	struct smbconf_ctx *conf_ctx = NULL;
	TALLOC_CTX *mem_ctx = talloc_stackframe();

	printf("test: text backend\n");

	if (!create_conf_file(filename)) {
		ret = false;
		goto done;
	}

	printf("TEST: init\n");
	err = smbconf_init_txt(mem_ctx, &conf_ctx, filename);
	if (!SBC_ERROR_IS_OK(err)) {
		printf("FAIL: text backend failed: %s\n", sbcErrorString(err));
		ret = false;
		goto done;
	}
	printf("OK: init\n");

	ret &= test_get_includes(conf_ctx);

	smbconf_shutdown(conf_ctx);

	printf("TEST: unlink file\n");
	if (unlink(filename) != 0) {
		printf("OK: unlink failed: %s\n", strerror(errno));
		ret = false;
		goto done;
	}
	printf("OK: unlink file\n");

done:
	printf("%s: text backend\n", ret ? "success" : "failure");
	talloc_free(mem_ctx);
	return ret;
}