Beispiel #1
0
/* some pretty lame, but useful test code */
int main(int argc, char **argv) {
	WindowsFirewallHelper wfh;
	int result;
	bool isOn;
	const char* app;

	result = 0;

	dprintf_set_tool_debug("TOOL", 0);

	isOn = wfh.firewallIsOn();

	printf("firewall is %s.\n", (isOn) ? "On" : "Off");

	if ( argc <= 1 ) {
		app = "C:\\Condor\\bin\\condor_master.exe";
	} else {
		app = argv[1];
	}

	isOn = wfh.applicationIsTrusted(app);

	printf("%s is %s by the firewall.\n", app, (isOn) ? "Trusted" : "Not Trusted");

	wfh.removeTrusted(app);
	// wfh.addTrusted(app);

	if ( ! SUCCEEDED(wfh.addTrusted("C:\\Condor\\bin\\condor_master.exe")) ) {
		printf("first addTrusted() failed\n");
		result = 1;
	}

	if ( ! SUCCEEDED(wfh.addTrusted("C:\\Condor\\condor_master.exe")) ) {
		printf("second addTrusted() failed\n");
		result = 1;
	}

	HRESULT hr = wfh.removeTrusted("C:\\Condor\\bin\\condor_master.exe");
	if (FAILED(hr)) {
		printf("first removeTrusted() failed 0x%08x\n", hr);
		result = 1;
	}


	hr = wfh.removeTrusted("C:\\Condor\\bin\\condor_master.exe");
	if (FAILED(hr)) {
		printf("second removeTrusted() failed 0x%08x\n", hr);
		result = 1;
	}

	printf("tests are done!\n");

	return result;
}
Beispiel #2
0
/* some pretty lame, but useful test code */
int main(int argc, char **argv) {
	WindowsFirewallHelper wfh;
	int result;
	bool isOn;
	const char* app;
	param_functions *p_funcs = NULL;

	result = 0;

	Termlog = 1;
	p_funcs = get_param_functions();
	dprintf_config ("TOOL", p_funcs );

	isOn = wfh.firewallIsOn();

	printf("firewall is %s.\n", (isOn) ? "On" : "Off");

	if ( argc <= 1 ) {
		app = "C:\\Condor\\bin\\condor_master.exe";
	} else {
		app = argv[1];
	}

	isOn = wfh.applicationIsTrusted(app);

	printf("%s is %s by the firewall.\n", app, (isOn) ? "Trusted" : "Not Trusted");

	wfh.removeTrusted(app);
	// wfh.addTrusted(app);

	if ( ! wfh.addTrusted("C:\\Condor\\bin\\condor_master.exe") ) {
		printf("first addTrusted() failed\n");
		result = 1;
	}

	if ( ! wfh.addTrusted("C:\\Condor\\condor_master.exe") ) {
		printf("second addTrusted() failed\n");
		result = 1;
	}

	if ( ! wfh.removeTrusted("C:\\Condor\\bin\\condor_master.exe") ) {
		printf("first removeTrusted() failed\n");
		result = 1;
	}

	if ( ! wfh.removeTrusted("C:\\Condor\\bin\\condor_master.exe") ) {
		printf("second removeTrusted() failed\n");
		result = 1;
	}

	printf("tests are done!\n");

	return result;
}