Beispiel #1
0
// Main screen
void EMMain(RPC *r)
{
	RPC_BRIDGE_SUPPORT t;

	// Validate arguments
	if (r == NULL)
	{
		return;
	}

	// Examine the bridge support status of the server side first
	Zero(&t, sizeof(t));
	if (CALLEX(NULL, ScGetBridgeSupport(r, &t)) == ERR_NO_ERROR)
	{
		if (t.IsBridgeSupportedOs == false)
		{
			// OS does not support the bridge
			MsgBox(NULL, MB_ICONEXCLAMATION, _UU("EM_UNSUPPORTED"));
			return;
		}

		if (t.IsWinPcapNeeded)
		{
			if (r->Sock->RemoteIP.addr[0] != 127)
			{
				// WinPcap is required, but can not do anything because it is in remote management mode
				MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_REMOTE"));
				return;
			}
			else
			{
				// WinPcap is required, and it's in local management mode
				if (MsIsAdmin())
				{
					// Administrators
					EmInstallWinPcap(NULL, r);
					return;
				}
				else
				{
					// Non-Administrators
					MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_ROOT"));
					return;
				}
			}
		}
	}

	Dialog(NULL, D_EM_MAIN, EmMainDlg, r);
}
Beispiel #2
0
// Edit the client configuration
void NmEditClientConfig(HWND hWnd, RPC *r)
{
	CM_ACCOUNT a;
	RPC_CREATE_LINK t;
	bool ret = false;
	// Validate arguments
	if (hWnd == NULL || r == NULL)
	{
		return;
	}

	Zero(&a, sizeof(a));
	Zero(&t, sizeof(t));

	a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION));
	a.NatMode = true;
	a.Rpc = r;

	if (CALLEX(hWnd, NcGetClientConfig(r, &t)) != ERR_NO_ERROR)
	{
		// Create New
		a.ClientOption->Port = 443;
		a.ClientOption->RetryInterval = 15;
		a.ClientOption->NumRetry = INFINITE;
		a.ClientOption->AdditionalConnectionInterval = 1;
		a.ClientOption->UseEncrypt = true;
		a.ClientOption->NoRoutingTracking = true;
		a.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH));
		a.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD;
	}
	else
	{
		// Edit
		a.EditMode = true;
		Copy(a.ClientOption, t.ClientOption, sizeof(CLIENT_OPTION));
		a.ClientAuth = CopyClientAuth(t.ClientAuth);

		FreeRpcCreateLink(&t);
	}

	ret = CmEditAccountDlg(hWnd, &a);

	Free(a.ServerCert);
	Free(a.ClientOption);
	CiFreeClientAuth(a.ClientAuth);
}